SlideShare une entreprise Scribd logo
1  sur  38
JavaEE.Next():Java EE 7,8
and Beyond
Vijay Nair
vijay.nair@oracle.com
@FusionVJ
Java EE 7 – Candidate JSRs
Java EE, Past, Present & Future
WebSocket Primer
•

•

HTTP is half duplex and traditional flavors of server
push were long polling, Comet/AJAX → Inefficient
and wasteful
WebSocket to the rescue !
TCP based, bi-directional, full-duplex messaging
Originally proposed as part of HTML5
W3C defined Javascript API
WebSocket Primer
•

In 4 lines
Establish connection (Single TCP Connection)
Send messages in both directions (Bi-directional)
Send messages independent of each other (Full Duplex)
End Connection
Java API for WebSocket
•

Higher level API for WebSocket

•

Both client and server-side (Java SE and Java EE)

•

Both declarative and programmatic
Java API for WebSocket
@ServerEndpoint(”/chat”)
public class ChatServer {
Set<Session> peers = ...
@OnOpen
public void onOpen(Session peer) {
peers.add(peer);
}
@OnClose
public void onClose(Session peer) {
peers.remove(peer);
}
...
Java API for WebSocket
...
@OnMessage
public void message(String message, Session client)
throws IOException {
for (Session session : peers) {
if (!session.equals(client)) {
session.getRemote().sendObject(message);
}
}
}
•

}
Java API for JSON Processing
•

•

•

API to parse, generate, transform, query JSON
Object Model and Streaming API -- similar to DOM
and StAX
Binding JSON to Java objects forthcoming
Java API for JSON Processing
Writing JSON (Object Model API)
JsonArray value =
Json.createArrayBuilder()

[
{

.add(Json.createObjectBuilder()

"type": "home”,
"number": "212 555-1234"
},
{
"type": "fax”,
"number": "646 555-4567"
}

.add("type", "home")
.add("number", "212 555-1234")
)
.add(Json.createObjectBuilder()
.add("type", "fax")
.add("number", "646 555-4567")
).build();

]
Java API for JSON Processing
Reading JSON (Streaming API)
{
"firstName": "John", "lastName": "Smith", "age": 25,
"phoneNumber": [
{ "type": "home", "number": "212 555-1234" },
{ "type": "fax", "number": "646 555-4567" } ]
}

Event event = parser.next();
// START_OBJECT
event = parser.next();
// KEY_NAME
event = parser.next();
// VALUE_STRING
String name = parser.getString();
// "John”
Batch Applications for the Java Platform
API for robust batch processing targeted to Java EE, Java SE
Batch Applications for the Java Platform
Step Example
Concurrency Utilities for Java EE
•

•

•

Provides simple, safe API for concurrency in Java EE
Builds on Java SE concurrency
java.util.concurrent.ExecutorService
Relatively low-level API and provides
ManagedExecutorService
ManagedScheduledExecutorService
ManagedThreadFactory
ContextService

•

Context Propagation (except Transactions !!)
Concurrency Utilities for Java EE
Managed Task Executor
public class TestServlet extends HTTPServlet {
@Resource(name=“concurrent/MyExecutorService”)
ManagedExecutorService executor;
Future future = executor.submit(new MyTask());
class MyTask implements Runnable {
public void run() {
... // Task logic
}
}
}
JMS 2
•

•

•

