<Insert Picture Here> Exploring Java EE 6 The Programming Model Explained

Similar documents
Oracle Corporation

Java EE 6 - Update Harpreet Singh GlassFish Portfolio Product Manager

JAX-RS and Jersey Paul Sandoz

<Insert Picture Here> Productive JavaEE 5.0 Development

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA

This is the first part of a multi-article series. For part 2 please see: Dependency Injection in Java EE 6 - Part 2

Hands-on Development of Web Applications with Java EE 6

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

1 Markus Eisele, Insurance - Strategic IT-Architecture

ENTERPRISE JAVABEANS TM (EJB TM ) 3.1 TECHNOLOGY

Cleveland Java Users Group Java Enterprise Edition 6 Update

Java EE 6 & GlassFish v3 Paving the path for future. Arun Gupta Sun Microsystems, Inc.

Seam 3. Pete Muir JBoss, a Division of Red Hat

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

PATTERNS & BEST PRACTICES FOR CDI

JavaEE.Next(): Java EE 7, 8, and Beyond

Specialized - Mastering JEE 7 Web Application Development

Developing Applications with Java EE 6 on WebLogic Server 12c

open source community experience distilled

Java EE 7: Back-End Server Application Development

V3 EJB Test One Pager

Apache OpenWebBeans and DeltaSpike Deep Dive Mark Struberg Gerhard Petracek

Shale and the Java Persistence Architecture. Craig McClanahan Gary Van Matre. ApacheCon US 2006 Austin, TX

Contents at a Glance

Courses For Event Java Advanced Summer Training 2018

Java EE 6: Develop Web Applications with JSF

CO Java EE 7: Back-End Server Application Development

TheServerSide.com. Part 3 of dependency injection in Java EE 6

APPLICATION SECURITY ENHANCEMENTS IN JAVA EE 6

Spring Framework 2.5: New and Notable. Ben Alex, Principal Software Engineer, SpringSource

JSR-299 (CDI), Weld and the Future of Seam. Dan Allen Principal Software Engineer JBoss by Red Hat

Refactoring to Seam. NetBeans. Brian Leonard Sun Microsystems, Inc. 14o

Concepts: business logic and middleware

Session 12. RESTful Services. Lecture Objectives

Metadata driven component development. using Beanlet

Java EE 6: Develop Business Components with JMS & EJBs

Spring 2.5 on the Way to 3.0

Developing RESTful Services in Java

Introduction to CDI Contexts and Dependency Injection

The Next Generation. Prabhat Jha Principal Engineer

Deccansoft Software Services. J2EE Syllabus

New Features in EJB 3.1

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Java EE 6 Community Roundtable. Reza Rahman Independent Consultant Author, EJB 3 in Action

JBoss Enterprise Application Platform 6

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

Injection Of Entitymanager

Fun with EJB and OpenEJB. David #OpenEJB

TheServerSide.com. Dependency Injection in Java EE 6 - Part 5

Java EE 6 & Spring: A Lover s Quarrel. Derrick Kittler Mauricio Maltron Leal Vamsi Chemitiganti

JBoss Enterprise Application Platform 6.3

Java EE 6 New features in practice Part 2

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

Oracle Fusion Middleware

WAS V7 Application Development

<Insert Picture Here> Accelerated Java EE Development: The Oracle Way

Java EE 8 What s coming? David Delabassee Oracle May 17, 2017

OSGi Application Development using GlassFish Server. Version 1.0

Apache TomEE Tomcat with a kick

Seam & Web Beans. Pete Muir JBoss, a division of Red Hat.

Baking a Java EE 8 Micro Pi Mike Croft Ondrej Mihályi. Payara Support

David Blevins State of OpenEJB 3.0

The 1st Java professional open source Convention Israel 2006

MicroProfile - New and Noteworthy

JSR 299: Web Beans. Web Beans Expert Group. Version: Public Review

Fast Track to Java EE

The. Platform. Alexis Moussine-Pouchkine

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java

Enterprise Development

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Oracle Corporation

OSGi in WebSphere : The Story so far

JBoss World 2009 Marius Bogoevici

IBM WebSphere Application Server 8. Java EE 6 Feature Packs

Deployment. See Packaging and deployment processes

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

Java SE7 Fundamentals

ISV Technical Executive Forum 2011

EJB 3.1 vs Contexts and Dependency Injection (CDI) and Dependency Injection for Java in Java EE 6. Jacek Laskowski.

Migrating traditional Java EE applications to mobile

JSR 365 (CDI 2.0) Review

<Insert Picture Here> Java Virtual Developer Day

The roots of Java EE 6

