javaone2015報告会 in okinawa
TRANSCRIPT
JavaOne 2015 フィードバック
日本オラクル株式会社 Fusion Middleware事業統括本部 伊藤 敬 Dec. 20th, 2015
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
#j1jp
Copyright © 2015, 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.
Oracle Confidential – Internal/Restricted/Highly Restricted 2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Java EE 8 アップデート
3
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Java Specification Request ステータス
JSR 366 – Java EE 8 Platform Early Draft Review (EDR)
JSR 369 – Servlet 4.0 – HTTP/2 EDR
JSR 365 – CDI 2.0 – CDI for Java SE, modularity & events EDR 完了
JSR 367 – JSON-B 1.0 – JSON Binding for Java Objects EDR 完了
JSR 371 – MVC 1.0 – Model View Controller, Action-Based, HTML framework EDR
JSR 368 – JMS 2.1 – MDB Improvements, CDI Managed Bean integration EDR
JSR 372 – JSF 2.3 – Integration with WebSocket, MVC, CDI, Java 8 DateTime EDR
JSR 374 – JSON-P 1.1 – Query enhancements, Java SE 8 improvements EDR 完了
JSR 375 – Security 1.0 – Simplifications, Cloud enhancements Early Draft策定中
JSR 370 – JAX-RS 2.1 – NIO, Server-Sent Events Early Draft策定中
JSR 373 – Management 2.0 – REST based Management Early Draft策定中
Java EE 8 仕様策定の状況 (as of 25/10/2015)
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Java EE 8 主要テーマ
• HTML5 / Web Tier 機能拡張
•開発をより容易に / CDI のさらなる活用
• クラウドの実行・管理環境化
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTML5のサポート / Web Tier機能拡張
• JSON Binding
• JSON Processing 機能拡張
• Action-based MVC
• HTTP/2のサポート – Servlet 4.0
• Server-sent Events
– JAX-RS 2.1
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 7
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-B
• Javaオブジェクト / JSON間のマーシャル/アンマーシャルを実現するAPI – XMLのJAXBランタイムAPIと類似
•既存のJSON Binding実装の成果を活用 – MOXy, Jackson, GSON, Genson, Xstream, …
– JSON Bindingプロバイダの変更を可能にする
8
Java API for JSON Binding
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 9
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 10
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 11
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-B 1.0 @Entity public class Person { @Id String name; String gender; @ElementCollection Map<String,String> phones; ... // getters and setters } Person duke = new Person(); duke.setName("Duke"); duke.setGender("M"); phones = new HashMap<String,String>(); phones.put("home", "650-123-4567"); phones.put("mobile", "650-234-5678"); duke.setPhones(phones); Jsonb jsonb = JsonbBuilder.create(); jsonb.toJson(duke, System.out) ;
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-234-5678"}
}
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 13
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• JSONデータがクライアントからデータベースまで連続的に処理可能に – JSON-Bによって、JAX-RSで“application/json”メディアタイプが標準的に利用
JSON-B 1.0
JPA JSON-B
Data Source
JSON Java Objects
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
• JSON-P の継続的な更新を維持
•新しい標準への対応
• JsonObject、JsonArrayに編集機能を追加する
• Java SE 8のStream処理を使いやすくするHelperクラス、メソッドの追加
Java API for JSON Processing
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
• JSON-Pointer – IETF RFC 6901
– JSON文書の中の特定の値を参照するための文字列の構文を規定する
"/0/phones/mobile"
新しい標準への対応
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1 JsonArray contacts = Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("name", "Duke")
.add("gender", "M")
.add("phones", Json.createObjectBuilder()
.add("home", "650-123-4567")
.add("mobile", "650-234-5678")))
.add(Json.createObjectBuilder()
.add("name", "Jane")
.add("gender", "F")
.add("phones", Json.createObjectBuilder()
.add("mobile", "707-555-9999")))
.build();
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-234-5678"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
JsonArray contacts = ...;
JsonPointer p =
new JsonPointer("/0/phones/mobile");
JsonValue v = p.getValue(contacts);
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-234-5678"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
JsonArray contacts = ...;
JsonPointer p =
new JsonPointer("/0/phones/mobile");
contacts = p.replace(contacts, "650-555-1212");
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-234-5678"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
JsonArray contacts = ...;
JsonPointer p =
new JsonPointer("/0/phones/mobile");
contacts = p.replace(contacts, "650-555-1212");
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-555-1212"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1
• JSON-Patch – IETF RFC 6902
• Patch is a JSON document
– JSONドキュメントを修整するためのオブジェクト / 処理の配列
– add, replace, remove, move, copy, test
–必ず “op” フィールドと “path” フィールドが必要
[
{"op":"replace", "path":"/0/phones/mobile", "value":"650-111-2222"},
{"op":"remove", "path":"/1"}
]
新しい標準への対応
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1 JsonPatchBuilder builder = new JsonPatchBuilder();
JsonArray patch =
builder.replace("0/phones/mobile", "650-111-2222")
.remove("/1")
.build();
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-234-5678"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1 JsonPatchBuilder builder = new JsonPatchBuilder();
JsonArray patch =
builder.replace("0/phones/mobile", "650-111-2222")
.remove("/1")
.build();
JsonArray result = patch.apply(contacts);
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-111-2222"}},
{
"name":"Jane",
"gender":"F",
"phones":{
"mobile":"707-555-9999"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
JSON-P 1.1 JsonPatchBuilder builder = new JsonPatchBuilder();
JsonArray patch =
builder.replace("0/phones/mobile", "650-111-2222")
.remove("/1")
.build();
JsonArray result = patch.apply(contacts);
[
{
"name":"Duke",
"gender":"M",
"phones":{
"home":"650-123-4567",
"mobile":"650-111-2222"}}
]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Model View Controller (MVC)
• Component-based MVC
–コンポーネントフレームワークを活用するタイプ
– Controller はフレームワークが提供する
– JSF, Wicket, Tapestry…
• Action-based MVC
– Controllerはアプリケーションで定義される
– Struts 2, Spring MVC…
2つのタイプ
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MVC 1.0
• アクション・ベースのModel-View-Controller アーキテクチャの追加
•既存のJava EEテクノロジーを組み合わせて実現: – Model
• CDI, Bean Validation, JPA
– View • Facelets, JSP
– Controller • JAX-RS リソースメソッド
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 27
JSP, Facelets CDI Bean
JAX-RS Resource Methods
Bean Validation
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MVC 1.0
@Path("hello")
public class HelloController {
@Inject
private Greeting greeting;
@GET
@Controller
public String hello() {
greeting.setMessage("Hello there!");
return "hello.jsp";
}
}
JAX-RS controller
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MVC 1.0
@Path("hello")
public class HelloController {
@Inject
private Greeting greeting;
@GET
@Controller
public String hello() {
greeting.setMessage("Hello there!");
return "hello.jsp";
}
}
JAX-RS controller Model
@Named
@RequestScoped
public class Greeting {
private String message;
public String getMessage() {
return message;
}
public void setMessage(message) {
this.message = message;
}
}
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MVC 1.0
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>${greeting.message}</h1>
</body>
</html>
View
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 31
JSP, Facelets CDI Bean
JAX-RS Resource Methods
Bean Validation
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2
• 一つのTCP接続を多重化
• リクエストは “Stream"と呼ばれるデータ単位で送受信
– 多重化
– Stream単位で重み付け
• バイナリフレームレイヤ
–Server Push
• ヘッダ圧縮
Multiplexed Binary Frames POST /upload HTTP/1.1 Host: www.test.com Content-Type: application/json Content-Length: 15 {“name”:“duke”}
HTTP 1.1 HTTP/2
HEADERS frame
DATA frame
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 サーバプッシュ
client server
.html
.js
.png
.css
• SSE/WebSocketとは用途が異なる
• 関連リソースをサーバプッシュ
• htmlの要求がきたら
• 関連のjs, png, css もプッシュする
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
34
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
35
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Servlet 4.0 HTTP/2 サーバプッシュのサンプル
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PushBuilder builder = request.getPushBuilder(); builder.setPath(“/style.css”); builder.push(); res.setContentType(“text/html”); PrintWriter out = res.getPrintWriter(); out.println(“<html>”); out.println(“<head>”) out.println(“<link rel=¥”stylesheet¥” type=¥”text/css¥” href=¥“style.css¥”>”); … }
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
開発をより容易に
• CDI 活用範囲の拡大
• Security インターセプタ
• JMS : Message-Briven Beanのメッセージ処理を簡素化
• JAX-RS injection の導入
• WebSocket スコープ
• Pruning - EJB 2.x client view, IIOPとの互換性
37
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
CDI 2.0
• Modularity
• Java SE support
• Asynchronous Events
• Event ordering
• …
利用範囲の拡大と機能強化
38
http://www.slideshare.net/dblevins1/2015-javaone-ejbcdi-alignment
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 39
https://published-rs.lanyonevents.com/published/oracleus2015/sessionsFiles/2550/CON2391_Paumard-The%20Path%20to%20CDI%202.0.pdf
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 40
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 41
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 42
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Java EE仕様策定に貢献しませんか??
• Adopt a JSR
– http://glassfish.org/adoptajsr
• Join an Expert Group project
– http://javaee-spec.java.net
– https://java.net/projects/javaee-spec/pages/Specifications
• The Aquarium
– http://blogs.oracle.com/theaquarium
• Java EE 8 Reference Implementation
– http://glassfish.org
興味ある方は是非参画ください!!!