You are on page 1of 54

For Oracle employees and authorized partners only. Do not distribute to third parties.

© 2012 Oracle Corporation – Proprietary and Confidential


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.
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Oracle Training Materials – Usage
Agreement
Use of this Site (“Site”) or Materials constitutes agreement with the following terms and conditions:

1. Oracle Corporation (“Oracle”) is pleased to allow its business partner (“Partner”) to download and copy the information,
documents, and the online training courses (collectively, “Materials") found on this Site. The use of the Materials is
restricted to the non-commercial, internal training of the Partner’s employees only. The Materials may not be used for
training, promotion, or sales to customers or other partners or third parties.

2. All the Materials are trademarks of Oracle and are proprietary information of Oracle. Partner or other third party at no time
has any right to resell, redistribute or create derivative works from the Materials.

3. Oracle disclaims any warranties or representations as to the accuracy or completeness of any Materials. Materials are
provided "as is" without warranty of any kind, either express or implied, including without limitation warranties of
merchantability, fitness for a particular purpose, and non-infringement.

4. Under no circumstances shall Oracle or the Oracle Authorized Boot Camp Training Partner be liable for any loss,
damage, liability or expense incurred or suffered which is claimed to have resulted from use of this Site of Materials. As a
condition of use of the Materials, Partner agrees to indemnify Oracle from and against any and all actions, claims, losses,
damages, liabilities and expenses (including reasonable attorneys' fees) arising out of Partner’s use of the Materials.

5. Reference materials including but not limited to those identified in the Boot Camp manifest can not be redistributed in any
format without Oracle written consent.

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
<Insert Picture Here>

Oracle WebLogic Server 12c


Implementation Boot Camp
Oracle and Java
Servers Desktop Embedded TV Mobile Card
BD-J
Key APIs Java EE JavaFX Java TV MSA

Platform Java SE Java ME Java Card

Language Java Language


Java Platform

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java Scorecard 2011: Technology
Result
 JDK 7
Java SE
 JRockit released gratis under same license as JDK
Java EE  GlassFish 3.1.1
 Java EE 7 specification development underway
 Java FX 2.0
Java FX
 Java FX 2.0 for Mac OS X Developer Preview
 Oracle Java Wireless Client 3.0
Java ME/  Oracle Java Embedded Client 1.0
Embedded  Java SE for Embedded 7
 Java ME SDK 3.0.5 and LWUIT 1.5

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java Scorecard 2011: Technology
Result
 JDK 7 for Mac OS X
Java SE  JDK 7
 JRockit released gratis under same license as JDK
Java EE  GlassFish 3.1.1
 Java EE 7 specification development underway
 Java FX 2.0
Java FX
 Java FX 2.0 for Mac OS X Developer Preview
 Oracle Java Wireless Client 3.0
Java ME/  Oracle Java Embedded Client 1.0
Embedded  Java SE for Embedded 7
 Java ME SDK 3.0.5 and LWUIT 1.5

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java Scorecard 2011: Oracle Leadership

Result
 Successfully integrated Java development teams
Ongoing
 Launched global JavaOne: Brazil, China, Russia, India
Investment
 Reinvigorated flagship JavaOne 2011

 Oracle launches Java Magazine (over 50k subscriptions)


Community  Over 80 Java Developer Days held around the world
Outreach  Java evangelist team reaches 80k developers @ 170 events
 Over 250k Java Podcast downloads

 JDK downloads up 91% Year over Year


 Over 1 million active NetBeans users
Validation
 Increase of TV devices running Java from 80 million to 115 million
 Over 45,000 Java ME applications

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JDK Roadmap
JDK 7u6
• OS X JRE port
NetBeans 7 (for end-users) NetBeans.next
• Java SE 7 JDK 7u2 • Improved OS • Java SE 8 support
support JDK 7 • JRE 7 on java.com Last public integration, • JavaFX 3.0 support
• more • JavaFX 2.0 co-install JDK 6 update auto-update • more

2011 2012 2013 2014

Mac OS X JDK 7u4 JDK 8


• JDK 7 Dev Preview • OS X JDK Port • Windows, Linux,
• JavaFX 2.0 Dev Preview (for developers) Solaris, OS X
• Jigsaw
• Lambda
NetBeans 7.1 • JavaFX 3.0
• JavaFX 2.0 support • Complete Oracle JVM
convergence
• JavaScript interop
• more

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JAVA SE 7
Java SE 7 Release Contents
• Java Language
• Project Coin (JSR-334)
• Class Libraries
• NIO2 (JSR-203)
• Fork-Join framework, ParallelArray (JSR-166y)
• Java Virtual Machine
• The DaVinci Machine project (JSR-292)
• InvokeDynamic bytecode
• Miscellaneous things
• JSR-336: Java SE 7 Release Contents
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Discriminating Strings Today
int monthNameToDays(String s, int year) {

if("April".equals(s) || "June".equals(s) ||
"September".equals(s) ||"November".equals(s))
return 30;

if("January".equals(s) || "March".equals(s) ||
"May".equals(s) || "July".equals(s) ||
"August".equals(s) || "December".equals(s))
return 31;

if("February".equals(s))
...
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Strings in Switch Statements
int monthNameToDays(String s, int year) {
switch(s) {
case "April": case "June":
case "September": case "November":
return 30;

case "January": case "March":


case "May": case "July":
case "August": case "December":
return 31;
Did you know it produces generally
more efficient byte codes than an if-
case "February”:
... then-else statement? Case
default: Sensitive!
... For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Automatic Resource Management
try (InputStream in = new FileInputStream(src),
OutputStream out = new FileOutputStream(dest))
{
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
}
• New superinterface java.lang.AutoCloseable
• All AutoCloseable (throws Exception) and by extension
java.io.Closeable (throws IOException) types useable with try-
with-resources
• Anything with a void close() method is a candidate
• JDBC 4.1 retrofitted as AutoCloseable too
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Multi-Catch
try {
...
} catch (ClassCastException e) {
doSomethingClever(e);
throw e;
} catch(InstantiationException |
NoSuchMethodException |
InvocationTargetException e) {
// Useful if you do generic actions
log(e);
throw e;
}
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Diamond Operator works many ways…
• With diamond (<>) compiler infers type

List<String> strList = new ArrayList<>();

OR

List<Map<String, List<String>> strList =


new ArrayList<>();

OR

Foo<Bar> foo = new Foo<>();


foo.mergeFoo(new Foo<>());

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JDBC 4.1
• Try-with-resources statement to automatically close resources of
type Connection, ResultSet, and Statement
• try (Statement stmt = con.createStatement()) { // ... }
• RowSet 1.1 introduces RowSetFactory and RowSetProvider

• //Factory options (impl) set on cmd line or metainf


• myRowSetFactory = RowSetProvider.newFactory();
• jdbcRs = myRowSetFactory.createJdbcRowSet();
• jdbcRs.setUrl("jdbc:myDriver:myAttribute"); //etc
• jdbcRs.setCommand("select COF_NAME, SUP_ID, PRICE, SALES,
TOTAL from COFFEES");
• jdbcRs.execute();

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java 8
Java SE Vision – Beyond JDK 8
• Multi-language JVM
Interoperability • Improved Java/Native integration

• Multi-tenancy support
Cloud • Resource management

• Self-tuning JVM
Ease of Use • Language enhancements

Advanced • Unified type system


Optimizations • Data structure optimizations

Works Everywhere • Scale down to embedded, up to massive servers


and with Everything • Support for heterogenuous compute models

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE
Java EE
 Scalable and maintainable enterprise apps
 Container vs. Developer
 Life-cycle, resource injection, security, ...
 Portable code
 Portable skills
 Vendor independence
 Industry standard
 large developer community,
 books, training, best practices, consultants, ...

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Introduction to Java EE
What is Java EE?
Designed to help developers create large-scale, multi-tiered,
scalable, reliable, and secure network applications
Source: Oracle Introduction to J2EE

Client Tier
• Handles user requests and communicates with the
business tier
• e.g. Web browser, Java or other application
Web Tier
• Handles the interaction between clients and the
business tier
• EE technologies include Servlets, Java Server
Pages (JSPs), Expression Language (EL) and Java
Server Faces (JSF)
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Introduction to Java EE
The Tiers (continued)
Business Tier
• Consists of components that provide the business
logic
• Core functionality should exist in business tier
components
• EE technologies include Enterprise JavaBeans
(EJBs) and Web Services (JAX-WS)
Enterprise Information System (EIS) Tier
• Consists of database servers, enterprise resource
planning systems, and other legacy data sources
• EE technologies include Java Database Connectivity
API (JDBC), Java Persistence API (JPA), and Java
Transaction API (JTA)

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Introduction to Java EE
The Java EE Server
A Java EE Server such as WebLogic Server implements the Java EE platform APIs and
provides the standard Java EE services
The specification defines the server’s contract
using the term container
The Web Container
• Interface between web components and the
web server – runs in J2EE server
The EJB Container
• Manages the execution of an application's
enterprise beans – runs in J2EE server
The Application Client Container
• Interface between Java SE applications and
Java EE resources
• Runs on client machine
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Enterprise Java Beans
EJBs
• Hosted components that encapsulate business logic

• Session Beans
• Synchronous request/reply processing
• EJB 3.1 introduces an asynchronous option, but this is for exceptional
use cases
• Stateless – no state retained on server
• Stateful – state not persisted, but kept for life of client session

• Message Driven Beans (MDB)


• Asynchronous, message-oriented processing

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Enterprise Java Beans
EJBs

EJBs have a well defined life-cycle


Example for Stateless Session Bean

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Servlets
• Web-Tier request/response protocol handler
• Commonly used to provide HTTP functionality
• The javax.servlet and javax.servlet.http packages
provide interfaces
• Interface defines common methods and objects used to
interact with the server
• doGet(HttpServletRequest req,
HttpServletResponse resp)
• Allows Java programmers to quickly develop web application
without worrying about underlying complexities

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java Server Pages
JSPs
• Simple and fast way to create dynamic web pages
• Consists of HTML with Java annotations
• Allows control of look and feel using corporate CCS or designs
• Processed on the server and the resulting page delivered to
the requestor
• Libraries of ‘tags’ are available, including Java Standard Tag
Library (JSTL)
• Expression Language (EL) used to access data objects in
JSPs

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Introduction to Java EE
Deployment

• JEE applications are composed of multiple modules


• A Web Application Archive (WAR) contains web components
• An Enterprise Archive (EAR) contains application, including
libraries and may contain WAR files
• Libraries of Java components are contained in Java Archives
(JAR)
• WARs and EARs will contain deployment descriptors – XML
documents to configure the JEE modules

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Example WAR Package

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE 6
•Embrace Open
Source Frameworks
•Drag & drop
•Web Profile Flexible & framework installation
•Pruning Lightweight Extensible

Java EE

Developer
Productivity
•More annotations
•More POJOs
•Less XML
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE 6 Overview
 New features
 Web Profile, REST, managed beans,
standard dependency injection, validation
 Enhanced APIs
 EJB 3.1, JSF 2.0, JPA 2.0, Servlet 3.0
 More ease of use
 Optional XML, simpler packaging, extensibility
 Usable “as is”
 The end of the 100's MB .war
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE, a brief History
Right-sizing
Ease of Java EE 6
development EJB 3.1
Java EE 5 JPA 2.0
Web Services Servlet 3.0
J2EE 1.4 JSF 2.0
Robust
JAX-RS 1.1
Scalable
Enterprise CDI 1.0
Application J2EE 1.3 @Inject
J2EE 1.2 WebValidat°
Bean Profile
Annotations
Servlet EJB 3
JSP WS JPA 1.0 Managed
Project JPE EJB CMP Management WS-* Bean
JMS JCA Deployment JSF
RMI/IIOP
May 1998 Dec 1999 Sept 2001 Nov 2003 May 2006 Q4 2009
10 specs 13 specs 20 specs 23 specs 28 specs

For Oracle employees and authorized partners only. Do not distribute to third parties.
New and improved specifications

 EJB 3.1  DI 1.0


 JPA 2.0  CDI 1.0
 Servlet 3.0  Managed Beans 1.0
 JSF 2.0  Interceptors 1.1
 JAX-WS 2.2
 JAX-RS 1.1
 JSR-109 1.3
 Connectors 1.6
 JSP 2.2 / EL 2.2
 Bean Validation 1.0
 JSR-250 1.1
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JAX-RS

 RESTful web services API


 Already widely adopted
 Really a general, high-level HTTP API
 Annotation-based programming model
 Programmatic API when needed
 JAX-RS 1.1 integration with EJBs

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JAX-RS sample code
• @Path("widgets/{id}")
• @Produces("application/widgets+xml")
• public class WidgetResource {
• public WidgetResource(
@PathParam("id") String id) {
• ...
• }

• @GET
• Widget getWidget() {
• ...
• }
• }

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Bean Validation 1.0
public class Address {
@NotNull @Size(max=30,
message="longer than {max} characters")
private String street1;
...
@NotNull @Valid
private Country country;
}
public class Country {
@NotNull @Size(max=20) request recursive
private String name; object graph
... validation
}
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Build your own!
@Size(min=5, max=5)
@ConstraintValidator(ZipcodeValidator.class)
@Documented
@Target({ANNOTATION_TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface ZipCode {
String message() default "Wrong zipcode";
String[] groups() default {};
}

Integrated in JPA and JSF


Bootstrap APIs
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
“Web” Profile

 First Java EE profile to be defined


 A fully-functional, mid-size stack for modern web
application development
 Complete, but not the kitchen sink

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE 6 Web Profile

 Servlet 3.0  JPA 2.0


 JSP 2.2 / EL 2.2  JTA 1.1

 JSR-45 1.0  DI 1.0

 JSTL 1.2  CDI 1.0

 JSF 2.0  Managed Beans 1.0

 Bean Validation 1.0  Interceptors 1.1

 EJB 3.1 Lite  JSR-250 1.1

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Extensible & Pluggable

 Focus on the web tier in this release


 Create a level playing ground for
third-party libraries and frameworks
 Simplify packaging of web apps

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Modular Web Applications

 Libraries can contain web-fragment.xml


 web.xml is optional
 @WebServlet, @WebFilter annotations
 ServletContainerInitializer interface
 Programmatic registration
 Resource jars

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
JSF 2.0

 Optional faces-config.xml
 Standardized facelets
 Auto-discovery of component libraries
 Composite components
 Ajax support (with or without JavaScript)
 Even a JavaScript API !

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
EJB 3.1

 @Singleton beans
 @Startup beans
 @Asynchronous invocations
 @Schedule tasks
 EJBContainer API works on Java SE
 Define EJBs directly inside a web app

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Packaging in a war

foo.ear foo.war
lib/foo_common.jar WEB-INF/classes
com/acme/Foo.class
com/acme/Foo.class
com/acme/FooServlet.class
foo_web.war com/acme/FooEJB.class
WEB-INF/web.xml
WEB-INF/classes
com/acme/FooServlet.class

foo_ejb.jar
com/acme/FooEJB.class
com/acme/FooEJBLocal.class

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Dependency Injection

 Context & Dependency Injection (CDI)


 JSR 299 with JSR-330 (@Inject)
 Context management (conversation), events, alternatives,
stereotypes, decorators & more
 Beans discovered at startup
 Injection metamodel (BeanManager API)
 @Resource still around

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Qualified injection

qualifier (user-defined label)


i.e. « which one? »

@Inject @Premium Customer cust;

injection point type


For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Qualifier Annotation
• @Target({TYPE,METHOD,PARAMETER,FIELD})
• @Retention(RUNTIME)
• @Documented
• @Qualifier
• public @interface Premium {…}

• @Premium // my own qualifier


• public class SpecialCustomer implements
Customer {
• public void buy() {…}
• }
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Qualified injection

qualifier (user-defined label)


i.e. « which one? »

@Inject @Premium Customer cust;

injection point type


For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Contexts
The 'C' in CDI
 Built-in “Web” Scopes :
 @RequestScoped

 @SessionScoped Client is not context-aware


 @ApplicationScoped

 @ConversationScoped
public class CheckoutHandler {
@Inject
CheckoutHandler(@LoggedIn User user,
@Reliable @PayBy(CREDIT_CARD)
PaymentProcessor processor,
@Default Cart cart) {
...
}
}
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
A lot more to CDI

 Events
 Stereotypes
 Consumer/Producer
 Decorator
 Alternatives
 Portable extensions
 etc...

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
Java EE 6
• Standard
• Lightweight
• Right-sized
• Widely available
• A foundation for PaaS

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
The preceding 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.

For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential
For Oracle employees and authorized partners only. Do not distribute to third parties.
© 2012 Oracle Corporation – Proprietary and Confidential

You might also like