SlideShare une entreprise Scribd logo
1  sur  76
Télécharger pour lire hors ligne
What’s New in the Java EE Platform
Alpes JUG - March 2014
!
David Delabassee
@delabassee
Software Evangelist - Oracle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!2
Program Agenda
A look at some of the important
new features of Java EE 7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!3
Java EE 7 Momentum
ACTIVEPROJECTS
26
Active and
transparent
mailing lists
JSRsADOPTED
22
JUGs
19
Adopt a JSR
PROMOTEDBUILDS
89
GlassFish
YOU
187
COMPANIES
32
EXPERTS
SPECLEADS
16
ACTIVEJSRs
14
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!4
Java EE 7 Momentum
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!5
Java EE 7 Themes
ENTERPRISE
EDITION
▪ Batch
▪ Concurrency
▪ Simplified JMS
▪ More annotated POJOs
▪ Less boilerplate code
▪ Cohesive integrated 

platform
DEVELOPER
PRODUCTIVITY
▪ WebSockets
▪ JSON
▪ Servlet 3.1 NIO
▪ REST
MEETING 

ENTERPRISE
DEMANDS
Java EE 7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Java EE 7 JSRs

New or Updated
▪ JPA 2.1
▪ JAX-RS 2.0
▪ EJB 3.2
▪ JMS 2.0
▪ Servlet 3.1
▪ EL 3.0
▪ JSF 2.2
▪ CDI 1.1
▪ Bean Validation 1.1
▪ WebSocket 1.0
▪ JSON 1.0
▪ Batch Applications 1.0
▪ Concurrency Utilities 1.0
!6
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Java EE 7 Maintenance Releases
▪ Common Annotations 1.2
▪ JTA 1.2
▪ Interceptors 1.2
▪ Connector 1.7
▪ JSP 2.3
▪ JASPIC 1.2
▪ JACC 1.4
▪ JavaMail 1.5
▪ Web Services 1.4
!7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!8
JSON Processing 1.0
▪ API to parse and generate JSON
▪ Streaming API (javax.json.stream)
– Low-level, efficient way to parse/generate JSON
– Similar to StAX API in XML world
▪ Object model API (javax.json)
– Simple, easy to use high-level API
– Similar to DOM API in XML world
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!9
JSON Processing 1.0
▪ Created using
– Json.createParser(…)!
– Json.createParserFactory().createParser(…)!
▪ Parses JSON in streaming way from input sources
Event event = parser.next(); // START_OBJECT!
event = parser.next(); // KEY_NAME!
event = parser.next(); // VALUE_STRING!
▪ Parser state events
– START_OBJECT, END_OBJECT, START_ARRAY, END_ARRAY,
KEY_NAME, VALUE_STRING, VALUE_NUMBER, …
Streaming API: Parsing
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!10
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!11
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
START_OBJECT
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!12
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
KEY_NAME
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!13
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
VALUE_STRING
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!14
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
VALUE_NUMBER
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!15
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
START_ARRAY
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!16
JSON Processing 1.0
{!
“firstName”:“John”,“lastName”: “Smith”,“age”: 25,!
“phoneNumber”: [!
{“type”: “home”, “number”: “212 555-1234” },!
{“type”: “fax”, “number”: “646 555-4567” }!
]!
}
Streaming Parser
END_ARRAY
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
JSON Processing 1.0
JsonGenerator gen = Json.createGenerator…!
.writeStartObject()!
.write("firstName", "John") !
.write("lastName", "Smith") !
.write("age", 25) !
.writeStartArray(“phones”)!
.writeStartObject()!
!! .write(“type",“home") !
.write(“number”, “222…”)!
.writeEnd()!
.writeStartObject() …!
.writeEnd()!
.writeEnd()!
.writeEnd();!
!
Using Streaming API to generate JSON
!
{ “firstName”:“John”,!
“lastName”:”Smith”,!
“age”:25, !
“phones”:[ !
{“type”:“home”,“number”:“…”},!
{“type”:“fax”,“number”:“…”} ]!
}
!17
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!18
Interactive Web Sites
• Flavors of Server Push
• Polling
• Long polling
• AJAX
!
!
• Complex, inefficient, wasteful
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!19
WebSockets to the rescue
▪ Bidirectional full-duplex messaging
– Over a single TCP connection
▪ IETF defined protocol: RFC 6455
▪ Part of HTML5
▪ W3C defined JavaScript API
▪ Adoption
▪ http://caniuse.com/websockets
Bring interactivity to the Web
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!20
WebSockets
Handshake Request
Http Request!
GET /mychat HTTP/1.1!
Host: server.example.com!
Upgrade: websocket!
Connection: Upgrade!
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==!
Sec-WebSocket-Protocol: megachat, chat!
Sec-WebSocket-Extensions : compress, mux!
Sec-WebSocket-Version: 13!
Origin: http://example.com
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!21
WebSockets
Handshake Response
Http Response!
HTTP/1.1 101 Switching Protocols!
Upgrade: websocket!
Connection: Upgrade!
Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=!
Sec-WebSocket-Protocol: chat!
Sec-WebSocket-Extensions: compress, mux
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!22
Java API for WebSocket 1.0
▪ WebSocket Java client & server API
▪ Part of Java EE 7
▪ Annotation-based & interface-based programming model
▪ Under consideration for Java SE 9
▪ Reference Implementation
▪ http://tyrus.java.net
▪ Supported in GlassFish 4.0
JSR 356
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!23
Java API for WebSocket 1.0
▪ Establish a WebSocket connection
▪ Send messages backwards and forwards
▪ End the connection
What’s the basic idea?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!24
Java API for WebSocket 1.0
▪ Session
– Represents the active conversation
▪ Endpoint
– Intercepts websocket lifecycle events
▪ RemoteEndpoint
– Represents the other end of the conversation
▪ MessageHandler
– Handles incoming messages for endpoint
Main API classes
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!25
WebSocket Endpoints
public class MyClient extends Endpoint {!
public void onOpen(Session session, EndpointConfig ec) {!
session.addMessageHandler(new MessageHandler.Whole<String>() {!
public void onMessage(String payload) {!
System.out.println("From the server : " + payload);!
}!
}!
session.getBasicRemote().sendText("Hello!");!
}!
!
public void onClose(Session session, CloseReason closeReason) {!
super.onClose(session, closeReason);!
}!
}
Programmatic API
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!26
WebSocket Endpoints as POJOs
@ClientEndpoint!
public class MyClient { !
@OnOpen!
public void onOpen(Session session) {!
session.getBasicRemote().sendText(“Hello”);!
}!
@OnMessage!
public void onMessage(String payload, Session session) { !
System.out.println("From the server : " + payload);!
} !
}
Annotated client endpoint
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!27
WebSocket Endpoints as POJOs
@ServerEndpoint(“/chat")!
public class ChatServer { !!
static Set<Session> peers = Collections.synchronizedSet(…);!!!
! ! ! @OnOpen!
!!! public void onOpen(Session peer) {!
peers.add(peer);!
}!
!
@OnMessage!
!!! public void onMessage (String message, Session client) { !
for (Session peer : peers) {!
peer.getBasicRemote().sendObject(message);!
} !
}!
!
@OnClose!
!!! public void onClose(Session peer) {!
peers.remove(peer);!
}!
}
Annotated server endpoint
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!28
Java API for WebSocket 1.0
▪ Payload
▪ Text
▪ Binary
▪ Ping-Pong
▪ Synchronous / Asynchronous
▪ Whole message / Sequence of partial messages
▪ No delivery guarantee
Messaging
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!29
Java API for WebSocket 1.0
▪ Use Session’s RemoteEndpoint interface
mySession.getBasicRemote().sendText(”Hello”);
!
▪ Return a value from @OnMessage method
@OnMessage!
public String echo(String incomingMessage) {!
return(“Hello”);!
}
Sending messages
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!30
Java API for WebSocket 1.0
Means of sending RemoteEndpoint method to use
as whole string sendText(String message)
as binary data sendBinary(ByteBuffer message)
in string fragments sendText(String part, boolean last)
in binary data fragments sendBinary(ByteBuffer part, boolean last)
as a blocking stream of text Writer getSendWriter())
as a blocking stream of binary data OutputStream getSendStream()
as a custom object of type T sendObject(T customObject)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!31
Java API for WebSocket 1.0
▪ Annotation - @onMessage
@OnMessage!
public void whenGettingText(String message)…!
!
▪ Implement a MessageHandler, add it to the Session
MyMessageHandler implements MessageHandler.Whole<String>!
…!
session.addMessageHandler( new MyMessageHandler() );
Receiving messages
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!32
Java API for WebSocket 1.0
▪ Encoder
▪ Object to Binary: Encoder.Binary<T>, Encoder.BinaryStream<T>!
▪ Object to Text: Encoder.Text<T>, Encoder.TextStream<T>!
▪ Decoder
▪ Text to Object: Decoder.Text<T>, Decoder.TextStream<T>!
▪ Binary to Object: Decoder.Binary<T>, Decoder.BinaryStream<T>!
▪ Lifecycle
▪ init() and destroy() methods
▪ willDecode()
Custom payload
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!33
Java API for RESTful Web Services (JAX-RS) 2.0
▪ Client API
▪ Filters and Interceptors
▪ Asynchronous Processing
▪ Hypermedia
▪ Validation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!34
JAX-RS 1.1
URL url = new URL("http://. . ./atm/balance"); !
HttpURLConnection conn = (HttpURLConnection) url.openConnection();!
conn.setDoInput(true); !
conn.setDoOutput(false); !
conn.setRequestMethod("GET"); !
BufferedReader br = new BufferedReader(new!
!!! ! ! ! ! ! ! ! ! InputStreamReader(conn.getInputStream())); !
String line; !
while ((line = br.readLine()) != null) {    !
//. . . !
}
Previous Client API
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!35
JAX-RS 2.0
Client client = ClientFactory.newClient();!
!
String name = client.target("http://.../orders/{orderId}/customer")!
.resolveTemplate(“orderId”, “10”)!
.request()!
.get(String.class);
JAX-RS 2.0 Client API
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!36
Client client = ClientFactory.newClient();!
…!
WebTarget target = client.target(“http://…/orders/{orderId}/customer”)!
! ! .register(LoggingFilter.class);!
!
String name = target.resolveTemplate(“orderId”, “10”)!
!! !! ! ! ! .request()!
!! !! ! ! ! .get(String.class);
JAX-RS 2.0
JAX-RS 2.0 Client API
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!37
JAX-RS 2.0
@Path("/")!
class MyResourceClass {!
!
@POST!
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)!
public void registerUser(!
@NotNull @FormParam("firstName") String firstName,!
@NotNull @FormParam("lastName") String lastName,!
@Email @FormParam("email") String email) {!
... }!
…!
}
Bean Validation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!38
Servlet 3.1
▪ Protocol Upgrade
▪ Non-blocking I/O
▪ Miscellaneous
▪ Security
▪ Upload
▪ …
JSR 340
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!39
Alignment and Simplification of Managed Beans
▪ CDI is core component model
▪ CDI enabled by default
▪ Expanded use of CDI Interceptors
– Transactional interceptors
– Method-level validation interceptors
▪ New CDI scopes: @TransactionScoped, @FlowScoped
Cohesive, integrated model
Java EE 7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!40
Managed Bean Alignment
▪ CDI injection and CDI interceptors apply to all Java EE components
and related managed classes when CDI is enabled
▪ CDI is enabled by default in implicit bean archives
– Use of CDI bean-defining annotations (@SessionScoped,
@Dependent,…) and session beans result in implicit bean archives
▪ Library jars, EJB jars, WEB-INF/classes
– beans.xml not required
Expanded use of CDI
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!41
Transactional Interceptors
@Transactional(rollbackOn={SQLException.class},!
dontRollbackOn={SQLWarning.class})!
public class ShoppingCart {…}!
…!
!
@Inherited!
@InterceptorBinding!
@Target({TYPE, METHOD}) @Retention(RUNTIME)!
public @interface Transactional {!
TxType value() default TxType.REQUIRED;!
Class[] rollbackOn() default {};!
Class[] dontRollbackOn() default {};!
}
Annotations and semantics defined in JTA 1.2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!42
Bean Validation 1.1

Method-level Validation
@Stateless!
public class OrderService {!
…!
@ValidOrder!
public Order placeOrder(!
@NotNull String productName,!
@Max(10) int quantity,!
@NotNull String customerName,!
@Address String customerAddress) {!
…!
}!
}
Via CDI Interceptors
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!43
Interceptor Ordering
▪ Interceptor.Priority.PLATFORM_BEFORE = 0
– Platform-defined interceptors to be executed at beginning of interceptor chain
– Transactional interceptors: Interceptor.Priority.PLATFORM_BEFORE+200
▪ Interceptor.Priority.LIBRARY_BEFORE = 1000
– Intended for use by extension libraries
▪ Interceptor.Priority.APPLICATION = 2000
– Intended for application-defined interceptors
▪ Interceptor.Priority.LIBRARY_AFTER = 3000
▪ Interceptor.Priority.PLATFORM_AFTER = 4000
– Bean Validation defined interceptors: Interceptor.Priority.PLATFORM_AFTER+800
Well-defined priority ordering
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!44
Resource Definition Metadata
▪ Specifies resources needed by application
– Enhances configurability in Java EE 7 apps
– Facilitates provisioning in cloud environments
– Java EE 6 introduced DataSourceDefinition
!
@DataSourceDefinition (!
name=“java:app/jdbc/myDB”,!
className=“oracle.jdbc.pool.OracleDataSource”,!
isolationLevel=TRANSACTION_REPEATABLE_READ, initialPoolSize=5)!
!
@Stateless public class MySessionBean {!
@Resource(lookup=“java:app/jdbc/myDB”) DataSource my DB;!
…!
}
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!45
Resource Definition Metadata
▪ Java EE 7 adds:
– JMSConnectionFactoryDefinition!
– JMSDestinationDefinition!
– MailSessionDefinition!
– ConnectionFactoryDefinition!
– AdministeredObjectDefinition
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!46
Default Resources
▪ JDBC/JPA
– java:comp/DefaultDataSource!
▪ JMS
– java:comp/DefaultJMSConnectionFactory!
▪ Concurrency Utilities
– java:comp/DefaultManagedExecutorService!
– java:comp/DefaultManagedScheduledExecutorService!
– java:comp/DefaultManagedThreadFactory!
– java:comp/DefaultManagedContextService
Preconfigured resources for use by application
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!47
Simplification through Pruning
▪ Process defined in Java EE 6
– Platform version N defines feature as “Proposed Optional”
– Platform version N+1 determines whether to make feature Optional
▪ Optional APIs as of Java EE 7
– EJB Entity Beans (CMP, BMP, EJB QL)
– JAX-RPC
– JAXR
– Deployment (JSR 88)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!48
Java Message Service 2.0
▪ Less code, less boilerplate
▪ Fewer objects to manage
▪ Increased developer productivity
▪ “Classic API” has also been improved
New JMS Simplified API targeted at ease of development
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!49
JMS 2.0
▪ New JMSContext interface
▪ Use of CDI injection; new TransactionScope
▪ AutoCloseable JMSContext, Connection, Session, …
▪ Use of runtime exceptions
▪ Method chaining on JMSProducer
▪ Simplified message sending
Simplifications include….
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!50
JMS 1.1
@Resource(lookup = “java:global/jms/myConnectionFactory”)!
ConnectionFactory connectionFactory; !
!
@Resource(lookup = “java:global/jms/myQueue”)!
Queue queue; !
!
public void sendMessage(String text) { !
try {!
Connection connection = connectionFactory.createConnection();!
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);!
MessageProducer messageProducer = session.createProducer(queue);!
TextMessage textMessage = session.createTextMessage(text);!
messageProducer.send(textMessage);!
} finally {!
connection.close();!
} catch (JMSException ex) { … }!
}!
Sending a message in the JMS 1.1 “classic” API
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!51
JMS 2.0
@Resource(lookup = “java:global/jms/myConnectionFactory”)!
ConnectionFactory connectionFactory; !
!
@Resource(lookup = “java:global/jms/myQueue”)!
Queue queue; !
!
public void sendMessage(String text) { !
try (JMSContext context = connectionFactory.createContext();) {!
context.createProducer().send(queue, text);!
} catch (JMSRuntimeException ex) {!
…!
}!
}
Sending a message using Simplified API and JMSContext
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!52
JMS 2.0
@Inject !
@JMSConnectionFactory(“java:global/jms/myConnectionFactory”)!
JMSContext context;!
!
@Resource(lookup = “java:global/jms/myQueue”)!
Queue queue; !
!
public void sendMessage(String text) { !
context.createProducer().send(queue, text);!
}
Even simpler….
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!53
JMS 2.0
@Inject !
JMSContext context;!
!
@Resource(lookup = “java:global/jms/myQueue”)!
Queue queue; !
!
public void sendMessage(String text) { !
context.createProducer().send(queue, text);!
}
Even simpler still….
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!54
Concurrency Utilities for Java EE 1.0
▪ Extension of Java SE Concurrency Utilities API
▪ Provides managed objects for submitting tasks and obtaining
managed threads
– ManagedExecutorService!
– ManagedScheduledExecutorService!
– ManagedThreadFactory!
– ContextService
Provides asynchronous capabilities to Java EE components
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!55
Concurrency Utilities for Java EE 1.0
public class AccountTask implements Callable {!
...!
public AccountInfo call() {!
// task logic!
}!
...!
}!
!
//in calling component:!
@Resource!
ManagedExecutorService mes;!
...!
Future<AccountInfo> acctFuture = mes.submit(new AccountTask(...));!
AccountInfo accountInfo = acctFuture.get(); // Wait for the results.!
...!
// Process the results!
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!56
Batch Applications for the Java Platform 1.0
▪ Designed for non-interactive, bulk-oriented and long-running tasks
▪ Sequential, parallel, and/or decision-based batch execution
▪ Processing styles
– Item-oriented (“chunked”)
– Task-oriented (“batchlet”)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!57
Batch 1.0
▪ Job : Entire batch process
– Defined through XML Job Specification Language
▪ Step : Independent, sequential phase of a job
▪ JobOperator : Interface for managing job processing
▪ JobRepository : Information about past and present jobs
Key concepts
Job Repository
Job Operator Job Step
ItemReader
ItemWriter
ItemProcessor
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!58
Batch 1.0
▪ Chunked : Item-oriented processing
– ItemReader/ItemProcessor/ItemWriter pattern
– Configurable checkpointing and transactions
▪ Batchlet : Task-oriented processing
– Roll-your-own batch pattern
– Runs to completion and exits
▪ Job can include both types of steps
Job steps
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!59
Batch Applications
▪ Read and Process one item
▪ Do the above ‘n’ times (‘commit interval’)
▪ Write the ‘n’ processed items
▪ Commit the transaction
Primary Processing Style
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!60
Batch 1.0
<job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">!
<step id="step1" next="step2">!
<chunk item-count="3">!
<reader ref="myItemReader"></reader> !
<processor ref="myItemProcessor"></processor>!
<writer ref="myItemWriter"></writer> !
</chunk>!!
</step>!
<step id="step2" next=“step3”>!
<batchlet ref="myBatchlet"/>!
</step>!
<step id="step3" >!
<chunk item-count="3">!
<reader ref="myOtherItemReader"></reader> !
<processor ref="myOtherItemProcessor"></processor>!
<writer ref="myOtherItemWriter"></writer> !
</chunk>!!
</step>!
</job>
Job specification language
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!61
Batch 1.0
<step id=”sendStatements”>!
<chunk item-count=“3”>

