Download - Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

Transcript
Page 1: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

The Java EE 7 Platform: Developing for the Cloud Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta

Page 2: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

2 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 6 Implementations Fastest implementations of a Java EE release ever!

Page 3: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

3 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE – Developer Adoption

0  5  

10  15  20  25  30  35  40  45  

FY  06   FY  07   FY  08   FY  09   FY  10   FY  11   FY  12  

Millions  

Downloads   40 Million+

Page 4: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

4 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7

Page 5: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

5 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Today’s Cloud Offerings Are Vendor-Specific

Infrastructure as a Service

Platform as a Service

Software as a Service

Page 6: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

6 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Focus: Platform as a Service

•  Provide way for customers and users to leverage public, private, and hybrid clouds

•  PaaS support entails evolutionary change

• Next logical step for Java EE –  J2EE à Java EE 6 : The Java EE Platform provides services –  Java EE 7 : The Java EE Platform IS a service

Page 7: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

7 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 PaaS Roadmap

• Define new platform roles to accommodate PaaS model •  Add metadata

–  For service provisioning and configuration –  For QoS, elasticity –  For sharing of applications and resources –  For (re)configurability and customization

•  Add useful APIs for cloud environment –  JAX-RS client API, Caching API, State Management, JSON,…

•  Extend existing APIs with support for multi-tenancy

Page 8: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

8 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Roles

Developer

PaaS Customer/

Tenant

Application Submitter

Application Administrator

PaaS Provider

PaaS Product Provider

PaaS Account Manager

PaaS Administrator

Deployer

Tenant 1 Tenant 2 Tenant 3

Machine

JVM

JVM

JVM

Machine

JVM

JVM

JVM

Machine

JVM

JVM

JVM

Machine

JVM

JVM

JVM

Machine

JVM

JVM

JVM

Machine

JVM

JVM

JVM

Page 9: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

9 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Focus Area: Cloud Services, Not Just APIs

•  In the cloud tenant applications consume services

•  PaaS administrators host, configure, and manage application and infrastructure services

•  Existing APIs in Java EE need to be updated to be service-enabled and tenant-aware –  Example: pluggable services, late binding

and tenant id injection

Queuing Service

Persistence Service

Caching Service

Security Service

Infrastructure as a Service

Platform as a Service - Services

Provisioning Service

File Service

PaaS Infrastructure Services

Java EE Application Level Services

Tenant App Tenant App Tenant App

Virt VIP VLAN Volume LBR

IaaS Infrastructure Services

Page 10: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

10 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Old Java EE model

•  Configure Java EE resources – JDBC, JMS etc

•  Deploy Application EAR

Database Service 1  

2  

4  

5  

LDAP Service

Provision and Initialize

Provision and Initialize

Provision and Initialize

Provision and Initialize

3  

Messaging Service

Application Container

Deploy Application (EAR/GAR/SAR …)

Page 11: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

11 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Model: Auto-Provision Services from Application Dependencies

•  Provision and deploy application resources (e.g. LDAP stripe, data source instantiation and connection …) •  Extensible Deployment Models

Supporting Multiple Frameworks •  Spring, Seam, Play …

Database Service

Cloud Administration Service 1  

2  

4  

5  

LDAP Service

Provision and Initialize

Provision and Initialize

Provision and Initialize

Provision and Initialize

3  

Messaging Service

Application Container Deploy Application (EAR/

GAR/SAR …)

Page 12: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

12 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Services

• Cloud apps consume services – Persistence, queueing, mail, caching, …

•  Service metadata facilitates ease of use when deploying into the cloud @DataSourceDefinition( name=“java:app/jdbc/myDB”, className=“oracle.jdbc.pool.OracleDataSource”, isolationLevel=TRANSACTION_REPEATABLE_READ, initialPoolSize=5 )

Page 13: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

13 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Services

• Cloud apps consume services – Persistence, queueing, mail, caching, …

•  Service metadata facilitates ease of use when deploying into the cloud @JMSConnectionFactory ( name=“java:app/myJMSConnectionFactory”, resourceType=“javax.jms.QueueConnectionFactory”) @JMSDestination( name=“java:app/myQueue”, resourceType=“javax.jms.Queue”)