API modernization using dependency injection
Delivery delay, async send, MDB alignment, JMS
resource definition
Fixes, clarifications
JMS 2
Old API
@Resource(lookup = "java:global/jms/demoConnectionFactory")
ConnectionFactory connectionFactory;
@Resource(lookup = "java:global/jms/demoQueue")
Queue demoQueue;
public void sendMessage(String payload) {
try {
Connection connection = connectionFactory.createConnection();
try {
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer =
session.createProducer(demoQueue);
TextMessage textMessage = session.createTextMessage(payload);
messageProducer.send(textMessage);
} finally {
connection.close();
}
} catch (JMSException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
}
}
JMS 2
Simplified API
@Inject
private JMSContext context;
@Resource(mappedName = "jms/inboundQueue")
private Queue inboundQueue;
public void sendMessage (String payload) {
context.createProducer().send(inboundQueue, payload);
}
JMS 2
JMS Resource Definition
@JMSConnectionFactoryDefinition(
name="java:global/jms/demoConnectionFactory",
interfaceName= "javax.jms.ConnectionFactory",
description="ConnectionFactory to use in demonstration")

@JMSDestinationDefinition(
name = "java:global/jms/demoQueue",
description = "Queue to use in demonstration",
interfaceName = "javax.jms.Queue",
destinationName="demoQueue")
JMS 2/EJB 3.2
More Standard MDB Properties
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(
propertyName = "destinationLookup",
propertyValue = "jms/OrderQueue"),
@ActivationConfigProperty(
propertyName = "connectionFactoryLookup",
propertyValue = "jms/MyConnectionFactory")})
public class OrderListener implements MessageListener {
...
public void onMessage(Message message) { ... }
...
}
JAX-RS 2
•

Client API

•

Message Filters & Entity Interceptors

•

Asynchronous Processing – Server & Client

•

Hypermedia Support

•

Content negotiation
JAX-RS 2
Client API
// Get instance of Client
Client client = ClientBuilder.newClient();
// Get customer name for the shipped products
String name = client.target(“../orders/{orderId}/customer”)
.pathParam(”orderId", ”10”)
.queryParam(”shipped", ”true”)
.request()
.get(String.class);
JAX-RS 2
Logging Filter

public class RequestLoggingFilter
implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext
requestContext) {
log(requestContext);
// Non-wrapping => returns without invoking next filter
}
...
}
Bean Validation 1.1
•

Method constraints

•

Bean Validation artifacts injectable

•

Fixes, clarifications and enhancements
Bean Validation 1.1
Method Level Constraints

public void placeOrder(
@NotNull String productName,
@NotNull @Max(“10”) Integer quantity,
@Customer String customer) {
...
}
@Future
public Date getAppointment() {
...
}
JPA 2.1
•

Schema generation

•

Stored procedures

•

Unsynchronized persistence contexts

•

Entity converters

•

Entity Graphs

•

Dynamic Named Queries

•

