© 2012 oracle corporation · the following is intended to outline our general product direction....
TRANSCRIPT
1 | © 2012 Oracle Corporation
Exploring Java EE 6 and WebLogic 12c
2 | © 2012 Oracle Corporation
Arun Guptablogs.oracle.com/arungupta, @arungupta
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be y yincorporated 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,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.
3 | © 2012 Oracle Corporation
Oracle Cloud Application FoundationFoundation for Oracle Fusion Middleware in the CloudFoundation for Oracle Fusion Middleware in the Cloud
Web Social Mobile
O l P bli Cl dUser EngagementUser EngagementUser EngagementUser Engagement
Business ProcessBusiness ProcessBusiness ProcessBusiness Process ContentContentContentContent BusinessBusinessBusinessBusinessTraffic Director
Oracle Public Cloud
Business Process Business Process ManagementManagement
Business Process Business Process ManagementManagement
Content Content ManagementManagement
Content Content ManagementManagement
Business Business IntelligenceIntelligenceBusiness Business
IntelligenceIntelligence
Service IntegrationService IntegrationService IntegrationService Integration Data IntegrationData IntegrationData IntegrationData Integration
WebLogic Server Coherence Tuxedo
Virtual Assembly BuilderIdentity Management & SecurityIdentity Management & SecurityIdentity Management & SecurityIdentity Management & Security
Development Development ToolsTools
Enterprise Enterprise ManagementManagement
Cloud Application Cloud Application FoundationFoundation
Cloud Application Foundation
Exalogic Elastic Cloud
4 | © 2012 Oracle Corporation
Java EE 6 - Themes
• Light-weightE t• Easy-to-use
• Extensible
5 | © 2012 Oracle Corporation
Light-weight
• Java EE 6 Web ProfileWebLogic supports Full Java EE 6 only• WebLogic supports Full Java EE 6 only
• Web Profile apps can be deployed to Full Java EE 6
• PruningPruning• Pruned today, means
• Optional in the next release• Deleted in the subsequent releases
• Technologies marked in Javadocs• EJB 2.x Entity Beans, JAX-RPC, JAXR, JSR 88
6 | © 2012 Oracle Corporation
y
Easy-to-use
• EJB-in-WARN i t f EJB• No-interface EJB
• Optional “web.xml”/”faces-config.xml”• Annotation-driven
• @Schedule• @Path• @Path• @Inject• . . .
7 | © 2012 Oracle Corporation
Java EE 6 & Ease-of-development
• Continue advancements of Java EE 5P i f W b Ti• Primary focus: Web Tier
• General principlesA t ti b d i d l• Annotation-based programming model
• Reduce or eliminate need for DD• Traditional API for advanced usersTraditional API for advanced users
8 | © 2012 Oracle Corporation
Extensible
• Servlet web-fragmentsD i i t ti f S l t• Dynamic registration of Servlets
• Portable CDI extensions
9 | © 2012 Oracle Corporation
Java EE 6 Specifications
• The PlatformJ EE 6 W b P fil 1 0• Java EE 6 Web Profile 1.0
• Managed Beans 1.0
10 | © 2012 Oracle Corporation
Java EE 6 SpecificationsNew• Contexts and Dependency Injection for
Java EE (JSR 299)
New
Java EE (JSR 299)• Bean Validation 1.0 (JSR 303)
J API f RESTf l W b S i (JSR 311)• Java API for RESTful Web Services (JSR 311)• Dependency Injection for Java (JSR 330)
11 | © 2012 Oracle Corporation
Java EE 6 SpecificationsExtreme Makeover• Java Server Faces 2.0 (JSR 314)
J S l t 3 0 (JSR 315)
Extreme Makeover
• Java Servlets 3.0 (JSR 315)• Java Persistence 2.0 (JSR 317)• Enterprise Java Beans 3.1 & Interceptors 1.1 (JSR 318)• Java EE Connector Architecture 1.6 (JSR 322)
12 | © 2012 Oracle Corporation
Java EE 6 SpecificationsUpdates• Java API for XML-based Web Services 2.2 (JSR 224)• Java API for XML Binding 2 2 (JSR 222)
Updates
• Java API for XML Binding 2.2 (JSR 222)• Web Services Metadata MR3 (JSR 181)• JSP 2.2/EL 2.2 (JSR 245)JSP 2.2/EL 2.2 (JSR 245)• Web Services for Java EE 1.3 (JSR 109)• Common Annotations 1.1 (JSR 250)( )• Java Authorization Contract for Containers 1.3 (JSR 115)• Java Authentication Service Provider Interface for Containers 1.0
13 | © 2012 Oracle Corporation
(JSR 196)
Java EE 6 SpecificationsAs is• JDBC 4.0 API• Java Naming and Directory Interface 1.2• Java Message Service 1.1
As-is
• Java Transaction API 1.1• Java Transaction Service 1.0• JavaMail API Specification 1.4• JavaBeans Activation Framework 1.1• Java API for XML Processing 1 3Java API for XML Processing 1.3• Java API for XML-based RPC 1.1• SOAP with Attachments API for Java 1.3• Java API for XML Registries 1.0• Java EE Management Specification 1.1 (JSR 77)• Java EE Deployment Specification 1.2 (JSR 88)• Java Management Extensions 1.2• Java Authentication and Authorization Service 1.0• Debugging Support for Other Languages (JSR 45)• Standard Tag Library for JSP 1.2 (JSR 52)
14 | © 2012 Oracle Corporation
S g y JS (JS 5 )• Streaming API for XML 1.0 (JSR 173)
Java EE 6 Web Profile 1.0
Servlets 3.0
JSF 2 0
JPA 2.0
Interceptors JAX RS
EJB 3.1 JDBC
JNDI J M il
StAX
NewJSF 2.0
EJB 3.1 Lite BeanValidation1.0
Interceptors1.1 JAX-RS
JAXB
JNDI
JMS JACC
JavaMail New
Updated
JSP 2.2 CDI 1.0
Validation1.0
JAX-WS JAXP SAAJContributed
JTA 1.1 ManagedBeans 1.0 JASPIC JAX-RPC . . . by RedHat
15 | © 2012 Oracle Corporation
Managed Beans 1.0
• JavaBeans component model for Java EE• Simple and Universally useful• Simple and Universally useful• Advanced concepts in companion specs
• Basic ServicesBasic Services• Resource Injection, Lifecycle Callbacks, Interceptors
• Available asAvailable as• @Resource / @Inject• java:app/<module-name>/<bean-name>
16 | © 2012 Oracle Corporation
• java:module/<bean-name>
Managed Beans 1.0 - Sample@
public class MyManagedBean {
public void setupResources() {
@ResourceMyManagedBean bean;
@javax.annotation.ManagedBean
@PostConstruct
// setup your resources}
bli id l R () {@PreDestroy
@InjectMyManagedBean bean;public void cleanupResources() {
// collect them back here}
public String sayHello(String name) {
y g ;
public String sayHello(String name) {return "Hello " + name;
}}
17 | © 2012 Oracle Corporation
}
http://blogs.sun.com/arungupta/entry/totd_129_managed_beans_1
Servlets in Java EE 5At least 2 filesAt least 2 files
<!--Deployment descriptor web.xml --><web-app><servlet>
<servlet-name>MyServlet</servlet-name>
/* Code in Java Class */
package com.sun;y /
<servlet-class>com.sun.MyServlet
</servlet-class></servlet><servlet-mapping>
<servlet-name>MyServlet</servlet-name>
public class MyServlet extends HttpServlet {public void
doGet(HttpServletRequest req,HttpServletResponse res) {
<servlet-name>MyServlet</servlet-name><url-pattern>/myApp/*</url-pattern>
</servlet-mapping>...
</web-app>
...}...}}
18 | © 2012 Oracle Corporation
Servlets 3.0 (JSR 315)Annotations based @WebServletAnnotations-based @WebServlet
package com.sun;@WebServlet(name=”MyServlet”, urlPatterns={”/myApp/*”})public class MyServlet extends HttpServlet {public void doGet(HttpServletRequest req,
HttpServletResponse res) { <! D l t d i t b l >{
...}
<!--Deployment descriptor web.xml -->
<web-app><servlet>
<servlet-name>MyServlet</servlet-name><servlet-class>
com.sun.MyServlety</servlet-class>
</servlet><servlet-mapping>
<servlet-name>MyServlet</servlet-name><url-pattern>/myApp/*</url-pattern>
</servlet-mapping>
19 | © 2012 Oracle Corporation
</servlet-mapping>...
</web-app>
Servlets 3.0
• @WebServlet, @WebListener, @WebFilter, , …@W bS l t( S t d t )• @WebServlet(asyncSupported=true)
• Plugin libraries using web fragments• Dynamic registration of Servlets• WEB-INF/lib/[*.jar]/META-INF/resources
accessible in the rootaccessible in the root• Programmatic authentication login/logout
Default Error Page20 | © 2012 Oracle Corporation
• Default Error Page• . . .
EJB 3.1 (JSR 318)Package & Deploy in a WARPackage & Deploy in a WAR
Java EE 5Java EE 6myApp.ear
web.war
WEB-INF/web xml
myApp.war
WEB-INF/classes
Java EE 6
WEB INF/web.xmlWEB-INF/classes
com.sun.FooServletcom.sun.TickTock
com.sun.FooServletcom.sun.TickTockcom.sun.FooBeancom sun FooHelper
beans.jar
com.sun.FooBeancom sun FooHelper
com.sun.FooHelper
web xml ?21 | © 2012 Oracle Corporation
com.sun.FooHelper web.xml ?
EJB 3.1 – Sample@EJB@Stateless
public class MySessionBean {
public void setupResources() {// set p o r reso rces
@EJBMySessionBean bean;
@Stateless
@PostConstruct
// setup your resources}
@PreDestroy
POJO
No specialpublic void cleanupResources() {// collect them back here
}
No special packaging
public String sayHello(String name) {return "Hello " + name;
}
No DD
22 | © 2012 Oracle Corporation
}
EJB 3.1
• No interface view – one source file per beanE b dd bl API• Embeddable API
• @Singleton I iti li ti i @P tC t t• Initialization in @PostContruct
• @Schedule: Simplified cron-like syntax for Timer@A h S i B• @Asynchronous Session Bean
• Portable Global JNDI Name
23 | © 2012 Oracle Corporation
Contexts & Dependency Injection (JSR 299)
• Standards-based Dependency InjectionT f B id @I j t API• Type-safe – Buids on @Inject API
• Context/Scope management• Includes ELResolver
@Inject @LoggedIn User userRequestInjection
What ?Which one ?
24 | © 2012 Oracle Corporation
Injection (Type)(Qualifier)
CDI
• QualifiersE t• Events
• Stereotypes• Interceptors• Decorators• Alternatives• . . .
25 | © 2012 Oracle Corporation
Java Server Faces 2.0 (JSR 314)
• Facelets as “templating language”• Custom components much easier to develop• Custom components much easier to develop
• Integrated Ajax“faces config xml” optional in common cases• “faces-config.xml” optional in common cases• Default navigation rules
• Much more• Much more …• Runs on Servlet 2.5+• Bookmarkable URLs
26 | © 2012 Oracle Corporation
• Conditional navigation• ...
Java Persistence API 2 (JSR 317)
• Improved O/R mapping, expanded/richer JPQLT f C it i API• Type-safe Criteria API
• 2nd-level Cache• New locking modes
• PESSIMISTIC_READ – grab shared lock• PESSIMISTIC WRITE grab exclusive lock• PESSIMISTIC_WRITE – grab exclusive lock
• Standard configuration options• javax persistence jdbc [driver | url | user | password]
27 | © 2012 Oracle Corporation
• javax.persistence.jdbc.[driver | url | user | password]
Bean Validation (JSR 303)
• Tier-independent mechanism to define constraints for data validationdata validation• Represented by annotations in javax.validation.* package
• @NotNull(message=” ”) @Max @Min @Size• @NotNull(message= ... ), @Max, @Min, @Size• Integrated with JSF and JPA
• JSF: f:validateRequired f:validateRegexpJSF: f:validateRequired, f:validateRegexp• JPA: pre-persist, pre-update, and pre-remove
• Fully Extensible
28 | © 2012 Oracle Corporation
y• @Email String recipient;
JAX-RS 1.1 (JSR 311)
• Java API for building RESTful Web ServicesPOJO b d• POJO based
• Annotation-driven• Server-side API• HTTP-centric
29 | © 2012 Oracle Corporation
JAX-RS – Sample
public class ProductResource {@Path(”products")
public Products[] getProducts() {// th d t b
@GET @Produces("text/plain")
// query the databasereturn products;
}
@GET @PathParam("id")
public Product getProduct(int id) {// query the databasereturn product;
@Path("{id}")
30 | © 2012 Oracle Corporation
}
}
IDE SupportWebLogic and Java EE 6WebLogic and Java EE 6
31 | © 2012 Oracle Corporation
From the real users ... Jigsaw puzzle, Modular, standard, less xml, easy,
Developers can concentrateon business logic, Java EE 6 is providing a standard for the infrastructure.
Standards compliance, vendor independence milliseconds
easy, have I said easy?
the infrastructure.
Higher integrated specs,simple and annotation driven,
independence, milliseconds and kilobyte deployment
Faster development, less frameworks, less complexity, more great
single-classloader WARs,next level of industry standard
complexity, more great code shipped
Definite excuse to avoid Spring forever
Not your fat grandfather's enterprise Java anymore, enterprise Java renaissance
Simplified Java Development, Focus on building great products
32 | © 2012 Oracle Corporation
http://blogs.oracle.com/arungupta/tags/community+feedback
Help shape Java EE
• Java EE Platform Specificationjavaee spec java net– javaee-spec.java.net
• Java EE HubJava EE Hub– oracle.com/javaee
33 | © 2012 Oracle Corporation
Join the WebLogic CommunityO l / bl i
Twittertwitter com/oracleweblogic
Oracle.com/weblogic
twitter.com/oracleweblogic
Facebookfacebook.com/oracleweblogic
Oracle’s WebLogic blogblogs.oracle.com/weblogicserver
Y t bYoutubeYoutube.com/oracleweblogic
Developer Webcast Seriesl / / bl d
34 | © 2012 Oracle Corporation
oracle.com/goto/weblogicdevcast