<Insert Picture Here>




Java EE 6 application development, OSGi and Eclipse users
Roberto Chinnici
Java EE 6 Specificati...
JAVA EE 6
  FINAL RELEASE
DECEMBER 10, 2009
What's New?


•   Several new APIs
•   Web Profile
•   Pluggability/extensibility
•   Dependency injection
•   Lots of imp...
New and updated components


•   EJB 3.1               •   Managed Beans 1.0
•   JPA 2.0               •   Interceptors 1....
Web Profile


• First Java EE profile to be defined
• A fully-functional, mid-size stack for modern web
  application deve...
Java EE 6 Web Profile Contents


                       JSF 2.0

      JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0

         ...
Pluggability/Extensibility


• Focus on the web tier in this release
• Create a level playing field for third-party framew...
Modular Web Applications


•   Libraries can contain /META-INF/web-fragment.xml
•   web.xml is optional
•   @WebServlet, @...
Sample Web Fragment Descriptor

<web-fragment
     version=”3.0”
     xmlns="http://java.sun.com/xml/ns/javaee">
  <servle...
JAX-RS 1.1


•   RESTful web services API
•   Already widely adopted
•   Really a general, high-level HTTP API
•   Annotat...
JAX-RS Sample


@Path(“widgets/{id}”)
@Produces(“application/widgets+xml”)
public class WidgetResource {
  public WidgetRe...
Bean Validation 1.0


• Integrated with JSF, JPA
• Declarative constraints using annotations
   @NotNull
   @Size(max=40) ...
EJB 3.1


• @Singleton beans
• @Startup beans
• @Asynchronous invocations
   @Asynchronous public Future<Integer> compute(...
Adding an EJB to a Web Application

           Before                       Now


BuyBooks.war     ShoppingCart        Sho...
Dependency Injection


• DI + CDI (JSR-330 + JSR-299)
• @Resource still around
   @Resource DataSource myDB;
• Added @Inje...
Dependency Injection Sample


@ApplicationScoped
public class CheckoutHandler {
  @Inject
  public CheckoutHandler(
      ...
JSF 2.0


•   Facelet as a standard view declaration language
•   Composite components
•   Automatic discovery of componen...
Java EE 6 Platform


•   More powerful
•   More flexible
•   More extensible
•   Easier to use




        http://java.sun...
What is GlassFish


• A Community
  – Users, Partners, Testers, Developers
  – Started in 2005 on http://java.net
• Applic...
GlassFish v3...


• The Java EE 6 spec, of course, and...
• Beyond the spec
  – Fast, very fast, small, very small
  – res...
Modular and Dynamic


• Modular : OSGi: Equinox and Apache Felix
• But also Equinox or Static mode, thanks to HK2
  – Yet ...
Web Session Retention


• Deployment option to maintain stateful sessions across re-
  deployments
  – $ asadmin redeploy ...
GlassFish and OSGi


• GlassFish runs on top of OSGi (Felix and Equinox)
  – GlassFish ships with 200+ bundles
• Can use O...
Demo


• GlassFish Java EE dev in Eclipse
Integration with maven 2


• Java EE 6 APIs in Maven repository
  – http://download.java.net/maven/2/javax/javaee-api/
  –...
Update Center: Add/Remove/Update Bundles
Thanks for your attention!


• http://java.sun.com/javaee
• http://glassfish.org
Java EE 6, Eclipse @ EclipseCon
Upcoming SlideShare
Loading in …5
×

Java EE 6, Eclipse @ EclipseCon

2,294 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,294
On SlideShare
0
From Embeds
0
Number of Embeds
607
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java EE 6, Eclipse @ EclipseCon

  1. 1. <Insert Picture Here> Java EE 6 application development, OSGi and Eclipse users Roberto Chinnici Java EE 6 Specification Lead Ludovic Champenois, GlassFish Tools Architect
  2. 2. JAVA EE 6 FINAL RELEASE DECEMBER 10, 2009
  3. 3. What's New? • Several new APIs • Web Profile • Pluggability/extensibility • Dependency injection • Lots of improvements to existing APIs
  4. 4. New and updated components • EJB 3.1 • Managed Beans 1.0 • JPA 2.0 • Interceptors 1.1 • Servlet 3.0 • JAX-WS 2.2 • JSF 2.0 • JSR-109 1.3 • JAX-RS 1.1 • JSP 2.2 • Connectors 1.6 • EL 2.2 • Bean Validation 1.0 • JSR-250 1.1 • DI 1.0 • JASPIC 1.1 • CDI 1.0 • JACC 1.5
  5. 5. Web Profile • First Java EE profile to be defined • A fully-functional, mid-size stack for modern web application development • Complete, but not the kitchen sink
  6. 6. Java EE 6 Web Profile Contents JSF 2.0 JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0 Servlet 3.0 EJB 3.1 Lite · DI 1.0 · CDI 1.0 · Managed Beans 1.0 Bean Validation 1.0 · Interceptors 1.1 · JSR-250 1.1 JPA 2.0 · JTA 1.1
  7. 7. Pluggability/Extensibility • Focus on the web tier in this release • Create a level playing field for third-party frameworks • Simplify packaging of web applications
  8. 8. Modular Web Applications • Libraries can contain /META-INF/web-fragment.xml • web.xml is optional • @WebServlet, @WebFilter annotations • ServletContainerInitializer interface • Programmatic registration of components • Resource jars containing /META-INF/resources
  9. 9. Sample Web Fragment Descriptor <web-fragment version=”3.0” xmlns="http://java.sun.com/xml/ns/javaee"> <servlet> <servlet-name>welcome</servlet-name> <servlet-class>WelcomeServlet</servlet-class> </servlet> <listener> <listener-class>RequestListener</listener-class> </listener> </web-fragment>
  10. 10. JAX-RS 1.1 • RESTful web services API • Already widely adopted • Really a general, high-level HTTP API • Annotation-based programming model • Programmatic API when needed
  11. 11. JAX-RS Sample @Path(“widgets/{id}”) @Produces(“application/widgets+xml”) public class WidgetResource { public WidgetResource(@PathParam(“id”) String id) {…} @GET public Widget getWidget() {…} @PUT public void putWidget(Widget widget){…} }
  12. 12. Bean Validation 1.0 • Integrated with JSF, JPA • Declarative constraints using annotations @NotNull @Size(max=40) String address; • Fully extensible: define your own constraints @Email String recipient; • Validator API for programmatic validation validator.validate(obj) → Set<ConstraintViolation>
  13. 13. EJB 3.1 • @Singleton beans • @Startup beans • @Asynchronous invocations @Asynchronous public Future<Integer> compute(); • Define EJBs directly inside a web application • EJBContainer API works on Java SE
  14. 14. Adding an EJB to a Web Application Before Now BuyBooks.war ShoppingCart ShoppingCart EJB Class EJB Class ShoppingCart.jar BuyBooks.ear BuyBooks.war
  15. 15. Dependency Injection • DI + CDI (JSR-330 + JSR-299) • @Resource still around @Resource DataSource myDB; • Added @Inject annotation for typesafe injection @Inject @LoggedIn User user; • Automatic scope management (request, session, etc.) • No configuration: beans discovered at startup • Extensible via the BeanManager API
  16. 16. Dependency Injection Sample @ApplicationScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…} } Injection points identified by Qualifier + Type @Default can be omitted
  17. 17. JSF 2.0 • Facelet as a standard view declaration language • Composite components • Automatic discovery of component libraries • Programmatic and declarative Ajax support • System events • Validation out-of-the-box
  18. 18. Java EE 6 Platform • More powerful • More flexible • More extensible • Easier to use http://java.sun.com/javaee
  19. 19. What is GlassFish • A Community – Users, Partners, Testers, Developers – Started in 2005 on http://java.net • Application Server – Enterprise Quality and Open Source (CDDL & GPL v2) – Java EE 5 / 6 Reference Implementation • Full Commercial Support from Oracle – Not only a Reference Implementation – Roadmap announced tomorrow regarding HA, Clustering...
  20. 20. GlassFish v3... • The Java EE 6 spec, of course, and... • Beyond the spec – Fast, very fast, small, very small – restart, btrace/dtrace, embedded, modularity, OSGi, RESTful Admin,... – Scripting: jRoR, Grails, and now Django • Update Center: repository of new/updated bundles • Tooling: Netbeans 6.8, IntelliJ,vi, and – Eclipse 3.5, 3.6Mx
  21. 21. Modular and Dynamic • Modular : OSGi: Equinox and Apache Felix • But also Equinox or Static mode, thanks to HK2 – Yet very Fast ! • Painless Java EE 6 development – Via the new/easier APIs – Via better tools integration – Ultra fast Auto-deploy of all Java EE and static artifacts – Application runner • java -jar glassfish.jar foo.war
  22. 22. Web Session Retention • Deployment option to maintain stateful sessions across re- deployments – $ asadmin redeploy --properties keepSessions=true myapp.war – Enabled by Default in Eclipse IDE • For All sessions: – Servlets, CDIs, Stateful EJBs,... • Greatly simplifies the development paradigm
  23. 23. GlassFish and OSGi • GlassFish runs on top of OSGi (Felix and Equinox) – GlassFish ships with 200+ bundles • Can use OSGi management tools (CLI or Web) • Any OSGi bundle will run in GlassFish v3 – Drop it in domain1/autodeploy/bundles – Can also asadmin deploy it using --type osgi • Consume OSGi services via @Resource @Resource (mappedName="MYPUREOSGISERVICE") HelloService myOSGiService; • Web Application Bundle (WAB Support)
  24. 24. Demo • GlassFish Java EE dev in Eclipse
  25. 25. Integration with maven 2 • Java EE 6 APIs in Maven repository – http://download.java.net/maven/2/javax/javaee-api/ – Stripped jars: very small <1Mb – Not to be used for Testing • GlassFish Embbeded can run via Maven – mvn gf:run
  26. 26. Update Center: Add/Remove/Update Bundles
  27. 27. Thanks for your attention! • http://java.sun.com/javaee • http://glassfish.org

×