KEMBAR78
Java EE for the Cloud | PPTX
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE for the Cloud
Dmitry Kornilov
JSONB/P Specification Lead
Oracle
@m0mus
October 20, 2016
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
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 © 2016, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Road to Java EE 8
Proposed Shift in Focus
Java EE 8 Revised Proposal
Java EE 9 Proposal
Q & A
1
2
3
4
3
5
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Road to Java EE 8
4
J2EE 1.2
J2EE 1.3
J2EE 1.4
Java EE 5
Java EE 6
Java EE 7
1999 2001 2003 2006 2009 2013
Servlet, JSP,
EJB, JMS, JTA,
RMI-IIOP
EJB 2.0, JSTL,
JAAS, JCA
EJB 2.1,
WebServices,
JAXP, JSF, JMX,
Deployment
EJB 3.0, JPA,
JAX-WS, JAXB,
SAAJ, StAX
JAX-RS,
Servlet 3.0,
EJB 3.1, JPA
2.0, CDI, BV
JAX-RS 2.0,
WebSocket,
JSON-P,
Concurrency,
JMS 2.0
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 5
Java EE 8 Community Survey
https://java.net/downloads/javaee-spec/JavaEE8_Community_Survey_Results.pdf
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 6
Java EE 7
Connector JAXBJSP Debugging
Managed BeansJSPConcurrency EE Interceptors JAX-WS WebSocket
Bean Validation JASPIC ServletJMS JTADeployment
Batch JACCDependency
Injection JAXR JSTL Management
CDI EJB JAX-RPC Web ServicesJSF Java Persistence
JSON-PCommon
Annotations EL JAX-RS Web Services
MetadataJavaMail
CDI
JSON-P
MVC
Bean Validation
JSF
JAX-RS
JSP
Servlet
Java EE 8 (Original Proposal, 2014)
JSON-B Security
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
“The world has changed. I see it in the
water. I feel it in the Earth. I smell it in
the air...”
– J.R.R. Tolkien
7
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE - Available On Premise and in the Cloud
10/20/2016
Confidential – Oracle
8
Cloud
On Premise
WebSphere
WebLogic
Red Hat JBoss
8Copyright © 2016, Oracle and/or its affiliates. All rights reserved.
Choice of
Implementations
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE APIs - Backbone of Leading Open Source Projects
9
Java EE
Containers
Microservices Web
Containers
Web
Frameworks
PaaSREST
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 10
Java EE +
Cloud• More demanding business requirements
• Move to the Cloud for agility & flexibility
• Shift from physical infrastructure to virtual
• Microservices vs. monolithic applications
• Runtime packaged with applications
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Cloud Development
Heterogeneous Clients
• Mobile, REST, HTML5
Stateless Services
• Managed and scaled
independently
Data Sources
• Relational, non-relational
User profile
service
Order
service
Partner
service
Catalog
service
Notification
service
Import
service
HTTP/2 REST JSON XHR
Event JAX-RS/JSON Notifications JAX-WS
RDBMS NoSQL DB TSDBData Streams
Time SeriesEventsKey ValueJDBC
11
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
It's Confusing!
12
Too many choices...
Which components?
Overall architecture?
Standards?
Vendor commitment?
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Proposed Enhancements to Java EE
• New AppDev style for Cloud and Microservices
• Build on proven technologies
• Comprehensive
– Programming Model, Packaging, Portability
• Standards-based
– This is a proposal only
– Will work with the community and follow the JCP process
13
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Designed for Agility and Scalability with Security
• Programming Model
– Reactive programming
– Unified event model
• Eventual Consistency
– Automatically event out changes to observed data structures
– Data sources with manageable consistency
• NoSQL
– Persistence and query interface for Key Value and Document DB
• Security
– Support of OAuth2, OpenID Connect
– Secret management
14
App
App
App
App
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Location Transparency and Resiliency
• Configuration
– Externalized configuration
– Multiple configuration sources
• State
– API for external state
• Resiliency
– Circuit breakers
– Health check API
15
Reliability, Monitoring
Container Management
Scheduling & Elastic Scaling
Key Value
Database
Logging
Configuration
State
Security
Notification
User profile
service
Order
service
Catalog
service
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Packaging and Simplicity
• Packaging
– Package applications, runtimes into containers
– Standalone immutable executable binary
– Multi-artifact archives
– Leveraging Java 9 module system
• Serverless
– Ephemeral instantiation
• Multitenancy
– Increased density
– Tenant-aware
16
App
Server
Order
service
App
Server
Catalog
service
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Recent Java EE 7 compatibility updates: Congratulations!Technical Focus Areas
17
 Extend for reactive
