2. 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.
2
6. Light-weight
• Java EE 6 Web Profile
• Pruning
• Pruned today, means
• Optional in the next release
• Deleted in the subsequent releases
• Technologies marked in Javadocs
• EJB 2.x Entity Beans, JAX-RPC, JAXR, JSR 88
6
9. Java EE 6 - Done
09
• Specifications approved by the JCP
20
• Reference Implementation is GlassFish
h
Server Open Source Edition 3
• TCK
10 t
ec
D
9
12. Managed Beans 1.0
• POJO as managed component for the Java
EE container
• JavaBeans component model for Java EE
• Simple and Universally useful
• Advanced concepts in companion specs
• Basic Services
• Resource Injection, Lifecycle Callbacks, Interceptors
• Available as
• @Resource / @Inject
• java:app/<module-name>/<bean-name>
• java:module/<bean-name>
12
14. Managed Beans 1.0 - Sample
@javax.annotation.ManagedBean @Resource
public class MyManagedBean { MyManagedBean bean;
@PostConstruct
public void setupResources() {
// setup your resources
}
@Inject
@PreDestroy MyManagedBean bean;
public void cleanupResources() {
// collect them back here
}
public String sayHello(String name) {
return "Hello " + name;
}
}
http://blogs.sun.com/arungupta/entry/totd_129_managed_beans_1
14
15. Interceptors 1.1
• Interpose on invocations and lifecycle events
on a target class
• Defined
• Using annotations or DD
• Default Interceptors (only in DD)
• Class & Method Interceptors
• In the same transaction & security context
• Cross-cutting concerns: logging, auditing,
profiling
15
17. Interceptors – Business Method
(Logging)
@InterceptorBinding @LoggingInterceptorBinding
@Retention(RUNTIME) public class MyManagedBean {
@Target({METHOD,TYPE}) . . .
public @interface }
LoggingInterceptorBinding {
}
@Interceptor
@LoggingInterceptorBinding
public class @LogInterceptor {
@AroundInvoke
public Object log(InvocationContext context) {
System.out.println(context.getMethod().getName());
System.out.println(context.getParameters());
return context.proceed();
}
}
17
18. Why Interceptor Bindings ?
• Remove dependency from the interceptor
implementation class
• Can vary depending upon deployment
environment
• Allows central ordering of interceptors
18
19. Interceptors – Business Method
(Transaction)
@InterceptorBinding @Transactional
@Retention(RUNTIME) public class ShoppingCart { . . . }
@Target({METHOD,TYPE})
public @interface Transactional { public class ShoppingCart {
} @Transactional public void
checkOut() { . . . }
@Interceptor
@Transactional
public class TransactionInterceptor {
@Resource UserTransaction tx;
@AroundInvoke
public Object manageTransaction(InvocationContext context) {
tx.begin()
context.proceed();
tx.commit();
}
}
http://blogs.sun.com/arungupta/entry/totd_151_transactional_interceptors_using
19
20. Servlets in Java EE 5
At least 2 files
<!--Deployment descriptor /* Code in Java Class */
web.xml -->
<web-app> package com.sun;
<servlet> public class MyServlet extends
<servlet-name>MyServlet HttpServlet {
</servlet-name> public void
<servlet-class> doGet(HttpServletRequest
com.sun.MyServlet req,HttpServletResponse res)
</servlet-class> {
</servlet>
...
<servlet-mapping>
<servlet-name>MyServlet }
</servlet-name> ...
<url-pattern>/myApp/* }
</url-pattern>
</servlet-mapping>
...
</web-app>
20
23. Servlets 3.0
• @WebServlet, @WebListener, @WebFilter, …
• Asynchronous Servlets
• @WebServlet(asyncSupported=true)
• Plugin libraries using web fragments
• Dynamic registration of Servlets
• WEB-INF/lib/[*.jar]/META-INF/resources
accessible in the root
• Programmatic authentication login/logout
• Default Error Page
• ...
23
24. Servlets 3.1 (JSR 340)
http://jcp.org/en/jsr/detail?id=340
NEW
• Cloud support
• Multi-tenancy
• Security / Session state / Resources isolation
• Asynchronous IO based on NIO2
• Utilize Java EE concurrency utilities
• Enable support for Web Sockets
24
25. Java Persistence API 2 (JSR 317)
• Improved O/R mapping
• Type-safe Criteria API
• Expanded and Richer JPQL
• 2nd-level Cache
• New locking modes
• PESSIMISTIC_READ – grab shared lock
• PESSIMISTIC_WRITE – grab exclusive lock
• PESSIMISTIC_FORCE_INCREMENT – update version
• Standard configuration options
• javax.persistence.jdbc.[driver | url | user | password]
25
27. JPA 2.1 Candidate Features
http://jcp.org/en/jsr/detail?id=338
NEW
●
Multi-tenancy
●
Support for stored procedures, vendor function
●
Update and Delete Criteria queries, JPQL ↔
Criteria
●
Query by Example
●
Support for schema generation
●
UUID generator type
●
Persistence Context synchronization control
●
Dynamic definition of PU
●
Additional event listeners
27
28. EJB 3.1 (JSR 318)
Package & Deploy in a WAR
Java EE 5 Java EE 6
myApp.war
myApp.ear
WEB-INF/classes
myWeb.war com.sun.FooServlet
com.sun.TickTock
WEB-INF/web.xml com.sun.FooBean
WEB-INF/classes com.sun.FooHelper
com.sun.FooServlet
com.sun.TickTock
myBeans.jar
com.sun.FooBean web.xml ?
com.sun.FooHelper
http://blogs.sun.com/arungupta/entry/screencast_37_java_ee_6
28
30. EJB 3.1
• No interface view – one source file per bean
• Embeddable API
• @Singleton
• Initialization in @PostContruct
• Simplified Cron-like syntax for Timer
• Asynchronous Session Bean
• Portable Global JNDI Name
30
31. Contexts & Dependency Injection - CDI
(JSR 299)
• Type-safe Dependency Injection
• No String-based identifiers
• Strong typing, Loose coupling
• Events, Interceptors, Decorators
• Context & Scope management – extensible
• Portable Extensions
• Bridge EJB and JSF in the platform
• Works with Java EE modular and
component architecture
• Integration with Unified Expression Language (UEL)
31
32. CDI
Injection Points
• Field, Method, Constructor
• 0 or more qualifiers
Which one ?
• Type (Qualifier)
@Inject @LoggedIn User user
Request What ?
Injection (Type)
32
34. CDI
Much more ...
• Producer methods and fields
• Bridging Java EE resources
• Alternatives
• Interceptors
• Decorators
• Stereotypes
34
35. Java Server Faces 2.0 (JSR 314)
• Facelets as “templating language” for the page
• Custom components much easier to develop
• Integrated Ajax
• “faces-config.xml” optional in common cases
• Default navigation rules
• Much more …
• Runs on Servlet 2.5+
• Bookmarkable URLs
• Conditional navigation
• ...
35
50. From the real users ... Jigsaw puzzle, Modular,
standard, less xml, easy,
easy, have I said easy?
Developers can concentrate
on business logic, Java EE 6 is
providing a standard for
the infrastructure. Standards compliance, vendor
independence, milliseconds
and kilobyte deployment
Faster development, less
frameworks/complexity,
Higher integrated specs,
more great code shipped
simple and annotation driven,
single-classloader WARs,
next level of industry
standard
Not your fat grandfather's
enterprise Java anymore,
Definite excuse to avoid Enterprise Java Renaissance
Spring forever
http://blogs.sun.com/arungupta/tags/community+feedback
50
51. Avoid “framework explosion”
In selecting an application server our main goal
was to avoid the framework explosion that
happens when you use a "custom" Enterprise
stack like Tomcat + Spring + Hibernate +
Myfaces +... Java EE 6 had 80% of what we
needed out of the box: strong persistence
support ( JPA ), inversion of control ( CDI ), and
a lightweight component model ( EJB 3.1 )
http://blogs.sun.com/stories/entry/egesa_engineering_avoids_framework_explosion
51
53. GlassFish Server Chronology
2006 2007 2008 2009 2010 2011 …
GlassFish v1
Java EE 5, Single Instance
GlassFish v2
Java EE 5, High Availability
GlassFish Server 3
Java EE 6, Single Instance
GlassFish Server 3.1
Java EE 6, High Availability
GlassFish Server 3.2
Virtualization, PaaS
53
54. GlassFish Server Distributions
Distribution License Features
• Java EE 6 compatibility
GlassFish Server Open CDDL & • Web Profile support
Source Edition 3.1 GPLv2 • In-memory replication / clustering
Web Profile
• Centralized Administration
• Java EE 6 compatibility
GlassFish Open Source CDDL & • Full Java EE distribution
Edition 3.1 GPLv2 • In-memory replication / clustering
• Centralized Administration
• Adds
Oracle GlassFish Server 3.1 Commercial • Oracle GlassFish Server Control
Web Profile • Patches, support, knowledge
base
• Adds
Oracle GlassFish Server 3.1 Commercial • Oracle GlassFish Server Control
• Patches, support, knowledge
base
55. GlassFish 3.1 Overview
• Built on GlassFish 3
• Modular and Extensible HK2 Kernel
• ~262 modules
• Clustering and High Availability
• HTTP, EJB, IIOP, SSO, Metro
• Dynamic Invocation of Services
• End-to-end extensibility
55
56. GlassFish 3.1: Fast and Furious ...
• 29% better startup/deploy/re-deploy cycle
over 3.0.1
• 33% better HA performance over 2.1.1
• Scalable Grizzly Adapter based on Java NIO
• Full-session and Modified-attribute* scope
• Multiple clusters per domain, multiple
instances per cluster, up to 100 instances
per domain
http://weblogs.java.net/blog/sdo/archive/2011/03/01/whats-new-glassfish-v31-performance
56
57. Java EE 7 : JSR 342
NEW
• Theme: Cloud
• More easily operate on private or public clouds
• Deliver functionality as a service with support for
features such as multi-tenancy and elasticity
• Technology refresh: JMS 2.0, CDI 1.1, ...
• Latest web standards: HTML 5 and Web Sockets
• Possible JSRs inclusion
• Concurrency Utilities for Java EE (JSR 236)
• JCache (JSR 107)
• New JSRs: Web Sockets, Java JSON API
• Modularity and Versioning
57
58. Java EE 7 Schedule
NEW
• March 2011 Early EG Formed
• Q3 2011 Early Draft
• Q1 2012 Public Draft
• Q3 2012 Final Release
58
59. Java EE JSR Soup
NEW
• Java EE 7 - JSR 342
• Servlets 3.1 – JSR 340
• Expression Language 3.0 – JSR 341
• Java Message Service 2.0 – JSR 343
• Java Server Faces 2.2 – JSR 344
• Java Persistence API 2.1 – JSR 338
• JAX-RS 2.0 – JSR 339
59
60. Transparency Checklist
NEW
• Names of the EG members
• EG business reported on publicly
readable alias
• Schedule is public, current and updated
regularly
• Public can read/write to a wiki
• Discussion board on jcp.org
• Public read-only issue tracker
60