This month’s NY JavaSig was chock full of information about JEE 7. It was nice seeing it before Oracle’s launch webcast . And at a more convenient time as well! Given that Reza Rahman works for Oracle, we got the standard Oracle disclaimer that anything can change in the next two weeks. But we all know they don’t have time to change much so 99.9% of this should be true. [comments in brackets are my opinions; not Reza’s or Oracle’s] High level JEE 7 changes JMS 2. Batch. Transactions. Concurrency, interceptor, web socket java api, json java api

El 3, jms 2′ jax-rs 2.

Rest like EJB are minor releases. Ejb 3.2 (interestingly CMP is from J2EE 1.3)

Add to web profile: jax-rs 2

Deprecate jax rpc, cmp, cmp, jsr 88 – no known tools to get off bmp/cmp

Themes are productivity and html 5, core foundational apis Jms 2 8 year old api. Needed an overhall

Change api to use DI

Delivery delay, async send, delivery count, now standard rather than optional, mdb alignment

Now you just inject JMSContext and Queue – a new Object. Reduces code from a slide to a few lines.

Uses default JMSContext connection factory unless specify otherwise

Context has createProducer() and createConsumer(). Uses builder pattern so can chain/use one liners to configure

New API uses runtime exceptions

Added JMSConnectionFactoryDefinition and JMSDestinationDefinition annotations so can configure in code instead of vendor specific descriptor. Can still use xml instead of annotations

MDBs have new @ActivationConfigProperty

Spring will be supporting JMS 2 in their apis. Will need new JMS apis as well from third party libraries.

Websockets

Stateful protocol. Bidirectional async communication. Good for gaming, online stock tickers, etc

Uses HTTO as handshake between client and server

Part of HTML 5. Hope people will be using within 3-5 years.

Very high level API

Supports both declarative and progamatic programming. Most people should be dealiling with declarative api. The programmatic one is meant for third party api developers

Abstracts keep alive setting

Weakness in websocket spec: can use up all sockets on a machine

Keep alive packets sent about every 5 minutes (vs 30 seconds normally). If your router times out after a minute, you’ll need to reconfigure. No session replication yet. If server goes down, you lose it

Server side code – POJO with annotaton for serverendpoint(url)’ onopen and onclose. Onopen and onclose callbacks get passed a session. Also callbacks for onmessage and onerror. Use session.getRemote. To get handle to remote endpoint and call sendXXX. It is NOT an HttpSession because you are not in http level of abstraction

Client – JavaScript has an api for websocket. Use this 90 peercent of the time

Json

[feels like java util logging. late to the party and not as good as open source libraries]

Have jsonp – Like xmlp?

Will have jsonb in future – Like xmlb. Eclipselink has two implementations now. Moxi and eclipse link json binding. The later one is likely to be closest to the standard.

No safe bet. Use what exists now and change later

To use

JsonArray array = Json.createArrayBuilder(). Can add primatives and objects

To read: parser().iterator and parser,getString()

iterator,nextO will return START_OBJECT, KEY_NA ME, etc in addition to the real values. [ugly – reminds me of the early days of DOM]

JAX-RS 2

[Lost what i typed because after deleting text undo deleted still more text. I think i remembered it all to retype]

Jersey is an implementation as is RESTEasy

Jax-rs was was introduced in jee 6

Hypermedia support – using hyperlinks in rest, like for lazy loading

Cient api, message filter, entity interceptor, asnc processing for high throughput, content negotiation (queues used to apply weight to client)

Client api: ClientBuilder.newClient() and client.target(url, params, … )

For filter implement ContainerRequestFilter

JPA 2.1

Schema generation – every provider supports already. This adds a standard format. Can create database and/or ddl, Showed examole with index names in Java and said “no other way to do it” [yuck – this is why you should separate your DDL and not store it in only in Java. You are going to need that standalone DDL later anyway for laters so why not put the index there.]

Stored procedure support – people want it, all providers have it already so gave in and put it in in ORM spec. Looks like namedqueries. @NamedStoredProcedureQuery

Unsynchronized persistence contexts – can join when ready to rejoin context

Entity convertors – edge case solution for odd format in database field but dont want in java objects

Fixes/enhancement

Jta 1.2

Old api that needed an update. Lots of fixes and two new features

Declarative transactions outside EJB – any CDI object supported now. @Transactional. Default is rollback for runtime exception and ignore checked exception

@TransactionScoped – new CDI scope. JMSContext uses this scope

Jsf 2.2

Html 5 support – pass thru html 5 components. Use normal inout type=color and then jsf:value and el expression as attribute. That way not limited to jsf component libraries. Similary jsf:id, jsf:validate, jsf:renderer

@Flowscoped – alternative to conversation scope. Conversation was suited to wizards. Flow scoped keeps certain objects active for different parts of the app. [Code looks like a state diagram in java code – long]

@ViewScoped for CDI

Deprecated JSF managed beans. Use CDI instead

File upload component – couldn’t add until now because JSF was being backward compatible with 2 versions of servlet apis

View actions – can trigger an action when land on page rather than wait for user to click on something

Multi templating – templates can have parents

Security

Batch applications

Concepts. JobRepository, Job,JobOperator, Step, ItemReader, ItemProcessor, ItemWriter ( map reduce pattern with readerprocess, write)

The java community doesnt generally get into batch processing. Financial community is different. Hadoop and analytics starting to bring batch to wider audience

To code use named annotation and implement Itemreader, ItemProcessor, ItemWriter

Write XML for step to chunk it and send to reader, processor and writer. Methods. ReadItem, processItems, writeitems

IBM websphere compute grid called out for batch multi threading on different machines.

IBM most active and spring second most active contributor to batch spec. Presumably that means Spring is interesting in supporting

Bean validation 1.1

Added method level constraints. Useful in REST. Method param and return type constraints. Used to only have property level

Bean validation artifacts injectable

Concurrency utilities for JEE

Builds on JSE Executor Service

Thread pool aware

Relatively low level API

Don’t expect a lot of people to use. Meant for third parties running on JEE so can share app server thread pool

Inject ManagedExecutorService annotation. Submit your task to executor

El. 3

Lambda expressions, collections support, operator support

EJB 3.2 truncating BMP/CMP

Servlet api – non blocking IO

Ordering of interceptors

Jee 8

jsonB. – probably before JEE 8

Jcache – available as drop in jar before. Just missed JEE 7 cutoff

Lots more stuff

Tomcat

Base Tomcat planning on supporting JSR 356 (web sockets), maybe concurrency utilities

TomEE – apache project taking plain tomcat and brining up to JEE web profile level. It is certified against web profile