programming
 Unified event model
 Event messaging API
 JAX-RS, HTTP/2, Lambda,
JSON-B, ...
Programming Model
 API to store externalized
state
 Automatically event out
changes to observed data
structures
 Extension to support
client-side circuit breakers
 Resilient commands
 Standardize on client-side
format for reporting
health
 New spec – interfaces,
packaging format,
manifest
 Ephemeral instantiation
 Secret management
 OAuth
 OpenID
 Package applications,
runtimes into services
 Standalone immutable
executable binary
 Multi-artifact archives
 Increased density
 Tenant-aware routing and
deployment
 Externalize configuration
 Unified API for accessing
configuration
 Persistence and query
interface for key value and
document DB
Key Value/Doc Store Configuration Resiliency
Packaging
Eventual Consistency
Serverless
Multitenancy
State
Security
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 18
Engage Java EE Community
• Feedback through Survey
• Launch Java EE Next JSRs
2016
Java EE 8
• Specs, RI, TCK complete
• Initial microservices support
• Define Java EE 9
• Early access implementation
of Java EE 9
Java EE 9
• Specs, RI, TCK complete
• Modular Java EE runtime
• Enhanced microservices
support
Java EE Roadmap
2017
2018
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
We Are Hiring
• Senior Java Developer
– Work on JAX-RS, HTTP/2 and Servlet projects
– Participate in specifications development
– Working on Reference Implementations and TCKs
– Participate in community reviews, forums, mailing lists
– Strong experience in Java and Java EE (5+ years)
– Full description
• Contacts
– dmitry.kornilov@oracle.com
19
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
We Need Your Feedback
20
Take the Java Community Survey
http://glassfish.org/survey
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE 8 Revised Proposal
21
 JSON <-> object mapping
JSON-B 1.0 (JSR 367)
No Change
Proposed to Drop
Proposed to Add
 JSON Pointer
 JSON Patch
 Java 8 Lambda support
JSON-P 1.1 (JSR 374)
 Reactive enhancements
 Server-sent events
 Non-blocking I/O
 Client-side circuit breakers
JAX-RS 2.1 (JSR 370)
 HTTP/2 support
Servlet 4.0 (JSR 369)
 Small-scale new features
 Community-driven improvements
JSF 2.3 (JSR 372)
 Action-based MVC framework
MVC 1.0 (JSR 371)
 Bootstrap API for Java SE
 Asynchronous events
 Observer ordering
CDI 2.0 (JSR 365)
 Collection constraints
 Date/Time support
 Community-requested features
Bean Validation 2.0 (JSR 380)
 Authentication/authorization APIs
 OAuth support
 OpenID support
 Secret management
Security 1.0 (JSR 375)
 REST-based APIs
Management 2.0 (JSR 373)
 Flexible JMS MDBs
 Improved XA support
JMS 2.1 (JSR 368)
 Externalized configuration
 Multiple configuration sources
 Layering and overrides
Configuration
 Client-side health checking
