43
Java EE The Evolution of a Platform Andrei Niculae Technology Presales Consultant

Andrei Niculae - JavaEE6 - 24mai2011

Embed Size (px)

Citation preview

Page 1: Andrei Niculae - JavaEE6 - 24mai2011

Java EE

The Evolution of a Platform

Andrei Niculae

Technology Presales Consultant

Page 2: Andrei Niculae - JavaEE6 - 24mai2011

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

Page 3: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 6 Overview

Page 4: Andrei Niculae - JavaEE6 - 24mai2011

4

May 1998

JPE Project

Sep 2001 13 Specs

J2EE 1.3

CPM, Connector Architecture

May 2006 23 specs

Java EE 5

Ease ofDevelopment

Annotations

EJB 3.0

Persistence API

New andUpdatedWeb Services

Dec 1999 10 specs

J2EE 1.2

Servlet, JSP, EJB, JMS

Nov 2003 20 specs

J2EE 1.4

WebServices

Management

Deployment

Java EE 6

Pruning

Extensibility

Ease of Development

EJB Lite

RESTful WS

CDI

Managed Beans

Java EE Web

Profile

Dec 2009 28 specs

Java EE: Past & Present

Page 5: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 6 Goals

DeveloperProductivity

Flexible&

Lightweight Extensible

•Web Profile

•Pruning

• Embrace open source frameworks

• More annotations• POJO development• Less XML configuration

Java EE

Page 6: Andrei Niculae - JavaEE6 - 24mai2011

What’s New in Java EE 6?

• Several new APIs

• Web Profile

• Pluggability / extensibility

• Dependency injection

• Lots of improvements to existing APIs

Page 7: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 8: Andrei Niculae - JavaEE6 - 24mai2011
Page 9: Andrei Niculae - JavaEE6 - 24mai2011

EJB 3.1

• No interface view – one source file per bean

• Simple POJO

• Much simpler to declare/work with

• Singleton

• EJB Timers

Page 10: Andrei Niculae - JavaEE6 - 24mai2011

EJB 3.1 Lite

A proper subset of the full EJB 3.1 API that includes a small, powerful selection of EJB features

Page 11: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 12: Andrei Niculae - JavaEE6 - 24mai2011

JPA 2.0Type-safe Criteria API

EntityManager em = getEntityManager();

CriteriaBuilder cb = em.getCriteriaBuilder();

CriteriaQuery<Employee> query =

cb.createQuery(Employee.class);

Root<Employee> employee = query.from(Employee.class);

query.where(cb.equal(employee.get("firstName"),

"Bob"));

List<Employee> result =

em.createQuery(query).getResultList();

Page 13: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 14: Andrei Niculae - JavaEE6 - 24mai2011

Servlets 3.0

Page 15: Andrei Niculae - JavaEE6 - 24mai2011

Servlets 3.0Extensibility

• Plugin libraries using web fragments• Modular web.xml

• Bundled in framework JAR file in META-INF Directory

• Zero-configuration, drag-and-drop for web Frameworks

• Servlets, servlet filters, context listeners for a framework get discovered and registered by the container

Page 16: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 17: Andrei Niculae - JavaEE6 - 24mai2011

Bean Validation

• Tier-independent mechanism to define constraints for data validation

• @NotNull(message=”...”), @Max, @Min, @Size

• Integrated with JSF and JPA

• JSF: f:validateRequired, f:validateRegexp

• JPA: pre-persist, pre-update, and pre-remove

• Fully Extensible

Page 18: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 19: Andrei Niculae - JavaEE6 - 24mai2011

Context and Dependency Injection (CDI)

• Opt-in technology on a per-module basis– META-INF/beans.xml

– WEB-INF/beans.xml

• @Resource only for container-provided objects

• Use @Inject for application classes

@Inject @LoggedIn User user;

Page 20: Andrei Niculae - JavaEE6 - 24mai2011

Context and Dependency Injection (CDI)

• Managed beans on steroids

• Opt-in technology on a per-module basis– META-INF/beans.xml

– WEB-INF/beans.xml

• @Resource only for container-provided objects

• Use @Inject for application classes

@Inject @LoggedIn User user;

The type describes the capabilities (methods)

Page 21: Andrei Niculae - JavaEE6 - 24mai2011

Context and Dependency Injection (CDI)

• Managed beans on steroids

• Opt-in technology on a per-module basis– META-INF/beans.xml

– WEB-INF/beans.xml

• @Resource only for container-provided objects

• Use @Inject for application classes

@Inject @LoggedIn User user;

Qualifiers describes qualities/characteristics/identity

Page 22: Andrei Niculae - JavaEE6 - 24mai2011

What's new in the Java EE 6 PlatformNew and updated components

• EJB 3.1(+Lite)

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• JAX-RS 1.1

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Connectors 1.6

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JASPIC 1.1

• JACC 1.5

• JAX-WS 2.2

• JSR 109 1.3

Page 23: Andrei Niculae - JavaEE6 - 24mai2011

Managed Beans

• Plain Java objects (POJOs)

• Foundation for other component types

• Fully support injection (@Resource,

@Inject)

• @PostConstruct, @PreDestroy

callbacks

• Optional name

Page 24: Andrei Niculae - JavaEE6 - 24mai2011

Sample Managed Beans

@ManagedBean

public class SpaceCapsule {

@Resource

DataSource configDB;

public launch() {

// ...

}

}

@ManagedBean("yuri")

public class Cosmonaut

{

@Resource

SpaceCapsule vostok;

@PostConstruct

orbitEarth() {

// ...

}

}

Page 25: Andrei Niculae - JavaEE6 - 24mai2011

UniformityCombination of annotations "just work"

• Example: JAX-RS resource classes are POJOs

• Use JAX-RS-specific injection capabilities

• But you can turn resource classes into managed

beans or EJB components ...

• ... and use all new services !

Page 26: Andrei Niculae - JavaEE6 - 24mai2011

JAX-RS SampleUsing JAX-RS injection annotations

@Path("root")

public class RootResource {

@Context UriInfo ui;

public RootResource() { ... }

@Path("{id}")

public SubResource find(@PathParam("id") String id) {

return new SubResource(id);

}

}

Page 27: Andrei Niculae - JavaEE6 - 24mai2011

JAX-RS SampleAs a managed bean, using @Resource

@Path("root")

@ManagedBean

public class RootResource {

@Context UriInfo ui;

@Resource DataSource myDB;

public RootResource() { ... }

@Path("{id}")

public SubResource find(@PathParam("id") String id) {

return new SubResource(id);

}

}

Page 28: Andrei Niculae - JavaEE6 - 24mai2011

JAX-RS SampleAs an EJB, using @Resource and security annotations

@Path("root")

@Stateless

public class RootResource {

@Context UriInfo ui;

@Resource DataSource myDB;

public RootResource() { ... }

@Path("{id}")

@RolesAllowed("manager")

public SubResource find(@PathParam("id") String id) {

return new SubResource(id);

}

}

Page 29: Andrei Niculae - JavaEE6 - 24mai2011

JAX-RS SampleAs a CDI bean, using @Inject and scope annotations

@Path("root")

@ApplicationScoped

public class RootResource {

@Context UriInfo ui;

@Inject @CustomerDB DataSource myDB;

@Inject @LoggedIn User user;

public RootResource() { ... }

@Path("{id}")

public SubResource find(@PathParam("id") String id) {

// ...

}

}

Page 30: Andrei Niculae - JavaEE6 - 24mai2011

How to Obtain UniformityCombination of annotations "just work"

• Annotations are additive

• New behaviors refine pre-existing ones

• Strong guidance for new APIs

Classes can evolve smoothly

Page 31: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 6 Web ProfileNew, updated components and unchanged components

• EJB 3.1 Lite

• JPA 2.0

• Servlet 3.0

• JSF 2.0

• Bean Validation 1.0

• DI 1.0

• CDI 1.0

• Managed Beans 1.0

• Interceptors 1.1

• JSP 2.2

• EL 2.2

• JSR 250 1.1

• JSR-45 1.0

• JSTL 1.2

• JTA 1.1

Page 32: Andrei Niculae - JavaEE6 - 24mai2011

JEE BenefitsA Better Platform

• Less boilerplate code than ever

• Fewer packaging headaches

• Uniform use of annotations

• Sharing of resources to avoid

duplication

• Dependency Injection

• Strongly-typed decorators

• ... and more!

Page 33: Andrei Niculae - JavaEE6 - 24mai2011

Future Java EE

Page 34: Andrei Niculae - JavaEE6 - 24mai2011

Java EE for the Cloud

• Applications are versioned

• Multiple versions can coexist

• Must deal with data versioning, upgrades, etc.

• Need ability to specify QoS properties

• Applications both expose and connect to services

• Common management and monitoring interfaces

• Evolution, not revolution

Page 35: Andrei Niculae - JavaEE6 - 24mai2011

Cloud Platform

Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Page 36: Andrei Niculae - JavaEE6 - 24mai2011

Cloud Platform

Application

CodeModule

CodeModule

Schema MigrationQoS

InformationSecurity

CodeModule

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Page 37: Andrei Niculae - JavaEE6 - 24mai2011

Cloud Platform

Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Page 38: Andrei Niculae - JavaEE6 - 24mai2011

Cloud Platform

Application Application Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Page 39: Andrei Niculae - JavaEE6 - 24mai2011

Cloud Platform

Managed Environment

Application Application Application

Virtualization Layer

State Management

JavaService

PersistenceService

QueueingService

Application Application

Page 40: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 7 Content (so far)

• Filed and voted !– Java EE 7 (JSR 342)

– JPA 2.1 (JSR 338)

– JAX-RS 2.0 (JSR 339)

– Servlet 3.1 (JSR 340)

– JSF 2.2 (JSR 344)

– EL 3.0 (JSR 341)

– JMS 2.0 (JSR 343)

Page 41: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 7 Content (so far)

• Other– JCache revived (JSR 107)

– Concurrency Utilities (236)

– MRs: JSR250, JAX-WS 2.3, JTA 1.2, JSP 2.3, connectors

– EJB 3.2

– Bean Validation 1.1

– JSR-330 1.1

– CDI 1.1

• Yet to be filed– JSON 1.0

Page 42: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 7 - When?

• Late 2012

• Date-driven release

– (anything not ready will be deferred to Java EE 8)

• Participate !

– Expert Groups still forming, consider joining

– JCP membership free for individuals

Page 43: Andrei Niculae - JavaEE6 - 24mai2011

Java EE 6 Platform

Available Today

http://www.oracle.com/javaee