Top Banner
1
49
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Java one brazil_keynote_dochez

1

Page 2: Java one brazil_keynote_dochez

<Insert Picture Here>

Future of Java EE

Jerome DochezGlassfish Architect

Page 3: Java one brazil_keynote_dochez

3

The following is intended to outline our general product direction. It is intended for information purposes, 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.

Page 4: Java one brazil_keynote_dochez

Java EE and… the Cloud?

• Containers are back in vogue!

4

Page 5: Java one brazil_keynote_dochez

Java EE and… the Cloud?

• We have containers...• We have services… injectable services…• We scale to large clusters…• We have a security model…

5

Page 6: Java one brazil_keynote_dochez

Java EE for the Cloud

• Tighter requirements for resource and state management

• Better isolation between applications• Potential standard APIs for NRDBMS,

caching, other• Common management and monitoring

interfaces• Evolution, not revolution

6

Page 7: Java one brazil_keynote_dochez

Better Packaging for the Cloud

• Apps are versioned• Multiple versions can coexist• Must deal with data versioning,

upgrades, etc.• Need ability to specify QoS properties• Apps both expose and connect to

services

7

Page 8: Java one brazil_keynote_dochez

Cloud Platform

Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

8

Page 9: Java one brazil_keynote_dochez

Cloud Platform

CodeModule

CodeModule

Schema Migration QoS InformationSecurity

CodeModule

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

9

Application

Page 10: Java one brazil_keynote_dochez

Cloud Platform

Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

10

Page 11: Java one brazil_keynote_dochez

Cloud Platform

Application Application Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

11

Page 12: Java one brazil_keynote_dochez

Cloud Platform

Managed Environment

Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Application Application

12

Page 13: Java one brazil_keynote_dochez

Demo Application

Database

RESTClient

EJB/CDIJSF

JPA

JPA

EJB Timer

Jersey Client API

Browser

Page 14: Java one brazil_keynote_dochez

Modularity

• Build on Java SE work• Applications made of modules• Dependencies are explicit• Versioning is built-in• Classloaders straightened out

14

Page 15: Java one brazil_keynote_dochez

Modular Applications

15

demo.app

demo-web-1.0.3

Page 16: Java one brazil_keynote_dochez

Modular Applications

16

twitter-client-2.3.0

demo.app

demo-web-1.0.3

demo-persist-1.4.0

Page 17: Java one brazil_keynote_dochez

Modular Applications

javaee-web-7.0

twitter-client-2.4.0

jpa-2.1

demo.app

demo-web-1.0.3demo-persist-1.4.0

17

jax-rs-2.0

requires

requiresrequires

Page 18: Java one brazil_keynote_dochez

Modular Applications

javaee-web-7.0

twitter-client-2.3.0

jpa-2.1

demo.app

demo-web-1.0.3demo-persist-1.4.0

18

jax-rs-2.0

requires

requiresrequires

Page 19: Java one brazil_keynote_dochez

Modular Applications

javaee-web-7.0

twitter-client-2.3.0

jpa-2.1

…………

gf-appserver-4.0.1

demo.app

demo-web-1.0.3demo-persist-1.4.0

19

jax-rs-2.0

implements

requires

requires

Page 20: Java one brazil_keynote_dochez

Modular Applications

javaee-web-7.0

twitter-client-2.3.0

jpa-2.1

…………

gf-appserver-4.0.1eclipselink-2

demo.app

demo-web-1.0.3demo-persist-1.4.0

20

jersey-2.0

jax-rs-2.0

implements

implementsimplements

Page 21: Java one brazil_keynote_dochez

Modular Applications

javaee-web-7.0

twitter-client-2.4.0

jpa-2.1

…………

gf-appserver-4.0.1eclipselink-2

demo.app

demo-web-1.0.4demo-persist-1.4.0

21

jersey-2.1.1

jax-rs-2.1

Page 22: Java one brazil_keynote_dochez

Modular Applications

jersey-2.1.5

javaee-web-7.0

twitter-client-2.4.0

jax-rs-2.1jpa-2.1

…………

gf-appserver-4.1.5eclipselink-2

jersey-2.1.1

jax-rs-2.1demo.app

demo-web-1.0.4demo-persist-1.4.0

22

