1
Java EE 6, a Technical Overview <Insert Picture Here>
Java EE <ul><li>Scalable and maintainable enterprise apps </li></ul><ul><li>Container vs. Developer </li></ul><ul><ul><li>...
Java EE 6 Overview <ul><li>New features </li></ul><ul><ul><li>Web Profile, REST, managed beans, standard dependency inject...
Java EE – a brief History May 1998 Project JPE Dec 1999 10 specs J2EE 1.2 Enterprise Application Servlet JSP EJB JMS RMI/I...
<ul><li>EJB 3.1 </li></ul><ul><li>JPA 2.0 </li></ul><ul><li>Servlet 3.0 </li></ul><ul><li>JSF 2.0 </li></ul><ul><li>JAX-RS...
This is no science fiction Java EE 6 and GlassFish Server 3 shipped  final releases  on December 10 th   2009
JAX-RS <ul><li>RESTful web services API </li></ul><ul><li>Already widely adopted </li></ul><ul><li>Really a general, high-...
JAX-RS sample code @Path (&quot;widgets/{id}&quot;) @Produces (&quot;application/widgets+xml&quot;) public class WidgetRes...
Bean Validation 1.0 public class Address { @NotNull @Size (max=30, message=&quot;longer than {max} characters&quot;) priva...
Build your own! <ul><li>@Size(min=5, max=5) @ConstraintValidator(ZipcodeValidator.class) @Documented @Target({ANNOTATION_T...
“ Web” Profile <ul><li>First Java EE profile to be defined </li></ul><ul><li>A fully-functional, mid-size stack for modern...
Java EE 6 Web Profile <ul><li>Servlet 3.0 </li></ul><ul><li>JSP 2.2 / EL 2.2 </li></ul><ul><li>JSR-45 1.0 </li></ul><ul><l...
Extensible & Pluggable <ul><li>Focus on the web tier in this release </li></ul><ul><li>Create a level playing ground for t...
Modular Web Applications <ul><li>Libraries can contain  web-fragment.xml </li></ul><ul><li>web.xml  is optional </li></ul>...
JSF 2.0 <ul><li>Optional  faces-config.xml </li></ul><ul><li>Standardized facelets </li></ul><ul><li>Auto-discovery of com...
EJB 3.1 <ul><li>@Singleton  beans </li></ul><ul><li>@Startup  beans </li></ul><ul><li>@Asynchronous  invocations </li></ul...
Packaging in a war foo.ear lib/foo_common.jar foo_web.war foo_ejb.jar com/acme/Foo.class WEB-INF/ web.xml WEB-INF/classes ...
Dependency Injection <ul><li>Context & Dependency Injection (CDI) </li></ul><ul><ul><li>JSR 299 with JSR-330 ( @Inject ) <...
Qualified injection @Inject  @Premium   Customer  cust; qualifier  (user-defined label) i.e. « which one? » type injection...
Qualifier Annotation <ul><li>@Target({TYPE,METHOD,PARAMETER,FIELD}) </li></ul><ul><li>@Retention(RUNTIME) </li></ul><ul><l...
Qualified injection @Inject  @Premium   Customer  cust; qualifier  (user-defined label) i.e. « which one? » type injection...
Contexts ( the 'C' in CDI) <ul><li>Built-in “Web” Scopes : </li></ul><ul><ul><li>@RequestScoped, @SessionScoped, @Applicat...
A lot more to CDI <ul><li>Alternatives </li></ul><ul><li>Events </li></ul><ul><li>Stereotypes </li></ul><ul><li>Consumer/P...
This is no science fiction Java EE 6 and GlassFish Server 3 shipped  final releases  on December 10 th  2009
A word on GlassFish <ul><li>Production-Quality Open Source Server </li></ul><ul><ul><li>Java EE 6 (full platform, web prof...
GlassFish and WebLogic Together WebLogic Server Production Java  Application Deployment GlassFish Server Production Java  ...
The following/preceding is intended to outline our general product direction. It is intended for information purposes only...
References <ul><li>glassfish.org </li></ul><ul><li>oracle.com/goto/glassfish </li></ul><ul><li>blogs.sun.com/theaquarium <...
Java EE 6, a Technical Overview <ul><li>http://oracle.com/javaee </li></ul><ul><li>http://glassfish.org </li></ul><Insert ...
Upcoming SlideShare
Loading in...5
×

JavaEE 6, una descripción técnica

795

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
795
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Stepping back a little bit from the latest and greatest standard it&apos;s important to understand the problem that Java EE is trying to solve. In essence it&apos;s all about building enterprise applications and focusing on business logic and separating concerns with presentation and data access layers. Java EE is an ever-improving standard to do just that.
  • Specifically Java EE 6 comes after a massive &amp;quot;Ease of Development&amp;quot; effort in Java EE 5 (done in 2006) to simplify the work of the developer. With this new version it&apos;s about more &amp;quot;Ease of use&amp;quot; but also new features such as RESTful Web Services (JAX-RS) and unified Injection (DI/CDI) and much improved existing APIs. With so many powerful features build into the platform, there is no (or less) requirement for carrying along a long list of frameworks. Java EE 6 alone is enough to build many non-trivial business applications.
  • Until J2EE 1.4 it was all about adding more features (without breaking existing ones). With Java EE 5 we finally started looking at making the developer&apos;s life much simpler and Java EE 6 added the &amp;quot;right-sized&amp;quot; Web Profile (see later slide)
  • EJB, JPA, Servlet and JSF have had massive improvements with Java EE 6. JAX-RS, CDI, and BeanValidation close the feature gap with other approaches making Java EE a very complete and attractive development platform. Managed Beans is a new specification on which other component model (EJB, JAX-RS, ...) are built upon.
  • You can experience for yourself everything you&apos;re about to hear on GlassFish 3. Java EE 6 was released as a specification on December 2009. It has many exciting new features and enhancement to most existing APIs as you&apos;ve probably heard in the Java EE 6 session. The good news is that GlassFish implements all of Java EE 6 today as in was released together with the specification. So, you&apos;re a download away from testing anything you&apos;d like for this new platform. As we will see throughout this presentation, GlassFish is much more than a reference implementation with enterprise quality, performance, and management as well as offering a number of developer productivity features.
  • JAX-RS has been around for a little while now and very well accepted as a generic high-level API for handling HTTP request. Version 1.1 it is now part of the platform and offers yet more portability and the ability to integrated with EJBs (a RESTful resource can actually be an EJB)
  • Hello World example showing URL and operation mapping, MIME-type representation of resources and parameter handling
  • BeanValidation only defines a rather small set of straightforward validation annotations. @Valid references sub-class validation constraints
  • You can also define your own annotation and defer to ConstraintValidator the validation of the value it is being passed (check against a DB or any list of valid ZipCodes)
  • A profile is a notion introduced in Java EE 6 and the Web Profile (version 1.0) is the first one to be defined. In this case of this Web Profile, it defines a strict subset of Java EE 6 for building Web Applications. It&apos;s an ambitious right-sized platform which should let you build applications without requiring extra frameworks. What&apos;s out: remote EJBs, JMS, timers, ...
  • The content is quite ambitious. Note the presence of the Dependency Injection JSRs, as well as EJBs (lite : local interfaces only, ....) JAX-RS is not part of the profile but can be easily added. It will also probably be in the next version of the Web profile.
  • Another key theme of Java EE 6 is the ability to build on top of the platform rather than re-invent the wheel. This translates into a number of extension points in the web tier and simpler packaging for Servlet and CDI extensions.
  • Fragments are the ability to extract the &lt;web-app&gt; portion of a web.xml config file and place it into an XML file in the framework carrying the Servlet, Filters, ... By placing this framework JAR(s) in the web application or in the application server, it&apos;ll be auto-discovered by the runtime. No need to edit web.xml . Your own servlets, filters, and listeners can also be defined using annotations (still no use of web.xml ) Servl etConta inerInitiazer is the ability to do all of the above with an API and create, say, servlets on the fly (useful for dynamic endpoints) Resource JARs is for JARs with nothing but static resources (images, css, javascript, html, ...). Imagine having a JAR for a given version of jquery.
  • JSF 2.0 is somewhat a reboot of this MVC framework. It makes faces-config.xml optional because managed beans can defined with annotations and navigation can be implicit. Facelet is the new recommended way of authoring views (XHTML). It no longer allows for Java code in the view (and that&apos;s a good thing). Composite components is about building your own set of components from basic controls and reusing them across pages and applications. Such a component can now be defined in a single XHTML file. Ajax integration has been possible for a while but it&apos;s now built into JSF with a standard piece of JavaScript or a &lt;f:ajax&gt; tag
  • *lots* of new features in EJB! EJB 3.0 was about doing the same things only much easier, 3.1 is about doing a whole lot more. @Singleton: single instance per JVM per app @Startup: instanciated when container starts @Asynchronous: if all you need is asynchronous behavior (vs. guaranteed messages delivery, etc. with JMS) @Schedule: a declarative way to program the EJB timer. No container config required EJBContainer: an API used for driving in-container tests or adding an EJB container to a Swinf app (for instance). No-interface view: an EJB can be as simple as one class Packaging is also simplyfied, see next slide
  • no more required XML no more required EJB interface no more EAR or JAR this is for doing simple things simply. Older approach still possible and useful in some cases.
  • Dependency injection is finally integrated and unified in the Java EE platform. CDI (JSR 299) builds upon the annotations defined in JSR 330 (@Inject) to provide semantics in a managed (container) environment. Discovering missing or ambiguous dependencies at startup enables developers to find errors as early as possible. Everything can be done dynamically with an API. @Resource is going away but can still be use for application server-related resources (vs. application-scoped artifacts)
  • @Inject is the way forward for requesting the container to inject (initialize) a variable The type here is probably an interface, not an implementation. The qualifier is optional and offers an ability to differentiate between multiple implementations. One can use multiple qualifiers
  • This is my custom-defined qualifier which is used to mark a given implementation (class implementing Customer) and the injection point. Qualifier can be defined to have attributes as well
  • This is strongly-typed (no String involved) and loosely-coupled - one can change the name of the injected class (SpecialCustomer) and not break the injection.
  • The scopes replace those in the servlet of JSF APIs and ConversationScope is a new one that enables developers de precisely define when a long-running conversation starts and when it should be marked for termination. Such conversations have a 1-1 mapping to browser tabs. In this constructor injection all parameters have probably different scopes but the client need not care about this.
  • Alternatives: an XML way (using beans.xml) to express with implementation should be used. No need to recompile code Events: another way to hookup bean together in an event more loose couple manner. The event producer is not aware of it&apos;s listeners/consumers. Stereotypes allows for the grouping of annotations (@Model = @SessionScope + @Named) Producers can be used to expose JPA entitymanager and other resources so that they can be injected using @Inject and qualified. etc...
  • You can experience for yourself everything you&apos;re about to hear on GlassFish 3. Java EE 6 was released as a specification on December 2009. It has many exciting new features and enhancement to most existing APIs as you&apos;ve probably heard in the Java EE 6 session. The good news is that GlassFish implements all of Java EE 6 today as in was released together with the specification. So, you&apos;re a download away from testing anything you&apos;d like for this new platform. As we will see throughout this presentation, GlassFish is much more than a reference implementation with enterprise quality, performance, and management as well as offering a number of developer productivity features.
  • How GlassFish and WebLogic share components and offer customer choice.
  • JavaEE 6, una descripción técnica

    1. 1. 1
    2. 2. Java EE 6, a Technical Overview <Insert Picture Here>
    3. 3. Java EE <ul><li>Scalable and maintainable enterprise apps </li></ul><ul><li>Container vs. Developer </li></ul><ul><ul><li>Life-cycle, resource injection, security, ... </li></ul></ul><ul><li>Portable code </li></ul><ul><ul><li>Portable skills </li></ul></ul><ul><ul><li>Vendor independence </li></ul></ul><ul><li>Industry standard </li></ul><ul><ul><li>large developer community, </li></ul></ul><ul><ul><li>books, training, best practices, consultants, ... </li></ul></ul>
    4. 4. Java EE 6 Overview <ul><li>New features </li></ul><ul><ul><li>Web Profile, REST, managed beans, standard dependency injection, validation </li></ul></ul><ul><li>Enhanced APIs </li></ul><ul><ul><li>EJB 3.1, JSF 2.0, JPA 2.0, Servlet 3.0 </li></ul></ul><ul><li>More ease of use </li></ul><ul><ul><li>Optional XML, simpler packaging, extensibility </li></ul></ul><ul><li>Usable “as is” </li></ul><ul><ul><li>The end of the 100's MB .war </li></ul></ul>
    5. 5. Java EE – a brief History May 1998 Project JPE Dec 1999 10 specs J2EE 1.2 Enterprise Application Servlet JSP EJB JMS RMI/IIOP Sept 2001 13 specs J2EE 1.3 Robust Scalable CMP JCA Nov 2003 20 specs J2EE 1.4 Web Services WS Management Deployment May 2006 23 specs Java EE 5 Ease of development Annotations EJB 3 JPA 1.0 WS-* JSF Q4 2009 28 specs Java EE 6 Ease of development (web) EJB 3.1 JPA 2.0 Servlet 3.0 JSF 2.0 JAX-RS 1.1 CDI 1.0 @Inject Bean Validat° Web Profile Managed Bean
    6. 6. <ul><li>EJB 3.1 </li></ul><ul><li>JPA 2.0 </li></ul><ul><li>Servlet 3.0 </li></ul><ul><li>JSF 2.0 </li></ul><ul><li>JAX-RS 1.1 </li></ul><ul><li>Connectors 1.6 </li></ul><ul><li>Bean Validation 1.0 </li></ul>New and improved specifications <ul><li>DI 1.0 </li></ul><ul><li>CDI 1.0 </li></ul><ul><li>Managed Beans 1.0 </li></ul><ul><li>Interceptors 1.1 </li></ul><ul><li>JAX-WS 2.2 </li></ul><ul><li>JSR-109 1.3 </li></ul><ul><li>JSP 2.2 / EL 2.2 </li></ul><ul><li>JSR-250 1.1 </li></ul>
    7. 7. This is no science fiction Java EE 6 and GlassFish Server 3 shipped final releases on December 10 th 2009
    8. 8. JAX-RS <ul><li>RESTful web services API </li></ul><ul><li>Already widely adopted </li></ul><ul><li>Really a general, high-level HTTP API </li></ul><ul><li>Annotation-based programming model </li></ul><ul><li>Programmatic API when needed </li></ul><ul><li>JAX-RS 1.1 integration with EJBs </li></ul>
    9. 9. JAX-RS sample code @Path (&quot;widgets/{id}&quot;) @Produces (&quot;application/widgets+xml&quot;) public class WidgetResource { public WidgetResource( @PathParam (&quot;id&quot;) String id) { ... } @GET Widget getWidget() { ... } }
    10. 10. Bean Validation 1.0 public class Address { @NotNull @Size (max=30, message=&quot;longer than {max} characters&quot;) private String street1; ... @NotNull @Valid private Country country; } public class Country { @NotNull @Size (max=20) private String name; ... } request recursive object graph validation
    11. 11. Build your own! <ul><li>@Size(min=5, max=5) @ConstraintValidator(ZipcodeValidator.class) @Documented @Target({ANNOTATION_TYPE, METHOD, FIELD}) @Retention(RUNTIME) public @interface ZipCode { String message() default &quot;Wrong zipcode&quot;; String[] groups() default {}; } </li></ul>Integrated in JPA and JSF Bootstrap APIs
    12. 12. “ Web” Profile <ul><li>First Java EE profile to be defined </li></ul><ul><li>A fully-functional, mid-size stack for modern web application development </li></ul><ul><li>Complete, but not the kitchen sink </li></ul>
    13. 13. Java EE 6 Web Profile <ul><li>Servlet 3.0 </li></ul><ul><li>JSP 2.2 / EL 2.2 </li></ul><ul><li>JSR-45 1.0 </li></ul><ul><li>JSTL 1.2 </li></ul><ul><li>JSF 2.0 </li></ul><ul><li>Bean Validation 1.0 </li></ul><ul><li>EJB 3.1 Lite </li></ul><ul><li>JPA 2.0 </li></ul><ul><li>JTA 1.1 </li></ul><ul><li>DI 1.0 </li></ul><ul><li>CDI 1.0 </li></ul><ul><li>Managed Beans 1.0 </li></ul><ul><li>Interceptors 1.1 </li></ul><ul><li>JSR-250 1.1 </li></ul>
    14. 14. Extensible & Pluggable <ul><li>Focus on the web tier in this release </li></ul><ul><li>Create a level playing ground for third-party libraries and frameworks </li></ul><ul><li>Simplify packaging of web apps </li></ul>
    15. 15. Modular Web Applications <ul><li>Libraries can contain web-fragment.xml </li></ul><ul><li>web.xml is optional </li></ul><ul><li>@WebServlet , @WebFilter annotations </li></ul><ul><li>ServletContainerInitializer interface </li></ul><ul><li>Programmatic registration </li></ul><ul><li>Resource jars </li></ul>
    16. 16. JSF 2.0 <ul><li>Optional faces-config.xml </li></ul><ul><li>Standardized facelets </li></ul><ul><li>Auto-discovery of component libraries </li></ul><ul><li>Composite components </li></ul><ul><li>Ajax support (with or without JavaScript) </li></ul><ul><li>Even a JavaScript API ! </li></ul>
    17. 17. EJB 3.1 <ul><li>@Singleton beans </li></ul><ul><li>@Startup beans </li></ul><ul><li>@Asynchronous invocations </li></ul><ul><li>@Schedule tasks </li></ul><ul><li>EJBContainer API works on Java SE </li></ul><ul><li>No-interface view (1 EJB = 1 class!) </li></ul><ul><li>Define EJBs directly inside a web app </li></ul>
    18. 18. Packaging in a war foo.ear lib/foo_common.jar foo_web.war foo_ejb.jar com/acme/Foo.class WEB-INF/ web.xml WEB-INF/classes com/acme/FooServlet.class com/acme/FooEJB.class com/acme/FooEJBLocal.class foo.war WEB-INF/classes com/acme/Foo.class com/acme/FooServlet.class com/acme/FooEJB.class
    19. 19. Dependency Injection <ul><li>Context & Dependency Injection (CDI) </li></ul><ul><ul><li>JSR 299 with JSR-330 ( @Inject ) </li></ul></ul><ul><ul><li>Context management (conversation), events, alternatives, stereotypes, decorators & more </li></ul></ul><ul><li>Beans discovered at startup </li></ul><ul><li>Injection metamodel ( BeanManager API) </li></ul><ul><li>@Resource still around </li></ul>
    20. 20. Qualified injection @Inject @Premium Customer cust; qualifier (user-defined label) i.e. « which one? » type injection point
    21. 21. Qualifier Annotation <ul><li>@Target({TYPE,METHOD,PARAMETER,FIELD}) </li></ul><ul><li>@Retention(RUNTIME) </li></ul><ul><li>@Documented </li></ul><ul><li>@Qualifier </li></ul><ul><li>public @interface Premium {…} </li></ul><ul><li>@Premium // my own qualifier </li></ul><ul><li>public class SpecialCustomer implements Customer { </li></ul><ul><li>public void buy() {…} </li></ul><ul><li>} </li></ul>
    22. 22. Qualified injection @Inject @Premium Customer cust; qualifier (user-defined label) i.e. « which one? » type injection point
    23. 23. Contexts ( the 'C' in CDI) <ul><li>Built-in “Web” Scopes : </li></ul><ul><ul><li>@RequestScoped, @SessionScoped, @ApplicationScoped </li></ul></ul><ul><ul><li>@ConversationScoped </li></ul></ul>public class CheckoutHandler { @Inject CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default Cart cart) { ... } } Client is not context-aware
    24. 24. A lot more to CDI <ul><li>Alternatives </li></ul><ul><li>Events </li></ul><ul><li>Stereotypes </li></ul><ul><li>Consumer/Producer </li></ul><ul><li>Decorator </li></ul><ul><li>Portable extensions </li></ul><ul><li>etc... </li></ul>
    25. 25. This is no science fiction Java EE 6 and GlassFish Server 3 shipped final releases on December 10 th 2009
    26. 26. A word on GlassFish <ul><li>Production-Quality Open Source Server </li></ul><ul><ul><li>Java EE 6 (full platform, web profile) </li></ul></ul><ul><ul><li>Modular (HK2, OSGi) </li></ul></ul><ul><ul><li>Developer-friendly (you judge!) </li></ul></ul><ul><li>GlassFish 3.1 now available! </li></ul><ul><ul><li>Clustering, centralized admin </li></ul></ul><ul><ul><li>Load-balancing, HA </li></ul></ul><ul><ul><li>more... </li></ul></ul><ul><li>http://glassfish.org </li></ul>
    27. 27. GlassFish and WebLogic Together WebLogic Server Production Java Application Deployment GlassFish Server Production Java Application Deployment <ul><li>Best open source application server with support from Oracle </li></ul><ul><li>Open source platform of choice for light- weight Web applications </li></ul><ul><li>Focus on latest Java EE standards and community driven innovation </li></ul><ul><li>Certified interoperability with Fusion Middleware </li></ul><ul><li>Differentiated innovation, scout thread </li></ul><ul><li>Best commercial application server for transactional Java EE applications </li></ul><ul><li>Platform of choice for standardization </li></ul><ul><li>Focus on lowest operational cost and mission critical applications </li></ul><ul><li>integration with Oracle Database, Fusion Middleware & Fusion Applications </li></ul>
    28. 28. The following/preceding 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.
    29. 29. References <ul><li>glassfish.org </li></ul><ul><li>oracle.com/goto/glassfish </li></ul><ul><li>blogs.sun.com/theaquarium </li></ul><ul><li>glassfish.org/roadmap </li></ul><ul><li>youtube.com/user/GlassFishVideos </li></ul><ul><li>Follow @glassfish </li></ul>
    30. 30. Java EE 6, a Technical Overview <ul><li>http://oracle.com/javaee </li></ul><ul><li>http://glassfish.org </li></ul><Insert Picture Here>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×