Andrei Niculae - JavaEE6 - 24mai2011

985 views

Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

Andrei Niculae - JavaEE6 - 24mai2011

  1. 1. Java EEThe Evolution of a PlatformAndrei NiculaeTechnology Presales Consultant
  2. 2. The following is intended to outline our generalproduct direction. It is intended for informationpurposes only, and may not be incorporated into anycontract. It is not a commitment to deliver anymaterial, code, or functionality, and should not berelied upon in making purchasing decisions.The development, release, and timing of anyfeatures or functionality described for Oracle’sproducts remains at the sole discretion of Oracle. 2
  3. 3. Java EE 6 Overview
  4. 4. Java EE: Past & Present Java EE 6 Pruning Java EE 5 Extensibility Ease of Ease of J2EE 1.4 Development Development WebServices Annotations EJB Lite Management EJB 3.0 RESTful WS J2EE 1.3 Deployment Persistence CDI CPM, J2EE 1.2 Connector API Managed Architecture New and Beans Servlet, JSP, EJB, JMS Updated Web Services JPE Java EEProject Web ProfileMay Dec 1999 Sep 2001 Nov 2003 May 2006 Dec 20091998 10 specs 13 Specs 20 specs 23 specs 28 specs 4
  5. 5. Java EE 6 Goals Flexible • Embrace open•Web Profile source frameworks &•Pruning Lightweight Extensible Java EE Developer Productivity • More annotations • POJO development • Less XML configuration
  6. 6. What’s New in Java EE 6?• Several new APIs• Web Profile• Pluggability / extensibility• Dependency injection• Lots of improvements to existing APIs
  7. 7. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  8. 8. EJB 3.1• No interface view – one source file per bean• Simple POJO• Much simpler to declare/work with• Singleton• EJB Timers
  9. 9. EJB 3.1 LiteA proper subset of the fullEJB 3.1 API that includesa small, powerful selectionof EJB features
  10. 10. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  11. 11. JPA 2.0Type-safe Criteria APIEntityManager em = getEntityManager();CriteriaBuilder cb = em.getCriteriaBuilder();CriteriaQuery<Employee> query = cb.createQuery(Employee.class);Root<Employee> employee = query.from(Employee.class);query.where(cb.equal(employee.get("firstName"),"Bob"));List<Employee> result = em.createQuery(query).getResultList();
  12. 12. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  13. 13. Servlets 3.0
  14. 14. Servlets 3.0Extensibility• Plugin libraries using web fragments • Modular web.xml• Bundled in framework JAR file in META-INF Directory• Zero-configuration, drag-and-drop for web Frameworks • Servlets, servlet filters, context listeners for a framework get discovered and registered by the container
  15. 15. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  16. 16. Bean Validation• Tier-independent mechanism to define constraints for data validation• @NotNull(message=”...”), @Max, @Min, @Size• Integrated with JSF and JPA • JSF: f:validateRequired, f:validateRegexp • JPA: pre-persist, pre-update, and pre-remove• Fully Extensible
  17. 17. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  18. 18. Context and Dependency Injection (CDI)• Opt-in technology on a per-module basis – META-INF/beans.xml – WEB-INF/beans.xml• @Resource only for container-provided objects• Use @Inject for application classes @Inject @LoggedIn User user;
  19. 19. Context and Dependency Injection (CDI)• Managed beans on steroids• Opt-in technology on a per-module basis – META-INF/beans.xml – WEB-INF/beans.xml• @Resource only for container-provided objects• Use @Inject for application classes @Inject @LoggedIn User user; The type describes the capabilities (methods)
  20. 20. Context and Dependency Injection (CDI)• Managed beans on steroids• Opt-in technology on a per-module basis – META-INF/beans.xml – WEB-INF/beans.xml• @Resource only for container-provided objects• Use @Inject for application classes @Inject @LoggedIn User user;Qualifiers describes qualities/characteristics/identity
  21. 21. Whats new in the Java EE 6 PlatformNew and updated components• EJB 3.1(+Lite) • Interceptors 1.1• JPA 2.0 • JSP 2.2• Servlet 3.0 • EL 2.2• JSF 2.0 • JSR 250 1.1• JAX-RS 1.1 • JASPIC 1.1• Bean Validation 1.0 • JACC 1.5• DI 1.0 • JAX-WS 2.2• CDI 1.0 • JSR 109 1.3• Connectors 1.6• Managed Beans 1.0
  22. 22. Managed Beans• Plain Java objects (POJOs)• Foundation for other component types• Fully support injection (@Resource, @Inject)• @PostConstruct, @PreDestroy callbacks• Optional name
  23. 23. Sample Managed Beans @ManagedBean("yuri")@ManagedBean public class Cosmonautpublic class SpaceCapsule { { @Resource DataSource configDB; @Resource SpaceCapsule vostok; public launch() { // ... @PostConstruct } orbitEarth() {} // ... } }
  24. 24. UniformityCombination of annotations "just work"• Example: JAX-RS resource classes are POJOs• Use JAX-RS-specific injection capabilities• But you can turn resource classes into managed beans or EJB components ...• ... and use all new services !
  25. 25. JAX-RS Sample Using JAX-RS injection annotations@Path("root")public class RootResource { @Context UriInfo ui; public RootResource() { ... } @Path("{id}") public SubResource find(@PathParam("id") String id) { return new SubResource(id); }}
  26. 26. JAX-RS Sample As a managed bean, using @Resource@Path("root")@ManagedBeanpublic class RootResource { @Context UriInfo ui; @Resource DataSource myDB; public RootResource() { ... } @Path("{id}") public SubResource find(@PathParam("id") String id) { return new SubResource(id); }}
  27. 27. JAX-RS Sample As an EJB, using @Resource and security annotations@Path("root")@Statelesspublic class RootResource { @Context UriInfo ui; @Resource DataSource myDB; public RootResource() { ... } @Path("{id}") @RolesAllowed("manager") public SubResource find(@PathParam("id") String id) { return new SubResource(id); }}
  28. 28. JAX-RS Sample As a CDI bean, using @Inject and scope annotations@Path("root")@ApplicationScopedpublic class RootResource { @Context UriInfo ui; @Inject @CustomerDB DataSource myDB; @Inject @LoggedIn User user; public RootResource() { ... } @Path("{id}") public SubResource find(@PathParam("id") String id) { // ... }}
  29. 29. How to Obtain UniformityCombination of annotations "just work"• Annotations are additive• New behaviors refine pre-existing ones• Strong guidance for new APIs Classes can evolve smoothly
  30. 30. Java EE 6 Web ProfileNew, updated components and unchanged components• EJB 3.1 Lite • EL 2.2• JPA 2.0 • JSR 250 1.1• Servlet 3.0 • JSR-45 1.0• JSF 2.0 • JSTL 1.2• Bean Validation 1.0 • JTA 1.1• DI 1.0• CDI 1.0• Managed Beans 1.0• Interceptors 1.1• JSP 2.2
  31. 31. JEE BenefitsA Better Platform• Less boilerplate code than ever• Fewer packaging headaches• Uniform use of annotations• Sharing of resources to avoid duplication• Dependency Injection• Strongly-typed decorators• ... and more!
  32. 32. Future Java EE
  33. 33. Java EE for the Cloud• Applications are versioned• Multiple versions can coexist• Must deal with data versioning, upgrades, etc.• Need ability to specify QoS properties• Applications both expose and connect to services• Common management and monitoring interfaces• Evolution, not revolution
  34. 34. Cloud Platform Application Java Persistence Queueing … Service Service Service State Management Virtualization Layer
  35. 35. Cloud Platform Application Code Code Code QoS Schema Migration Security … Module Module Module Information Java Persistence Queueing … Service Service Service State Management Virtualization Layer
  36. 36. Cloud Platform Application Application Application Java Persistence Queueing … Service Service Service State Management Virtualization Layer
  37. 37. Cloud Platform Application Application Application Application Application Java Persistence Queueing … Service Service Service State Management Virtualization Layer
  38. 38. Cloud Platform Managed Environment Application Application Application Application Application Java Persistence Queueing … Service Service Service State Management Virtualization Layer
  39. 39. Java EE 7 Content (so far)• Filed and voted ! – Java EE 7 (JSR 342) – JPA 2.1 (JSR 338) – JAX-RS 2.0 (JSR 339) – Servlet 3.1 (JSR 340) – JSF 2.2 (JSR 344) – EL 3.0 (JSR 341) – JMS 2.0 (JSR 343)
  40. 40. Java EE 7 Content (so far)• Other – JCache revived (JSR 107) – Concurrency Utilities (236) – MRs: JSR250, JAX-WS 2.3, JTA 1.2, JSP 2.3, connectors – EJB 3.2 – Bean Validation 1.1 – JSR-330 1.1 – CDI 1.1• Yet to be filed – JSON 1.0
  41. 41. Java EE 7 - When?• Late 2012• Date-driven release – (anything not ready will be deferred to Java EE 8)• Participate ! – Expert Groups still forming, consider joining – JCP membership free for individuals
  42. 42. Java EE 6 Platform Available Todayhttp://www.oracle.com/javaee

×