Java EE 7 and HTML5: Developing for the Cloud

Similar documents
<Insert Picture Here> Java EE 7: the New Cloud Platform

<Insert Picture Here> Java EE 7: the New Cloud Platform

<Insert Picture Here> Java EE 7. Linda DeMichiel Java EE Platform Lead

The Java EE 6 Platform. Alexis Moussine-Pouchkine GlassFish Team

WebLogic & Coherence. Best backend for Mobile Apps. July 2014 INSERT PRESENTER TITLE AND DATE

Server-Side JavaScript auf der JVM. Peter Doschkinow Senior Java Architect

Oracle im Open Source Kontext Abgrenzung GlassFish vs. JBoss und wozu noch WebLogic?

Java EE 6 development with Eclipse, Netbeans, IntelliJ and GlassFish. Ludovic Champenois Oracle Corporation

Java EE 6 Ce qui vous attends

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

JMS 2.0: Support for Multi-tenancy

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

<Insert Picture Here> GlassFish v3 - A Taste of a Next Generation Application Server

OpenShift is FanPaaStic For Java EE. By Shekhar Gulati Promo Code JUDCON.IN

JSR-303 Bean Validation

Why IBM WebSphere Application Server V8.0?

The Future of Java. Terrence Barr Senior Technologist, Oracle

Framework Adoption for Java Enterprise Application Development

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

<Insert Picture Here> Java, the language for the future

APAC WebLogic Suite Workshop Oracle Parcel Service Overview. Jeffrey West Application Grid Product Management

EclipseLink. Solutions Guide for EclipseLink Release 2.5

Learning GlassFish for Tomcat Users

White Paper: Why Upgrade from WebSphere Application Server (WAS) v7 to v8.x?

Supporting Multi-tenancy Applications with Java EE

Java EE 7: Back-End Server Application Development

RESIN APPLICATION SERVER JAVA EE 6 WEB PROFILE

The end. Carl Nettelblad

The Java EE 7 Platform and Support for the PaaS Model

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

Weblogic 12c: Mastering The Cloud Foundation. Patrick Dewael & Kristof Satory

JBoss Enterprise App. Platforms Roadmap. Rich Sharples Director of Product Management, Red Hat 4th April 2011

Oracle Database Cloud

Oracle Communications WebRTC Session Controller: Basic Admin. Student Guide

Introduction to Sun ONE Application Server 7

Oracle WebLogic Server

Managing Complexity in Mobile Application Deployment Using the OSGi Service Platform

Glassfish, JAVA EE, Servlets, JSP, EJB

GlassFish. Developing an Application Server in Open Source

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

How To Write A Web Framework In Java

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

JBoss SOAP Web Services User Guide. Version: M5

Oracle WebLogic Server 11g Administration

Enterprise Application Development In Java with AJAX and ORM

Converting Java EE Applications into OSGi Applications

2012 LABVANTAGE Solutions, Inc. All Rights Reserved.

Adobe ColdFusion 11 Enterprise Edition

How To Build A Web App

Rapid Application Development. and Application Generation Tools. Walter Knesel

Towards a cloud-enabled Java EE platform Rok Povše, prof. dr. Matjaž Branko Jurič