<reader ref=”accountReader”/>!
<processor ref=”accountProcessor”/>

<writer ref=”myWriter”/>!
</step>
…implements ItemReader {

public Object readItem() {

// read account using JPA
}
…implements ItemProcessor {!
Public Object processItems(Object account) {

// read Account, return Statement!
}!
…implements ItemWriter {!
public void writeItems(List accounts) {

// use JavaMail to send email or save on disk!
}!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!62
Batch 1.0
<step id=”transferFile”>!
<batchlet ref=“MyFileTransfer” />!
</step>
@Dependent!
@Named("MyFileTransfer")!
public class MyBatchlet implements javax.batch.api.chunk.Batchlet {!
@Inject!
private JobContext jobCtx;!!
@Override!
public void process() throws Exception {!
String fName = jobCtx.getProperties().getProperty("out_file");!
// transfer file!
}!
}!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!63
Batch 1.0
Interface Abstract Classes
JobListener AbstractJobListener
StepListener AbstractStepListener
ChunkListener AbstractChunkListener
ItemRead/Write/ProcessListener AbstractItemRead/Write/ProcessListener
SkipRead/Write/ProcessListener AbstractSkipRead/Write/ProcessListener
RetryRead/Write/ProcessListener AbstractRetryRead/Write/ProcessListener
Listeners
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!64
Batch 1.0
JobOperator
private long startNewBatchJob() throws Exception { !
! ! JobOperator jobOperator = BatchRuntime.getJobOperator(); !
! ! Properties props = new Properties(); !
! ! props.setProperty(”someInputFileName", someInputFileName); !
! ! return jobOperator.start(JOB_NAME, props); !
}
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!65
And more…
▪ Servlet 3.1
▪ JPA 2.1
▪ JSF 2.2
▪ EJB 3.2
▪ EL 3.0
▪ JCA 1.7
▪ …
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!66
Java EE 7 Summary
ENTERPRISE
EDITION
▪ Batch
▪ Concurrency
▪ Simplified JMS
▪ More annotated POJOs
▪ Less boilerplate code
▪ Cohesive integrated 

platform
DEVELOPER
PRODUCTIVITY
▪ WebSockets
▪ JSON
▪ Servlet 3.1 NIO
▪ REST
MEETING 

ENTERPRISE
DEMANDS
Java EE 7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!67
Transparency in JSR processes
▪ java.net used for all Oracle-led JSRs
– http://java.net/projects/javaee-spec/pages/Home
▪ Publicly viewable Expert Group mailing archives
▪ Users observer lists get copies of all Expert Group emails
▪ Public download areas, JIRAs
▪ Wikis, source repositories, etc. at the group discretion
▪ Commitment to JCP 2.8/2.9 processes
All Java EE JSRs run with high level of transparency
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!68
DOWNLOAD
Java EE 7 SDK
oracle.com/javaee
!
GlassFish 4.0
Full Platform or Web Profile
glassfish.org
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!69
WebLogic Server 12.1.3
WebLogic Server
12.1.3
Clients
HTML5
clients
ADF Mobile
Proxies
HTTP/S, JSON/XML
WebSocket, Server-Sent
Events, Long polling
OTD
Apache
OHS
Web Sockets (JSR 356)
TopLink Data Services
Server-Sent Events
JAX-RS 2.0
Avatar (post-GA)
HTML5client
emulation
JPA
Change

Notification
Database
• Server-Sent Events
• JAX-RS 2.0
• WebSocket – JSR 356
• JPA 2.1, JSON-P
• WebSocket Client Emulation
• Avatar
• Maven improvements
• Classloader Analysis Tool
updates
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!70
Program Agenda
Java EE 8 and beyond
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!71
Java EE 8
▪ New JSRs
▪ JCACHE (JSR 107)
▪ Data Grid API (JSR 347)
▪ State Management API (JSR 350)
▪ Identity API (JSR 351)
▪ Java API for JSON Binding
▪ Java EE Configuration
▪ …
▪ Profiles & Pruning
Ideas… just ideas!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!72
Java EE 8
▪ HTML 5
▪ Server-sent events?
▪ JavaScript on the server?
▪ Something else?
▪ User Interface
▪ MVC?
▪ Client API for TSA?
▪ Templating? Facelet?
Ideas (cont.)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!73
Java EE 8
▪ CDI
▪ NoSQL ?
▪ Cloud
▪ PaaS, SaaS, Multi-tenancy ?
▪ Logging
▪ Security
▪ Testability
▪ Deployment, Management, Monitoring
▪ ???
Ideas (cont.)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!74
https://glassfish.org/survey
Java EE 8 Survey
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!75
Merci!
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12!76
Graphic Section Divider

Contenu connexe

Tendances

Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015Edward Burns
 
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014David Delabassee
 
Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Logico
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reza Rahman
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0David Delabassee
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsPavel Bucek
 
WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoBruno Borges
 
Oracle Cloud: Anything as a Service
Oracle Cloud: Anything as a ServiceOracle Cloud: Anything as a Service
Oracle Cloud: Anything as a ServiceBruno Borges
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015Edward Burns
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8PT.JUG
 
GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOFglassfish
 
Supercharge your Code to get optimal Database Performance
Supercharge your Code to get optimal Database PerformanceSupercharge your Code to get optimal Database Performance
Supercharge your Code to get optimal Database Performancegvenzl
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXTweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXBruno Borges
 
Another compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilationAnother compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilationLogico
 

Tendances (20)

Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015Servlet 4.0 at GeekOut 2015
Servlet 4.0 at GeekOut 2015
 
MVC 1.0 / JSR 371
MVC 1.0 / JSR 371MVC 1.0 / JSR 371
MVC 1.0 / JSR 371
 
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
 
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David DelabasseeJavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
 
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David DelabasseeJavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
 
Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)
 
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
 
JavaCro'15 - Java Certification – in theory and practice - Branko Mihaljević,...
JavaCro'15 - Java Certification – in theory and practice - Branko Mihaljević,...JavaCro'15 - Java Certification – in theory and practice - Branko Mihaljević,...
JavaCro'15 - Java Certification – in theory and practice - Branko Mihaljević,...
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise Applications
 
WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo Conectado
 
Oracle Cloud: Anything as a Service
Oracle Cloud: Anything as a ServiceOracle Cloud: Anything as a Service
Oracle Cloud: Anything as a Service
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8
 
GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOF
 
Supercharge your Code to get optimal Database Performance
Supercharge your Code to get optimal Database PerformanceSupercharge your Code to get optimal Database Performance
Supercharge your Code to get optimal Database Performance
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXTweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
 
JavaCro'15 - HUJAKing – Expansion of Java Community - Branko Mihaljević, Alek...
JavaCro'15 - HUJAKing – Expansion of Java Community - Branko Mihaljević, Alek...JavaCro'15 - HUJAKing – Expansion of Java Community - Branko Mihaljević, Alek...
JavaCro'15 - HUJAKing – Expansion of Java Community - Branko Mihaljević, Alek...
 
Another compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilationAnother compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilation
 

Similaire à Java EE 7 (Lyon JUG & Alpes JUG - March 2014)

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)David Delabassee
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Bruno Borges
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeJAXLondon2014
 
Automated infrastructure is on the menu
Automated infrastructure is on the menuAutomated infrastructure is on the menu
Automated infrastructure is on the menujtimberman
 
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaGetting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaCodemotion
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouDavid Delabassee
 
Getting started with Websocket and Server-sent Events using Java - Arun Gupta
Getting started with Websocket and Server-sent Events using Java - Arun Gupta Getting started with Websocket and Server-sent Events using Java - Arun Gupta
Getting started with Websocket and Server-sent Events using Java - Arun Gupta jaxconf
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Marco Antonio Maciel
 
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...Codemotion Tel Aviv
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2
 
REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)Jeff Smith
 
Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_aioughydchapter
 
GeekAustin DevOps
GeekAustin DevOpsGeekAustin DevOps
GeekAustin DevOpsMatt Ray
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Anna Klepacka
 
Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy WSO2
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...Big Data Spain
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaArun Gupta
 

Similaire à Java EE 7 (Lyon JUG & Alpes JUG - March 2014) (20)

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
 
Avatar 2.0
Avatar 2.0Avatar 2.0
Avatar 2.0
 
JAX-RS.next
JAX-RS.nextJAX-RS.next
JAX-RS.next
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David Delabassee
 
Automated infrastructure is on the menu
Automated infrastructure is on the menuAutomated infrastructure is on the menu
Automated infrastructure is on the menu
 
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaGetting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
 
Getting started with Websocket and Server-sent Events using Java - Arun Gupta
Getting started with Websocket and Server-sent Events using Java - Arun Gupta Getting started with Websocket and Server-sent Events using Java - Arun Gupta
Getting started with Websocket and Server-sent Events using Java - Arun Gupta
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
 
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
 
WSO2 AppDev platform
WSO2 AppDev platformWSO2 AppDev platform
WSO2 AppDev platform
 
REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)
 
Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_Leverage integration cloud_service_for_ebs_
Leverage integration cloud_service_for_ebs_
 