Page 14: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

14 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Services

• Cloud apps consume services – Persistence, queueing, mail, caching, …

•  Service metadata facilitates ease of use when deploying into the cloud @MailSession ( name=“java:app/mailSession”, from=“[email protected]” )

Page 15: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

15 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Services

• Cloud apps consume services – Persistence, queueing, mail, caching, …

•  Service metadata facilitates ease of use when deploying into the cloud @ConnectorService ( name=“java:app/myCustomConnector”, type=“com.extraServices.customConnector.class”, properties = {…} )

Page 16: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

16 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Focus Area: Elasticity

•  Service Levels • Minimum and Maximum Instances •  Futures – Self Adjustment, Capacity On Demand

Elasticity Continuum

Single node Non-Elastic

Dynamic Self Adjusting SLA Driven Elasticity

Java EE Multi-Node Multi-Instance Clustering

Java EE 7 Focus: Move the Bar Right

Java EE Cluster Ca

Elastic Cluster Capacity

on Demand

Elastic Cluster

Page 17: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

17 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Example Scenario

“A software company writes an application, submits it to a PaaS provider, then any number of tenants sign up for the application, deploy it, their end users access it”

Page 18: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

18 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (1) DiabloCloud  SimplyCRM  

Page 19: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

19 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (2) SimplyCRM  

Applica3on  Developer  

App

Writes

DiabloCloud  

Page 20: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

20 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (3)

PaaS  Account  Manager  PaaS  Customer  Signs up as a customer

SimplyCRM   DiabloCloud  

Page 21: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

21 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (4)

Application Submitter

App

Submits the application System  Administrator  

SimplyCRM   DiabloCloud  

Page 22: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

22 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (5) ExtraServices  

App Discovers

DiabloCloud  

Page 23: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

23 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (6)

PaaS  Customer  Signs up as a customer

DiabloCloud  ExtraServices  

PaaS  Account  Manager  

App

Page 24: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

24 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

App

Walkthrough (7)

Deployer  Customizes and deploys the application

DiabloCloud  ExtraServices  

System  Administrator  

Page 25: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

25 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

App

Walkthrough (8)

Provisions on Cloud

infrastructure

DiabloCloud  ExtraServices  

System  Administrator  Deployer  

Page 26: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

26 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (9)

Provisioned and Deployed App

DiabloCloud  ExtraServices  

System  Administrator  Deployer  

Page 27: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

27 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (10)

End-­‐Users  Access the application

DiabloCloud  ExtraServices  

Provisioned and Deployed App

Page 28: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

28 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (11)

End-­‐Users   Access the application

Administrator   Administers the application

DiabloCloud  ExtraServices  

Provisioned and Deployed App

Page 29: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

29 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Walkthrough (12)

Monitors

DiabloCloud  ExtraServices  

System  Administrator  

End-­‐Users   Access the application

Administrator   Administers the application

Provisioned and Deployed App

Page 30: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

30 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Demo PaaSing a Java EE Application in the Cloud

Page 31: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

31 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Conference Planning in the Cloud

Java EE Application

Deploy

EJB Services Metadata

JSF JPA

http://glassfish.org/javaone2011

<glassfish-services> <service-description init-type="LB" name="ConferencePlanner-lb"> <template id="LBNative"/> <configurations> <configuration name="https-port" value="50443"/> <configuration name="ssl-enabled" value="false"/> <configuration name="http-port" value="50080"/> </configurations></service-description> <service-description init-type="JavaEE" name="ConferencePlanner"> <characteristics> <characteristic name="service-type" value="JavaEE"/> </characteristics> <configurations> <configuration name="max.clustersize" value="4"/> <configuration name="min.clustersize" value="2"/> </configurations> </service-description> . . . </glassfish-services>

Page 32: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

32 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Service Provisioning

Database

Java EE Java EE Java EE . . .

Load Balancer

Page 33: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

33 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Multi-tenancy in Java EE 7