JBoss Enterprise Application Platform 6.1

CO Java EE 6: Develop Database Applications with JPA

Transactions and Transaction Managers

ApplicationComposer. The TomEE Swiss Knife

Java Training Center, Noida - Java Expert Program

INTRODUCTION TO COMPONENT DESIGN IN JAVA EE COMPONENT VS. OBJECT, JAVA EE JAVA EE DEMO. Tomas Cerny, Software Engineering, FEE, CTU in Prague,

JAX-RS. Sam Guinea

Enterprise Java in 2012 and Beyond From Java EE 6 To Cloud Computing

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

What is tackled in the Java EE Security API (Java EE 8)

<Insert Picture Here> Future<JavaEE>

Java Enterprise Edition

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Java SE 8 Fundamentals

Transcription:

<Insert Picture Here> Exploring Java EE 6 The Programming Model Explained Lee Chuk Munn chuk-munn.lee@oracle.com

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.

What's New in the Java EE 6 Platform? New and updated components EJB 3.1 (+Lite) JPA 2.0 Servlet 3.0 JSF 2.0 JAX-RS 1.1 Bean Validation 1.0 DI 1.0 CDI 1.0 Connectors 1.6 Managed Beans 1.0 Interceptors 1.1 JSP 2.2 EL 2.2 JSR 250 1.1 JASPIC 1.1 JACC 1.5 JAX-WS 2.2 JSR 109 1.3

Changes in Java EE 6 23% 52% 11% 14% Unchanged Completely new Major updates Regular updates http://blog.eisele.net/2010/12/who-is-afraid-of-java-ee-6-get-rid-of.html

Java EE 6 Web Profile CDI Extensio ns ns Web Cont ainer Extensions JSP JAX-RS 1.1 JSF 2.0 2.2 2.2 JSTL 1.2 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 JPA 2.0 // JTA 1.1 Bean Validation 1.0

Simplfied Packaging Java EE 5 Java EE 6 foo.ear foo_web.war WEB-INF/web.xml WEB-INF/classes com.sun.fooservlet com.sun.ticktock foo_ejb.jar com.sun.foobean com.sun.foohelper foo.war WEB-INF/classes com.sun.fooservlet com.sun.ticktock com.sun.foobean com.sun.foohelper

Web Apps Simplified Packaging Web Application WEB-INF/classes com/acme/myservlet.class com/acme/myfilter.class WEB-INF/lib someframework.jar WEB-INF/web.xml index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

Web Apps Simplified Packaging Web Application WEB-INF/classes com/acme/myservlet.class com/acme/myfilter.class WEB-INF/lib someframework.jar @WebServlet(urlPatterns= /foo ) public class MyServlet { } @WebFilter(urlPatterns= /foo ) public class MyFilter { } WEB-INF/web.xml index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

Web Apps Simplified Packaging Web Application WEB-INF/classes com/acme/myservlet.class com/acme/myfilter.class WEB-INF/lib someframework.jar Framework Jar META-INF/web-fragment.xml com/fw/fwservlet.class com/fw/fwfilter.class index.html main.css jquery-1.4.2.js ui/jquery.ui.core.js ui/jquery.ui.widget.js

Web Apps Simplified Packaging Web Application WEB-INF/classes com/acme/myservlet.class com/acme/myfilter.class WEB-INF/lib someframework.jar jquery-ui-1.8.4.jar jquery Resource Jar META-INF/resources/jquery-1.4.2.js META-INF/resources/ui/jquery.ui.core.js META-INF/resources/ui/jquery.ui.widget.js index.html main.css

Web Apps Simplified Packaging Web Application WEB-INF/classes com/acme/myservlet.class com/acme/myfilter.class WEB-INF/lib someframework.jar jquery-ui-1.8.4.jar Simpler packaging Drag and drop self configuring frameworks Resource JARs index.html main.css

Managed Bean as the Foundation Plain Java objects (POJOs) Lifecycle managed by container Foundation for other component types Not something that developers would use directly Supports injections @Resource, @Inject Lifecycle callbacks @PostConstruct, @PreDestroy Optional name Interceptors

