3. IBM Software Group
ついに2009年12月に承認
Java EE 6 ついに 年 月
・・・難産でした
http://jcp.org/en/jsr/results?id=5025
3
4. IBM Software Group
ついに2009年12月に承認
Java EE 6 ついに 年 月
・・・難産でした
Intel Corp. voted Abstain
Intel Corp. voted Abstain
We were not satisfied with some of the information
We were not satisfied with some of the information
accompanying this ballot and have informed the Spec
accompanying this ballot and have informed the Spec
Lead. No technical issues. It's a good spec.
Lead. No technical issues. It's a good spec.
IBM voted Yes
IBM voted Yes
IBM's vote is based on the technical merits of this JSR and is not a vote on
IBM's vote is based on the technical merits of this JSR and is not a vote on
the licensing terms. IBM supports licensing models that create an open
the licensing terms. IBM supports licensing models that create an open
and level playing field by allowing third parties to create independent
and level playing field by allowing third parties to create independent
implementations of Java Specifications and that do not allow individuals or
implementations of Java Specifications and that do not allow individuals or
companies to exercise unnecessary control for proprietary advantage. We
companies to exercise unnecessary control for proprietary advantage. We
support open source as a licensing model for contributions in the JCP, and
support open source as a licensing model for contributions in the JCP, and
would hope others will support this direction.
would hope others will support this direction.
http://jcp.org/en/jsr/results?id=5025
4
5. IBM Software Group
他にもいろいろありました
POJOをベースとした新しいServlet APIの提出と揺り戻し
「JSR 299 Web Beans」に対抗して
Google/Springから出された「JSR 330 Dependency Injection for Java」
「Java EE終了のお知らせ」(2009-05-09)
「Java EE終了のお知らせ」(2009-05-09)
ひがやすお氏
ひがやすお氏
しかし,様々な困難を乗り越え,新しいJava EEは承認されました
苦労の甲斐あって,いい仕様です
5
7. IBM Software Group
主要な
Java EE 6 の主要なゴール
軽量化:Right Sizing
– 柔軟なテクノロジースタック/Webプロファイル
– "Pruning dead wood"
拡張性
さらなる開発容易性:Ease of Development
– EJBにつづきServletもアノテーションベースに
– CDI (Contexts and Dependency Injection)
機能の大幅な
機能の大幅な強化
プレゼンテーション層の強化
–Web 2.0への対応 / Servlet 3.0,JSF 2.0,JAX-RS
永続化の機能強化
–JPA 2.0,Bean Validation
7
8. IBM Software Group
柔軟なテクノロジースタック
柔軟な
Java EE
「Profile」の導入
– Java EEのサブセットをProfileとして定義 Web
• Java EEの仕様群の全部もしくは一部だけをふくむ
– Java EEコンテナを提供するプロバイダーは,
特定のプロファイルを選択して実装することが可能
• Java EEの全ての仕様を実装しなくてもJava EE認定が受けられる
– ユーザーは,必要な機能だけを実装したコンテナを選択することが可能
Java EE 6の策定時点で定義されているプロファイル
– Java EE Profile
• 定義されている,ほぼ全ての仕様を実装
– Web Profile
• Webアプリケーションの実行に必要な仕様だけを実装
8
9. IBM Software Group
プロファイル登場の背景
プロファイル登場の
登場
肥大化したJava EE仕様
Java EE 6 Java SE
EJB 3.1 JACC 1.3
Servlet 3.0 JASPIC 1.0 Java IDL
JSP 2.2 JSP Debugging 1.0 JDBC
EL 1.2 JSTL 1.2 RMI-IIOP
JMS 1.1 Web Services Metadata 2.0 JNDI
JTA 1.1 JSF 2.0 JAXP
JavaMail 1.4 Common Annotations 1.1 StAX 1.0
Connector 1.6 Java Persistence 2.0 JAAS
Web Services 1.3 Bean Validation 1.0 JMX
JAX-RPC 1.1 Managed Beans 1.0 JAX-WS 2.2
JAX-RS 1.1 Interceptors 1.1 JAXB 2.2
JAXR 1.0 DI(JSR-299) 1.0 JAF
Java EE Management 1.1 CDI(JSR-330) 1.0 SAAJ 1.3
Java EE Deployment 1.2c Common Annotations 1.1
9
10. IBM Software Group
に まれる仕様
Web Profileに含まれる仕様 Java EE Profile
Web Profile
Web Application Technologies Web Services Technologies
JSR 315: Java Servlet 3.0 JSR 311: JAX-RS: The Java API
JSR 314: JavaServer Faces (JSF) 2.0 for RESTful Web Services 1.1
JSR 245: JavaServer Pages 2.2 JSR 109: Implementing Enterprise Web Services 1.3
and Expression Language (EL) 1.2 JSR 224: Java API for XML-Based
サーブレット/JSP基本機能だけでなく
JSR 52: A Standard Tag Library for JavaServer Pages 1.2 Web Services (JAX-WS) 2.2
JSR-45: Debugging Support for Other Languages 1.0 ・トランザクション・サービス
JSR 222: Java Architecture
・(リモート呼び出しのない)EJB
for XML Binding (JAXB) 2.2
Enterprise Application Technologies JSR 181: Web Services Metadata
・DBへの永続化を行うJPA仕様
for the Java Platform
JSR 299: Contexts and Dependency Injection
for the Java EE Platform 1.0 JSR 101: Java APIs for XML based RPC 1.1
も含まれている
JSR 67: Java APIs for XML Messaging 1.3
JSR 330: Dependency Injection for Java
JSR 318: Enterprise JavaBeans 3.1 (EJB Lite) JSR 93: Java API for
JSR 317: Java Persistence API 2.0 XML Registries 1.0 (JAXR) 1.0
JSR 250: Common Annotations for the Java Platform 1.1
JSR 907: Java Transaction API (JTA) 1.1 Management and Security Technologies
JSR 303: Bean Validation 1.0 JSR 196: Java Authentication Service Provider
Interface for Containers 1.0
JSR 318: Enterprise JavaBeans 3.1 JSR 115: Java Authorization
JSR 322: Java EE Connector Architecture 1.6 Contract for Containers 1.3
JSR 914: Java Message Service (JMS) API 1.1 JSR 88: Java EE Application Deployment 1.2
JSR 919: JavaMail 1.4 JSR 77: J2EE Management 1.1
10
11. IBM Software Group
"Pruning dead wood"
古い仕様を将来のバージョンで
削除することを予告
– Deprecate EJB Entity beans
– Deprecate JAX-RPC
– Deprecate JSR-88 J2EE Deployment
– Deprecate JAX-R
追加・追加で肥大化してきた仕様を
より適切なサイズに
11
12. IBM Software Group
さらなるEase of Development
さらなる
EJBに続きServletもアノテーションに
WebServlet(name=”MyServlet”, urlPatterns={"/foo", "/bar"})
@@WebServlet(name=”MyServlet”, urlPatterns={"/foo", "/bar"})
public class SampleUsingAnnotationAttributes extends HttpServlet{
public class SampleUsingAnnotationAttributes extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) {{
public void doGet(HttpServletRequest req, HttpServletResponse res)
– web.xml (構成ファイル)はオプション
Dependency Injectionのためのアノテーション仕様も標準化
– JSR 299: Contexts and Dependency Injection
for the Java EE Platform 1.0
– JSR 330: Dependency Injection for Java
二つの大きな流れ
• 設定情報はデプロイメントディスクリプタではなくJavaソースに
• Javaコード中に初期化コードはかかない
12
13. IBM Software Group
Dependency Injection
private DataSource ds;
private DataSource ds;
InitialContext ic == new InitialContext();
InitialContext ic new InitialContext();
ds == (DataSource)ic.lookup("java:comp/env/jdbc/MyDS");
ds (DataSource)ic.lookup("java:comp/env/jdbc/MyDS");
Connection con == ds.getConnection();
Connection con ds.getConnection();
「初期化コード」から「DI」へ
Resource(name == "jdbc/MyDS")
@@Resource
Resource
Resource(name "jdbc/MyDS")
private DataSource ds;
private DataSource ds;
オープンソース・フレームワークである
Spring FrameworkやSeasar2が
切り開いた分野
13
14. IBM Software Group
Injection)
CDI (Contexts and Dependency Injection)
ServletでのDI
ServletでのDI
での
CDI
DIの仕様を
統合
EJBでのDI
EJBでのDI
での
Context
and
WebサービスでのDI
WebサービスでのDI
サービスでの Dependency
Injection
ユーザー定義の
ユーザー定義のDI
定義
DIの機能をコンテナから分離 → Java SEでも使用可能
ビジネスロジック層とプレゼンテーション層の連携が容易に
14
15. IBM Software Group
CDIの使用例
の
import org.example.HelloService;
import org.example.HelloService;
WebServlet(name == "HelloWorld", urlPatterns == {{ "/HelloWorld" })
@@WebServlet
WebServlet
WebServlet(name "HelloWorld", urlPatterns "/HelloWorld" })
public class HelloWorld extends HttpServlet {{
public class HelloWorld extends HttpServlet
@Inject HelloService helloService;
@Inject HelloService helloService;
package org.example;
package org.example;
import javax.inject.Named;
import javax.inject.Named;
@Named
@Named
public class HelloService {{
public class HelloService
public void sayHello() {{
public void sayHello()
System.out.println("Hello!");
System.out.println("Hello!");
}}
}}
15
23. IBM Software Group
Bean Validation 1.0
JPAやJSF,JCAで使用できるValidatation機能
– Beanに対する制約を統一的に扱うことができる
@Min/@Max/@Size/@NotNull/@Pattern等のアノテーションで制約をかける
– ユーザー定義の制約も実装できる
@entity
@entity
public class Customer {
public class Customer {
@Id
@Id
private int id;
private int id;
private String name;
private String name;
@Pattern(regexp="((¥d¥d¥d¥-)?¥d¥d¥d¥-d¥d¥d¥d)?")
@Pattern(regexp="((¥d¥d¥d¥-)?¥d¥d¥d¥-d¥d¥d¥d)?")
private String phoneNumber;
private String phoneNumber;
……
……
}}
23
24. IBM Software Group
まとめ
Java EEはより簡単に,よりスリムになっていきます
Java EE 5が,「今までと同じ事がより簡単にできる」更新だったのに対し
Java EE 6は,「今まで出来なかったことができる」という更新です
Servlet/JSP/JSFといった,変化が少なかったAPIにも大幅な機能追加が
RESTfullアプリケーション,Ajaxアプリケーションなど技術に対応
24
25. IBM Software Group
最後に
最後に
Java EE 6対応となるWebSphere Application Server V8.0
Alphaバージョンが公開中です
https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wsasoa/index.shtml
25