フォトアルバム

2009年7月

      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  

なかのひと

アンケート

  • Do you Like?
    アンケート
    どのColdfusion用フレームワークが好き?
    ModelGlue:Unity
    ModelGLue
    Mach-II
    FuseBox
    LiteWire
    OnTap
    ColdBox
    OnAir
    cfWheels
    CFRails

    [PR]アンログ.jp 自動車保険

373news.com

想ひ出

  • Dvc00050
    携帯で撮った写真をアルバムにしています。

サムネイル

  • CF-OOP









  • ganymean.org









  • シナプス

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:

コメント

コメントを投稿

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

ログイン

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

    パスワード:

PR情報

  • [[PR]]
  • おすすめバナー

更新ブログ

google Search

  • Google
    blog.ganymean.org
    WWW

最近のトラックバック

Google

SHINOBI

Blog powered by TypePad
Member since 04/2005