Health Checking
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 22
Java EE 7
Connector JAXBJSP Debugging
Managed BeansJSPConcurrency EE Interceptors JAX-WS WebSocket
Bean Validation JASPIC ServletJMS JTADeployment
Batch JACCDependency
Injection JAXR JSTL Management
CDI EJB JAX-RPC Web ServicesJSF Java Persistence
JSON-PCommon
Annotations EL JAX-RS Web Services
MetadataJavaMail
CDI
JSON-P
Security
Bean Validation
JSF
JAX-RS
JSP
Servlet
Health CheckConfiguration
Java EE 8 (Revised Proposal, 2016)
JSON-B
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
• Update JSON-P spec to stay current with emerging standards (RFC 7159)
• Support for IETF standards on
– JSON Pointer (RFC 6901)
– JSON Patch (RFC 6902)
– JSON Merge Patch (RFC 7396)
• Add editing/transformation operations to JSON objects and arrays
• Support for a streaming API, together with Collectors
• Support for processing big JSON, e.g. add filters to JSON parsing.
23
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSON Pointer Sample
JsonArray dogs = . . .;
JsonPointer pointer =
Json.createPointer("/1/breed");
JsonValue breed =
pointer.getValue(dogs);
p.replace(dogs,
Json.createValue("English Bulldog"));
24
[
{
"name": "Cassidy",
"breed": "English Bulldog",
"age": 6
},
{
"name": "Falco",
"breed": "Pug",
"age": 4
}
]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSON Patch Sample
• Modify Parts of JSON document
• Patch is a JSON document itself
• Operations:
– Add, replace, remove, move, copy, test
25
[
{
"name": "Cassidy",
"breed": "English Bulldog",
"age": 6
},
{
"name": "Falco",
"breed": "Pug",
"age": 4
},
{
"name": "Funes",
"breed": "Frenchie",
"age": 2
}
]
[
{ "op": "replace",
"path": "/1/breed",
"value": "English Bulldog" },
{ "op": "remove",
"path": "/2" }
]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSON-B 1.0
• API to serialize/deserialize Java objects to/from JSON documents
– Similar to JAX-B
– Standardizes the current technologies (Jackson, Genson, Gson)
• Default mapping between classes and JSON
• Customization APIs
– Annotations (@JsonbProperty, @JsonbNillable)
– Runtime configuration builder
• Natural follow on to JSON-P
– Closes the JSON support gap
– Allows to change providers
26
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSON-B Sample
27
Dog dog1 = new Dog();
dog1.setName("Cassidy");
dog1.setBreed("English Bulldog");
dog1.setAge(6);
Dog dog2 = new Dog();
dog2.setName("Falco");
dog2.setBreed("English Bulldog");
dog2.setAge(4);
List<Dog> dogs = new ArrayList<>();
dogs.add(dog1);
dogs.add(dog2);
Jsonb jsonb = JsonbBuilder.create();
jsonb.toJson(dogs);
[
{
"name": "Cassidy",
"breed": "English Bulldog",
"age": 6
},
{
"name": "Falco",
"breed": "English Bulldog",
"age": 4
}
]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CDI 2.0
• Define behavior of CDI outside of a Java EE container
• Make CDI more modular to help other Java EE specs better integrate with it
– Core CDI
– CDI in Java SE
– CDI in Java EE
• API to bootstrap a CDI container in Java SE
• Observer ordering
• Asynchronous event firing
28
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JAX-RS 2.1
• Server-sent events
• Non-blocking I/O in providers (filters, interceptors…)
• Reactive programming paradigm to improve JAX-RS asynchronous clients
• Hypermedia API enhancements
• Integration with other JSRs and frameworks
• Circuit breakers
29
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
SSE – Server Code
30
@Path("tickers")
public class StockTicker {
@Resource ManagedExecutorService executor;
@GET @Produces("text/event-stream")
public EventOutput getQuotes() {
EventOutput output = new EventOutput();
executor.execute(() -> {
...
output.send(new StockQuote(...));
...
});
return output;
}
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
SSE – Client Code
31
WebTarget target = client.target("http://example.com/tickers");
EventSource eventSource = new EventSource(target) {
@Override
public void onEvent(InboundEvent inboundEvent) {
StockQuote quote = inboundEvent.readData(StockQuote.class);
...
}
};
eventSource.open();
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Servlet 4.0
• Support for HTTP/2
– Request/response multiplexing
– Server push
– Upgrade from HTTP 1.1
• Compatibility with latest HTTP 1.1 RFCs
• Smaller community-requested improvements (JIRA issues)
32
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSF 2.3
• Better CDI integration
• WebSocket integration
• Ajax method invocation
• Class-level Bean Validation
• Java Date/Time support
33
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE Security 1.0
• API for managing users and groups
• Simple security providers
• Support for password aliasing
• API for role mapping
• Metadata and API for authentication
• Interceptors for authorization, with CDI support
• OAuth and OpenID Connect support
• Secret management
34
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Simple Security Providers
35
@EmbedddedSecurityProvider({
@Credentials(username="user1", password="password", roles="admin"),
@Credentials(username="user2", password="password", roles="user")})
@DatabaseSecurityProvider(
lookup="java:global/MyDB",
userQuery="SELECT password FROM principals WHERE username=?",
rolesQuery="SELECT role FROM roles where username=?", ...)
@LdapSecurityProvider(url="...", dnPrefix="...", dnSuffix="...", ...)
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Bean Validation 2.0
• Constraints applied to collection elements
• Support for new Date/Time API
• Integration with Optional wrappers
• Repeatable annotations
• Additional features requested from community
36
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE Configuration
• Unified API
• Externalized configuration
• Support of multiple configuration sources
– Properties, xml and json
• Layering and overrides
• Optional configuration descriptor
• Dynamic configuration
• Integration with other Java EE frameworks
37
Java EE
Config
XML JSONprop
DBweb
Application
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java EE Configuration
• Unified API
• Externalized configuration
• Support of multiple configuration sources
– Properties, xml and json formats support out of the box
• Layering and overrides
38
Java EE 8
• Optional configuration descriptor
• Dynamic configuration
• Integration with other Java EE frameworks
Java EE 9
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
API
39
a=JavaOne
b=9
c=2016
Config config = ConfigProvider.getConfig();
// Returns "JavaOne"
String a = config.getProperty("a");
// Returns string "9"
String b = config.getProperty("b");
// Returns null
String notExists = config.getProperty("not.exist");
// Returns string "default"
String notExistsDefault = config.getProperty("not.exist","default");
// Returns number 2016
Long c = config.getProperty("c", Long.class);
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Defining Configuration Sources
40
• Using config.sources runtime parameter
• Using API
• Using config-sources.xml
java –jar my.jar –Dconfig.source=/cfg/config.json,http://shared/global.xml
Config config = ConfigProvider.builder()
.addSource(new FileSource("/cfg/config.json"), 200)
.addSource(new WebSource("http://shared/global.xml"), 100)
.build();
<config-sources>
<source>/cfg/config.json</source>
<source>http://shared/config.xml</source>
</config-sources>
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Health Check
• Standard health-check end-point
– <service>/management/health
– Services can choose to over-ride default location
• Define a format of health-check
– JSON, XML
• Health-check Java API
– Annotations
– Lightweight Java API
41
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Health Check Sample
42
public class MyHealthContributor {
// Variant example which does not take a HealthContext.
// Directly callable with REST
@HealthProvider
@Path("bar")
@GET
public Health contributeHealthSummary() {
Health health = new Health();
...
return health;
}
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Eventing API
• Make event producer and consumer as top level configurable, injectable
objects
• Be able to send and receive events synchronously and asynchronously
• Incorporate reactive style in API
– Use Java 9 Flow for batched asynchronous event sending
• Be able to programmatically start and stop asynchronous event consumer
• Provide pluggability of underlying messaging system
– Kafka, ZeroMQ, RabbitMQ
• Integration with Java EE Configuration API
43
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Eventing API Example
44
@Inject
@EventConfig(configkey="myeventconfig")
EventProducer producer;
public void someMethod() {
producer.sendEvent("My event: hello");
}
@Inject
@EventConfig(configkey="myeventconfig")
EventConsumer consumer;
public void someMethod() {
System.out.println(consumer.receiveEvent(1000L));
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Q & A
45
Java EE for the Cloud

Java EE for the Cloud

  • 1.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE for the Cloud Dmitry Kornilov JSONB/P Specification Lead Oracle @m0mus October 20, 2016
  • 2.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement 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
  • 3.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Program Agenda Road to Java EE 8 Proposed Shift in Focus Java EE 8 Revised Proposal Java EE 9 Proposal Q & A 1 2 3 4 3 5
  • 4.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Road to Java EE 8 4 J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 1999 2001 2003 2006 2009 2013 Servlet, JSP, EJB, JMS, JTA, RMI-IIOP EJB 2.0, JSTL, JAAS, JCA EJB 2.1, WebServices, JAXP, JSF, JMX, Deployment EJB 3.0, JPA, JAX-WS, JAXB, SAAJ, StAX JAX-RS, Servlet 3.0, EJB 3.1, JPA 2.0, CDI, BV JAX-RS 2.0, WebSocket, JSON-P, Concurrency, JMS 2.0
  • 5.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | 5 Java EE 8 Community Survey https://java.net/downloads/javaee-spec/JavaEE8_Community_Survey_Results.pdf
  • 6.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | 6 Java EE 7 Connector JAXBJSP Debugging Managed BeansJSPConcurrency EE Interceptors JAX-WS WebSocket Bean Validation JASPIC ServletJMS JTADeployment Batch JACCDependency Injection JAXR JSTL Management CDI EJB JAX-RPC Web ServicesJSF Java Persistence JSON-PCommon Annotations EL JAX-RS Web Services MetadataJavaMail CDI JSON-P MVC Bean Validation JSF JAX-RS JSP Servlet Java EE 8 (Original Proposal, 2014) JSON-B Security
  • 7.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | “The world has changed. I see it in the water. I feel it in the Earth. I smell it in the air...” – J.R.R. Tolkien 7
  • 8.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE - Available On Premise and in the Cloud 10/20/2016 Confidential – Oracle 8 Cloud On Premise WebSphere WebLogic Red Hat JBoss 8Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Choice of Implementations
  • 9.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE APIs - Backbone of Leading Open Source Projects 9 Java EE Containers Microservices Web Containers Web Frameworks PaaSREST
  • 10.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | 10 Java EE + Cloud• More demanding business requirements • Move to the Cloud for agility & flexibility • Shift from physical infrastructure to virtual • Microservices vs. monolithic applications • Runtime packaged with applications
  • 11.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Cloud Development Heterogeneous Clients • Mobile, REST, HTML5 Stateless Services • Managed and scaled independently Data Sources • Relational, non-relational User profile service Order service Partner service Catalog service Notification service Import service HTTP/2 REST JSON XHR Event JAX-RS/JSON Notifications JAX-WS RDBMS NoSQL DB TSDBData Streams Time SeriesEventsKey ValueJDBC 11
  • 12.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | It's Confusing! 12 Too many choices... Which components? Overall architecture? Standards? Vendor commitment?
  • 13.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Proposed Enhancements to Java EE • New AppDev style for Cloud and Microservices • Build on proven technologies • Comprehensive – Programming Model, Packaging, Portability • Standards-based – This is a proposal only – Will work with the community and follow the JCP process 13
  • 14.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Designed for Agility and Scalability with Security • Programming Model – Reactive programming – Unified event model • Eventual Consistency – Automatically event out changes to observed data structures – Data sources with manageable consistency • NoSQL – Persistence and query interface for Key Value and Document DB • Security – Support of OAuth2, OpenID Connect – Secret management 14 App App App App
  • 15.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Location Transparency and Resiliency • Configuration – Externalized configuration – Multiple configuration sources • State – API for external state • Resiliency – Circuit breakers – Health check API 15 Reliability, Monitoring Container Management Scheduling & Elastic Scaling Key Value Database Logging Configuration State Security Notification User profile service Order service Catalog service
  • 16.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Packaging and Simplicity • Packaging – Package applications, runtimes into containers – Standalone immutable executable binary – Multi-artifact archives – Leveraging Java 9 module system • Serverless – Ephemeral instantiation • Multitenancy – Increased density – Tenant-aware 16 App Server Order service App Server Catalog service
  • 17.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Recent Java EE 7 compatibility updates: Congratulations!Technical Focus Areas 17  Extend for reactive programming  Unified event model  Event messaging API  JAX-RS, HTTP/2, Lambda, JSON-B, ... Programming Model  API to store externalized state  Automatically event out changes to observed data structures  Extension to support client-side circuit breakers  Resilient commands  Standardize on client-side format for reporting health  New spec – interfaces, packaging format, manifest  Ephemeral instantiation  Secret management  OAuth  OpenID  Package applications, runtimes into services  Standalone immutable executable binary  Multi-artifact archives  Increased density  Tenant-aware routing and deployment  Externalize configuration  Unified API for accessing configuration  Persistence and query interface for key value and document DB Key Value/Doc Store Configuration Resiliency Packaging Eventual Consistency Serverless Multitenancy State Security
  • 18.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | 18 Engage Java EE Community • Feedback through Survey • Launch Java EE Next JSRs 2016 Java EE 8 • Specs, RI, TCK complete • Initial microservices support • Define Java EE 9 • Early access implementation of Java EE 9 Java EE 9 • Specs, RI, TCK complete • Modular Java EE runtime • Enhanced microservices support Java EE Roadmap 2017 2018
  • 19.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | We Are Hiring • Senior Java Developer – Work on JAX-RS, HTTP/2 and Servlet projects – Participate in specifications development – Working on Reference Implementations and TCKs – Participate in community reviews, forums, mailing lists – Strong experience in Java and Java EE (5+ years) – Full description • Contacts – dmitry.kornilov@oracle.com 19
  • 20.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | We Need Your Feedback 20 Take the Java Community Survey http://glassfish.org/survey
  • 21.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE 8 Revised Proposal 21  JSON <-> object mapping JSON-B 1.0 (JSR 367) No Change Proposed to Drop Proposed to Add  JSON Pointer  JSON Patch  Java 8 Lambda support JSON-P 1.1 (JSR 374)  Reactive enhancements  Server-sent events  Non-blocking I/O  Client-side circuit breakers JAX-RS 2.1 (JSR 370)  HTTP/2 support Servlet 4.0 (JSR 369)  Small-scale new features  Community-driven improvements JSF 2.3 (JSR 372)  Action-based MVC framework MVC 1.0 (JSR 371)  Bootstrap API for Java SE  Asynchronous events  Observer ordering CDI 2.0 (JSR 365)  Collection constraints  Date/Time support  Community-requested features Bean Validation 2.0 (JSR 380)  Authentication/authorization APIs  OAuth support  OpenID support  Secret management Security 1.0 (JSR 375)  REST-based APIs Management 2.0 (JSR 373)  Flexible JMS MDBs  Improved XA support JMS 2.1 (JSR 368)  Externalized configuration  Multiple configuration sources  Layering and overrides Configuration  Client-side health checking Health Checking
  • 22.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | 22 Java EE 7 Connector JAXBJSP Debugging Managed BeansJSPConcurrency EE Interceptors JAX-WS WebSocket Bean Validation JASPIC ServletJMS JTADeployment Batch JACCDependency Injection JAXR JSTL Management CDI EJB JAX-RPC Web ServicesJSF Java Persistence JSON-PCommon Annotations EL JAX-RS Web Services MetadataJavaMail CDI JSON-P Security Bean Validation JSF JAX-RS JSP Servlet Health CheckConfiguration Java EE 8 (Revised Proposal, 2016) JSON-B
  • 23.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSON-P 1.1 • Update JSON-P spec to stay current with emerging standards (RFC 7159) • Support for IETF standards on – JSON Pointer (RFC 6901) – JSON Patch (RFC 6902) – JSON Merge Patch (RFC 7396) • Add editing/transformation operations to JSON objects and arrays • Support for a streaming API, together with Collectors • Support for processing big JSON, e.g. add filters to JSON parsing. 23
  • 24.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSON Pointer Sample JsonArray dogs = . . .; JsonPointer pointer = Json.createPointer("/1/breed"); JsonValue breed = pointer.getValue(dogs); p.replace(dogs, Json.createValue("English Bulldog")); 24 [ { "name": "Cassidy", "breed": "English Bulldog", "age": 6 }, { "name": "Falco", "breed": "Pug", "age": 4 } ]
  • 25.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSON Patch Sample • Modify Parts of JSON document • Patch is a JSON document itself • Operations: – Add, replace, remove, move, copy, test 25 [ { "name": "Cassidy", "breed": "English Bulldog", "age": 6 }, { "name": "Falco", "breed": "Pug", "age": 4 }, { "name": "Funes", "breed": "Frenchie", "age": 2 } ] [ { "op": "replace", "path": "/1/breed", "value": "English Bulldog" }, { "op": "remove", "path": "/2" } ]
  • 26.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSON-B 1.0 • API to serialize/deserialize Java objects to/from JSON documents – Similar to JAX-B – Standardizes the current technologies (Jackson, Genson, Gson) • Default mapping between classes and JSON • Customization APIs – Annotations (@JsonbProperty, @JsonbNillable) – Runtime configuration builder • Natural follow on to JSON-P – Closes the JSON support gap – Allows to change providers 26
  • 27.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSON-B Sample 27 Dog dog1 = new Dog(); dog1.setName("Cassidy"); dog1.setBreed("English Bulldog"); dog1.setAge(6); Dog dog2 = new Dog(); dog2.setName("Falco"); dog2.setBreed("English Bulldog"); dog2.setAge(4); List<Dog> dogs = new ArrayList<>(); dogs.add(dog1); dogs.add(dog2); Jsonb jsonb = JsonbBuilder.create(); jsonb.toJson(dogs); [ { "name": "Cassidy", "breed": "English Bulldog", "age": 6 }, { "name": "Falco", "breed": "English Bulldog", "age": 4 } ]
  • 28.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | CDI 2.0 • Define behavior of CDI outside of a Java EE container • Make CDI more modular to help other Java EE specs better integrate with it – Core CDI – CDI in Java SE – CDI in Java EE • API to bootstrap a CDI container in Java SE • Observer ordering • Asynchronous event firing 28
  • 29.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JAX-RS 2.1 • Server-sent events • Non-blocking I/O in providers (filters, interceptors…) • Reactive programming paradigm to improve JAX-RS asynchronous clients • Hypermedia API enhancements • Integration with other JSRs and frameworks • Circuit breakers 29
  • 30.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | SSE – Server Code 30 @Path("tickers") public class StockTicker { @Resource ManagedExecutorService executor; @GET @Produces("text/event-stream") public EventOutput getQuotes() { EventOutput output = new EventOutput(); executor.execute(() -> { ... output.send(new StockQuote(...)); ... }); return output; } }
  • 31.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | SSE – Client Code 31 WebTarget target = client.target("http://example.com/tickers"); EventSource eventSource = new EventSource(target) { @Override public void onEvent(InboundEvent inboundEvent) { StockQuote quote = inboundEvent.readData(StockQuote.class); ... } }; eventSource.open();
  • 32.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Servlet 4.0 • Support for HTTP/2 – Request/response multiplexing – Server push – Upgrade from HTTP 1.1 • Compatibility with latest HTTP 1.1 RFCs • Smaller community-requested improvements (JIRA issues) 32
  • 33.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | JSF 2.3 • Better CDI integration • WebSocket integration • Ajax method invocation • Class-level Bean Validation • Java Date/Time support 33
  • 34.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE Security 1.0 • API for managing users and groups • Simple security providers • Support for password aliasing • API for role mapping • Metadata and API for authentication • Interceptors for authorization, with CDI support • OAuth and OpenID Connect support • Secret management 34
  • 35.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Simple Security Providers 35 @EmbedddedSecurityProvider({ @Credentials(username="user1", password="password", roles="admin"), @Credentials(username="user2", password="password", roles="user")}) @DatabaseSecurityProvider( lookup="java:global/MyDB", userQuery="SELECT password FROM principals WHERE username=?", rolesQuery="SELECT role FROM roles where username=?", ...) @LdapSecurityProvider(url="...", dnPrefix="...", dnSuffix="...", ...)
  • 36.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Bean Validation 2.0 • Constraints applied to collection elements • Support for new Date/Time API • Integration with Optional wrappers • Repeatable annotations • Additional features requested from community 36
  • 37.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE Configuration • Unified API • Externalized configuration • Support of multiple configuration sources – Properties, xml and json • Layering and overrides • Optional configuration descriptor • Dynamic configuration • Integration with other Java EE frameworks 37 Java EE Config XML JSONprop DBweb Application
  • 38.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Java EE Configuration • Unified API • Externalized configuration • Support of multiple configuration sources – Properties, xml and json formats support out of the box • Layering and overrides 38 Java EE 8 • Optional configuration descriptor • Dynamic configuration • Integration with other Java EE frameworks Java EE 9
  • 39.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | API 39 a=JavaOne b=9 c=2016 Config config = ConfigProvider.getConfig(); // Returns "JavaOne" String a = config.getProperty("a"); // Returns string "9" String b = config.getProperty("b"); // Returns null String notExists = config.getProperty("not.exist"); // Returns string "default" String notExistsDefault = config.getProperty("not.exist","default"); // Returns number 2016 Long c = config.getProperty("c", Long.class);
  • 40.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Defining Configuration Sources 40 • Using config.sources runtime parameter • Using API • Using config-sources.xml java –jar my.jar –Dconfig.source=/cfg/config.json,http://shared/global.xml Config config = ConfigProvider.builder() .addSource(new FileSource("/cfg/config.json"), 200) .addSource(new WebSource("http://shared/global.xml"), 100) .build(); <config-sources> <source>/cfg/config.json</source> <source>http://shared/config.xml</source> </config-sources>
  • 41.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Health Check • Standard health-check end-point – <service>/management/health – Services can choose to over-ride default location • Define a format of health-check – JSON, XML • Health-check Java API – Annotations – Lightweight Java API 41
  • 42.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Health Check Sample 42 public class MyHealthContributor { // Variant example which does not take a HealthContext. // Directly callable with REST @HealthProvider @Path("bar") @GET public Health contributeHealthSummary() { Health health = new Health(); ... return health; } }
  • 43.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Eventing API • Make event producer and consumer as top level configurable, injectable objects • Be able to send and receive events synchronously and asynchronously • Incorporate reactive style in API – Use Java 9 Flow for batched asynchronous event sending • Be able to programmatically start and stop asynchronous event consumer • Provide pluggability of underlying messaging system – Kafka, ZeroMQ, RabbitMQ • Integration with Java EE Configuration API 43
  • 44.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Eventing API Example 44 @Inject @EventConfig(configkey="myeventconfig") EventProducer producer; public void someMethod() { producer.sendEvent("My event: hello"); } @Inject @EventConfig(configkey="myeventconfig") EventConsumer consumer; public void someMethod() { System.out.println(consumer.receiveEvent(1000L)); }
  • 45.
    Copyright © 2016,Oracle and/or its affiliates. All rights reserved. | Q & A 45

Editor's Notes

  • #12 Let’s take a look at the cloud development model. When you look at it you more likely to see heterogeneous set of clients. They are applications on mobile phones, tablets and desktops using various of javascript and HTML5 frameworks using REST, HTTP or XML for communication with backends. Traditional RDMSes are used as a storage. Or many people started to use NoSQL databases, data streams or some other options are there. In between there is a collection of services (microservices). Typically, they are stateless. What developers want is an ability to manage their lifecycle independently. Not relying on some other person who is in charge of your AS administration. And you also want to scale them independently according to business needs.