$30 off During Our Annual Pro Sale. View Details »

Java EE 7 Overview

Java EE 7 Overview

I gave a talk on some of the new features in Java EE 7 at Queensland JVM Group meetup

Avatar for Denys Digtiar

Denys Digtiar

June 24, 2013
Tweet

Other Decks in Programming

Transcript

  1. Platform in JSRs 14 JSRs 4 of them New 9

    Maintenance Releases 4 Pruned JSRs
  2. 14 JSRs Java Platform, Enterprise Edition 7 ( ) Concurrency

    Utilities for Java EE 1.0 ( ) Java Persistence 2.1 ( ) JAX-RS: The Java API for RESTful Web Services 2.0 ( ) Java Servlet 3.1 ( ) Expression Language 3.0 ( ) Java Message Service 2.0 ( ) JavaServer Faces 2.2 ( ) Enterprise JavaBeans 3.2 ( ) Contexts and Dependency Injection for Java EE 1.1 ( ) Bean Validation 1.1 ( ) Batch Applications for the Java Platform 1.0 ( ) Java API for JSON Processing 1.0 ( ) Java API for WebSocket 1.0 ( ) JSR 342 JSR 236 JSR 338 JSR 339 JSR 340 JSR 341 JSR 343 JSR 344 JSR 345 JSR 346 JSR 349 JSR 352 JSR 353 JSR 356
  3. 9 Maintenance Releases Web Services for Java EE 1.4 (

    ) Java Authorization Service Provider Contract for Containers 1.5 (JACC 1.5) ( Java Authentication Service Provider Interface for Containers 1.1 (JASPIC 1.1) JavaServer Pages 2.3 ( ) Common Annotations for the Java Platform 1.2 ( ) Interceptors 1.2 ( ) Java EE Connector Architecture 1.7 ( ) Java Transaction API 1.2 ( ) JavaMail 1.5 ( ) JSR 109 JS JSR 245 JSR 250 JSR 318 JSR 322 JSR 907 JSR 919
  4. 4+ pruned JSRs Java EE Management ( ) Application Deployment

    ( ) JAXR for interfacing UDDI registries ( ) JAX-RPC ( ) EJB 2.x Container Managed Persistence JSR 77 JSR 88 JSR 93 JSR 101
  5. Show us some new APIs!!! Java API for WebSocket 1.0

    ( ) Java API for JSON Processing 1.0 ( ) Batch Applications for the Java Platform 1.0 ( ) Concurrency Utilities for Java EE 1.0 ( ) JSR 356 JSR 353 JSR 352 JSR 236
  6. HTML5 Java API for WebSocket 1.0 ( ) Java API

    for JSON Processing 1.0 ( ) JSR 356 JSR 353
  7. Java API for WebSocket 1.0 Overview Full support for creating

    WebSocket Endpoints Client profile Server profile 2 approaches Programmatic (Endpoint) Annotation based (@ServerEndpoint, @ClientEndpoint)
  8. Java API for WebSocket 1.0 Main API classes (javax.websocket.*) Endpoint

    - Intercepts WebSocket lifecycle events onOpen onClose onError MessageHandler - Handles all incoming messages for an Endpoint RemoteEndpoint - Represents the 'other end' of this conversation Session - represent the active conversation
  9. Java API for WebSocket 1.0 Message Processing Send or receive

    text and binary messages As complete messages As sequence of partial messages Using traditional blocking I/O Send or receive WebSocket messages as any Java object Using pluggable encoder/decoder components Encoders and decoders for Java primitives built in Send messages synchronously or asynchronously
  10. Java API for JSON Processing 1.0 Streaming API to produce/consume

    JSON Low-level, efficient way to parse/generate JSON Similar to StAX API in XML world Object model API to represent JSON Simple, easy to use high-level API Similar to DOM API in XML world
  11. JAX-RS 2.0 What's new? Client API Filters & Interceptors Asynchronous

    Processing Hypermedia ... some other features
  12. Developer Productivity Contexts and Dependency Injection for Java EE 1.1

    ( ) Bean Validation 1.1 ( ) Java Transaction API 1.2 ( ) Java Message Service 2.0 ( ) JSR 346 JSR 349 JSR 907 JSR 343
  13. Contexts and Dependency Injection for Java EE 1.1 CDI is

    ON by default "beans.xml" is optional Bean discovery mode all annotated none @Vetoed Global ordering/priority of interceptors and decorators
  14. Java Message Service 2.0 Get More from Less New JMSContext

    interface AutoCloseable: JMSContext, Connection, Session,... Use of runtime exceptions Method chaining on JMSProducer Simplified message sending Default ConnectionFactory
  15. Java Message Service 2.0 Sending a Message using JMS 1.1

    @ R e s o u r c e ( l o o k u p = " j m s / m y C o n n e c t i o n F a c t o r y " ) C o n n e c t i o n F a c t o r y c o n n e c t i o n F a c t o r y ; @ R e s o u r c e ( l o o k u p = " j m s / m y Q u e u e " ) Q u e u e m y Q u e u e ; p u b l i c v o i d s e n d M e s s a g e ( S t r i n g p a y l o a d ) { C o n n e c t i o n c o n n e c t i o n = n u l l ; t r y { c o n n e c t i o n = c o n n e c t i o n F a c t o r y . c r e a t e C o n n e c t i o n ) ; S e s s i o n s e s s i o n = c o n n e c t i o n . c r e a t e S e s s i o n ( f a l s e , S e s s i o n . A U T O _ A C K N O W L E D G E ) ; M e s s a g e P r o d u c e r m e s s a g e P r o d u c e r = s e s s i o n . c r e a t e P r o d u c e r ( m y Q u e u e ) ; T e x t M e s s a g e t e x t M e s s a g e = s e s s i o n . c r e a t e T e x t M e s s a g e ( p a y l o a d ) ; m e s s a g e P r o d u c e r . s e n d ( t e x t M e s s a g e ) ; } c a t c h ( J M S E x c e p t i o n e x ) { / / . . . } f i n a l l y { i f ( c o n n e c t i o n ! = n u l l ) { t r y { c o n n e c t i o n . c l o s e ( ) ; } c a t c h ( J M S E x c e p t i o n e x ) { / * . . . * / } } } }
  16. Java Message Service 2.0 Sending a Message using JMS 2.0

    @ R e s o u r c e ( l o o k u p = " j m s / m y C o n n e c t i o n F a c t o r y " ) C o n n e c t i o n F a c t o r y c o n n e c t i o n F a c t o r y ; @ R e s o u r c e ( l o o k u p = " j m s / m y Q u e u e " ) Q u e u e m y Q u e u e ; p u b l i c v o i d s e n d M e s s a g e ( S t r i n g p a y l o a d ) { t r y ( J M S C o n t e x t c o n t e x t = c o n n e c t i o n F a c t o r y . c r e a t e C o n t e x t ( ) ; ) { c o n t e x t . c r e a t e P r o d u c e r ( ) . s e n d ( m y Q u e u e , p a y l o a d ) ; } }
  17. Java Message Service 2.0 Sending a Message using JMS 2.0

    and DI @ I n j e c t @ J M S C o n n e c t i o n F a c t o r y ( l o o k u p = " j m s / m y C o n n e c t i o n F a c t o r y " ) J M S C o n t e x t c o n t e x t ; @ R e s o u r c e ( l o o k u p = " j m s / m y Q u e u e " ) Q u e u e m y Q u e u e ; p u b l i c v o i d s e n d M e s s a g e ( S t r i n g p a y l o a d ) { c o n t e x t . c r e a t e P r o d u c e r ( ) . s e n d ( m y Q u e u e , p a y l o a d ) ; }
  18. Meeting Enterprise Demand Concurrency Utilities for Java EE 1.0 (

    ) Batch Applications for the Java Platform 1.0 ( ) JSR 236 JSR 352
  19. Concurrency Utilities for Java EE 1.0 javax.enterprise.concurrent.* Extension of Java

    SE Concurrency Utilities API 4 types of managed objects ManagedExecutorService ManagedScheduledExecutorService ManagedThreadFactory ContextService Context Propagation (classloading, JNDI, security) Event Notification (ManagedTask, ManagedTaskListener)
  20. Concurrency Utilities for Java EE 1.0 c l a s

    s S o m e B e a n { @ R e s o u r c e / * ( n a m e = " j a v a : c o m p / D e f a u l t M a n a g e d E x e c u t o r S e r v i c e " ) * / M a n a g e d E x e c u t o r S e r v i c e e x e c u t o r ; p u b l i c v o i d e x e c u t e ( ) { F u t u r e < S t r i n g > r e s u l t = e x e c u t o r . s u b m i t ( n e w C a l l a b l e < S t r i n g > ( ) { / / c a l l a b l e i m p l e m e n t a t i o n h e r e } ) ; / / d o s o m e t h i n g e l s e } }
  21. Batch Applications for the Java Platform 1.0 Feature Summary Batch

    Programming Artifacts Job Specification Language (JSL) JobOperator Interface
  22. Batch Applications for the Java Platform 1.0 Batch Programming Artifact

    overview Codifies key batch programming constructs Reader, Processor, Writter, Batchlet, Listerens, PartionPlan, ... Batch runtime orchestrates flow based on well known patterns, e.g chunked (Reader, Processor, Writer)
  23. Batch Applications for the Java Platform 1.0 Job Specification Language

    (JSL) XML document Defines a "job" "Scripts" batch execution sequence "Step" oriented Conditional step execution Supports parameterization and substitution
  24. Batch Application for Java Platform 1.0 JobOperator Interface Interface to

    the Batch Runtime Defines operations to act on jobs Start, stop, restart, job repository retrieval "The" interface for applications to interact with jobs
  25. What does the future hold for us? JSON-B JCache NoSQL

    Cloud (multi-tenancy, elasticity) Jigsaw