Managed Bean Example @ManagedBean( MyCustomer ) public class Customer { @Resource DataSource db; //Inject another managed bean @Resource Address address; } @PostConsturct private void init() { // }

EJB Components as Managed Beans All managed beans core services are available in EJB EJB component model extends managed beans by providing State @Stateful, @Stateless, @Singleton Transaction @TransactionAttribute Security @RolesAllowed, @DenyAll, @PermitAll Access semantics @Remote, @WebService EJBs can now be view as features on managed beans Just as other types of components

Incremental Programming Model Application changes over time Requirement change, functions of classes/objects changes Allows you to evolve your application gracefully Start with POJOs @ManagedBean Use all the basic services lifecycle, resource injection, etc Turn them in to EJBs, Enitites, etc to take advantage of new capabilities No change to (local) client

Incremental Programming Model @ManagedBean public class Customer { @Resource DataSource db; //Inject another managed bean @Resource Address address; } @PostConsturct private void init() { // }

Incremental Programming Model @Stateful public class Customer { @Resource DataSource db; //Inject another managed bean @Resource Address address; } @PostConsturct private void init() { // }

Common Injection Service Framework Injection services available to all objects Not restricted to specific components eg. EJB Context and Dependency Injection Managed beans on steroids Opt-in technology on per-module basis WEB-INF/beans.xml, META-INF/beans.xml Key CDI concepts Strongly typed for typesafety Loose coupling events, interceptors, decorators Context and scope management Integration with EL Bridge EJB (business) to JSF (presentation)

CDI Example @Inject User user;

CDI Example @Inject User user; Type describes the capability of the user

CDI Example What type of User? @Inject User user;

CDI Example @Inject @LoggedIn User user; Qualifier describes the characteristic of the user

Uniformity Annotations are additive New behaviour refine pre-existing ones Unless annotation conflicts with the semantics of component Eg. session scoped for JAX-RS components Eg. JAX-RS resource classes are POJOs Use JAX-RS specific injection capabilities Additional annotations to turn resource classes into CDI managed beans or EJBs Use the new services with REST

JAX-RS Example @Path( root ) public class RootResource { @Context UriInfo info; @Path( {id} ) public SubResource find( @PathParam( id ) String id) { } } return (new SubResource(id));

JAX-RS Example As a managed bean, using @Resource @ManagedBean @Path( root ) public class RootResource { @Context UriInfo info; @Resource DataSource mydb; @Path( {id} ) public SubResource find( @PathParam( id ) String id) { } } return (new SubResource(id));

JAX-RS Example As a CDI bean, using @Inject and scoped annotations @RequestScoped @Path( root ) public class RootResource { @Context UriInfo info; @Inject @CustomerDB DataSource mydb; @Path( {id} ) public SubResource find( @PathParam( id ) String id) { } } return (new SubResource(id));

APIs That Work Better Together Previous versions have a bunch of APIs that are quite independent of each other Java EE 5/6 introduces lots of 'services' API Managed bean, CDI, validation, interceptors, etc Aiming to get API to work better together Eg. Bean Validation integrated into JSF, JPA But not so well with CDI working on it Use of SPI to provide integration to other frameworks

Java EE 6

After Frameworks

Java EE 6 Platform Extensions

Extensibility Integrating 3 rd party frameworks Pluggability contracts make extension look like build-in technologies Two main extension points in Java EE 6 Servlet 3.0 pluggability CDI extensions

Servlet 3.0 Pluggability Primary to address 3 rd party web frames Drag and drop model Dynamic or static registration for frameworks Configuration, initialization, code generation, etc Results in ready to use framework JARs Modular web.xml and web-fragment.xml Framework contains a fragment of web.xml META-INF/web-fragment.xml Extension can discover and process annotated classes

Pluggability Example @MyWebFramework public class DoSomething { Register with service loader framework myframework.jar META-INF/services/ javax.servlet.servletcontainerinitializer myframework.frameworkloader

Pluggability Example @HandlesTypes(MyWebFramework.class) public class FrameworkLoader implements ServletContainerInitializer { public void onstartup(set<class<?>> c, ServletContext ctx) { //Load framework controller ServletRegistration.Dynamic reg = ctx.addservlet( MyFrameworkController, myframework.controller.frameworkcontroller ); reg.setinitparameter( config, /WEB-INF/config.properties ); } } //Other processing eg. Code generation...

Extending CDI Portable extension framework provides standard way of extending CDI Drag and drop Extensions can process any annotated types What can you do with portable extensions Introduce new bean types Satisfy injection points Introduce custom scopes Augment or substitute bean's annotations and/or metadata Limited by your imagination

Portable Extension Example @RequestScope @Message public class HandleMessage { New component type @Inject @From JID from; @PersistenceContext EntityManager em; New bean type Integrates well } @Body( {body} ) public Object handle(@named( body ) int custid) { return (em.find(customer.class, custid)); } Export a named bean to handle method only

Conclusion A Better Platform Less boilerplate code Simpler packaging Uniform use of annotations Consistent programming model Extensible Simple things should be simple complex things should be possible Alan Kay

For More Information search.oracle.com or oracle.com