-Tapestry-S2連携再考(8)

ひきつづき、ひがさんうえやんさんとのBLOGを介したディスカッションです。Tapestryの変更を要求するとして、とにかく変更範囲を少なくTapestryのほうにテストも含めて手数をかけさせない方法は、

private IPage instantiatePage(...)
private IComponent instantiateComponent(...)

これらのorg.apache.tapestry.pageload.PageLoaderのメソッドをprotectedにするということでよい?上記メソッド中のClass#newInstance()コールのファクトリ化とか考えひがさんのところにコメントしましたけど、クラスをJavassistでEnhanceしているは、Poolするはで、変更範囲が大きくなっちゃいそうです。あとは説得する理由を英作文だなぁ。とりえあえず書いたんで、添削してくださいね。コメント即反映で直します(緑の字は再日本語訳です)。
subject: make PageLoader's private-method protected

Hello,
こんにちは。


I am trying to set components on the original IoC-Container called (named だったかな?もうだしちゃったから、忘れよう) 'Seasar' to Tapestry pages and JWC-component-objects. But org.apache.tapestry.pageload.PageLoader's instantiatePage(...) and instantiateComponent(...) are private method. I hope that these private methods to change into protected in the next release.
いま、「Seasar」というオリジナルのIoCコンテナ上のコンポーネントTapestryのページやJWCコンポーネントオブジェクトにセットできないかどうか、試しています。しかし、org.apache.tapestry.pageload.PageLoaderのinstantiatePage(...)と、instantiateComponent(...) はprivateメソッドなのです。次のリリースで、これらのprivateメソッドをprotectedへの変更を希望します。


Because....
Seasar has Type2 and init-method style (and Type3) component instanciate functions already, and these functions will have been apply to outer components like JWC-component-objects on Seasar's next version. See below,
なぜならば。。。
SeasarはすでにType2とinitメソッド風のコンポーネント生成機能を持ってます(それとType3も持ってます)。そして、これらの機能はSesarの次のバージョンまでにはJWCコンポーネントオブジェクトのような外部コンポーネントにも適用できるようになります。以下を見てください。

public interface S2Container {
  public injectDependency(Object outer, Class componentClass)
  public injectDependency(Object outer, String componentName)
}

'S2Container' is next version's interface which omited exceptions and many other methods from Seasar. 'injectDependency(*)' method inject components on S2Container to an 'outer' Java objects. I intended to override Tapestry's PageLoader (and PageSource) like below,
「S2Container」はSeasar中の、例外と多くのメソッドを省略した次バージョンのInterfaceです。「injectDependency(*)」メソッドはS2Container上のコンポーネントJavaオブジェクト「outer」に注入します。私はTapestryのPageLoader(とPageSource)を以下のようにオーバーライドしようとしています。

IPage page = (IPage)super.instantiatePage(...) ;
_container.injectDependency(page, pageName);
return page;

and container configuration sample is
そして、コンテナの設定サンプルは、

<components>
  <component name="home" instance="injection">
    <property name="dataSource">
      <component
        class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
        <property name="driverClassName">
          'oracle.jdbc.driver.OracleDriver'
        </property>
        <property name="URL">
          'jdbc:oracle:thin:@isid00845:1521:ark'
        </property>
      </component>
    </property>
    <initMethod name="init">
      <arg>true</arg>
    </init>
    <aspect pointcut="click">traceAdvice</aspect>
</components>

so, 'home' page-object is set 'dataSource' property and is called 'init(true)'. Additionally, home's 'click(IRequestCycle)' method is maken pointcut for 'traceAdvice' with AOP.
こうして、「home」ページオブジェクトは「dataSource」プロパティが設定され、「init(true)」が呼ばれます。さらには、homeの「click(IRequestCycle)」メソッドはAOPの「traceAdvice」のポイントカットとなります。


By the way, I have seen Tapestry's roadmap in the Wiki. I heared that Tapestry3.1 or later will be refacterd by using HiveMind. Could you think about another component containers like JBoss-AOP, Spring Framework, PicoContainer ...and Seasar?
ところで、以前Tapestryのロードマップを例のWikiで見ました。Tapestry3.1もしくはその後のバージョンはHiveMindを使って書き直すようなことを聞いています。他のコンポーネントコンテナ、たとえばJBoss-AOPとか、Spring Frameworkとか、PicoContainerとか、そしてそして、Seasarとかのことも考慮していただけませんでしょうか。<-Couldは私の英語知識が確かなら、結構丁寧な言い方のはず。本当?


if you are interested, download the latest Seasar from SourceForge.JP (sorry, there is no english version service, but this software has i18n functions).
もし、興味を持たれたなら、最新のSeasarSourceForge.JPからダウンロードしてください(すいませんが、英語版のサービスはありません。しかし、ソフトウェアは国際化機能を持ってます)。


http://prdownloads.sourceforge.jp/seasar/8807/S2-RC1.jar


Thanks for all,
Masataka.
みなさんありがとう。
まさたかでした。

えぃ!だしちゃえ[16:00]
tapestry-dev at jakarta.apache.org に出しちゃいました[16:15]