Page 23: Java one brazil_keynote_dochez

JSF 2.1: short term

• Transient State Saving• UIData Transient state saving• XML view cleanup• Facelets Cache API• “XML free” in specification

23

Page 24: Java one brazil_keynote_dochez

JSF 2.2

• HTML5– semantic tags– support of browser feature detection– HTML5 for components– Audio and video– Standardize popular API (Trinidad’s page

resolver, ADF ApplicationContectManager)– JSR-276, tools support– Enhancements to existing features

• mobile renderkits• composite components

24

Page 25: Java one brazil_keynote_dochez

JMS

• Resolve ambiguities and uncertainties in the APIS– Remove complexities in the existing API– Incomplete and optional integration in Java EE env.

• Standardize common vendor extensions/features

• Integration with other specs and non-Java languages

• Expand JMS spec with new developments in messaging

25

Page 26: Java one brazil_keynote_dochez

Web Tier

• Web socket support• Standard JSON API• HTML5 support• NIO.2-based web container

26

Page 27: Java one brazil_keynote_dochez

Web Socket Sample (with Grizzly WebSocket API)public class ChatApplication extends WebSocketApplication<ChatWebSocket> { protected ChatWebSocket createWebSocket(Connection c, ServerWebSocketMeta m) { return new ChatWebSocket(c, m, this); }

public void onMessage(ChatWebSocket s, DataFrame frame) { String msg = frame.getAsText(); s.sendJson(s.getUser(), msg); } public void onClose(ChatWebSocket s) { s.sendJson(“system”, s.getUser() + “ left the chat”); }}

27

Page 28: Java one brazil_keynote_dochez

Async Web Sample (Atmosphere)Java EE 8

