今から役立つ ! teeda 入門

42
Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved. 1 Seasar Conference Seasar Conference 2007 Spring 2007 Spring Seasar Conference Seasar Conference 2007 Spring 2007 Spring 今今今今今今 今今今今今今 ! Teeda ! Teeda 今今 今今 2007.5.27 大大 大大

Upload: geona

Post on 14-Jan-2016

106 views

Category:

Documents


0 download

DESCRIPTION

今から役立つ ! Teeda 入門. 2007.5.27 大谷 晋平. 本日のアジェンダ. Teeda 概要 Teeda の歩んできた道 Teeda の特徴 Teeda 入門 Teeda の歩んでいく道 まとめ. 自己紹介1. 名前 大谷 晋平 (HN:shot) コミッタ活動 Teeda /S2JSF/S2Struts Seasar2 Blog http://d.hatena.ne.jp/shot6/ メールアドレス [email protected]. 自己紹介2. 最近の執筆活動・メディア紹介記事 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 今から役立つ ! Teeda 入門

Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

1

Seasar ConferenceSeasar Conference2007 Spring2007 Spring

Seasar ConferenceSeasar Conference2007 Spring2007 Spring

今から役立つ今から役立つ ! Teeda! Teeda 入門入門

2007.5.27

大谷 晋平

Page 2: 今から役立つ ! Teeda 入門

2Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

本日のアジェンダ本日のアジェンダ

• Teeda 概要• Teeda の歩んできた道• Teeda の特徴• Teeda 入門• Teeda の歩んでいく道• まとめ

Page 3: 今から役立つ ! Teeda 入門

3Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

自己紹介1自己紹介1

• 名前– 大谷 晋平 (HN:shot)

• コミッタ活動– Teeda/S2JSF/S2Struts– Seasar2

• Blog– http://d.hatena.ne.jp/shot6/

• メールアドレス– [email protected]

Page 4: 今から役立つ ! Teeda 入門

4Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

自己紹介2自己紹介2

• 最近の執筆活動・メディア紹介記事– JavaExpert 創刊号

特集2:「 Seasar2.4/Teeda の正体を探る」(共同)

– Software Design 2007 年 05 月号• OSCJ Times 第 9 回「 Teeda 」(共同)

Page 5: 今から役立つ ! Teeda 入門

5Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

始める前に始める前に

• 本日のセッションは、– 前半後半で言うところの前半です。

• 難しいことより、基礎知識をしっかり説明• 詳細な記述の部分は後で振り返ってみてください。

– 「現場で役立つ実践 Teeda 」が後半戦• Teeda ユーザとして共に歩んできたたかのりさんの

発表• 具体的な事例、活用の Tips

– ひがさんのセッションの説明を受けて・・・• Teeda の詳細をもう一歩つっこむ

Page 6: 今から役立つ ! Teeda 入門

6Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 概要概要

• Teeda とは– Java の Web アプリケーションフレームワーク

• プレゼンテーションの開発をよりシンプルに。– JSF meets DI x AOP

• Java で Page 駆動開発を実現– POJO(Plain Old Java Object) ベースでの開発

• Seasar2.4 ベース

– http://teeda.seasar.org/ja/– Teeda とは沖縄の言葉で「太陽」

Page 7: 今から役立つ ! Teeda 入門

7Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の歩んできた道の歩んできた道

• リリース状況– 2006/11/11 1.0 正式リリース– 現在最新版は 1.0.7 。 1.0.8 も着々と進行中

• 平均して 1 ヶ月に 1 度の安定したリリース状況

– 現在は機能追加よりも安定化を最優先• 案件適用状況

– 適用事例は順調に増加中(感謝!)– フィードバックによって更に改善・改良

• Seasar-user ML• Blog• 案件からの直接フィードバック

Page 8: 今から役立つ ! Teeda 入門

8Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴の特徴

• Teeda の特徴– JSF ベースの 2 層構造

• Core と Extension• Add-on として、 Ajax 機能、 Testing 機能

– Java で Page 駆動開発を実現– Seasar2.4 ベース

• HotDeploy 対応

– 設定ファイルレス– View をシンプルな HTML で記述可能– 同名プロパティの状態受け継ぎ

Page 9: 今から役立つ ! Teeda 入門

9Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda のテクノロジ的な位置づけのテクノロジ的な位置づけ

プレゼンテーション層

View 層 View 制御層パーシステンス層(それ以外の層)

Teeda

Mayaa Struts

JSFJSP

Velocity

KuinaDao

S2Dao

Hibernate

Page 10: 今から役立つ ! Teeda 入門

10Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda Extension

TeedaTeeda の特徴(詳細1)の特徴(詳細1)

• JSF ベースの 2 層構造– Core → JSF1.1 の実装– Extension → よりユーザへの利便性提供を実現

Teeda Core

ライフサイクル標準コンポーネントEL 評価機構JSP タグ

Page モデルHTML テンプレートHotDeploy 対応規約マッピング

Page 11: 今から役立つ ! Teeda 入門

11Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細2)の特徴(詳細2)

• Page 駆動開発とは– HTML をベースとした開発スタイル– HTML に Java クラスをマッピングする

• 対応関係が明確なのでムリが少ない– 1Page = 1HTML + 1POJO クラス

» この POJO を Page クラスと呼びます

• マッピングの設定が必要なの?– Teeda ではシンプルに名前をあわせるだけ。– add.html  →  AddPage.java– Struts のように設定ファイルが必要ない

Page 12: 今から役立つ ! Teeda 入門

12Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細2続き)の特徴(詳細2続き)

hoge.html<html> <body> <form id=“addForm”> <input type=“text” id=“arg1” /> <input type=“text” id=“arg2” /> <input type=“submit” id=“doHoge” value=“execute” /> </form> </body></html>

public class HogePage { private Integer arg1; private Integer arg2; public String doHoge() { ・・・ } //setter/getter}

• Page モデル– Page クラスは HTML に対応するデータ構造– Page クラスは、プロパティとアクションメソッ

ドを持つ

Page 13: 今から役立つ ! Teeda 入門

13Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細3)の特徴(詳細3)

• Seasar2.4 ベース– HOT deploy ready!

• LL のような Step by Step な開発が可能– アプリケーションサーバを稼動したまま、開発可能

– 規約によって開発を効率化• 設定ファイルを書く時間を極小化

– Seasar2.4 のフルスタック「 Chura 」の Web部分

• SuperAgile では Teeda+S2.4+S2Dao• EasyEnterprise では Teeda+S2.4+KuinaDao(+JPA)

Page 14: 今から役立つ ! Teeda 入門

14Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細4)の特徴(詳細4)

• 設定ファイルレス– ゼロでは無いが、最小限。– XML設定地獄からの脱却

• 画面遷移の登録設定• 使用するモデルの登録設定

–あるべき設定はあるべき場所へ• 画面遷移の設定は、 HTML へ記述する

– 驚き最小限の法則• モデルの登録は本質的でない追加作業。

Page 15: 今から役立つ ! Teeda 入門

15Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細4続き)の特徴(詳細4続き)

• 設定ファイル比較

画面遷移の設定 モデルの登録

Teeda

従来型WebFW

HTML に簡単な規約で記述するだけなので直感的。

<input type="button“

id=“goAddResult"/>

外出しの XML に遷移ごとに記述する。一極集中で管理しやすい反面、設定量の膨大によって、保守性低下。

初期設定時に規約での探索の基点となるパッケージ名を登録するのみ。

外出しの XML に記述する。一極集中で管理しやすい反面、モデル名の変更などに追従できない。

Page 16: 今から役立つ ! Teeda 入門

16Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細5)の特徴(詳細5)

• View をシンプルな HTML で記述可能– JSP などの代わりに HTML で記述

• HTML テンプレートと呼びます– 設計の時に使った HTML の Mock をそのまま開発に使う

• Teeda では適切な id を振るのみで開発可能• add.html で下記のような記述をすると、 AddPage の arg1 プロ

パティとバインディングされる。

add.html<html><body><form id=“addForm”> <input type="text" id="arg1"/> public class AddPage {

private int arg1; 

Page 17: 今から役立つ ! Teeda 入門

17Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴(詳細6)の特徴(詳細6)

• 同名プロパティの状態受け継ぎ

addInput.html

addResult.html

POST

GET

REDIRECT

View ( Client ) Teeda ( Server )

AddInputPage

AddResultPage

状態をsave状態を

restore

Page 18: 今から役立つ ! Teeda 入門

18Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の特徴ふりかえりの特徴ふりかえり

• Teeda を使った開発者は、– HTML と Page クラスだけ書けばよい

• 対応関係は 1 対 1 ( add.html ←→ AddPage )

– HTML は設計時に使った Mock を流用できる– 開発時に、

• 設定ファイルに費やす時間を規約により削減できる• HOT deploy でサーバ再起動の無駄な待ち時間を削減

できる

これさえ覚えれば、Teeda の特徴については完璧です。

Page 19: 今から役立つ ! Teeda 入門

19Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門概要入門概要

• Teeda 入門では以下の事をご紹介します– 基本コンポーネントの使い方– Teeda のライフサイクルメソッド– Validator/Converter のかけかた– Demo

Page 20: 今から役立つ ! Teeda 入門

20Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (outputText)(outputText)

• outputText– 文字列を出力するコンポーネント– Span タグで id あり

hello.html Hello&nbsp;<span id=“name">World!</span>

HelloPagepublic class HelloPage { private String name = “Teeda”; //getter/setter

結果は Hello Teeda

Page 21: 今から役立つ ! Teeda 入門

21Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (inputText)(inputText)

• inputText– 入力コンポーネント– Input タグ(タイプは text )で、 id ありadd.html<form id=“addForm”> <input type=“text” id=“arg1” title=“IN” />

AddPagepublic class AddPage { private Integer arg1; //getter/setter

Page 22: 今から役立つ ! Teeda 入門

22Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (button1)(button1)

• button ( do )– Page の任意のメソッド(引数なし)を呼び出す– Input タグ(タイプは submit )で、 id が” do*”

add.html<form id=“addForm”> <input type=“submit” id=“doCalculate” value=“submit”/>

AddPagepublic class AddPage { public String doCalculate() { result = arg1 + arg2; return “addResult”;//null を返すと自画面遷移 }

Page 23: 今から役立つ ! Teeda 入門

23Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (button2)(button2)

• button ( go )– Page のメソッドを呼び出さない– Validation はかかる– 状態維持はされる– Input タグ(タイプは submit )で、 id が” go*”

add.html<form id=“addForm”> <input type=“submit” id=“goAddResult” value=“submit”/>

Page 24: 今から役立つ ! Teeda 入門

24Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (button3)(button3)

• button ( jump )– Page のメソッドを呼び出さない– Validation もかからない– 状態維持もされない– Input タグ(タイプは submit )で、 id

が” jump*”add.html<form id=“addForm”> <input type=“submit” id=“jumpAddResult” value=“submit”/>

Page 25: 今から役立つ ! Teeda 入門

25Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (forEach)(forEach)

• forEach– tbody タグか div タグで繰り返しの配列 /List を指定

<table> <tbody id=“aaaItems”> <tr> <td><span id=“foo”>hoge</span></td> <td><span id=“bar”>huga</span></td></tr> </tbody></table>

public class FooPage { private String foo; private String bar; private FooItem[] aaaItems;//FooItem は単なる DTO

Page 26: 今から役立つ ! Teeda 入門

26Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (( ライフサイクルメソッドライフサイクルメソッド 1)1)

• initialize– Page のインスタンス生成時に 1 度だけ呼ばれる

• 画面の初期状態を設定– 戻り値は String 、 Class 、 void のどれかを選択

可能• String の場合は HTML 名を指定• Class の場合は Page クラスを指定• Void の場合は自画面にのみ遷移public Class initialize() {

// 初期化ロジック return null; }

Page 27: 今から役立つ ! Teeda 入門

27Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (( ライフサイクルメソッド2ライフサイクルメソッド2 ))

• prerender–画面の描画直前に毎回呼ばれる

• 表示上の見栄えを整理する

–戻り値は String 、 Class 、 void のどれかを選択可能

• Initialize と同様AddPagepublic class AddPage { public Class prerender() { // 表示上の設定項目を整える return null; }}

Page 28: 今から役立つ ! Teeda 入門

28Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門入門 (Validator/Converter)(Validator/Converter)

• Validator– Validator は Page クラスにアノテーションで指

定– メソッドかフィールドに指定

• Converter– Converter も Validator 同様

@Required @Length(minimum = 2, maximum = 5) private Integer arg1;

@DateTimeConverterpublic Date getLimitDate() { return limitDate;}

Page 29: 今から役立つ ! Teeda 入門

29Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda 入門(デモ)入門(デモ)

• Demo アプリ

Page 30: 今から役立つ ! Teeda 入門

30Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda の歩んでいく道の歩んでいく道

• Teeda Roadmap– Teeda1.0

• Stable として、 Policy も今後変更なし– HTML テンプレートとのマッピングは id ベース– 1HTML に対し、 1Page クラス

• 地道な修正・改善を繰り返す– ForEach のネスト対応、 faces-config の順番制御など

– Teeda1.1• Dev として、基本は踏襲しつつも積極的に変更• よりコード量の削減を目的とした変更を取り入れる

– public フィールド対応( Seasar2.5 )• カスタマイザビリティと開発生産性の強化• JSF1.2 対応

Page 31: 今から役立つ ! Teeda 入門

31Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda1.1 Roadmap1Teeda1.1 Roadmap1

• public フィールド対応– getter/setter の記述量削減– Seasar2.5 レベルで対応AddPagepublic class AddPage { public Integer arg1;//getter/sesster なし public Integer arg2; public Integer result; public String doCalculate() { result = arg1 + arg2; return “addResult”;//null を返すと自画面遷移 }}

Page 32: 今から役立つ ! Teeda 入門

32Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda1.1 Roadmap2Teeda1.1 Roadmap2

• カスタマイザビリティの強化– 規約拡張機能の強化–カスタムコンポーネント開発支援

• できるだけ作成するリソースを減らす

• 開発生産性の強化– Bluescreen 機能

• 開発時にどこで何のエラーが発生したかが瞬時にわかる

– Configuration の状況を可視化• Page クラス、各内部的なクラスなどの状態を可視化

Page 33: 今から役立つ ! Teeda 入門

33Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda1.1 Roadmap3Teeda1.1 Roadmap3

• JSF1.2 対応– 段階的に JSF1.2 の仕様を取り入れていく

• EL 式の解釈を JSP2.1 に委譲• Ajax サポートの強化• 標準コンポーネントの強化

– カスタムコンポーネントの作成

• Teeda1.1 は Tiger 前提

Page 34: 今から役立つ ! Teeda 入門

34Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda RoadmapTeeda Roadmap

• ドキュメント作成– JSF自体のドキュメント– Teeda extension のドキュメント

• リファレンスの強化• チュートリアルの作成• コンポーネントショウケースの作成

– コンポーネントの使い方、ソース、詳細ドキュメントのセット

   コミッタ・協力者募集中です

Page 35: 今から役立つ ! Teeda 入門

35Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

それ以外のオモシロそれ以外のオモシロ RoadmapRoadmap

• それ以外のオモシロ Roadmap (何の役に立つかはおいておいて・・・)– Java Web Start で Teeda を配布?– Web コンテナと同梱されて配布?

Page 36: 今から役立つ ! Teeda 入門

36Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda Teeda リリースプランリリースプラン

• Teeda リリースプラン– Teeda1.0 は基本 2 ヶ月に 1 度リリース– Teeda1.1 のリリースプラン

• 2007/07 Beta1• 2007/08 RC1• 2007/09 RC2• 2007/10 1.1 リリース

Page 37: 今から役立つ ! Teeda 入門

37Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

Teeda RoadmapTeeda Roadmap まとめまとめ

• Teeda1.0 系– 安定版として、これからもバグ修正・改善– 単体テスト、結合テストを増やしていく– ドキュメントの充実

• Teeda1.1 系– 開発版。より新機能の追加に重きを置く– より開発の生産性を挙げる

Page 38: 今から役立つ ! Teeda 入門

38Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

TeedaTeeda とと S2PresentationS2Presentation の棲み分けの棲み分け

• S2Presentation ?– S2.5 に同梱される– 開始は S2.5 、 S2Persistence以後なので流動的– Seasar の仕様( SSR )は各 issueごとでそれ

が決まり次第実装。先に仕様決定、 Wiki に掲載• Teeda

– S2.4 で稼動–枯れた安定版への階段を徐々に上る

Page 39: 今から役立つ ! Teeda 入門

39Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

まとめまとめ

• 本セッションでは、– Teeda の特徴– Teeda の入門– Teeda の Roadmap

• 今後の方向性、リリースプラン

Page 40: 今から役立つ ! Teeda 入門

40Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

各種リソース各種リソース 11

• Teeda各種リソース– http://teeda.seasar.org/ja/– JavaExpert 創刊号特集 2– もっと deep なネタが知りたければ、、、

• ちょっと古いけど、「 Inside of Teeda 」– https://www.seasar.org/svn/sandbox/learnings/trunk/donbiki/

donbiki-view/1st/InsideOfTeeda.ppt

– サンプルを動かしたいなら、• Dolteng の Scaffold• JavaExpert の TODO管理

– http://www.gihyo.co.jp/book/2007/236471/download/todo-manage.zip

Page 41: 今から役立つ ! Teeda 入門

41Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

各種リソース各種リソース 22

• Teeda各種リソース 2– Seasar-user–各コミッタの blog

• http://d.hatena.ne.jp/shot6/• などなど。。。

Page 42: 今から役立つ ! Teeda 入門

42Seasar ConferenceSeasar Conference

2007 Spring2007 Spring Copyright© 2004-2007 The Seasar Foundation and the others. All rights reserved.

ありがとうございまし

感謝感謝