Java ee 7   New Features
Upcoming SlideShare
Loading in...5
×
 

Java ee 7 New Features

on

  • 2,953 views

Java EE 7 New Features discussed in pakijug session in Karachi, Pakistan.

Java EE 7 New Features discussed in pakijug session in Karachi, Pakistan.

Statistics

Views

Total Views
2,953
Views on SlideShare
2,943
Embed Views
10

Actions

Likes
3
Downloads
75
Comments
0

1 Embed 10

http://www.linkedin.com 10

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Java ee 7   New Features Java ee 7 New Features Presentation Transcript

  • Java EE 7 – New Features? Presenter: Shahzad Badar
  • Agenda  Who am I?  Java EE 7 – New Features? Pakistan Java User Group
  • Who am I? A programmer working on java since 2002 Spent most of the time in Islamabad Leading Pakistan Java User Group Working in Royal Cyber Pakistan Java User Group
  • Catch me @shahzadbadar shahzadbadar@gmail.com http://www.implementsjava.com Pakistan Java User Group
  • Pakistan Java User Group
  • Pakistan Java User Group
  • Java EE 6 - Achievements  50,000,000 + downloads  #1 choice for enterprise developers  #1 application development platform  Fastest adoptions of any Java EE release – 18 complaint servers Pakistan Java User Group
  • Java EE 6 – Main Features  Web Profile  EJB packaged in war  Optional web.xml  Type-safe dependency injection  CDI Events  JSF standardizing on facelets  @Schedule Pakistan Java User Group
  • JEE 7 Theme Pakistan Java User Group
  • Pakistan Java User Group
  • Active JSRs  JSR 342: Java EE 7 Platform  JSR 338: Java API for RESTful Web Services 2.0  JSR 339: Java Persistence API 2.1  JSR 340: Servlet 3.1  JSR 341: Expression Language 3.0  JSR 343: Java Message Service 2.0  JSR 344: JavaServer Faces 2.2  JSR 345: Enteprise JavaBeans 3.2  JSR 346: Contexts and Dependency Injection 1.1  JSR 349: Bean Validation 1.1  JSR 236: Concurrency Utilities for Java EE 1.0  JSR 352: Batch Applications for the Java Platform 1.0  JSR 353: Java API for JSON Processing 1.0  JSR 356: Java API for WebSocket 1.0 Pakistan Java User Group
  • Concurrency and Java EE  Managing your own threads within a Java EE container is not recommended  Using java.util.concurrent API in a Java EE application component such as EJB or Servlet are problematic since the container and server have no knowledge of these resource  Provides simple, safe API for concurrency in Java EE  Builds on Java SE concurrency java.util.concurrent.ExecutorService Pakistan Java User Group
  • Pakistan Java User Group
  • Batch Applications for the Java Platform  Batch processing is execution of series of "jobs" that is suitable for non-interactive, bulk-oriented and long-running tasks.  no standard Java programming model existed for batch applications. Pakistan Java User Group
  • Pakistan Java User Group
  • Java EE Web Profile Enhancements  The Java Enterprise Edition Web Profile was introduced in Java EE 6  Most Web applications have significant requirements in the areas of transaction management, security, and persistence.  but are not supported by standalone servlet containers  Web Profile is provided with pre-installed, pre- integrated, fully tested Web infrastructure features.  The Java EE 7 Web Profile adds support for HTML5 with WebSockets, JSON, JAX-RS 2.0, and more. Pakistan Java User Group
  • Bean Validation 1.1  Method constraints  Bean Validation artifacts injectable  Fixes, clarifications and enhancements Pakistan Java User Group
  • Bean Validation 1.1 Method Level Constraints Pakistan Java User Group public void placeOrder( @NotNull String productName, @NotNull @Max(“10”) Integer quantity, @Customer String customer) { . . . } @Future public Date getAppointment() { . . . }
  • JSF 2.2  HTML5 Support  @FlowScoped  @ViewScoped for CDI  Managed beans deprecated/CDI alignment  File upload component  View actions  Multi-templating  Security  Fixes and enhancements Pakistan Java User Group
  • JSON Processing Support  JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.  It is easy for machines to parse and generate.  It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.  JSON is a text format that is completely language independent but uses conventions that are familiar to programmers Pakistan Java User Group { “employee": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ] } JSON Example
  • JSON Implementations for Java  org.json.  org.json.me.  Jackson JSON Processor.  Json-lib.  JSON Tools.  Stringtree.  SOJO.  Jettison.  json-taglib.  XStream.  Flexjson.  JON tools.  Argo.  jsonij.  fastjson.  mjson.  jjson.  json-simple.  json-io.  JsonMarshaller.  google-gson.  Json-smart.  FOSS Nova JSON.  Corn CONVERTER. Pakistan Java User Group a lot of implementations for other languages
  • Why we need another API? Pakistan Java User Group • JSON has become a defacto data transfer standard specially for RESTful Web Services. • Java applications use different implementations to consume and process JSON data • There should be standardized Java API for JSON so that applications do not need to bundle the implementation libraries
  • JSON Processing Support  API to parse and generate JSON  Streaming API  Low level efficient way to parse/generate JSON  Provide pluggability for parser/generator  Object Model  Simple, Easy-to-use high-level API  Implemented on top of Streaming API Pakistan Java User Group
  • Java API for JSON Processing Writing JSON (Object Model API) Pakistan Java User Group “employees": [ { “firstName": “Asif", “lastName": ”Naveed” }, { “firstName": “Khalid", “lastName": ”Ali” } ] JsonObject jsonObject = new JsonBuilder() .beginArray(“employees") .beginObject() .add(“firstName", “Asif") .add(“lastName", “Naveed") .endObject() .beginObject () .add(“firstName", “Khalid") .add(“lastName", “Ali").endObject() .endArray() .build();
  • Java API for JSON Processing Pakistan Java User Group { "firstName": "Javaid", "lastName": “Shah", "age": 19, "phoneNumber": [ { "type": “cell", "number": “03218983449" }, { "type": "fax", "number": “02142423212" } ] } Iterator<Event> it = parser.iterator(); Event event = it.next(); // START_OBJECT event = it.next(); // KEY_NAME event = it.next(); // VALUE_STRING String name = parser.getString(); // "Javaid” Reading JSON (Streaming API)
  • Web Socket Support In age of Web 2.0 / 3.0 , We need interactive websites Pakistan Java User Group but In the standard HTTP model, a server cannot initiate a connection with a client nor send an unrequested HTTP response to a client; thus, the server cannot push asynchronous events to clients.
  • Why WebSocket?  HTTP is half duplex  HTTP is verbose  Hacks for Server Push  Polling  Long Polling  Comet/Ajax  Complex, Wasteful, Inefficient Pakistan Java User Group
  • HTTP Communication Pakistan Java User Group
  • Polling Pakistan Java User Group
  • Long Polling Pakistan Java User Group
  • HTTP Streaming (Comet) Pakistan Java User Group
  • WebSocket to rescue  TCP based, bi-directional, full-duplex messaging  Capable of sending both UTF-8 string and binary frames in any direction at the same time  Operating from a single socket across the web  As part of HTML5, the application of the client interface will become native to all modern browsers  To establish a Web Socket connection, the browser or client simply makes a request to the server for an upgrade from HTTP to a Web Socket Pakistan Java User Group
  • WebSocket to rescue Pakistan Java User Group
  • Pakistan Java User Group “Reducing kilobytes of data to 2 bytes…and reducing latency from 150ms to 50ms is far more than marginal. In fact, these two factors alone are enough to make Web Sockets seriously interesting to Google.”
  • Java WebSocket Implementations Pakistan Java User Group
  • WebSocket API Connection Life Cycle @Singleton @WebSocketEndpoint(path=”/chat”) public class ChatServer { Set<Session> peers = ... @WebSocketOpen public void onOpen(Session peer) { peers.add(session); } @WebSocketClose public void onClose(Session session) { peers.remove(session); } ... Pakistan Java User Group
  • WebSocket API WebSocket Communication . . . @WebSocketMessage public void message(String message, Session client) throws IOException { for (Session session : peers) { if (!session.equals(client)) { session.getRemote().sendObject(message); } } } } Pakistan Java User Group
  • JPA 2.1 – New Features The first spec to include new features is the JPA 2.1. The new features can be described with the following short list:  Multi-Tenancy (Table discriminator)  Stored Procedures  Custom types and transformation methods - Query by Example  Dynamic PU Definition  Schema Generation (Additional mapping metadata to provide better standardization) Pakistan Java User Group
  • Servlet 3.1 – New Features NIO.2 async I/O Leverage Java EE concurrency Security improvements Web Sockets support Ease-of-Development Pakistan Java User Group
  • Enteprise JavaBeans 3.2 – New Features The scope of EJB 3.2 is intended to be relatively constrained in focusing on these goals.  Incremental factorization (Interceptors)  Further use of annotations to simplify the EJB programming model  Proposed Optional: BMP/CMP  Proposed Optional: Web Services invocation using RPC Pakistan Java User Group
  • Java EE 8 Plan  JSON-B  JCache  More CDI/EJB alignment  Cloud, PaaS, multitenancy/SaaS  JMS.next()?  JAX-RS.next()?  Modularity?  NoSQL?  Action-oriented Web framework/HTML 5?  Configuration API?  Security? Pakistan Java User Group
  • References  http://www.oracle.com/technetwork/java/javaee/index. html  https://blogs.oracle.com/arungupta/  http://www.infoq.com/presentations/Java-EE-7-8 Pakistan Java User Group
  • Pakistan Java User Group