Fixes and enhancements
JPA 2.1
Schema Generation Properties
javax.persistence.schema-generation.[database|scripts].action
- “none”, “create”, “drop-and-create”, “drop”
javax.persistence.schema-generation.[create|drop]-source
-“metadata”, “script”, “metadata-then-script”, “script-then- metadata”
javax.persistence.schema-generation.[create|drop]-script-source
javax.persistence.schema-generation.scripts.[create|drop]-target
javax.persistence.sql-load-script-source
JPA 2.1
Stored Procedures
@Entity
@NamedStoredProcedureQuery(name="topGiftsStoredProcedure”,
procedureName="Top10Gifts")
public class Product {
StoredProcedureQuery query =
EntityManager.createNamedStoredProcedureQuery(
"topGiftsStoredProcedure");
query.registerStoredProcedureParameter(1, String.class,
ParameterMode.INOUT);
query.setParameter(1, "top10");
query.registerStoredProcedureParameter(2, Integer.class,
ParameterMode.IN);
query.setParameter(2, 100);
...
query.execute();
String response = query.getOutputParameterValue(1);
JTA 1.2

•

Declarative transactions outside EJB

•

Transaction scope - @TransactionScoped
JTA 1.2
@Transactional Annotation
@Inherited
@InterceptorBinding
@Target({TYPE, METHOD}) @Retention(RUNTIME)
public @interface Transactional {
TxType value() default TxType.REQUIRED;
Class[] rollbackOn() default {};
Class[] dontRollbackOn() default {};
}
@Transactional(rollbackOn={SQLException.class},
dontRollbackOn={SQLWarning.class})
public class UserService {...}
JSF 2.2
•

HTML5 Support

•

@FlowScoped

•

@ViewScoped for CDI

•

Managed beans deprecated/CDI alignment

•

Stateless views

•

Resource library contracts

•

File upload component

•

Cross-Site Request Forgery handling support
JSF 2.2
Pass-Through HTML 5 Components
<html>
...
<input type=“color” jsf:value=“#{colorBean.color2}” />
<input type=“date” jsf:value=“#{calendarBean.date1}” />
...
</html>
JSF 2.2
Faces Flows
@Named
@FlowScoped(id="flow-a")
public class FlowABean implements Serializable {
public String getName() {
return "FlowABean";
}
public String getReturnValue() {
return "/return1";
}
@Produces
public Flow getFlow(FlowBuilder builder) {
builder.startNode("router1");
builder.flowReturn("success").fromOutcome("/complete");
builder.flowReturn("errorOccurred").fromOutcome("error");
builder.switchNode("router1")
.navigationCase().condition("#{facesFlowScope.customerId == null}")
.fromOutcome("create-customer")
.defaultOutcome("view-customer");
builder.viewNode("create-customer");
builder.viewNode("maintain-customer-record");
builder.methodCall("upgrade-customer")
.method("#{maintainCustomerBean.upgradeCustomer}").defaultOutcome("view-customer");
builder.initializer("#{maintainCustomerBean.initializeFlow}");
builder.finalizer("#{maintainCustomerBean.cleanUpFlow}");
return builder.getFlow();
•

•

}
Others
•

•

•

•

Servlet 3.1: Non-blocking I/O, Security
Enhancements
CDI 1.1: Global enablement, @AroundConstruct,
@Vetoed…
EL 3.0: Lambda expressions, collections, operators,
standalone API…
EJB 3.2: Truncating CMP/BMP…
Java EE 8
•
•
•
•
•
•
•
•
•
•
•
•

JSON-B
JCache
CDI.next()
More CDI/EJB alignment
Cloud, PaaS, multitenancy/SaaS
Security?
Testability?
Modularity?
Management/deployment APIs?
NoSQL?
Action-oriented Web framework/HTML 5?
JMS.next()?
Resources
•

Java EE Tutorials
http://docs.oracle.com/javaee/7/tutorial/doc/home.htm
http://www.programming-simplified.com/index.html

•

Digging Deeper
http://docs.oracle.com/javaee/7/firstcup/doc/home.htm
https://glassfish.java.net/hol/
https://java.net/projects/cargotracker/

•

Java EE 7 Transparent Expert Groups
http://javaee-spec.java.net

•

Java EE 7 Reference Implementation
http://glassfish.org
Cargo Tracker
Planned Reference Architectural Blueprint for Java EE 7
utilizing DDD
•

•

•

•

Clean DDD design utilizing almost all the JSRs for Java
EE 7
Demonstrates building of modern mobile/desktop
applications utilizing Java EE 7
Project code is available at
https://java.net/projects/cargotracker/pages/Home

Contributors/Reviewers needed. Ask Reza
Rahman/myself for more details

Contenu connexe

Tendances

Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web SocketsFahad Golra
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, mavenFahad Golra
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Trisha Gee
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeansRyan Cuprak
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerZeroTurnaround
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutesArun Gupta
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Fahad Golra
 
Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 javatwo2011
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)Kevin Sutter
 
Understanding
Understanding Understanding
Understanding Arun Gupta
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
 
Advance java Online Training in Hyderabad
Advance java Online Training in HyderabadAdvance java Online Training in Hyderabad
Advance java Online Training in HyderabadUgs8008
 
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Arun Gupta
 
Take Your XPages Development to the Next Level
Take Your XPages Development to the Next LevelTake Your XPages Development to the Next Level
Take Your XPages Development to the Next Levelbalassaitis
 

Tendances (20)

Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web Sockets
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes
 
Maven
MavenMaven
Maven
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2
 
Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
 
Understanding
Understanding Understanding
Understanding
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
 
Spring 4 Web App
Spring 4 Web AppSpring 4 Web App
Spring 4 Web App
 
Advance java Online Training in Hyderabad
Advance java Online Training in HyderabadAdvance java Online Training in Hyderabad
Advance java Online Training in Hyderabad
 
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
 
Take Your XPages Development to the Next Level
Take Your XPages Development to the Next LevelTake Your XPages Development to the Next Level
Take Your XPages Development to the Next Level
 
Servlets
ServletsServlets
Servlets
 

Similaire à JUDCON India 2014 Java EE 7 talk

What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyMohamed Taman
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7WASdev Community
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Kile Niklawski
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5IndicThreads
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConLudovic Champenois
 
Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Alex Soto
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012Arun Gupta
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGMarakana Inc.
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 UpdateRyan Cuprak
 
Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)Hamed Hatami
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Josh Juneau
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Peter Pilgrim
 
