Fusayuki Minamoto
miki.****@nifty*****
2006年 4月 22日 (土) 00:43:46 JST
SeamのContextについては、WebinarやGavin Kingのブログが参考になります。 これらの方がリファレンスマニュアルより、Seamを生み出した背景やメリット が明確に書いてあるからです。 JBoss Seam Webinar: http://www.jboss.com/services/online_education The Seam Component Model: http://blog.hibernate.org/cgi-bin/blosxom.cgi/Gavin%20King/components.html 例えば、このブログではstatefulのコンポーネントのinjectionのサポート について次のように言及しています。 At this time, most other IoC frameworks have the same two limitations, and this is perfectly defensible in the case of something like Spring where the components being injected are understood to be stateless, and hence any two instances of a component are interchangeable. It's not so good if components are stateful, as they are in JSF. statefulということは、同じクラスのインスタンスであっても、内容は異なる わけですから、同じクラスのインスタンスであればどれでも"interchangeable" ではありません。そこで、個々のインスタンスに名前をつけてContextで管理 する必要がでてきます。そうして、ContextへのIn, Outはコンテナが自動的 に、ダイナミックに、関連コンポーネントに反映させます。 このブログでは最後に3つのウリでまとめています。 First, it allows us to bind stateful components, expecially entity beans, dire ctly to the webpage. (略) Second, it means that the container (Seam) can guarantee cleanup of state from ended or abandoned conversations. (略) Finally, the model allows stateful components to interact in a relatively loos ly coupled way. (略) 最後の、コンポーネント間を疎結合し、それぞれが互いのライフサイクルを 意識しなくて良いというのは便利ですね。 Miki >Java EEでは、 > > Transaction Context > Security Context > Persistence Context > >などの用語があります。 >他にも、EJBのSessionContextのようなのもありますね。 > >これらのContextに共通するのは、 > >(1) メッセージの呼び出し間で、メッセージパラメタとして明示的に渡す > のではなく、システムによってコンポーネント間で伝達される情報です。 >(2) Contextのライフサイクルはコンテナによって管理されます。 > >SeamのContextは、おそらく、コンポーネント間のやり取り >をまたがって参照可能な情報です(そう、会話情報です)。 > >そのスコープはSeam Contextの種類によって規定され、その生滅は >スコープに応じてコンテナによって管理されるのでしょう。 > >だから、Seam Contextも、上の(1),(2)を満たしていると思います。 > >Miki ---- 皆本 房幸 <miki.****@nifty*****> http://d.hatena.ne.jp/neverbird/about