フォトアルバム

2011年10月

            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

なかのひと

373news.com

google Search

  • Google
    blog.ganymean.org
    WWW

Google Analytics

« modelglue+tartanのサンプル紹介-3 | メイン | modelglue+tartanのサンプル紹介-5 »

modelglue+tartanのサンプル紹介-4

さて、modelglue.xmlの一例を紹介したところで、controller<userManager>を見てみます。
 controller<userManager>は、ModelGlue.Core.Controllerを拡張したものです。
冒頭に、お決まりのinit( )メソッドがありますが、一般的なmodelglueアプリケーションの場合と比較して、tartan連携モデルでは、tartanサービスの呼出し手続きをinit( )で行います。

1.一般的modelGlueアプリケーション

    <cffunction name="init" returntype="usermanager" access="public" output="false">
        <cfargument name="core" type="ModelGlue.ModelGlue" required="true"/>
        <cfset super.init(arguments.core) />
        <cfset variables.dsn = arguments.core.getConfigSetting("dsn") />
        <cfset variables.dbUser = arguments.core.getConfigSetting("dbUser") />
        <cfset variables.dbPass = arguments.core.getConfigSetting("dbPass") />
        <cfreturn this />
    </cffunction>

2.tartan連携modelGlueアプリケーション

<cffunction name="Init" access="Public" returnType="userManager" output="false" hint="I build a new SampleController">
  <cfargument name="ModelGlue" type="ModelGlue.ModelGlue" required="true" />
  <cfset var result = "" />

  <cfset super.Init(arguments.ModelGlue) />
 
  <!--- Load the config params for the Tartan app we're talking to --->
  <cfset result = getModelGlue().getConfigBean("Tartan.xml") />
 
  <!--- Load the Tartan proxy --->
  <cfset variables.tartanProxy = createObject("component", "ModelGlue.Util.TartanProxy").init(result) />
 
  <!--- We're going to need the catClub service universally --->
  <cfset variables.clubService = getTartan().CreateService("catClub") /> 

<!--- append from original "init" function ---> 
  <cfset variables.dsn = arguments.ModelGlue.getConfigSetting("dsn") />
  <cfset variables.dbUser = arguments.ModelGlue.getConfigSetting("dbUser") />
  <cfset variables.dbPass = arguments.ModelGlue.getConfigSetting("dbPass") />


  <cfreturn this />
</cffunction>

tartan連携アプリケーションでは、以下の部分をおまじないとして追加すればいいようです。
(ただし、CreateService( ) 内のサービス名をターゲットに応じて変更してください。)

  <!--- Load the config params for the Tartan app we're talking to --->
  <cfset result = getModelGlue().getConfigBean("Tartan.xml") />
 
  <!--- Load the Tartan proxy --->
  <cfset variables.tartanProxy = createObject("component", "ModelGlue.Util.TartanProxy").init(result) />
 
  <!--- We're going to need the catClub service universally --->
  <cfset variables.clubService = getTartan().CreateService("catClub") /> 


次回は、メソッド<getMembers>について、紹介します。

トラックバック

このページのトラックバックURL:
http://app.synapse-blog.jp/t/trackback/190195/6001486

modelglue+tartanのサンプル紹介-4を参照しているブログ:

コメント

コメントを投稿

コメントは記事の投稿者が承認するまで表示されません。

ログイン

  • コントロールパネルへのログイン
    アカウント:

    パスワード:

更新ブログ

最近のトラックバック

Google

ブログ powered by TypePad
Member since 04/2005