Introduction tomcat7 servlet3
Introduction tomcat7 servlet3Introduction tomcat7 servlet3
Introduction tomcat7 servlet3JavaEE Trainers
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6glassfish
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaJames Falkner
 

Similaire à JUDCON India 2014 Java EE 7 talk (20)

What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
 
Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Java EE 7, what's in it for me?
Java EE 7, what's in it for me?
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
 
Introduction tomcat7 servlet3
Introduction tomcat7 servlet3Introduction tomcat7 servlet3
Introduction tomcat7 servlet3
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and Java
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 

Dernier

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 

Dernier (20)

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 

JUDCON India 2014 Java EE 7 talk

  • 1.
  • 2. JavaEE.Next():Java EE 7,8 and Beyond Vijay Nair vijay.nair@oracle.com @FusionVJ
  • 3. Java EE 7 – Candidate JSRs
  • 4. Java EE, Past, Present & Future
  • 5. WebSocket Primer • • HTTP is half duplex and traditional flavors of server push were long polling, Comet/AJAX → Inefficient and wasteful WebSocket to the rescue ! TCP based, bi-directional, full-duplex messaging Originally proposed as part of HTML5 W3C defined Javascript API
  • 6. WebSocket Primer • In 4 lines Establish connection (Single TCP Connection) Send messages in both directions (Bi-directional) Send messages independent of each other (Full Duplex) End Connection
  • 7. Java API for WebSocket • Higher level API for WebSocket • Both client and server-side (Java SE and Java EE) • Both declarative and programmatic
  • 8. Java API for WebSocket @ServerEndpoint(”/chat”) public class ChatServer { Set<Session> peers = ... @OnOpen public void onOpen(Session peer) { peers.add(peer); } @OnClose public void onClose(Session peer) { peers.remove(peer); } ...
  • 9. Java API for WebSocket ... @OnMessage public void message(String message, Session client) throws IOException { for (Session session : peers) { if (!session.equals(client)) { session.getRemote().sendObject(message); } } } • }
  • 10. Java API for JSON Processing • • • API to parse, generate, transform, query JSON Object Model and Streaming API -- similar to DOM and StAX Binding JSON to Java objects forthcoming
  • 11. Java API for JSON Processing Writing JSON (Object Model API) JsonArray value = Json.createArrayBuilder() [ { .add(Json.createObjectBuilder() "type": "home”, "number": "212 555-1234" }, { "type": "fax”, "number": "646 555-4567" } .add("type", "home") .add("number", "212 555-1234") ) .add(Json.createObjectBuilder() .add("type", "fax") .add("number", "646 555-4567") ).build(); ]
  • 12. Java API for JSON Processing Reading JSON (Streaming API) { "firstName": "John", "lastName": "Smith", "age": 25, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] } Event event = parser.next(); // START_OBJECT event = parser.next(); // KEY_NAME event = parser.next(); // VALUE_STRING String name = parser.getString(); // "John”
  • 13. Batch Applications for the Java Platform API for robust batch processing targeted to Java EE, Java SE
  • 14. Batch Applications for the Java Platform Step Example
  • 15. Concurrency Utilities for Java EE • • • Provides simple, safe API for concurrency in Java EE Builds on Java SE concurrency java.util.concurrent.ExecutorService Relatively low-level API and provides ManagedExecutorService ManagedScheduledExecutorService ManagedThreadFactory ContextService • Context Propagation (except Transactions !!)
  • 16. Concurrency Utilities for Java EE Managed Task Executor public class TestServlet extends HTTPServlet { @Resource(name=“concurrent/MyExecutorService”) ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { ... // Task logic } } }
  • 17. JMS 2 • • • API modernization using dependency injection Delivery delay, async send, MDB alignment, JMS resource definition Fixes, clarifications
  • 18. JMS 2 Old API @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } }
  • 19. JMS 2 Simplified API @Inject private JMSContext context; @Resource(mappedName = "jms/inboundQueue") private Queue inboundQueue; public void sendMessage (String payload) { context.createProducer().send(inboundQueue, payload); }
  • 20. JMS 2 JMS Resource Definition @JMSConnectionFactoryDefinition( name="java:global/jms/demoConnectionFactory", interfaceName= "javax.jms.ConnectionFactory", description="ConnectionFactory to use in demonstration") @JMSDestinationDefinition( name = "java:global/jms/demoQueue", description = "Queue to use in demonstration", interfaceName = "javax.jms.Queue", destinationName="demoQueue")
  • 21. JMS 2/EJB 3.2 More Standard MDB Properties @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty( propertyName = "destinationLookup", propertyValue = "jms/OrderQueue"), @ActivationConfigProperty( propertyName = "connectionFactoryLookup", propertyValue = "jms/MyConnectionFactory")}) public class OrderListener implements MessageListener { ... public void onMessage(Message message) { ... } ... }
  • 22. JAX-RS 2 • Client API • Message Filters & Entity Interceptors • Asynchronous Processing – Server & Client • Hypermedia Support • Content negotiation
  • 23. JAX-RS 2 Client API // Get instance of Client Client client = ClientBuilder.newClient(); // Get customer name for the shipped products String name = client.target(“../orders/{orderId}/customer”) .pathParam(”orderId", ”10”) .queryParam(”shipped", ”true”) .request() .get(String.class);
  • 24. JAX-RS 2 Logging Filter public class RequestLoggingFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) { log(requestContext); // Non-wrapping => returns without invoking next filter } ... }
  • 25. Bean Validation 1.1 • Method constraints • Bean Validation artifacts injectable • Fixes, clarifications and enhancements
  • 26. Bean Validation 1.1 Method Level Constraints public void placeOrder( @NotNull String productName, @NotNull @Max(“10”) Integer quantity, @Customer String customer) { ... } @Future public Date getAppointment() { ... }
  • 27. JPA 2.1 • Schema generation • Stored procedures • Unsynchronized persistence contexts • Entity converters • Entity Graphs • Dynamic Named Queries • Fixes and enhancements
  • 28. JPA 2.1 Schema Generation Properties javax.persistence.schema-generation.[database|scripts].action - “none”, “create”, “drop-and-create”, “drop” javax.persistence.schema-generation.[create|drop]-source -“metadata”, “script”, “metadata-then-script”, “script-then- metadata” javax.persistence.schema-generation.[create|drop]-script-source javax.persistence.schema-generation.scripts.[create|drop]-target javax.persistence.sql-load-script-source
  • 29. JPA 2.1 Stored Procedures @Entity @NamedStoredProcedureQuery(name="topGiftsStoredProcedure”, procedureName="Top10Gifts") public class Product { StoredProcedureQuery query = EntityManager.createNamedStoredProcedureQuery( "topGiftsStoredProcedure"); query.registerStoredProcedureParameter(1, String.class, ParameterMode.INOUT); query.setParameter(1, "top10"); query.registerStoredProcedureParameter(2, Integer.class, ParameterMode.IN); query.setParameter(2, 100); ... query.execute(); String response = query.getOutputParameterValue(1);
  • 30. JTA 1.2 • Declarative transactions outside EJB • Transaction scope - @TransactionScoped
  • 31. JTA 1.2 @Transactional Annotation @Inherited @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface Transactional { TxType value() default TxType.REQUIRED; Class[] rollbackOn() default {}; Class[] dontRollbackOn() default {}; } @Transactional(rollbackOn={SQLException.class}, dontRollbackOn={SQLWarning.class}) public class UserService {...}
  • 32. JSF 2.2 • HTML5 Support • @FlowScoped • @ViewScoped for CDI • Managed beans deprecated/CDI alignment • Stateless views • Resource library contracts • File upload component • Cross-Site Request Forgery handling support
  • 33. JSF 2.2 Pass-Through HTML 5 Components <html> ... <input type=“color” jsf:value=“#{colorBean.color2}” /> <input type=“date” jsf:value=“#{calendarBean.date1}” /> ... </html>
  • 34. JSF 2.2 Faces Flows @Named @FlowScoped(id="flow-a") public class FlowABean implements Serializable { public String getName() { return "FlowABean"; } public String getReturnValue() { return "/return1"; } @Produces public Flow getFlow(FlowBuilder builder) { builder.startNode("router1"); builder.flowReturn("success").fromOutcome("/complete"); builder.flowReturn("errorOccurred").fromOutcome("error"); builder.switchNode("router1") .navigationCase().condition("#{facesFlowScope.customerId == null}") .fromOutcome("create-customer") .defaultOutcome("view-customer"); builder.viewNode("create-customer"); builder.viewNode("maintain-customer-record"); builder.methodCall("upgrade-customer") .method("#{maintainCustomerBean.upgradeCustomer}").defaultOutcome("view-customer"); builder.initializer("#{maintainCustomerBean.initializeFlow}"); builder.finalizer("#{maintainCustomerBean.cleanUpFlow}"); return builder.getFlow(); • • }
  • 35. Others • • • • Servlet 3.1: Non-blocking I/O, Security Enhancements CDI 1.1: Global enablement, @AroundConstruct, @Vetoed… EL 3.0: Lambda expressions, collections, operators, standalone API… EJB 3.2: Truncating CMP/BMP…
  • 36. Java EE 8 • • • • • • • • • • • • JSON-B JCache CDI.next() More CDI/EJB alignment Cloud, PaaS, multitenancy/SaaS Security? Testability? Modularity? Management/deployment APIs? NoSQL? Action-oriented Web framework/HTML 5? JMS.next()?
  • 37. Resources • Java EE Tutorials http://docs.oracle.com/javaee/7/tutorial/doc/home.htm http://www.programming-simplified.com/index.html • Digging Deeper http://docs.oracle.com/javaee/7/firstcup/doc/home.htm https://glassfish.java.net/hol/ https://java.net/projects/cargotracker/ • Java EE 7 Transparent Expert Groups http://javaee-spec.java.net • Java EE 7 Reference Implementation http://glassfish.org
  • 38. Cargo Tracker Planned Reference Architectural Blueprint for Java EE 7 utilizing DDD • • • • Clean DDD design utilizing almost all the JSRs for Java EE 7 Demonstrates building of modern mobile/desktop applications utilizing Java EE 7 Project code is available at https://java.net/projects/cargotracker/pages/Home Contributors/Reviewers needed. Ask Reza Rahman/myself for more details