Java EE 與 雲端運算的展望

1,597 views
1,532 views

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,597
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
122
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Java EE 與 雲端運算的展望

  1. 1. Java EE 7Reaching for the CloudLee Chuk Munnchuk-munn.lee@oracle.com
  2. 2. The following is intended to outline our generalproduct direction. It is intended for informationpurposes only, and may not be incorporatedinto any contract. It is not a commitment todeliver any material, code, or functionality, andshould not be relied upon in making purchasingdecisions.The development, release, and timing of anyfeatures or functionality described for Oraclesproducts remains at the sole discretion ofOracle.
  3. 3. Java EE 6 PlatformDecember 10, 2009
  4. 4. Great Tooling Support
  5. 5. Industry Wide Support
  6. 6. <Insert Picture Here>Java EE 6
  7. 7. What is New in Java EE 6?• Several new APIs• Web profile• Pluggability/extensibility• Dependency injection• Lots of improvements to existing API
  8. 8. New And Updated Components• EJB 3.1 (+Lite) • Managed Beans 1.0• JPA 2.0 • Interceptors 1.1• Servlet 3.0 • JSP 2.2• JSF 2.0 • EL 2.2• JAX-RS 1.1 • JSR-250 1.1• Bean Validation 1.0 • JASPIC 1.1• DI 1.0 • JACC 1.5• CDI 1.0 • JAX-WS 2.2• Connectors 1.6 • JSR-109 1.3
  9. 9. Java EE 6 Web Profile Web container JSP 2.2 extensions JSF 2.0 JSTL 1.2 CDI Bean Validation 1.0extensions Servlet 3.0 · EL 2.2 DI 1.0 · CDI 1.0 · Interceptors 1.1 · JSR-250 1.1 Managed Beans 1.0 EJB 3.1 Lite JPA 2.0 · JTA 1.1
  10. 10. Web Tier Updates• Annotations in Servlet 3.0• Automatic discovery and registration of libraries• web.xml is optional• Package static files in resource jars• Use EJBs directly inside web apps
  11. 11. Web Apps Simplified Packaging Web ApplicationWEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.classWEB-INF/lib someframework.jarWEB-INF/web.xmlindex.htmlmain.cssjquery-1.4.2.jsui/jquery.ui.core.jsui/jquery.ui.widget.js
  12. 12. Web Apps Simplified Packaging Web ApplicationWEB-INF/classes @WebServlet(urlPatterns=”/foo”) com/acme/MyServlet.class public class MyServlet { … } com/acme/MyFilter.classWEB-INF/lib @WebFilter(urlPatterns=”/foo”) someframework.jar public class MyFilter { … }WEB-INF/web.xmlindex.htmlmain.cssjquery-1.4.2.jsui/jquery.ui.core.jsui/jquery.ui.widget.js
  13. 13. Web Apps Simplified Packaging Web ApplicationWEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.class Framework JarWEB-INF/lib META-INF/web-fragment.xml someframework.jar com/fw/FwServlet.class com/fw/FwFilter.classindex.htmlmain.cssjquery-1.4.2.jsui/jquery.ui.core.jsui/jquery.ui.widget.js
  14. 14. Web Apps Simplified Packaging Web ApplicationWEB-INF/classes com/acme/MyServlet.class com/acme/MyFilter.classWEB-INF/lib someframework.jar jQuery Resource Jar jquery-ui-1.8.4.jar META-INF/resources/jquery-1.4.2.js META-INF/resources/ui/jquery.ui.core.js META-INF/resources/ui/jquery.ui.widget.jsindex.htmlmain.css
  15. 15. Web Apps Simplified Packaging Web Application • Self-containedWEB-INF/classes • Generic com/acme/MyServlet.class • Reusable com/acme/MyFilter.classWEB-INF/lib someframework.jar jquery-ui-1.8.4.jarindex.htmlmain.css
  16. 16. Java EE 6 Programming Model• Complementary declarative/programmatic layer• Annotations are additive• Code can evolve gradually• Managed beans as a common foundation
  17. 17. EJB 3.1 Lite• Session bean programming model• Stateless, singleton programming model• Annotation based declarative security and transactions• Deployment descriptors are optional
  18. 18. EJB 3.1 New First Class Construct@Singleton @Startuppublic class StartupBean { @PostConstruct public void doAtStartup() { … }}@Stateless public class BackupBean { @Schedule(dayOfWeek=”Fri”, hour=”3”, minute=”15”) public void performBackup() { … }}@Stateless public class BatchProcessor { @Asynchronous public Future<Result> submit(Task t){ … }}
  19. 19. Dependency Injection• Powerful type-safe model• Can be enabled per-module• Integrated with JSF, JSP, EJB, web tier• Friendly to pre-Java EE 6 resources and services• Event model• Highly extensible
  20. 20. Bean with Constructor Injection@RequestScopedpublic class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…}
  21. 21. Bean with Constructor Injection @RequestScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD)Types PaymentProcessor processor, @Default ShoppingCart cart) {…}
  22. 22. Bean with Constructor Injection @RequestScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD)Qualifiers PaymentProcessor processor, @Default ShoppingCart cart) {…}
  23. 23. Bean with Constructor Injection Request scoped@RequestScopedpublic class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…}
  24. 24. Bean with Constructor Injection @RequestScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD)Session scoped PaymentProcessor processor, @Default ShoppingCart cart) {…}
  25. 25. Bean with Constructor Injection @RequestScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…}Applicationscoped
  26. 26. Bean with Constructor Injection@RequestScopedpublic class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…} Conversation scoped
  27. 27. Java EE 7 Cloudy Ahead
  28. 28. Layers of Cloud Software as a Service (SaaS) Platform as a Service (PaaS)Infrastructure as a Service (IaaS)
  29. 29. Java EE and the Cloud• Containers are back in vogue!• We have containers• We have services... injectable services...• We scale to large clusters...• We have a security model...
  30. 30. JSR 342 – Java EE for the Cloud• More easily operate on public/private cloud – Multi tenancy, elasticiy• Tighter requirements for resource and state management• Better isolation between applications• Potential standard APIs for NRDBMS, caching, etc.• Common management and monitoring interfaces• Evolving the platform
  31. 31. Better Packaging for the Cloud• Applications should be versioned• Multiple versions should be able to coexists• Dealing with data versioning, upgrades, etc.• Need the ability to specify QoS properties• Exposed and connected to services
  32. 32. Cloud Platform Application Java Persistence Queueing Service Service Service ... State Management Virtualization Layer
  33. 33. Cloud Platform Application Code Code Code QoSModule Module Module Schema Migration Security Information … Java Persistence Queueing Service Service Service ... State Management Virtualization Layer
  34. 34. Cloud PlatformApplication Application Application Application Application Java Persistence Queueing Service Service Service ... State Management Virtualization Layer
  35. 35. Cloud Platform Managed EnvironmentApplication Application Application Application Application Java Persistence Queueing Service Service Service ... State Management Virtualization Layer
  36. 36. Modularity• Build on JavaSE 8 modularity• Applications are composed of modules• Dependencies are explicit• Versioning is built-in• Additional metadata for JavaEE
  37. 37. JavaSE 8 Modules com.foo.appmodule-info.javamodule com.foo @ 1.0.0 { com.foo.extra class com.foo.app.Main requires com.foo.lib @ 2.1-alpha; com.foo.lib provides com.foo.app.lib @ 1.0.0; requires optional com.foo.extra;} org.bar.lib edu.baz.util
  38. 38. Packaging and Install• Compiling Java classes with modules$ javac -modulepath mods src/com.foo.app/...• Packaging classes into modules$ jpkg -modulepath mods jmod com.foo.app com.foo.extra com.foo.lib• Installing modules into library$ jmod -L mlib install $EXT/edu.baz.util@*.jmod $EXT/org.bar.lib@*.jmod
  39. 39. Modular Applications j1demo.app j1demo-1.0.3
  40. 40. Modular Applications j1demo.app twitter-client-2.3.0 j1demo-1.0.3 requires j1demo-persist-1.4.0
  41. 41. Modular Applications j1demo.app twitter-client-2.3.0 j1demo-1.0.3 j1demo-persist-1.4.0 javaee-web-7.0 jpa-2.1 jax-rs-2.0
  42. 42. Modular Applications j1demo.app twitter-client-2.3.0 j1demo-1.0.3 j1demo-persist-1.4.0 javaee-web-7.0 jpa-2.1 jax-rs-2.0 implements gf-appserv-4.01. ...
  43. 43. Modular Applications j1demo.app twitter-client-2.3.0 j1demo-1.0.3 j1demo-persist-1.4.0 javaee-web-7.0 jpa-2.1 jax-rs-2.0 implements gf-appserv-4.01. eclipselink- 2.1.3 ... jersey-2.0.5
  44. 44. Modular Applications j1demo.app twitter-client-2.3.0 jax-rs-2.1 j1demo-1.0.3 j1demo-persist-1.4.0 jersey-2.1.1 javaee-web-7.0 jpa-2.1 gf-appserv-4.01. eclipselink- 2.1.3 ...
  45. 45. Modular Applications j1demo.app twitter-client-2.3.0 jax-rs-2.1 j1demo-1.0.3 j1demo-persist-1.4.0 jersey-2.1.1 javaee-web-7.0 jpa-2.1 jax-rs-2.1 gf-appserv-4.01. eclipselink- 2.1.3 ... jersey-2.1.1
  46. 46. <Insert Picture Here>Status
  47. 47. Web Tier• Web socket support in Servlet container• Standard JSON API• HTML5 support in JSF• NIO2 based web container• Updates to Web Profile• JAX-RS 2.0 will be mandatory
  48. 48. New API• Concurrency Utilities – JSR 236 – Eg. transaction-, security- naming- aware ExecutorService• JCache – JSR 107 – Local cache API, key-value map – Needs to be aligned with JPA cache API• JMS 2.0 – Annotation based programming model to JMS• JSON 1.0• RESTful client API for JAX-RS 2.0
  49. 49. Java EE 7 JSRs Status Approved Ongoing• JPA 2.1 • Concurrency Utilities 1.0• JAX-RS 2.0 • JCache 1.0• Servlet 3.1• EL 3.0 Yet to be filed• Platform 7/Web Profile 7 • EJB 3.2• JMS 2.0 • CDI 1.1• JSF 2.2 • JSR-330 1.1 • Bean Validation 1.1 • JSON 1.0
  50. 50. Java EE 7 Schedule• First seven JSRs already filed• Remaining ones to be filed soon... – Stay tuned• Final release late 2012• Date driven release – Anything not ready will be deferred to Java EE 8
  51. 51. JavaEE 6 on the Cloud Today
  52. 52. JRockit Virtualized Edition • Oracle JRockit VE runs natively on hypervisor – Better performance – Improved security • Deterministic GC behaviour – “Soft” real-time • Simple administration – Console and scripting
  53. 53. Java EE 6 PlatformAvailable fromhttp://www.oracle.com/javaee
  54. 54. Java EE 7Reaching for the CloudLee Chuk Munnchuk-munn.lee@oracle.com

×