Basic TCP/IP networking knowledge of client/server concepts Basic Linux commands and desktop navigation (if don't know we will cover it )

How to Build an E-Commerce Application using J2EE. Carol McDonald Code Camp Engineer

Experiences with Open-Source BPM/SOA-based Stack using Java EE Rok Povše, Matjaž B. Jurič

Oracle Database Cloud Service Rick Greenwald, Director, Product Management, Database Cloud

JBoss JEE5 with EJB3.0 on NonStop. JAVA SIG, San Jose

<Insert Picture Here> Oracle Mobile Enterprise Application Platform Overview

PG DAC. Syllabus. Content. Eligibility Criteria

Oracle WebLogic Server 11g: Administration Essentials

Web Development in Java Part I

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

Module 13 Implementing Java EE Web Services with JAX-WS

Eclipse Web Tools Platform. Naci Dai (Eteration), WTP JST Lead

The Oracle Fusion Development Platform

Accelerated Java EE Open Source Development with Eclipse CON1905

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Spring 3.1 to 3.2 in a Nutshell. Sam Brannen Senior Software Consultant

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

applications. JBoss Enterprise Application Platform

Complete Java Web Development

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

WebLogic Server 11g Administration Handbook

This document gives an outline of Tim Ward s work on mobile phone systems

Listeners. Formats. Free Form. Formatted

Enterprise JavaBeans 3.1

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

CrownPeak Java Web Hosting. Version 0.20

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

Java Servlet 3.0. Rajiv Mordani Spec Lead

Web Cloud Architecture

70-487: Developing Windows Azure and Web Services

Building and Using Web Services With JDeveloper 11g

JReport Server Deployment Scenarios

Oracle Identity Analytics Architecture. An Oracle White Paper July 2010

Tuning Your GlassFish Performance Tips. Deep Singh Enterprise Java Performance Team Sun Microsystems, Inc.

ORACLE COHERENCE 12CR2

Middleware- Driven Mobile Applications

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture # Apache.

WEB SERVICES. Revised 9/29/2015

Enterprise JavaBeans' Future: Getting Simpler, More Ubiquitous, but Not Dominant

Systems Integration in the Cloud Era with Apache Camel. Kai Wähner, Principal Consultant

Bayeux Protocol: la nuova frontiera della comunicazione a portata di mano. Relatore Nino Guarnacci

Transcription:

Main sponsor Java EE 7 and HTML5: Developing for the Cloud Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle. 2 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 6 Platform December 10, 2009 3 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 6 Key Statistics 40+ Million Java EE 6 Component Downloads #1 Choice for Enterprise Developers #1 Application Development Platform Fastest implementation of a Java EE release 4 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Top Ten Features in Java EE 6 1. EJB packaging in a WAR 2. Servlet and CDI extension points 3. Optional web.xml! 4. Type-safe dependency injection 5. CDI Events 6. JSF standardizing on Facelets 7. EJBContainer API 8. @Schedule! 9. EJB No Interface View 10. Web Profile 5 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Today s Cloud Offerings are all Proprietary Infrastructure as a Service Platform as a Service Software as a Service 6 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 7 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 and 8 Focus Areas Cloud Provisioning Elastic & Autonomic Scalability Multi-Tenancy Modularity Building on Jigsaw Focus on OSGi interop Supporting Profiles & Modular Applications HTML5 Emerging Web Standards require a programming model JSON, WebSockets, off-line, APIs & DOM 8 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Focus: Platform as a Service Next logical step for Java EE J2EE à Java EE 6 : The Java EE Platform provides services Java EE 7 : The Java EE Platform IS a service PaaS support entails evolutionary change Basic form of SaaS Provide way for customers and users to leverage public, private, and hybrid clouds 9 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Roles Developer PaaS Provider PaaS Customer/ Tenant JVM JVM JVM Machine JVM JVM JVM Machine JVM JVM JVM Machine PaaS Product Provider Deployer Application Submitter Application Administrator JVM JVM JVM JVM JVM JVM JVM JVM JVM Machine Machine Machine Tenant 1 Tenant 2 Tenant 3 PaaS Account Manager PaaS Administrator 10 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Existing Java EE model Configure Java EE resources JDBC, JMS etc Deploy Application EAR 1 2 Provision and Initialize Provision and Initialize Database Service LDAP Service 3 Provision and Initialize Messaging Service 4 Provision and Initialize Application Container 5 Deploy Application (EAR/ GAR/SAR ) 11 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Model: Auto-Provision Services from Application Dependencies Provision and deploy application resources (e.g. LDAP stripe, data source instantiation and connection ) 1 2 Provision and Initialize Provision and Initialize Cloud Administration Service Database Service Extensible Deployment Models Supporting Multiple Frameworks Spring, Seam, Play 3 Provision and Initialize LDAP Service 4 Provision and Initialize Messaging Service 5 Deploy Application (EAR/ GAR/SAR ) Application Container 12 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Services Cloud apps consume services Persistence, queueing, mail, caching, Service metadata facilitates ease of use when deploying into the cloud @DataSourceDefinition(! )! name= java:app/jdbc/mydb,! classname= oracle.jdbc.pool.oracledatasource,! isolationlevel=transaction_repeatable_read,! initialpoolsize=5! 13 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Services Cloud apps consume services Persistence, queueing, mail, caching, Service metadata facilitates ease of use when deploying into the cloud @JMSConnectionFactoryDefinition( name= java:app/myjmsconnectionfactory, classname= javax.jms.queueconnectionfactory resourceadaptername= myjmsra )!! @JMSDestinationDefinition( name= java:app/myqueue, classname= javax.jms.queue destinationname= myqueue1 )! 14 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Services Cloud apps consume services Persistence, queueing, mail, caching, Service metadata facilitates ease of use when deploying into the cloud @MailSessionDefinition(! )! name= java:app/mailsession, host= example.com from= MyService@example.com! 15 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Services Cloud apps consume services Persistence, queueing, mail, caching, Service metadata facilitates ease of use when deploying into the cloud @ConnectorResourceDefinition(! )! name= java:app/mycustomconnector,! classname= com.extraservices.customconnector.class,! properties= { }! 16 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Elasticity Java EE 7 Focus: Move the Bar Right Elasticity Continuum Java EE Cluster Elastic Cluster Elastic Cluster Capacity on Demand Ca Single node Non-Elastic Service Levels Java EE Multi-Node Multi-Instance Clustering Minimum and Maximum Instances Dynamic Self Adjusting SLA Driven Elasticity Futures Self Adjustment, Capacity On Demand 17 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Demo PaaSing a Java EE Application in the Cloud glassfish.org/javaone2011 18 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Conference Planning in the Cloud Java EE Application JSF JPA Deploy EJB Services Metadata <glassfish-services> <service-description init-type="lb" name="conferenceplanner-lb"> <template id="lbnative"/> <configurations> <configuration name="https-port" value="50443"/> <configuration name="ssl-enabled" value="false"/> <configuration name="http-port" value="50080"/> </configurations></service-description> <service-description init-type="javaee" name="conferenceplanner"> <characteristics> <characteristic name="service-type" value="javaee"/> </characteristics> <configurations> <configuration name="max.clustersize" value="4"/> <configuration name="min.clustersize" value="2"/> </configurations> </service-description>!... </glassfish-services>! 19 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Service Provisioning Load Balancer Java EE Java EE... Java EE Database 20 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Multi-tenancy in Java EE 7 Support for separate isolated instances of the same app for different tenants One application instance per tenant Tenants correspond to units of isolation Multitenant apps are declared as such Each instance customized and deployed for a single tenant Limited form of SaaS Mapping to tenant done by the container Tenant id available to application E.g., under java:comp/tenantid! 21 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Candidate JSRs CDI Extensions CDI 1.1 / Interceptors 1.1 / JSR 250 1.1 Managed Beans 1.0 EJB 3.2 JPA 2.1 Web Container Extensions JAX-RS 2.0 JSF 2.2 JSP 2.2 Servlet 3.1 JTA 1.1 EL 3.0 JMS 2.0 Bean Validation 1.1 Jcache 1.0 (JSR 107) Concurrency Utilities 1.0 (JSR 236) State Management 1.0 (JSR 350) Batch Processing 1.0 (JSR 352) JSON 1.0 (JSR 353) 22 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Early Draft Requires Java SE 7 Added new roles Resource definition metadata DataSourceDefinition, JMSConnectionFactoryDefinition, JMSDestinationDefinition, MailSessionDefinition, ConnectorResourceDefinition! Pre-provisioned or shared resource 23 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Early Draft Default Data Source java:comp/defaultdatasource! Default JMS Connection Factory java:comp/ defaultjmsconnectionfactory! Tenant Identifier: java:comp/tenantid! Made optional EJB Entity Beans, EJB QL, JAX-RPC, Deployment API, JAXR 24 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java Persistence API 2.1 @NamedStoredProcedureQuery, StoredProcedureQuery! Bulk update/delete using Criteria! User-defined functions using FUNCTION! Persistence Context Synchronization 25 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA 2.1 Stored Procedures @Entity @NamedStoredProcedureQuery(name="topGiftsStoredProcedure", Stored Procedures procedurename="top10gifts") public class Product {... }! StoredProcedreQuery 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);! // there are other setparameter methods for defining the temporal type...! query.execute();! String response = query.getoutputparametervalue(1);!! 26 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA 2.1 Criteria Update/Delete CriteriaUpdate<Customer> q = cb.createcriteriaupdate(customer.class); Root<Customer> Update/Delete c = q.from(customer.class); using Criteria q.set(c.get(customer_.status), "outstanding").where(cb.lt(c.get(customer_.balance), 10000));...! @PersistenceContext EntityManager em; Query query = em.createquery(q); query.executeupdate();! UPDATE Customer c! SET c.status = 'outstanding'! WHERE c.balance < 10000! CriteriaDelete<Customer> q = cb.createcriteriadelete(customer.class); Root<Customer> c = q.from(customer.class); q.where(cb.equal(c.get(customer_.status), "inactive"), cb.isempty(c.get(customer_.orders)));...! @PersistenceContext EntityManager em; Query query = em.createquery(q); query.executeupdate();! 27 Copyright 2012, Oracle and/or its affiliates. All rights reserved. DELETE FROM Customer c WHERE c.status = 'inactive' AND c.orders IS EMPTY!

JAX-RS 2.0 Client-side API URL url = new URL("http://.../atm/balance"); Client-side API HttpURLConnection conn = (HttpURLConnection) url.openconnection(); conn.setrequestmethod("get"); conn.setdoinput(true); conn.setdooutput(false); BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = br.readline())!= null) { out.println(line); }! Client client = ClientFactory.newClient();! String balance = client.target("http://.../atm/balance")!.request("text/plain")!.get(string.class);! 28 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JAX-RS 2.0 Filters and Interceptors @Provider class LoggingFilter implements RequestFilter, ResponseFilter {! @Override public FilterAction prefilter(filtercontext ctx) throws IOException { logrequest(ctx.getrequest()); return FilterAction.NEXT; }! @Override public FilterAction postfilter(filtercontext ctx) throws IOException { logresponse(ctx.getresponse()); return FilterAction.NEXT; } }! 29 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JAX-RS 2.0 Client-side Async Client-side Async Client client = ClientFactory.newClient(); Future<String> future = client.target("http://.../atm/{card}/balance").pathparam("card", "1111222233334444").queryParam("pin", "1234").request("text/plain").async().get( new InvocationCallback<String>() { public void completed(string result) { } public void failed(invocationexception e) { } } );! 30 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JAX-RS 2.0 Bean Validation Integration @Path("/") Integration with Bean Validation class ProductResource {! @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void addproduct(@notnull @FormParam("productName") String name, @NotNull @Category @FormParam("category") String category) {... } }! 31 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JAX-RS 2.0 Server-side content negotiation @Path("/") Server-side Content Negotiation class ProductResource {! @GET @Produces({ "text/xml;qs=0.75", "application/json"}) public Product[] getproducts() {... } }! 32 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JavaServer Faces 2.2 Integration with HTML5 forms Queue control for Ajax requests File Upload component (Non-Ajax & Ajax) Injection in all JSF artifacts including converters & validators @FaceletsResourceResolver! Instantiating composite components in Java... 33 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Contexts & Dependency Injection 1.1 Embedded mode to startup outside Java EE container Global ordering of interceptors and decorators API for managing built-in contexts Send Servlet events as CDI events... 34 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Bean Validation 1.1 Code Sample @MethodValidated public class OrderService { public OrderService(@NotNull CreditCardProcessor creditcardprocessor) {... } public void placeorder( @NotNull @Size(min=3, max=20) String customercode, @NotNull @Valid Item item, @Min(1) int quantity) {... } @NotNull @Size(min=1) public Set<CreditCardProcessor> getcreditcardprocessors() {... } @NotNull @Future public Date getnextavailabledeliverydate() {... }! }! 35 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java Message Service 2.0 Simplified API Less verbose Reduce the number of objects needed to send/receive message Allow resource injection Alternative, not replacement, for standard API Remove JMSException, where possible Connection, Session and other objects are AutoCloseable New methods no need for redundant arguments 36 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JMS 1.1 Sending a Message (Java EE) Standard API @Resource(lookup = "jms/connectionfactory ") ConnectionFactory connectionfactory; @Resource(lookup="jms/inboundQueue") Queue inboundqueue; public void sendmessageold (String payload) throws JMSException { try (Connection connection = connectionfactory.createconnection()) { Session session = connection.createsession(); MessageProducer messageproducer = session.createproducer(inboundqueue); TextMessage textmessage = session.createtextmessage(payload); messageproducer.send(textmessage); }! }! 37 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JMS 2.0 Sending a Message (Java EE) New Simplified API @Resource(mappedName="jms/contextFactory")! ConnectionFactory connectionfactory;!! @Resource(mappedName="jms/inboundQueue")! Queue inboundqueue;!! public void sendmessage(string payload) {! try (JMSContext context = connectionfactory.createcontext();){! context.send(inboundqueue,payload);! }! }! 38 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JMS 2.0 Sending a Message (Java EE) New Simplified API (with Injection) @Inject! @JMSConnectionFactory("jms/contextFactory")! JMSContext context;!! @Resource(mappedName="jms/inboundQueue")! Queue inboundqueue;!! public void sendmessage(string payload) {! context.send(inboundqueue,payload);! }! 39 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JSON 1.0 (JSR 353) javax.json.* Object model API to represent JSON Similar to DOM API in XML world Streaming API to produce/consume JSON Similar to StAX API in XML world JSR Supporters fasterxml.com (Jackson) Doug Crockford (json.org) Spec: json-processing-spec.java.net Reference Implementation: jsonp.java.net 40 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JSON 1.0 (JSR 353) DOM-based APIs (javax.json.* package) JSONBuilder Builds a JSON object JSONReader Reads a JSON object or array from the stream JSONWriter Writes a JSON object or array to the stream Streaming APIs (javax.json.stream.* package) JsonGenerator Streaming JSON generator JsonParser Allows forward, read-only access to JSON 41 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JSON 1.0 (JSR 353) Code Sample - JsonBuilder JsonObject value = new JsonBuilder().beginObject().add("firstName", "John").add("lastName", "Smith") add("age", 25).beginObject("address ).add("streetaddress", "21 2nd Street ).add("city", "New York ).add("state", "NY ).add("postalcode, "10021 ).endobject().beginarray("phonenumber").beginobject().add("type", "home").add("number", "212 555-1234").endObject().beginObject().add("type", "home").add("number", "646 555-4567").endObject().endArray().endObject().build();! { "firstname": "John", "lastname": "Smith", "age": 25, "address" : { "streetaddress", "21 2nd Street", "city", "New York", "state", "NY", "postalcode", "10021" }, "phonenumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] } 42 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JSON 1.0 (JSR 353) Code Sample JsonReader, JsonWriter String json = "..."; JsonReader reader = new JsonReader(new StringReader(json)); JsonValue value = reader.readobject(); reader.close();! JsonWriter jsonwriter = new JsonWriter(new FileWriter(...)); JsonObject jsonobject = new JsonBuilder().beginObject()....endObject().build();! jsonwriter.writeobject(jsonobject); jsonwriter.close();! 43 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JSON 1.0 (JSR 353) Code Sample JsonGenerator, JsonParser JsonGenerator generator = new JsonGenerator(new FileWriter(...)); generator.beginobject()....beginarray()....endarray().endobject().build(); generator.close();! String json = "..."; JsonParser parser = new JsonParser(new StringReader(json)); Iterator<Event> it = reader.iterator(); Event event = it.next();! START_OBJECT! END_OBJECT! START_ARRAY! END_ARRAY! KEY_NAME! VALUE_xxx! 44 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Transparency Oracle s Java EE 7 JSRs are run in the open on java.net http://javaee-spec.java.net One project per spec e.g., jpa-spec, jax-rs-spec, jms-spec Publicly viewable Expert Group mail archive Users observer list gets copies of all Expert Group emails Publicly viewable download area Publicly viewable issue tracker Commitment to update to JCP 2.8 Process 45 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Status and Schedule All JSRs up and running Early Drafts Java EE 7 Platform, JSF 2.2, JAX-RS 2.0, JPA 2.1, CDI 1.1, EJB 3.2, JMS 2.0, Bean Validation 1.1, Expression Language 3.0 Final release target: Q2 2013 46 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

HTML 5 is Disruptive HTML 5 is the new UI across devices Offline, Real-time Communication, File access, Semantic markup, Multimedia, CSS3 HTML 5 Requires New Programming Model Servers no longer generating markup language Event Driven JavaScript is part of the domain model JSON is the payload, not just HTML 47 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Java EE: Investments for HTML5 WebSocket and Server Sent Events Infrastructure WebSocket SDK and JSR-356 Simplify the programming model for Java EE 48 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket Part of HTML5 Specification Bi-directional Full-duplex Over a single TCP connection Examples Real-time online games Collaborative platforms Social Networking 49 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket Protocol Handshake tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17 GET /mychat HTTP/1.1! Host: server.example.com! Upgrade: websocket! Connection: Upgrade! Sec-WebSocket-Key: x3jjhmbdl1ezlkh9gbhxdw==! Sec-WebSocket-Protocol: chat, superchat! Sec-WebSocket-Version: 13! Origin: http://example.com <EMPTY LINE>!! HTTP/1.1 101 Switching Protocols! Upgrade: websocket! Connection: Upgrade! Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=! Sec-WebSocket-Protocol: chat <EMPTY LINE>! Request Response 50 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket Protocol Framing tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17 Wire format of messages Design Philosophy Minimum framing required Data Frames Text & Binary Blob, ArrayBuffer Control Frames Protocol-level signaling 51 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket API dev.w3.org/html5/websockets/ 52 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket SDK websocket-sdk.java.net Annotation Driven Model Allows you to turn POJOs into WebSocket Endpoints Support for Server Sent Events WebLogic 12.1.2 support Runs on GlassFish 4.0 Early Builds Now! WebSocket SDK and JSR-356 Simplify the programming model for Java EE Integrated with Java EE Platform e.g. CDI 53 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

WebSocket Example import org.glassfish.websocket.api.annotations.websocketclose; import org.glassfish.websocket.api.annotations.websocket; import org.glassfish.websocket.api.annotations.websocketmessage;!! @WebSocket(path= /HelloWorld") public class HelloWorld{ @WebSocketMessage public String sayhelloworld(string caller) { return "hello " + caller + "!"; }! }! @WebSocketClose public void goodbye() { System.out.println( Adios ); } https://blogs.oracle.com/arungupta/entry/websockets_and_java_ee_7 54 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Server-Sent Events Part of HTML5 Specification Server-push notifications Cross-browser JavaScript API: EventSource! Message callbacks MIME type: text/eventstream! 55 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

EventSource API dev.w3.org/html5/eventsource/ 56 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Server-Sent Events Example Client-side var url = 'http://' + document.location.host + '/glassfish-sse/simple ; eventsource = new EventSource(url);! eventsource.onmessage = function (event) { var theparagraph = document.createelement('p'); theparagraph.innerhtml = event.data.tostring(); document.body.appendchild(theparagraph); }! https://blogs.oracle.com/arungupta/entry/server_sent_events_using_glassfish 57 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Server-Sent Events Example Server-side Handler @ServerSentEvent("/simple ) public class MySimpleHandler extends ServerSentEventHandler {! public void sendmessage(string data) { try { connection.sendmessage(data); } catch (IOException ex) {... } } }! https://blogs.oracle.com/arungupta/entry/server_sent_events_using_glassfish 58 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Server-Sent Events Example Server-side Business Logic @Stateless! public class SimpleEvent {!! @Inject @ServerSentEventContext("/simple")! ServerSentEventHandlerContext<MySimpleHandler> simplehandlers;!! @Schedule(hour="*", minute="*", second="*/10")! public void senddate() {! for(mysimplehandler handler : simplehandlers.gethandlers()) {! handler.sendmessage(new Date().toString());! }! }! }! https://blogs.oracle.com/arungupta/entry/server_sent_events_using_glassfish 59 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

SSE & WebSocket competing technologies? WebSocket can send/receive, SSE is server-push SSE are over HTTP, WebSocket require servers to understand the protocol SSE provides simple and easy-to-use for server-push, WebSocket is slightly complex and has overhead WebSocket provide real-time updates, SSE can be configured 60 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Project Avatar Complete Solution for Dynamic Rich Clients HTML 5 browser HTML & Java hybrid application JSON over WebSocket Java application Java EE Cloud 61 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA-RS: Building Block of Project Avatar Exposes JPA mapped entities over REST via JAX-RS HTTP Methods GET, PUT, POST, DELETE! Content-Type and Accept-based content negotiation XML or JSON Client HTML5 with JavaScript (primary focus) JavaFX 62 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA-RS: Current Programming Model GET http:// /order/4 JAX-RS Customer Product Order Shop Persistence Unit JPA 63 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA-RS: Thin Server Architecture JPA-RS GET http:// /<pu-name>/<entity>/4 Shop PU PU JPA 64 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

JPA-RS: Building Block of Project Avatar Server-side Business Logic Persistence Unit Operations /<root-uri>/<pu-name>/entity! /<root-uri>/<pu-name>/query! /<root-uri>/<pu-name>/metadata! Supports invocation of @NamedQueries via HTTP Server-caching EclipseLink clustered cache Dynamic Persistence also supported Entities defined via metadata no Java classes required Enables persistence for HTML5/JavaScript apps 65 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

NoSQL Stores No standards Differing APIs and feature sets Some offer query language/api some not 66 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

EclipseLink NoSQL Support JPA access to NoSQL databases Define annotations and XML to identify NoSQL stored entities (e.g., @NoSQL) Support JPQL subset for each Key principal: leverage what s available Initial support for MongoDB and Oracle NoSQL. Support mixing relational and non-relational data in single composite persistence unit 67 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

GlassFish Roadmap GlassFish v3 Java EE 6 support Single instance GlassFish Enterprise Mgr GlassFish Server 3.1 Centralized administration Clustering / HA GlassFish Server Control GlassFish Server 3.1.2 Bug Fixes Incremental features 2009 2010 2011 2012 2013 GlassFish Server 3.0.1 Oracle branding Oracle platform support Oracle interoperability GlassFish Server 3.1.1 Bug fixes Updated components Incremental features GlassFish Server 4 Java EE 7 Multitenancy PaaS-enablement 68 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Call to Action Java EE 7 Expert Group Project http://javaee-spec.java.net Java EE 7 Reference Implementation http://glassfish.org The Aquarium http://blogs.oracle.com/theaquarium 69 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

70 Copyright 2012, Oracle and/or its affiliates. All rights reserved.