GeekAustin DevOps
GeekAustin DevOpsGeekAustin DevOps
GeekAustin DevOps
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in Java
 

Plus de David Delabassee

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessDavid Delabassee
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffDavid Delabassee
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016David Delabassee
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyDavid Delabassee
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontDavid Delabassee
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8David Delabassee
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot David Delabassee
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshotDavid Delabassee
 
Pushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationPushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationDavid Delabassee
 

Plus de David Delabassee (19)

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
 
REST in an Async World
REST in an Async WorldREST in an Async World
REST in an Async World
 
JAX-RS 2.1 Reloaded
JAX-RS 2.1 ReloadedJAX-RS 2.1 Reloaded
JAX-RS 2.1 Reloaded
 
Java EE Next
Java EE NextJava EE Next
Java EE Next
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web front
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshotJava EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
Pushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home AutomationPushing Java EE outside of the Enterprise - Home Automation
Pushing Java EE outside of the Enterprise - Home Automation
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Dernier (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Java EE 7 (Lyon JUG & Alpes JUG - March 2014)

  • 1. What’s New in the Java EE Platform Alpes JUG - March 2014 ! David Delabassee @delabassee Software Evangelist - Oracle
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!2 Program Agenda A look at some of the important new features of Java EE 7
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!3 Java EE 7 Momentum ACTIVEPROJECTS 26 Active and transparent mailing lists JSRsADOPTED 22 JUGs 19 Adopt a JSR PROMOTEDBUILDS 89 GlassFish YOU 187 COMPANIES 32 EXPERTS SPECLEADS 16 ACTIVEJSRs 14
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!4 Java EE 7 Momentum
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!5 Java EE 7 Themes ENTERPRISE EDITION ▪ Batch ▪ Concurrency ▪ Simplified JMS ▪ More annotated POJOs ▪ Less boilerplate code ▪ Cohesive integrated 
 platform DEVELOPER PRODUCTIVITY ▪ WebSockets ▪ JSON ▪ Servlet 3.1 NIO ▪ REST MEETING 
 ENTERPRISE DEMANDS Java EE 7
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Java EE 7 JSRs
 New or Updated ▪ JPA 2.1 ▪ JAX-RS 2.0 ▪ EJB 3.2 ▪ JMS 2.0 ▪ Servlet 3.1 ▪ EL 3.0 ▪ JSF 2.2 ▪ CDI 1.1 ▪ Bean Validation 1.1 ▪ WebSocket 1.0 ▪ JSON 1.0 ▪ Batch Applications 1.0 ▪ Concurrency Utilities 1.0 !6
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Java EE 7 Maintenance Releases ▪ Common Annotations 1.2 ▪ JTA 1.2 ▪ Interceptors 1.2 ▪ Connector 1.7 ▪ JSP 2.3 ▪ JASPIC 1.2 ▪ JACC 1.4 ▪ JavaMail 1.5 ▪ Web Services 1.4 !7
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!8 JSON Processing 1.0 ▪ API to parse and generate JSON ▪ Streaming API (javax.json.stream) – Low-level, efficient way to parse/generate JSON – Similar to StAX API in XML world ▪ Object model API (javax.json) – Simple, easy to use high-level API – Similar to DOM API in XML world
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!9 JSON Processing 1.0 ▪ Created using – Json.createParser(…)! – Json.createParserFactory().createParser(…)! ▪ Parses JSON in streaming way from input sources Event event = parser.next(); // START_OBJECT! event = parser.next(); // KEY_NAME! event = parser.next(); // VALUE_STRING! ▪ Parser state events – START_OBJECT, END_OBJECT, START_ARRAY, END_ARRAY, KEY_NAME, VALUE_STRING, VALUE_NUMBER, … Streaming API: Parsing
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!10 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!11 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser START_OBJECT
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!12 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser KEY_NAME
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!13 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser VALUE_STRING
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!14 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser VALUE_NUMBER
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!15 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser START_ARRAY
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!16 JSON Processing 1.0 {! “firstName”:“John”,“lastName”: “Smith”,“age”: 25,! “phoneNumber”: [! {“type”: “home”, “number”: “212 555-1234” },! {“type”: “fax”, “number”: “646 555-4567” }! ]! } Streaming Parser END_ARRAY
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. JSON Processing 1.0 JsonGenerator gen = Json.createGenerator…! .writeStartObject()! .write("firstName", "John") ! .write("lastName", "Smith") ! .write("age", 25) ! .writeStartArray(“phones”)! .writeStartObject()! !! .write(“type",“home") ! .write(“number”, “222…”)! .writeEnd()! .writeStartObject() …! .writeEnd()! .writeEnd()! .writeEnd();! ! Using Streaming API to generate JSON ! { “firstName”:“John”,! “lastName”:”Smith”,! “age”:25, ! “phones”:[ ! {“type”:“home”,“number”:“…”},! {“type”:“fax”,“number”:“…”} ]! } !17
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!18 Interactive Web Sites • Flavors of Server Push • Polling • Long polling • AJAX ! ! • Complex, inefficient, wasteful
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!19 WebSockets to the rescue ▪ Bidirectional full-duplex messaging – Over a single TCP connection ▪ IETF defined protocol: RFC 6455 ▪ Part of HTML5 ▪ W3C defined JavaScript API ▪ Adoption ▪ http://caniuse.com/websockets Bring interactivity to the Web
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!20 WebSockets Handshake Request Http Request! GET /mychat HTTP/1.1! Host: server.example.com! Upgrade: websocket! Connection: Upgrade! Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==! Sec-WebSocket-Protocol: megachat, chat! Sec-WebSocket-Extensions : compress, mux! Sec-WebSocket-Version: 13! Origin: http://example.com
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!21 WebSockets Handshake Response Http Response! HTTP/1.1 101 Switching Protocols! Upgrade: websocket! Connection: Upgrade! Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=! Sec-WebSocket-Protocol: chat! Sec-WebSocket-Extensions: compress, mux
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!22 Java API for WebSocket 1.0 ▪ WebSocket Java client & server API ▪ Part of Java EE 7 ▪ Annotation-based & interface-based programming model ▪ Under consideration for Java SE 9 ▪ Reference Implementation ▪ http://tyrus.java.net ▪ Supported in GlassFish 4.0 JSR 356
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!23 Java API for WebSocket 1.0 ▪ Establish a WebSocket connection ▪ Send messages backwards and forwards ▪ End the connection What’s the basic idea?
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!24 Java API for WebSocket 1.0 ▪ Session – Represents the active conversation ▪ Endpoint – Intercepts websocket lifecycle events ▪ RemoteEndpoint – Represents the other end of the conversation ▪ MessageHandler – Handles incoming messages for endpoint Main API classes
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!25 WebSocket Endpoints public class MyClient extends Endpoint {! public void onOpen(Session session, EndpointConfig ec) {! session.addMessageHandler(new MessageHandler.Whole<String>() {! public void onMessage(String payload) {! System.out.println("From the server : " + payload);! }! }! session.getBasicRemote().sendText("Hello!");! }! ! public void onClose(Session session, CloseReason closeReason) {! super.onClose(session, closeReason);! }! } Programmatic API
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!26 WebSocket Endpoints as POJOs @ClientEndpoint! public class MyClient { ! @OnOpen! public void onOpen(Session session) {! session.getBasicRemote().sendText(“Hello”);! }! @OnMessage! public void onMessage(String payload, Session session) { ! System.out.println("From the server : " + payload);! } ! } Annotated client endpoint
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!27 WebSocket Endpoints as POJOs @ServerEndpoint(“/chat")! public class ChatServer { !! static Set<Session> peers = Collections.synchronizedSet(…);!!! ! ! ! @OnOpen! !!! public void onOpen(Session peer) {! peers.add(peer);! }! ! @OnMessage! !!! public void onMessage (String message, Session client) { ! for (Session peer : peers) {! peer.getBasicRemote().sendObject(message);! } ! }! ! @OnClose! !!! public void onClose(Session peer) {! peers.remove(peer);! }! } Annotated server endpoint
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!28 Java API for WebSocket 1.0 ▪ Payload ▪ Text ▪ Binary ▪ Ping-Pong ▪ Synchronous / Asynchronous ▪ Whole message / Sequence of partial messages ▪ No delivery guarantee Messaging
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!29 Java API for WebSocket 1.0 ▪ Use Session’s RemoteEndpoint interface mySession.getBasicRemote().sendText(”Hello”); ! ▪ Return a value from @OnMessage method @OnMessage! public String echo(String incomingMessage) {! return(“Hello”);! } Sending messages
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!30 Java API for WebSocket 1.0 Means of sending RemoteEndpoint method to use as whole string sendText(String message) as binary data sendBinary(ByteBuffer message) in string fragments sendText(String part, boolean last) in binary data fragments sendBinary(ByteBuffer part, boolean last) as a blocking stream of text Writer getSendWriter()) as a blocking stream of binary data OutputStream getSendStream() as a custom object of type T sendObject(T customObject)
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!31 Java API for WebSocket 1.0 ▪ Annotation - @onMessage @OnMessage! public void whenGettingText(String message)…! ! ▪ Implement a MessageHandler, add it to the Session MyMessageHandler implements MessageHandler.Whole<String>! …! session.addMessageHandler( new MyMessageHandler() ); Receiving messages
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!32 Java API for WebSocket 1.0 ▪ Encoder ▪ Object to Binary: Encoder.Binary<T>, Encoder.BinaryStream<T>! ▪ Object to Text: Encoder.Text<T>, Encoder.TextStream<T>! ▪ Decoder ▪ Text to Object: Decoder.Text<T>, Decoder.TextStream<T>! ▪ Binary to Object: Decoder.Binary<T>, Decoder.BinaryStream<T>! ▪ Lifecycle ▪ init() and destroy() methods ▪ willDecode() Custom payload
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!33 Java API for RESTful Web Services (JAX-RS) 2.0 ▪ Client API ▪ Filters and Interceptors ▪ Asynchronous Processing ▪ Hypermedia ▪ Validation
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!34 JAX-RS 1.1 URL url = new URL("http://. . ./atm/balance"); ! HttpURLConnection conn = (HttpURLConnection) url.openConnection();! conn.setDoInput(true); ! conn.setDoOutput(false); ! conn.setRequestMethod("GET"); ! BufferedReader br = new BufferedReader(new! !!! ! ! ! ! ! ! ! ! InputStreamReader(conn.getInputStream())); ! String line; ! while ((line = br.readLine()) != null) {    ! //. . . ! } Previous Client API
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!35 JAX-RS 2.0 Client client = ClientFactory.newClient();! ! String name = client.target("http://.../orders/{orderId}/customer")! .resolveTemplate(“orderId”, “10”)! .request()! .get(String.class); JAX-RS 2.0 Client API
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!36 Client client = ClientFactory.newClient();! …! WebTarget target = client.target(“http://…/orders/{orderId}/customer”)! ! ! .register(LoggingFilter.class);! ! String name = target.resolveTemplate(“orderId”, “10”)! !! !! ! ! ! .request()! !! !! ! ! ! .get(String.class); JAX-RS 2.0 JAX-RS 2.0 Client API
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!37 JAX-RS 2.0 @Path("/")! class MyResourceClass {! ! @POST! @Consumes(MediaType.APPLICATION_FORM_URLENCODED)! public void registerUser(! @NotNull @FormParam("firstName") String firstName,! @NotNull @FormParam("lastName") String lastName,! @Email @FormParam("email") String email) {! ... }! …! } Bean Validation
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!38 Servlet 3.1 ▪ Protocol Upgrade ▪ Non-blocking I/O ▪ Miscellaneous ▪ Security ▪ Upload ▪ … JSR 340
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!39 Alignment and Simplification of Managed Beans ▪ CDI is core component model ▪ CDI enabled by default ▪ Expanded use of CDI Interceptors – Transactional interceptors – Method-level validation interceptors ▪ New CDI scopes: @TransactionScoped, @FlowScoped Cohesive, integrated model Java EE 7
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!40 Managed Bean Alignment ▪ CDI injection and CDI interceptors apply to all Java EE components and related managed classes when CDI is enabled ▪ CDI is enabled by default in implicit bean archives – Use of CDI bean-defining annotations (@SessionScoped, @Dependent,…) and session beans result in implicit bean archives ▪ Library jars, EJB jars, WEB-INF/classes – beans.xml not required Expanded use of CDI
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!41 Transactional Interceptors @Transactional(rollbackOn={SQLException.class},! dontRollbackOn={SQLWarning.class})! public class ShoppingCart {…}! …! ! @Inherited! @InterceptorBinding! @Target({TYPE, METHOD}) @Retention(RUNTIME)! public @interface Transactional {! TxType value() default TxType.REQUIRED;! Class[] rollbackOn() default {};! Class[] dontRollbackOn() default {};! } Annotations and semantics defined in JTA 1.2
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!42 Bean Validation 1.1
 Method-level Validation @Stateless! public class OrderService {! …! @ValidOrder! public Order placeOrder(! @NotNull String productName,! @Max(10) int quantity,! @NotNull String customerName,! @Address String customerAddress) {! …! }! } Via CDI Interceptors
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!43 Interceptor Ordering ▪ Interceptor.Priority.PLATFORM_BEFORE = 0 – Platform-defined interceptors to be executed at beginning of interceptor chain – Transactional interceptors: Interceptor.Priority.PLATFORM_BEFORE+200 ▪ Interceptor.Priority.LIBRARY_BEFORE = 1000 – Intended for use by extension libraries ▪ Interceptor.Priority.APPLICATION = 2000 – Intended for application-defined interceptors ▪ Interceptor.Priority.LIBRARY_AFTER = 3000 ▪ Interceptor.Priority.PLATFORM_AFTER = 4000 – Bean Validation defined interceptors: Interceptor.Priority.PLATFORM_AFTER+800 Well-defined priority ordering
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!44 Resource Definition Metadata ▪ Specifies resources needed by application – Enhances configurability in Java EE 7 apps – Facilitates provisioning in cloud environments – Java EE 6 introduced DataSourceDefinition ! @DataSourceDefinition (! name=“java:app/jdbc/myDB”,! className=“oracle.jdbc.pool.OracleDataSource”,! isolationLevel=TRANSACTION_REPEATABLE_READ, initialPoolSize=5)! ! @Stateless public class MySessionBean {! @Resource(lookup=“java:app/jdbc/myDB”) DataSource my DB;! …! }
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!45 Resource Definition Metadata ▪ Java EE 7 adds: – JMSConnectionFactoryDefinition! – JMSDestinationDefinition! – MailSessionDefinition! – ConnectionFactoryDefinition! – AdministeredObjectDefinition
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!46 Default Resources ▪ JDBC/JPA – java:comp/DefaultDataSource! ▪ JMS – java:comp/DefaultJMSConnectionFactory! ▪ Concurrency Utilities – java:comp/DefaultManagedExecutorService! – java:comp/DefaultManagedScheduledExecutorService! – java:comp/DefaultManagedThreadFactory! – java:comp/DefaultManagedContextService Preconfigured resources for use by application
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!47 Simplification through Pruning ▪ Process defined in Java EE 6 – Platform version N defines feature as “Proposed Optional” – Platform version N+1 determines whether to make feature Optional ▪ Optional APIs as of Java EE 7 – EJB Entity Beans (CMP, BMP, EJB QL) – JAX-RPC – JAXR – Deployment (JSR 88)
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!48 Java Message Service 2.0 ▪ Less code, less boilerplate ▪ Fewer objects to manage ▪ Increased developer productivity ▪ “Classic API” has also been improved New JMS Simplified API targeted at ease of development
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!49 JMS 2.0 ▪ New JMSContext interface ▪ Use of CDI injection; new TransactionScope ▪ AutoCloseable JMSContext, Connection, Session, … ▪ Use of runtime exceptions ▪ Method chaining on JMSProducer ▪ Simplified message sending Simplifications include….
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!50 JMS 1.1 @Resource(lookup = “java:global/jms/myConnectionFactory”)! ConnectionFactory connectionFactory; ! ! @Resource(lookup = “java:global/jms/myQueue”)! Queue queue; ! ! public void sendMessage(String text) { ! try {! Connection connection = connectionFactory.createConnection();! Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer messageProducer = session.createProducer(queue);! TextMessage textMessage = session.createTextMessage(text);! messageProducer.send(textMessage);! } finally {! connection.close();! } catch (JMSException ex) { … }! }! Sending a message in the JMS 1.1 “classic” API
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!51 JMS 2.0 @Resource(lookup = “java:global/jms/myConnectionFactory”)! ConnectionFactory connectionFactory; ! ! @Resource(lookup = “java:global/jms/myQueue”)! Queue queue; ! ! public void sendMessage(String text) { ! try (JMSContext context = connectionFactory.createContext();) {! context.createProducer().send(queue, text);! } catch (JMSRuntimeException ex) {! …! }! } Sending a message using Simplified API and JMSContext
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!52 JMS 2.0 @Inject ! @JMSConnectionFactory(“java:global/jms/myConnectionFactory”)! JMSContext context;! ! @Resource(lookup = “java:global/jms/myQueue”)! Queue queue; ! ! public void sendMessage(String text) { ! context.createProducer().send(queue, text);! } Even simpler….
  • 53. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!53 JMS 2.0 @Inject ! JMSContext context;! ! @Resource(lookup = “java:global/jms/myQueue”)! Queue queue; ! ! public void sendMessage(String text) { ! context.createProducer().send(queue, text);! } Even simpler still….
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!54 Concurrency Utilities for Java EE 1.0 ▪ Extension of Java SE Concurrency Utilities API ▪ Provides managed objects for submitting tasks and obtaining managed threads – ManagedExecutorService! – ManagedScheduledExecutorService! – ManagedThreadFactory! – ContextService Provides asynchronous capabilities to Java EE components
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!55 Concurrency Utilities for Java EE 1.0 public class AccountTask implements Callable {! ...! public AccountInfo call() {! // task logic! }! ...! }! ! //in calling component:! @Resource! ManagedExecutorService mes;! ...! Future<AccountInfo> acctFuture = mes.submit(new AccountTask(...));! AccountInfo accountInfo = acctFuture.get(); // Wait for the results.! ...! // Process the results! ...
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!56 Batch Applications for the Java Platform 1.0 ▪ Designed for non-interactive, bulk-oriented and long-running tasks ▪ Sequential, parallel, and/or decision-based batch execution ▪ Processing styles – Item-oriented (“chunked”) – Task-oriented (“batchlet”)
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!57 Batch 1.0 ▪ Job : Entire batch process – Defined through XML Job Specification Language ▪ Step : Independent, sequential phase of a job ▪ JobOperator : Interface for managing job processing ▪ JobRepository : Information about past and present jobs Key concepts Job Repository Job Operator Job Step ItemReader ItemWriter ItemProcessor
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!58 Batch 1.0 ▪ Chunked : Item-oriented processing – ItemReader/ItemProcessor/ItemWriter pattern – Configurable checkpointing and transactions ▪ Batchlet : Task-oriented processing – Roll-your-own batch pattern – Runs to completion and exits ▪ Job can include both types of steps Job steps
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!59 Batch Applications ▪ Read and Process one item ▪ Do the above ‘n’ times (‘commit interval’) ▪ Write the ‘n’ processed items ▪ Commit the transaction Primary Processing Style
  • 60. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!60 Batch 1.0 <job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">! <step id="step1" next="step2">! <chunk item-count="3">! <reader ref="myItemReader"></reader> ! <processor ref="myItemProcessor"></processor>! <writer ref="myItemWriter"></writer> ! </chunk>!! </step>! <step id="step2" next=“step3”>! <batchlet ref="myBatchlet"/>! </step>! <step id="step3" >! <chunk item-count="3">! <reader ref="myOtherItemReader"></reader> ! <processor ref="myOtherItemProcessor"></processor>! <writer ref="myOtherItemWriter"></writer> ! </chunk>!! </step>! </job> Job specification language
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!61 Batch 1.0 <step id=”sendStatements”>! <chunk item-count=“3”>
 <reader ref=”accountReader”/>! <processor ref=”accountProcessor”/>
 <writer ref=”myWriter”/>! </step> …implements ItemReader {
 public Object readItem() {
 // read account using JPA } …implements ItemProcessor {! Public Object processItems(Object account) {
 // read Account, return Statement! }! …implements ItemWriter {! public void writeItems(List accounts) {
 // use JavaMail to send email or save on disk! }!
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!62 Batch 1.0 <step id=”transferFile”>! <batchlet ref=“MyFileTransfer” />! </step> @Dependent! @Named("MyFileTransfer")! public class MyBatchlet implements javax.batch.api.chunk.Batchlet {! @Inject! private JobContext jobCtx;!! @Override! public void process() throws Exception {! String fName = jobCtx.getProperties().getProperty("out_file");! // transfer file! }! }!
  • 63. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!63 Batch 1.0 Interface Abstract Classes JobListener AbstractJobListener StepListener AbstractStepListener ChunkListener AbstractChunkListener ItemRead/Write/ProcessListener AbstractItemRead/Write/ProcessListener SkipRead/Write/ProcessListener AbstractSkipRead/Write/ProcessListener RetryRead/Write/ProcessListener AbstractRetryRead/Write/ProcessListener Listeners
  • 64. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!64 Batch 1.0 JobOperator private long startNewBatchJob() throws Exception { ! ! ! JobOperator jobOperator = BatchRuntime.getJobOperator(); ! ! ! Properties props = new Properties(); ! ! ! props.setProperty(”someInputFileName", someInputFileName); ! ! ! return jobOperator.start(JOB_NAME, props); ! }
  • 65. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!65 And more… ▪ Servlet 3.1 ▪ JPA 2.1 ▪ JSF 2.2 ▪ EJB 3.2 ▪ EL 3.0 ▪ JCA 1.7 ▪ …
  • 66. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!66 Java EE 7 Summary ENTERPRISE EDITION ▪ Batch ▪ Concurrency ▪ Simplified JMS ▪ More annotated POJOs ▪ Less boilerplate code ▪ Cohesive integrated 
 platform DEVELOPER PRODUCTIVITY ▪ WebSockets ▪ JSON ▪ Servlet 3.1 NIO ▪ REST MEETING 
 ENTERPRISE DEMANDS Java EE 7
  • 67. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!67 Transparency in JSR processes ▪ java.net used for all Oracle-led JSRs – http://java.net/projects/javaee-spec/pages/Home ▪ Publicly viewable Expert Group mailing archives ▪ Users observer lists get copies of all Expert Group emails ▪ Public download areas, JIRAs ▪ Wikis, source repositories, etc. at the group discretion ▪ Commitment to JCP 2.8/2.9 processes All Java EE JSRs run with high level of transparency
  • 68. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!68 DOWNLOAD Java EE 7 SDK oracle.com/javaee ! GlassFish 4.0 Full Platform or Web Profile glassfish.org
  • 69. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!69 WebLogic Server 12.1.3 WebLogic Server 12.1.3 Clients HTML5 clients ADF Mobile Proxies HTTP/S, JSON/XML WebSocket, Server-Sent Events, Long polling OTD Apache OHS Web Sockets (JSR 356) TopLink Data Services Server-Sent Events JAX-RS 2.0 Avatar (post-GA) HTML5client emulation JPA Change
 Notification Database • Server-Sent Events • JAX-RS 2.0 • WebSocket – JSR 356 • JPA 2.1, JSON-P • WebSocket Client Emulation • Avatar • Maven improvements • Classloader Analysis Tool updates
  • 70. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!70 Program Agenda Java EE 8 and beyond
  • 71. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!71 Java EE 8 ▪ New JSRs ▪ JCACHE (JSR 107) ▪ Data Grid API (JSR 347) ▪ State Management API (JSR 350) ▪ Identity API (JSR 351) ▪ Java API for JSON Binding ▪ Java EE Configuration ▪ … ▪ Profiles & Pruning Ideas… just ideas!
  • 72. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!72 Java EE 8 ▪ HTML 5 ▪ Server-sent events? ▪ JavaScript on the server? ▪ Something else? ▪ User Interface ▪ MVC? ▪ Client API for TSA? ▪ Templating? Facelet? Ideas (cont.)
  • 73. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!73 Java EE 8 ▪ CDI ▪ NoSQL ? ▪ Cloud ▪ PaaS, SaaS, Multi-tenancy ? ▪ Logging ▪ Security ▪ Testability ▪ Deployment, Management, Monitoring ▪ ??? Ideas (cont.)
  • 74. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!74 https://glassfish.org/survey Java EE 8 Survey
  • 75. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!75 Merci!
  • 76. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12!76 Graphic Section Divider