@Path("/{topic}")@Produces("text/plain;charset=ISO-8859-1")public class PubSub { private @PathParam("topic") Broadcaster topic;

@GET @Suspend public Broadcastable subscribe() { return new Broadcastable("",topic); }

@POST @Broadcast @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Broadcastable publish( @FormParam("message") String message) { return new Broadcastable(message,topic); }

28

Page 29: Java one brazil_keynote_dochez

Java Persistence 2.1

• Build on functionality added in JPA 2.0• Features largely driven by community input• Infilling for

–Improved standardization–Improved flexibility

2

Page 30: Java one brazil_keynote_dochez

Java Persistence 2.1 Candidate FeaturesO/R Mapping and Modeling

• Converters / custom types• “Fetch” plans / profiles• Additional mapping metadata• User-defined naming strategies• More flexibility in use of generated values• Immutable attributes; readonly entities• More flexible XML descriptors

3

Page 31: Java one brazil_keynote_dochez

Java Persistence 2.1 Candidate FeaturesAPI Enhancements

• Additional event listeners and callbacks• Improved control of persistence context

synchronization• Support for dynamic definition of persistence unit• Extension of Metamodel API to ORM• Methods for dirty detection• Additional unwrap methods

4

Page 32: Java one brazil_keynote_dochez

Java Persistence 2.1 Candidate FeaturesEnhancements to Query Functionality

• Support for stored procedures• Additional built-in functions• Database and vendor function invocation

support• Downcasting• Outer joins with ON conditions• Update and delete criteria queries• Mapping between JPQL and criteria queries• Improved result type mapping for native

queries5

Page 33: Java one brazil_keynote_dochez

JPA 2.1 Rollout

• Targeted as part of Java EE 7 + standalone• Plan to file JSR this year

–Expert Group formation in January 2011

• Timelines for Java EE 7 may impact contents of JPA 2.1–Expert Group will need to prioritize–Community input a very important factor here

[email protected]

6

Page 34: Java one brazil_keynote_dochez

34

JAX-RS status

• JAX-RS 1.0: 18th October 2008• JAX-RS 1.1: 23rd November 2009

–Aligned with Java EE 6, but not in the Web profile!

• JAX-RS 2.0: Future<?>–Draft JSR 12th November 2010–Like to submit to JCP in December–http://bit.ly/bkXtay

• Implementations–Apache CXF, Apache Wink, eXo, Jersey, RESTEasy,

Restlet, Triaxrs

1

Page 35: Java one brazil_keynote_dochez

35

The Future<?>

• JAX-RS 1.0 is 2 years old• JAX-RS implementations have innovated in that

2 year period... and other frameworks–Play, SiteBricks, Scalate, Spring, VRaptor

• JAX-RS 2.0 should take innovations that work well and standardize–Premature standardization is a root of evil

2

Page 36: Java one brazil_keynote_dochez

36

List<Future<?>>

• Client API–Low level builder pattern–High level response matching

• Model View Controller–Using JSPs and Scalate

• Asynchronous interactions–Using Atmosphere for HTTP streaming

3

Page 37: Java one brazil_keynote_dochez

37

List<Future<?>>

• Hypermedia• Improved @Inject integration• Parameter validation

–Using Bean Validation API (JSR-303)

• Improve ease of use–DRY–Convention over configuration

4

Page 38: Java one brazil_keynote_dochez

38

Improved @Inject integration

• JAX-RS was specified before JSR 330 was started

• Use @Inject for all injection targets–Some progress made with CDI integration

• Enable injection targets for methods that JAX-RS runtime invokes–resource methods, sub-resource methods and sub-

resource locators

5

Page 39: Java one brazil_keynote_dochez

39

Standard injection declarations

public class Foo { @Context UriInfo ui;

@Context public setRequest(Request r) { … }

public Foo(@QueryParam("x") int x) { … }}

6

Page 40: Java one brazil_keynote_dochez

40

Replace @Context with @Inject

public class Foo { @Inject UriInfo ui;

@Inject public setRequest(Request r) { … }

@Inject public Foo(@QueryParam("x") int x) { … }

@Inject SomeOtherDependency o;}

7

Page 41: Java one brazil_keynote_dochez

41

Replace @Context with @Inject

public class Foo { @Inject UriInfo ui;

@Inject public setRequest(Request r) { … }

@Inject public Foo(@QueryParam int x) { … }

@Inject SomeOtherDependency o;}

8

Page 42: Java one brazil_keynote_dochez

42

Supported now with CDI

@RequestScopedpublic class Foo { @Inject UriInfo ui;

@Inject public setRequest(Request r) { … }

public Foo() {} @Inject public Foo(@QueryParam("x") int x) { … }

@Inject SomeOtherDependency o;}

9

Page 43: Java one brazil_keynote_dochez

43

Targets for invoked methods

public class Foo { @Inject SomeOtherDependency o;

@GET public String post( String s, // Request entity is not annotated @Context UriInfo ui, @? SomeOtherDependency o) { ... }}

10

Page 44: Java one brazil_keynote_dochez

44

Targets for invoked methods

public class Foo { @Inject SomeOtherDependency o;

@GET public String post( String s, // Request entity is not annotated @Context UriInfo ui,

@? SomeOtherDependency o) { ... }

}

11

Page 45: Java one brazil_keynote_dochez

45

Annotate non-entity parameters?

public class Foo { @Inject SomeOtherDependency o;

@GET public String post( String s, @InjectParam UriInfo ui, @InjectParam SomeOtherDependency o) { ... }}

12

Page 46: Java one brazil_keynote_dochez

46

Annotate entity parameter?

public class Foo { @Inject SomeOtherDependency o;

@GET public String post( @Entity String s, UriInfo ui, SomeOtherDependency o) { ... }}

13

Page 47: Java one brazil_keynote_dochez

47

Future<Future<?>>

• Asynchronous interactions with the Atmosphere framework–Long polling, HTTP streaming and WebSocket–Leverages JAX-RS and Jersey for a high-level

programming model

14

Page 48: Java one brazil_keynote_dochez

48

Pub/Sub example

@Path("/{topic}")@Produces("text/plain")public class PubSub { private @PathParam("topic") Broadcaster topic;

@Suspend @GET public Broadcastable subscribe() { return new Broadcastable(topic); }

@Broadcast @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Broadcastable publish( @FormParam("message") String message) { return new Broadcastable(message, topic); }}

15

Page 49: Java one brazil_keynote_dochez

49

Questions?

• Send feedback• JSR 311

[email protected]–http://jsr311.dev.java.net/–Note: project will transition from CollabNet to Kenai

infrastructure at the end of the month

• Jersey–[email protected]–http://jersey.java.net/

16