Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Java EE 8 - Work in progress

2 109 vues

Publié le

Presented at the Hong Kong JUG (PolyU - Kowloon) end of 2015.

Publié dans : Logiciels
  • Soyez le premier à commenter

Java EE 8 - Work in progress

  1. 1. HKJUG& December&2015& David&Delabassee& @delabassee& Oracle Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.** What's*Coming*in*Java*EE*8 1
  2. 2. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee
  3. 3. Safe*Harbor*Statement The*following*is*intended*to*outline*our*general*product*direction.*It*is*intended*for* information*purposes*only,*and*may*not*be*incorporated*into*any*contract.*It*is*not*a* commitment*to*deliver*any*material,*code,*or*functionality,*and*should*not*be*relied*upon* in*making*purchasing*decisions.*The*development,*release,*and*timing*of*any*features*or* functionality*described*for*Oracle’s*products*remains*at*the*sole*discretion*of*Oracle. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.*
  4. 4. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Agenda How*did*we*get*here?* What*do*we*want*to*do?* How*can*you*get*involved? Preview&of&Java&EE&8
  5. 5. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Industry*Trends*We're*Seeing Cloud Mobile HTTP/2 SECURITY Reactive&Programming User*Experience
  6. 6. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee CommunityQPrioritized*Features 7 http://glassfish.org/survey
  7. 7. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*8*Themes • HTML5*/*Web*Tier*Enhancements* • Ease*of*Development* • Infrastructure*for*running*in*the*Cloud 8
  8. 8. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*8*Themes • HTML5*/*Web*Tier*Enhancements* • Ease*of*Development* • Infrastructure*for*running*in*the*Cloud 8
  9. 9. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTML5*Support*/*Web*Tier*Enhancements • JSON*Binding* • JSON*Processing*enhancements* • ServerQsent*Events* • ActionQbased*MVC* • HTTP/2*support 9
  10. 10. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 Java&API&for&JSON&Processing • Keep*JSONQP*spec*upQtoQdate* • Track*new*standards* • Add*editing*operations*to*JsonObject*and*JsonArray* • Java*SE*8* • JSON*Big*Data 10
  11. 11. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 • String*syntax*for*referencing*a*JSON*value* * "/0/phone/mobile" JSONMPointer&–&IETF&RFC&6901 11
  12. 12. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 JsonArray)contacts)=)…) JsonPointer)pointer)=)new)JsonPointer("/0/name");) JsonValue)value)=)pointer.getValue(contacts);) [* ){* ))))"name":"Duke",* ))))"gender":"M",* ))))"phones":{* )))))))"home":"650K123K4567",* )))))))"mobile":"650K234K5678"}},* )){* ))))"name":"Jane",) ))))"gender":"F",) ))))"phones":{* )))))))"mobile":"707K555K9999"}}* ]* )) 12
  13. 13. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 • String*syntax*for*referencing*a*JSON*value* * “/0/name"* • Methods* – getValue()* – JSON*operations:*add(),*replace(),*remove() JSONMPointer&–&IETF&RFC&6901 )JsonPointer)pointer)=)new)JsonPointer("/0/name");) )JsonArray)result)=)pointer.replace(contacts,)Json.createValue("Alex")); 13
  14. 14. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 • Patch*is*a*JSON*document* – Array*of*objects*/*operations*for*modifying*a*JSON*document* – add,*replace,*remove,*move,*copy,*test JSONMPatch&–&IETF&RFC&6902 [) ))){"op":"replace","path":"/0/phones/mobile","value":"650K111K222"},) ))){"op":"remove","path":"/1"}) ] 14
  15. 15. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 [) ){) ))"op":"replace",) ))"path":"/0/phones/mobile",) ))"value":"650211122222"},) ){) ))"op":"remove",) ))"path":"/1"}) ] [* ){* ))))"name":"Duke",* ))))"gender":"M",* ))))"phones":{* )))))))"home":"650K123K4567",* )))))))"mobile":"650211122222"}},* )){* ))))"name":"Jane",) ))))"gender":"F",) ))))"phones":{* )))))))"mobile":"707K555K9999"}}* ]* )) 16
  16. 16. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 [) ){) ))"op":"replace",) ))"path":"/0/phones/mobile",) ))"value":"650K111K2222"},) ){) ))"op":"remove",) ))"path":"/1"}) ] [* ){* ))))"name":"Duke",* ))))"gender":"M",* ))))"phones":{* )))))))"home":"650K123K4567",* )))))))"mobile":"650K111K2222"}}* ]) )) 17
  17. 17. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee )JsonArray)target)=)…;) )JsonArray)patch)=)…;) )) )JsonPatch)jsonPatch)=)new)JsonPatch(patch);) )JsonArray)result)=)jsonPatch.apply(target); JSONQP*1.1 )JsonPatchBuilder)builder)=)new)JsonPatchBuilder();) )JsonArray)result)=)builder.add("/Joe/phones/office",)"1234K567")) ))))))))))))))))))))))))))).remove("/Amy/age")) ))))))))))))))))))))))))))).apply(contacts); 18
  18. 18. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 JSONMMerge&Patch&–&IETF&RFC&7386 Orignal****************Patch*******************Result& {"a":"b"}*************{"a":"c"}**************{"a":"c"}* {"a":"b"}*************{"b":"c"}**************{"a":"b",* ***********************************************************"b":"c"}* {"a":"b"}*************{"a":null}*************{*}* {"a":"b",*************{"a":null}*************{"b":"c"}* *"b":"c"}* {*}*************************{"a":*********************{"a":* *******************************{"bb":******************{"bb":* ***********************************{"ccc":****************{}}}* ***************************************null}}}* 19
  19. 19. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 {) )))))"title":)"Hello!",) )))))"author":){) ))))))))))))"familyName":)null) ))))))},) ))))))"tags":)[;"example";],) ))))))"phoneNumber":)"+012123245627890") )}) {) ))))"title":)"Goodbye!",) ))))"author":){) ))))))))"givenName":)"John",) ))))))))"familyName":)"Doe") )))))},) )))))"tags":)[)"example",)"sample")],) )))))"content":)"This)will)be)unchanged") )}) )) {) )))))"title":)"Hello!",) )))))"author":){) ))))))))))))"givenName":)"John") ))))))},) ))))))"tags":)[)"example")],) ))))))"content":)"This)will)be)unchanged",) ))))))"phoneNumber":)"+01K123K456K7890") )}) )) JSONMMerge&Patch&–&IETF&RFC&7386 20
  20. 20. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee )JsonObject)contact)=)…;)//)The)target)to)be)patched) )JsonObject)patch)=)…;) )) )JsonValue)output)=)JsonMergePatch.mergePatch(target,)patch); JSONQP*1.1 JSONMMerge&Patch&–&IETF&RFC&7386 21
  21. 21. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 • Reverse*operation* – Given*two*objects*returns*the*patch*to*apply*(diff)* JSONMPatch&&&JSONMMerge&Patch&Diff JsonValue)output)=)JsonMergePatch.diff(original,)target);) JsonArray)diff)=)JsonPatch.diff(original,)target); 22
  22. 22. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 JSON&Query&using&Streams JsonArray)cars)=)...;) List<String>)audis)=)cars.getValuesAs(JsonObject.class).stream()) ))))))))))))))))))))))))).filter(xK>"Audi".equals(x.getString("brand")))) ))))))))))))))))))))))))).map(xK>(x.getString("serial"))) ))))))))))))))))))))))))).collect(Collectors.toList()); 23
  23. 23. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 JSON&Query&using&Streams JsonArray)cars)=)...;* JsonArray)audis)=)cars.getValuesAs(JsonObject.class).stream()* *****************************************************.filter(xK>"Audi".equals(x.getString("brand")))* *****************************************************.map(xK>(x.getString("serial"))* *****************************************************.collect(JsonCollectors.toJsonArray()); 24
  24. 24. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQP*1.1 • Keep*JSONQP*spec*upQtoQdate* • Track*new*standards* • Add*editing*operations*to*JsonObject*and*JsonArray* • Java*SE*8* • JSON*Big*Data JSR&374 25
  25. 25. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQB • API*to*marshal/unmarshal*Java*objects*to/from*JSON* – Similar*to*JAXB*runtime*API*in*XML*world* • Default*mapping*of*classes*to*JSON* – Annotations*to*customize*the*default*mappings* – JsonProperty,*JsonTransient,*JsonNillable,*JsonValue,*… Java&API&for&JSON&Binding 26
  26. 26. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQB • Draw*from*best*practices*of*existing*JSON*binding*implementations* – Jackson,*Genson,*EclipseLink&MOXy,*Fleece,*JSONQlib,*Gson,*Flexjson,*JsonQio,* JSONiJ,*Johnzon,*Xstream,*etc.* • Switch*JSON*binding*providers* • Implementations*compete*on*common*ground Standard&API 27
  27. 27. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JSONQB // from default JsonbBuilder instance of the default JsonbProvider Jsonb jsonb = JsonbBuilder.create(); JsonbProvider myProvider = JsonbProvider.provider("foo.bar.ProviderImpl"); Jsonb jsonb = JsonbBuilder.newBuilder(myProvider); // UnMarshall Book book = jsonb.fromJson(new File("myBook.json"), Book.class); // Marshall String result = jsonb.toJson(myObject); jsonb.toJson(myObject, new File(“foo.json”)); jsonb.toJson(myObject, new PrintWriter(System.out)); 28
  28. 28. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JAXQRS*2.1 29 • Improving*integration*with*CDI* • JSONQB*Integration* • NIO*support*in*providers*(filters,*interceptors,*…)* • Building*upon*the*hypermedia*API* • JAXQRS*resource*classes*as*MVC*controllers* • Reactive*API* • ServerQsent*Events,*etc.
  29. 29. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JAXQRS*2.1 …* CompletionStage<List<String>>)cs)=) )))))))))))))))))client.target("forecast/{destination}")) ))))))))))))))))))))))).resolveTemplate("destination",)"mars")) ))))))))))))))))))))))).request()) ))))))))))))))))))))))).header("RxKUser",)"Java8")) ))))))))))))))))))))))).rx())//)CompletionStageRxInvoker) ))))))))))))))))))))))).get(new)GenericType<List<String>>()){) )))))))))))))))))))))))});) cs.thenAccept(l)K>)System.out.println(l)); Reactive&Client&API 30
  30. 30. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee • Servlet,*WebSocket,*JAXQRS*or*standalone*API?* • JAXQRS*deemed*most*natural*fit* – Streaming*HTTP*resources*already*supported* – Small*extension* • Server*API:*new*media*type;*EventOutput** • Client*API:*new*handler*for*server*side*events* – Convenience*of*mixing*with*other*HTTP*operations;*new*media*type* – Jersey*already*supports*SSE 31 JAXQRS*2.1 ServerMsent&Events
  31. 31. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee ServerQsent*Events @Path("tickers")) public)class)StockTicker){) …) )))@Get) )))@Produces("text/event2stream")) )))public)EventOutput)getQuotes()){) )))))))EventOutput)eo)=)new)EventOutput();) )))))))new)StockThread(eo).start()) )))))))return)eo;) )))}) } JAXMRS&resource&class 32
  32. 32. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JAXMRS&StockThread&class class)StockThread)extends)Thread){* *private)EventOutput)eo;) )…) )@Override public)void)run()){ )))))))try){ … )))))))))))eo.send(new)StockQuote("..."));) )))))))})catch)(IOException)e)){)…)} } } ServerQsent*Events 33
  33. 33. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee WebTarget)target)=)client.target("http://example.com/tickers");) EventSource)eventSource)=)new)EventSource(target)){) )))@Override) )))public)void)onEvent(InboundEvent)inboundEvent)){) )))))StockQuote)sq)=)inboundEvent.readData(StockQuote.class);) )))))//)...) ))))}) ))};) eventSource.open(); JAXMRS&Client ServerQsent*Events 34
  34. 34. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTTP*1.1*circa*1999 • HoLB* • HTTP*uses*TCP*poorly* - HTTP*flows*are*short*and*bursty* - TCP*was*built*for*longQlived*flows* • Solutions* - File*concatenations,*Assets*Inlining,*Domain*sharding,*etc. Problems&Vs&Solutions 35
  35. 35. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTTP/2 • HTTP/2* – Hypertext*Transfer*Protocol*version*2*Q*RFC*7540* – HPACK*Q*Header*Compression*for*HTTP/2*Q*RFC*7541* • Reduce*latency* • Address*the*HOL*blocking*problem* • Support*parallelism* • Define*interaction*with*HTTP*1.x* • Retain*semantics*of*HTTP*1.1 Address&the&Limitations&of&HTTP&1.x 36
  36. 36. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. 37 @delabassee HTTP/2 Connections,&Streams,&Messages,&Frames
  37. 37. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTTP/2 • One*TCP*Connection* • Request*Q>*Stream* – Multiplexed* – Prioritised* • Binary*Framing*Layer* – Prioritisation* – Flow*Control* – Server*Push* • Header*Compression Address&HTTP&1.x&Limitations POST*/upload*HTTP/1.1* Host:*www.test.com* ContentQType:*application/json* ContentQLength:*15* {“name”:“duke”} HTTP&1.1 HTTP/2 HEADERS&frame DATA&frame 38
  38. 38. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTTP/2 Server&Push /index.html*:*stream*1* /style.css*:*stream*2* /logo.png*:*stream*4 Client Server stream&1& HEADERS stream&1& FRAME&x stream&2& PROMISE stream&4& PROMISE 39
  39. 39. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee HTTP/2 Header&Compression 40
  40. 40. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Servlet*4.0 • Request/response*multiplexing* – Servlet*Request*as*HTTP/2*message* • Stream*prioritization* • Server*push* • Binary*framing* • Upgrade*from*HTTP*1.1 HTTP/2&Features&in&Servlet&API 41
  41. 41. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Servlet*4.0 • Request/response*multiplexing* – Servlet*Request*as*HTTP/2*message* • Stream*prioritization* • Server*push* • Binary*framing* • Upgrade*from*HTTP*1.1 HTTP/2&Features&in&Servlet&API 41
  42. 42. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee PushBuilder;builder = baseRequest.getPushBuilder(); builder.addHeader(“X-Pusher", …); builder.path(aResource) .etag(associated._etag) .lastModified(associated._lastModified) .push(); 42 Servlet*4.0 Server&Push
  43. 43. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee ActionQbased*MVC • Controller(s)*defined*by*the*application* • Examples* – Struts*1*(end*of*life),*Struts*2* – Spring*MVC* • No*standard*Java*EE*implementation* – JSR*371* – “ActionQbased”*MVC*1.0*JSR* – Targeted*for*inclusion*in*Java*EE*8 43
  44. 44. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee MVC*1.0 • ActionQbased*MVC* • Glues*together*key*Java*EE*technologies* – Model*:*CDI,*Bean*Validation,*JPA* – *View*:*Facelets,*JSP,*more?* – *Controller*:*Invent*new*technology*Vs.*Leverage*existing*technologies 44 Principles
  45. 45. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Controller • Combine*data*models*and*views*to*produce*web*application*pages @Path("hello") public class HelloController { @GET @Controller public String hello() { // do something return “hello.jsp”; } } 45
  46. 46. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Controller • Class/method*decorated*with*@Controller @Path(“hello") @Controller public class HelloController { @GET @View(“hello.md”) public void hello() { // do business stuff } } 46
  47. 47. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Controller @Path(“hello") @Controller public class HelloController { @GET public Viewable hello() { // some other stuff return new Viewable("hello.adoc"); } } 47
  48. 48. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Controller … @GET @Controller public Response getById(@PathParam("id") String id) { if (id.length() == 0) { return Response.status(Response.Status.BAD_REQUEST) .entity(“error.xhtml”) .build(); } } 48
  49. 49. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Model • CDI*@Named*bean* • javax.mvc.Models*interface 49
  50. 50. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Model @Named(“greeting”) @RequestScoped public class Greeting { private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } 50
  51. 51. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Model @Path(“hello”) public class HelloController { @Inject private Models models; @GET @Controller public String hello() { models.set(“greeting”, new Greeting(“Salut”)); return “hello.jsp”; } } 51
  52. 52. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee View • Define*the*structure*of*the*output* • Can*refer*to*model(s)* • Rendered*by*a*View*Engine* – JSP* – Facelets* • Not*accessible*as*static*resources* – /WEBQINF/views/* 52
  53. 53. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee View <html> <head> <title>FreeMarker</title> </head> <body> <p>Hello ${user}</p> … </body> </html> 53
  54. 54. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee View*Engine • CDI*based*extension*mechanism* • javax.mvc.engine.ViewEngine interface* boolean supports(String view); void processView(ViewEngineContext context) throws ViewEngineException; • Ozark* – JSP*&*Facelets* – FreeMarker,*Velocity,*Thymeleaf,*Mustache,*Handlebars,*Jade,*AsciiDoc,*… 54
  55. 55. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee MVC • New*annotations* – @Controller,*@View,*@csrf,*@RedirectScoped* • Doing*MVC*now*is*not*a*bad*idea* – Leveraging*CDI,*JAXQRS,*Facelets,*BV* – More?*Servlet*4.0’s*ServerPush* – Easy*migration*path*for*JSPs* • Offers*more*choices 55
  56. 56. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee JavaServer*Faces 56 • CDI*Alignment* – @Inject*FacesContext,*ExternalContext,*etc.* – CDI*managed*versions*of*Validator*and*Converter* – Rely*on*CDI*for*EL*resolving* – Invoking*CDI*managed*bean*methods*directly*from*Ajax,*etc.* • “Adjustments”*for*MVC* • Misc.* – MultiQfield*validation,*etc.
  57. 57. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*8*Themes • HTML5*/*Web*Tier*Enhancements* • Ease*of*Development* • Infrastructure*for*running*in*the*Cloud 57
  58. 58. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Ease*of*Development • CDI*alignment* • JAXQRS*injection*alignment* • Simplified*messaging*through*CDIQbased*“MDBs”* • WebSocket*scopes* • Pruning*of*EJB*2.x*client*view*and*IIOP*interoperability* • Security*interceptors* • … 58
  59. 59. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JMS @MessageDriven(activationConfig)=){) ))@ActivationConfigProperty(propertyName="connectionFactoryLookup",)propertyValue="jms/myCF"),) ))@ActivationConfigProperty(propertyName="destinationLookup",)propertyValue="jms/myQueue"),) ))@ActivationConfigProperty(propertyName="destinationType",)propertyValue="javax.jms.queue")})) public)class)MyMDB)implements)MessageListener){) )))public)void)onMessage(Message)message)){) )))))))//)extract)message)body) )))))))String)body)=)message.getBody(String.class));) )))))))//)process)message)body) )))}) })) MDBs&Today 59
  60. 60. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JMS*2.1 )@MessageDriven) )public)class)MyMessageBean)implements;JMSMessageDrivenBean){) )) )))@JMSQueueListener(destinationLookup=“java:global/TradesQ”)) )))public)void)processTrade(TextMessage)tradeMessage){) )))))...) )))}) )} “Flexible&MDBs” 60
  61. 61. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee JMS*2.1 @Dependent) public)class)MyCDIBean21){) )))))@JMSQueueListener(destinationLookup=“java:global/requestQueue”)) )))))public)void)myMessageCallback(Message)message)){) )))))))...) )))))}) } CDI&beans&as&message&listener? 61
  62. 62. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee • Java*SE*support* • Modularity* • Enhanced*Events* • Misc.* – AOP* – SPI* – Interceptors*and*Decorators*enhancements* – Cleaning* 62 CDI*2.0
  63. 63. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee CDI*2.0 • Add*new*features*to*CDI*without*bloating*the*specification* • “Sub*specification”(aka*“parts”)*that*can*be*used*independently* – SE* – EE* – more?* • Will*help*CDI*adoption 63 Modularity
  64. 64. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee64 public)class)ProducerClass){) ; @Inject;Event<SomeEvent>;someEvent;; ) public)void)someMethod(...)){) ) ) ...) ) ) someEvent.fire(...);) ) }) } CDI*2.0 Asynchronous&Events public)class)AnotherClass){) ))))))public)void)someObserver(@Observes;SomeEvent;someEvent)){) )))...) ))))))}) }
  65. 65. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee64 public)class)ProducerClass){) ; @Inject;Event<SomeEvent>;someEvent;; ) public)void)someMethod(...)){) ) ) ...) ) ) someEvent.fire(...);) ) }) } CDI*2.0 Asynchronous&Events public)class)AsynchProducerClass){))))) ;;;;;@Inject;Event<Payload>;someEvent;; )))))public)void)anotherMethod()){) )))CompletionStage<…>)completionStage)someEvent.fireAsync(...);) )))))}) } public)class)AnotherClass){) ))))))public)void)anotherObserver(@ObservesAsync;SomeEvent;someEvent)){) )))...) ))))))}) }
  66. 66. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee65 CDI*2.0 Events&Ordering public)void)importantObserver(@Observes;@Priority(1))MyEvent)evt)) {) ...) }) public)void)anotherObserver(@Observes;@Priority(10))MyEvent)evt)) {) ...) }
  67. 67. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Pruning Should*we*prune*EJB*2.x*remote*and*local*client*view*(EJBObject,*EJBLocalObject,* EJBHome,*and*EJBLocalHome*interfaces)?* Should*we*prune*CORBA,*including*support*for*interoperability*by*means*of*IIOP? Candidates&for&Proposed&Optional&status 66
  68. 68. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*8*Themes • HTML5*/*Web*Tier*Enhancements* • Ease*of*Development* • Infrastructure*for*running*in*the*Cloud 67
  69. 69. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*Management*2.0 • Update*to*JSR*77*(“J2EE*Management”)* • RESTQbased*interfaces*to*augment*(or*replace)*current*Management*EJB* APIs* – Currently*used*OBJECT_NAME*to*become*URL* – Define*CRUD*operations*over*individual*managed*objects* – ServerQsent*events*used*for*event*support* • Simple*deployment*interfaces*also*to*be*considered*as*part*of* management*API 68
  70. 70. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*Security*1.0 Identity&Store @Inject** IdentityStore*idStore;** Credential*cred*=*new*UsernamePasswordCredential("john",new*Password("secret"));* CredentialValidationResult*result*=*idStore.validate(cred);* if*(Status.VALID*==*result.getStatus())*{* *******groups*=*result.getGroups();* *******…* }*else*{* *******//*Invalid*or*not*validated* *******…* }* 69
  71. 71. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*Security*1.0 @IsAuthorized("(hasRoles('Manager'))&&)schedule.officeHrs)")) void)transferFunds()) @IsAuthorized("hasRoles('Manager'))&&)hasAttribute('directReports',)employee.id)")) double)getSalary(long)employeeId);) @IsAuthorized(ruleSourceName="java:app/payrollAuthRules",)rule="report")) void)displayReport(); Authorization&via&CDI&Interceptors 70
  72. 72. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*Security*1.0 Candidate&Areas&to&Enhance&Portability,&Flexibility,&EaseMofMUse • Authorization*Interceptors* • User*Management* • Role*Mapping* • Authentication* • REST*Authentication* • Password*Aliasing* 71
  73. 73. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Java*EE*8*Themes • HTML5*/*Web*Tier*Enhancements* • Ease*of*Development* • Infrastructure*for*running*in*the*Cloud* • Java*SE*8*alignment 72
  74. 74. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved. @delabassee Java*EE*8 • Java&EE&8&Platform&(JSR&366) • CDI&2.0&(JSR&365) • JSON&Binding&1.0&(JSR&367) • JMS*2.1*(JSR*368)* • Servlet*4.0*(JSR*369)* • JAXQRS*2.1*(JSR*370) • MVC&1.0&(JSR&371)& • JSF&2.3&(JSR&372) • Java*EE*Management*2.0*(JSR*373) • JSONMP&1.1&(JSR&374) • Java*EE*Security*1.0*(JSR*375) So&far….. 73 &&&&&&&&&&Early&Draft&Review
  75. 75. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee More*to*Follow… • Batch** • JPA& • Bean*Validation* • Connector*Architecture* • WebSocket* • Interceptors* • EJB* • JTA* • JCache* • Concurrency*Utilities** • JavaMail* • … 74
  76. 76. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Transparency • Our*Java*EE*8*JSRs*run*in*the*open*on*java.net* – http://javaeeQspec.java.net* – One*project*per*JSR*–*jaxQrsQspec,*mvcQspec,*servletQspec,…* • Publicly*viewable*Expert*Group*mail*archive* – Users*observer*lists*gets*all*copies* • Publicly*accessible*issue*tracker*/*JIRA** • Publicly*accessible*download*area* • … Commitment&to&JCP&transparent&processes 76
  77. 77. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Adopt*A*JSR*for*Java*EE*8 • Make*Java*EE*8*the*most*community*driven*platform*to*date!* - Share*ideas*and*feedback*(e.g.*fill*issues)* - Follow*EG*discussions,*chime*in* - Read*early*versions*of*specifications,*Javadocs* - Write*apps*using*early*RI*builds* - Write,*speak*about*the*technology* - Encourage*others*to*participate,*etc.* • http://glassfish.org/adoptajsr 77
  78. 78. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee How*to*Get*Involved • Join*an*Expert*Group* – http://javaeeQspec.java.net* • Adopt*a*JSR* – http://glassfish.org/adoptajsr* • The*Aquarium* – http://blogs.oracle.com/theaquarium* • Java*EE*Reference*Implementation* – http://glassfish.org 78
  79. 79. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.* @delabassee Thanks!
  80. 80. Copyright*©*2015,*Oracle*and/or*its*affiliates.*All*rights*reserved.*

×