•  Support for separate isolated instances of the same app for different tenants –  One application instance per tenant –  Tenants correspond to units of isolation –  Multitenant apps are declared as such –  Each instance customized and deployed for a single tenant –  Limited form of SaaS

•  Mapping to tenant done by the container

•  Tenant id available to application –  E.g., under java:comp/tenantId or by injection

Page 34: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

34 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Focus Area: Application Level Multi Tenancy

@Entity  @Table(name=“EMP”)  @MultiTenant(SINGLE_TABLE)  @TenantDiscriminator(name=“company-­‐id”,  columnName=“COMPANY”)  public  class  Employee  {  

•  Goal: Simple configuration •  Flexible tenant discriminator support •  Other areas impacted - JNDI, JMS, EJB …

EMP

EMP_ID VERSION F_NAME L_NAME GENDER DEPT_ID

1 1 John Doe M 1

2 3 Jane Doe F 2

SELECT  *  FROM  EMPLOYEE  WHERE  L_NAME  LIKE  ‘D%’  AND  DEPT_ID=  1  

DEPT_ID depart_id

Page 35: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

35 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Persistence Layer

• Dedicated App, Dedicated Database •  Shared App, Dedicated Database • Dedicated App, Shared Database •  Shared App, Shared Database

Multi-tenant Taxonomies

Page 36: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

36 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Dedicated App, Dedicated Database Persistence Layer Multi-Tenant Taxonomies

App is configured for tenant-id at bootstrap and connects to

the data source

Page 37: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

37 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Shared App, Dedicated Database Persistence Layer Multi-Tenant Taxonomies

App knows tenant-id and connects with the tenant-specific

data source

Page 38: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

38 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Dedicated App, Shared Database Persistence Layer Multi-Tenant Taxonomies

Tenant-id configured at bootstrap and connects to tenant-specific table

or striped table

Page 39: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

39 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Shared App, Shared Database Persistence Layer Multi-Tenant Taxonomies

App knows tenant-id and connects to tenant specific

table or striped table

Page 40: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

40 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 Is Not Just Cloud-y

•  Alignment of ManagedBeans across CDI, EJB, JSF,… –  POJO à ManagedBean à Enterprise JavaBean –  Extension of container-managed transactions beyond EJB

•  Further simplifications for ease-of-development –  JMS 2.0 focus on ease-of-development –  Expanded use of dependency injection –  Expanded service metadata; improved configuration

•  Pruning –  EJB CMP and BMP, JAX-RPC, Deployment API

•  Update to Web Profile

Page 41: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

41 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Java EE 7 – Candidate JSRs

JPA 2.1, JTA 1.1

Managed Beans 1.0 EJB 3.2

CDI 1.1 / Interceptors 1.1 / JSR 250 1.1

Servlet 3.1

CDI Extensions

JSP 2.2 EL 3.0 JSF 2.2 JAX-RS

2.0 Web

Conainer Extensions

Bea

n Va

lidat

ion

1.1

JMS 2.0

Jcache 1.0 (JSR 107)

Concurrency Utilities 1.0

State Management 1.0

Batch Processing 1.0

JSON 1.0

Page 42: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

42 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Transparency

• Our Java EE 7 JSRs are run in the open on java.net –  http://javaee-spec.java.net – One project per spec – e.g., jpa-spec, jax-rs-spec, jms-spec…

•  Publicly viewable Expert Group mail archive – Users observer list gets copies of all Expert Group emails

•  Publicly viewable download area •  Publicly viewable issue tracker • Commitment to match JCP 2.8 Process

Page 43: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

43 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Status and Schedule

• Nearly all JSRs up and running

• Remaining ones to be filed in next few weeks

•  Final release target: Q3 2012

• Date-driven release: anything not ready will be deferred to Java EE 8

Page 44: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

44 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

How to Get in the Loop

•  Java EE 7 Expert Group Project

– http://javaee-spec.java.net

•  Java EE 7 Reference Implementation

– http://glassfish.org

•  The Aquarium

– http://blogs.oracle.com/theaquarium

Page 45: Java EE | Java EE 7: Developing for the Cloud | Arun Gupta

45 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

The Java EE 7 Platform: Developing for the Cloud Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta