Top Banner
T2ジェク 米林 正明 片山 暁雄 T2でつなごう! -つなぐつながるWebク「T2」の紹
82

sc2009white_T2

Jul 01, 2015

Download

Technology

T2でつなごう!-つなぐつながるWebフレームワーク「T2」の紹介-
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: sc2009white_T2

T2プロジェクト

米林正明

片山暁雄

T2でつなごう!-つなぐつながるWebフレームワーク「T2」の紹介

Page 2: sc2009white_T2

自己紹介

�名前

�米林 正明

�ID

�id:yone098

�所属

�株式会社Abby 代表取締役社長

Page 3: sc2009white_T2

自己紹介

�名前

�片山 暁雄

�ID

�id:c9katayama

�所属�株式会社キャピタルアセットプランニング

Page 4: sc2009white_T2

Agenda

�T2の概要

�T2の基本姿勢

�T2の目指す所

�機能紹介

�DIコンテナ非依存

�今後の展開

�デモ

Page 5: sc2009white_T2

T2 - The WEB Connector -

T2の概要

Page 6: sc2009white_T2

サーバサーバサーバサーバ

クライアントクライアントクライアントクライアント

Webを取り巻く環境

Ajax

XML

Flex3HTML

Param

Action ActionSupport POJO

フレームワークフレームワークフレームワークフレームワーク

AMF3

Struts Struts2 BlazeDS

Page 7: sc2009white_T2

Webを取り巻く環境

無理無理無理無理

Page 8: sc2009white_T2

T2とは

�T2とは�Webフレームワーク

�テーマ「つなぐ・つながる」

�クライアントとユーザーコードの仲介役

Page 9: sc2009white_T2

サーバ

クライアント

T2でつなぐつながる

T2!

Page 10: sc2009white_T2

T2 - The WEB Connector -

T2のスタイル

Page 11: sc2009white_T2

T2のスタイル

�アノテーションドリブン�エントリーポイントのPOJOにアノテーション付

�エントリーポイントの分かりやすさ重視

�規約とアノテーションを適切に利用

サーバ@GET@ActionPath(“/hoge”)@POST

Page 12: sc2009white_T2

T2のスタイル

�基本はステートレス

�特定のコンテナへ依存しない

コンテナコンテナコンテナコンテナなくてなくてなくてなくてももももOK

Page 13: sc2009white_T2

T2のスタイル

�ユーザーに介入してほしい�コアはシンプルに extで拡張を提供

�できればプロジェクトごとに必要な機能を作ってほしい

�extはあなたが作る!

Page 14: sc2009white_T2

T2 - The WEB Connector -

T2の目指す所

Page 15: sc2009white_T2

T2の目指す所

�マルチビューをさばけるフレームワーク

�過渡期でも使えるフレームワーク

�依存性の少ないフレームワーク

�ユーザーが支配出来るフレームワーク

Page 16: sc2009white_T2

T2 - The WEB Connector -

機能紹介

Page 17: sc2009white_T2

T2 - The WEB Connector -

リクエストとPOJOの

マッピング

Page 18: sc2009white_T2

基本機能

STEP1:@Pageででででクラスクラスクラスクラス特定特定特定特定

http://yoursite.com/t2app/hello/world

@Page(“/hello”)public class MyHello {…

Page 19: sc2009white_T2

基本機能

STEP2222:メソッドアノテーションメソッドアノテーションメソッドアノテーションメソッドアノテーションででででメソッドメソッドメソッドメソッド特定特定特定特定

@Page(“/hello”)public class MyHello {

@GET@ActionPath(“/world”)public Navigation helloworld(){…

http://yoursite.com/t2app/hello/world

Page 20: sc2009white_T2

メソッド特定方法

@GET GETののののリクエストリクエストリクエストリクエストでででで かつかつかつかつ@ActionPath(“/world”) /worldののののパスパスパスパスのののの場合場合場合場合public Navigation helloworld(){…

全全全全マッチマッチマッチマッチのののの場合場合場合場合、、、、呼呼呼呼びびびび出出出出されるされるされるされる。。。。

Page 21: sc2009white_T2

メソッドアノテーション

�@GET,@POST

�@ActionPath

�@ActionParam

�リクエストパラメータのkey

�key-value指定も可能

�@Ajax

�@Amf (0.6から)

�@Default

Page 22: sc2009white_T2

アノテーションマッチ

�複数のメソッドがマッチした場合

�たくさんアノテーションがマッチした方を優先

�同じ数のアノテーションがマッチした場合

�先に見つかったほうを使用(バージョン0.5)

�ただしここは検討中

�マッチするのがなかった場合

�@Defaultがついたメソッドを呼ぶ

�@Defaultつきがない場合、エラー

Page 23: sc2009white_T2

メソッド引数特定方法

�引数のアノテーションを見て、引数を解決�@RequestParam,

�@RequestHeader

�@SessionAttr

�@Upload

�@Form

�@Index

�@Var

Page 24: sc2009white_T2

メソッド引数特定方法

�引数の型を見て、引数を解決�HttpServletRequest, HttpServletResponse

�HttpSession

�ServletContext

�Cookie/Cookie[]

�WebContext

�Request, Response

�UploadFile

�ErrorInfo

Page 25: sc2009white_T2

メソッド引数特定方法

@ActionPath(“/world/{id}”)public Navigation helloworld(HttpSession session,@Var(“id”) String id,@RequestParam(“name”) String name){

Page 26: sc2009white_T2

T2 - The WEB Connector -

レスポンス

Page 27: sc2009white_T2

レスポンス

�戻り値として、Navigationインターフェースを

実装したクラスのインスタンスを返す

�Forward

�Redirect

�SimpleText

�Direct

�Json

�NoOperation

�PassThrough

Page 28: sc2009white_T2

レスポンス

//JSPににににForward@ActionPath(“/world/{id}”)public Navigation helloworld(){return Forward.to(“/WEB-INF/jsp/hoge.jsp”);}

//画像画像画像画像ファイルファイルファイルファイルをををを返返返返すすすす@ActionPath(“/worldImage”)public Navigation helloworldImage(){File image = new File(“world.png”);return Direct.from(image);}

Page 29: sc2009white_T2

T2 - The WEB Connector -

DIコンテナ非依存

Page 30: sc2009white_T2

DIコンテナ非依存

�T2が動作するDIコンテナ

�Guice

�Spring

�Lucy

Page 31: sc2009white_T2

DIコンテナ非依存

今日今日今日今日はははは

Seasar

カンファレンスカンファレンスカンファレンスカンファレンス

やないかやないかやないかやないか!!!!

Page 32: sc2009white_T2

DIコンテナ非依存

Seasar君君君君、、、、

どこどこどこどこ行行行行ってしもたんやってしもたんやってしもたんやってしもたんや…

Page 33: sc2009white_T2

DIコンテナ非依存

�T2が動作するDIコンテナ

�Seasar2

�Guice

�Spring

�Lucy

あるよあるよあるよあるよ!!!!

Page 34: sc2009white_T2

DIコンテナ非依存

�環境構築~Seasar2編~

�参照

�t2-employee

�構成

�S2.4 + S2Dao

Page 35: sc2009white_T2

DIコンテナ非依存

�作成設定ファイル~Seasar2編~

�aop.dicon

�app.dicon

�dao.dicon

�jdbc.dicon

Page 36: sc2009white_T2

DIコンテナ非依存

�web.xml~Seasar2編~<filter>

<filter-name>t2</filter-name>

<filter-class>org.t2framework.filter.T2Filter

</filter-class>

<init-param>

<param-name>t2.rootpackage</param-name>

<param-value>examples.employee.page</param-value>

</init-param>

<init-param>

<param-name>t2.container.adapter</param-name>

<param-value>org.t2framework.plugins.container.Seasar2Adapter</param-value>

</init-param>

<init-param>

<param-name>t2.eagerload</param-name>

<param-value>true</param-value>

</init-param>

</filter>

Page 37: sc2009white_T2

DIコンテナ非依存

�Pageクラス~Seasar2編~

@RequestScope@Page("login")public class LoginPage

Page 38: sc2009white_T2

DIコンテナ非依存

�PageクラスDI~Seasar2編~

protected FooService fooService;

@Binding(bindingType = BindingType.MUST)public void setFooService(FooService fooService) {this.fooService = fooService;

}

Page 39: sc2009white_T2

DIコンテナ非依存

�環境構築~Guice編~

�参照

�t2-guice

�構成

�Guice + JPA

Page 40: sc2009white_T2

DIコンテナ非依存

�作成設定ファイル~Guice編~

�persistence.xml

�※Guice用のモジュール(Java

で)

Page 41: sc2009white_T2

DIコンテナ非依存

�web.xml~Guice編~<filter>

<filter-name>t2</filter-name>

<filter-class>org.t2framework.t2.filter.T2Filter</filter-class>

<init-param>

<param-name>t2.rootpackage</param-name>

<param-value>org.t2framework.samples.guice.page</param-value>

</init-param>

<init-param>

<param-name>t2.container.adapter</param-name>

<param-value>org.t2framework.t2.adapter.GuiceAdapter</param-value>

</init-param>

<init-param>

<param-name>t2.exclude-resources</param-name>

<param-value>css, js</param-value>

</init-param>

</filter>

Page 42: sc2009white_T2

DIコンテナ非依存

�Pageクラス~Guice編~

@RequestScoped@Page("add")public class AddPage

Page 43: sc2009white_T2

DIコンテナ非依存

�PageクラスDI~Guice編~

@Injectprivate CalcService calcService;

@Inject@RequestParametersMap<String, String[]> params;

Page 44: sc2009white_T2

DIコンテナ非依存

�環境構築~Spring編~

�参照

�t2-spring

�構成

�Spring2.5 + iBatis

Page 45: sc2009white_T2

DIコンテナ非依存

�作成設定ファイル~Spring編~

�applicationContext.xml

�dao-ibatis.xml

�sql-map-config.xml

�XxxSqlMap.xml

Page 46: sc2009white_T2

DIコンテナ非依存

�web.xml~Spring編~<filter>

<filter-name>t2</filter-name>

<filter-class>org.t2framework.t2.filter.T2Filter</filter-class>

<init-param>

<param-name>t2.rootpackage</param-name>

<param-value>org.t2framework.samples.spring.page</param-value>

</init-param>

<init-param>

<param-name>t2.config</param-name>

<param-value>applicationContext.xml</param-value>

</init-param>

<init-param>

<param-name>t2.container.adapter</param-name>

<param-value>org.t2framework.t2.adapter.SpringAdapter</param-value>

</init-param>

<init-param>

<param-name>t2.eagerload</param-name>

<param-value>true</param-value>

</init-param>

<init-param>

<param-name>t2.exclude-resources</param-name>

<param-value>css, js</param-value>

</init-param>

</filter>

Page 47: sc2009white_T2

DIコンテナ非依存

�Pageクラス~Spring編~

@Component@Page("add")public class AddPage

Page 48: sc2009white_T2

DIコンテナ非依存

�PageクラスDI~Spring編~

private CalcService calcService;

@Autowired(required=true)public void setCalcService(CalcService calcService) {this.calcService = calcService;

}

Page 49: sc2009white_T2

DIコンテナ非依存

�動作確認アプリケーションサーバ

�Tomcat5x/6x

�JBoss4x/5x

�Jetty6x

�WebLogic10x

�その他いろいろ… Yonexで確認

Page 50: sc2009white_T2

T2 - The WEB Connector -

今後の展望

Page 51: sc2009white_T2

今後の展望

�バージョン0.6

�Flex3対応 (AMF3)

�BlazeDSのAMF3ライブラリ使用

�もしくはS2Flex2のAMF3部分使用

�バージョン0.7

�Atom,RSS

Page 52: sc2009white_T2

その他プロダクト

� Commons

�共通ユーティリティ郡

� Lucy

�DIコンテナ

�アノテーションベース

�Daisy

�2waySQLフレームワーク

�OS(Object-SQL)マッパ

�薄いJDBCラッパー

Page 53: sc2009white_T2

その他プロダクト

�Yonex(仮)�Hyper Integration Test Suite

レポーティングとかも

提供したい!

Page 54: sc2009white_T2

プロジェクトリソース

�サイト�http://code.google.com/p/t-2/

�リリースアーカイブ、ドキュメント、ソースコード

�メーリングリスト�T2-users

�http://groups.google.com/group/t2-users

�開発の話、仕様の話、なんでもOK。

Page 55: sc2009white_T2

T2 - The WEB Connector -

まとめ

Page 56: sc2009white_T2

まとめ

�T2はマルチビュー対応

�つなぐ機能は提供します!

�が

�組み合わせはユーザーで!

�まだまだ発展途上。ご意見ください!

Page 57: sc2009white_T2

T2 - The WEB Connector -

エンドロール

Page 58: sc2009white_T2

T2 - The WEB Connector -

出演

Page 59: sc2009white_T2

T2 - The WEB Connector -

テツ

Page 60: sc2009white_T2

T2 - The WEB Connector -

テツ

Page 61: sc2009white_T2

T2 - The WEB Connector -

テツ

Page 62: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 63: sc2009white_T2

T2 - The WEB Connector -

Page 64: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 65: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 66: sc2009white_T2

T2 - The WEB Connector -

Page 67: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 68: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 69: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 70: sc2009white_T2

T2 - The WEB Connector -

Page 71: sc2009white_T2

T2 - The WEB Connector -

イーダ

Page 72: sc2009white_T2

T2 - The WEB Connector -

designed by

カネウチカズコ

Page 73: sc2009white_T2

T2 - The WEB Connector -

出演コミッタ

Page 74: sc2009white_T2

T2 - The WEB Connector -

片山 暁雄

Page 75: sc2009white_T2

T2 - The WEB Connector -

Page 76: sc2009white_T2

T2 - The WEB Connector -

米林 正明

Page 77: sc2009white_T2

T2 - The WEB Connector -

Page 78: sc2009white_T2

T2 - The WEB Connector -

横田 健彦

Page 79: sc2009white_T2

T2 - The WEB Connector -

Page 80: sc2009white_T2

T2 - The WEB Connector -

大谷 晋平(自宅)

Page 81: sc2009white_T2

T2 - The WEB Connector -

Page 82: sc2009white_T2

T2 - The WEB Connector -

御静聴ありがとうございました