WebSphere Application Server Network Deployment for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

スクリプトによる Web モジュールでのセッション管理用アプリケーションの構成

スクリプトと wsadmin ツールを使用して、Web モジュール内のセッション・マネージメント用のアプリケーションを構成します。

始める前に

このタスクを開始する場合は、あらかじめ wsadmin ツールが稼働 している必要があります。 詳しくは、wsadmin スクリプト・クライアントの開始 の項目を参照してください。

このタスクについて

AdminApp オブジェクトを使用して、アプリケーションの構成を設定できます。 ただし、AdminApp オブジェクトでは設定できない構成もいくつかあります。 以下のタスクでは、AdminConfig オブジェクトを使用して、アプリケーションで Web モジュールのセッション・マネージャーを構成します。

プロシージャー

  1. アプリケーションのデプロイメント構成オブジェクトを識別して、 deployment 変数に割り当てます。 以下に例を示します。
    • Jacl を使用:
      set deployments [$AdminConfig getid /Deployment:myApp/]
    • Jython を使用:
      deployments = AdminConfig.getid('/Deployment:myApp/')
      print deployments
    各部の意味は、次のとおりです。
    set Jacl コマンドです。
    deployments 変数名です。
    $ 変数名を値で置換する Jacl 演算子です。
    AdminConfig WebSphere Application Server の構成を表すオブジェクトです。
    getid AdminConfig コマンドです。
    Deployment 属性です。
    myApp 属性の値です。
    出力例:
    myApp(cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#Deployment_1)
  2. アプリケーション内のすべてのモジュールを取得して、modules 変数に割り当てます。 以下に例を示します。
    • Jacl を使用:
      set appDeploy [$AdminConfig showAttribute $deployments deployedObject]
      set mod1 [$AdminConfig showAttribute $appDeploy modules]
      出力例:
      (cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#WebModuleDeployment_1)
      (cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#EJBModuleDeployment_1)
      (cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#WebModuleDeployment_2)
    • Jython を使用:
      appDeploy = AdminConfig.showAttribute(deployments, 'deployedObject')
      mod1 = AdminConfig.showAttribute(appDeploy, 'modules')
      print mod1
      出力例:
      [(cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#WebModuleDeployment_1) 
      (cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#EJBModuleDeployment_1)
      (cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#EJBModuleDeployment_2)]
    各部の意味は、次のとおりです。
    set Jacl コマンドです。
    appDeploy 変数名です。
    mod1 変数名です。
    $ 変数名を値で置換する Jacl 演算子です。
    AdminConfig WebSphere Application Server の構成を表すオブジェクトです。
    showAttribute AdminConfig コマンドです。
    deployments ステップ 1 で指定したデプロイメント・オブジェクトの ID を評価します。
    deployedObject 属性です。
  3. セッション・マネージャーに設定できる属性のリストを取得するには、 attributes コマンドを使用します。以下に例を示します。
    • Jacl を使用:
      $AdminConfig attributes SessionManager
    • Jython を使用:
      print AdminConfig.attributes('SessionManager')
    各部の意味は、次のとおりです。
    $ 変数名を値で置換する Jacl 演算子です。
    AdminConfig WebSphere Application Server の構成を表すオブジェクトです。
    attributes AdminConfig コマンドです。
    SessionManager 属性です。
    出力例:
    "accessSessionOnTimeout Boolean"
    "allowSerializedSessionAccess Boolean"
    "context ServiceContext@"
    "defaultCookieSettings Cookie"
    "enable Boolean"
    "enableCookies Boolean"
    "enableProtocolSwitchRewriting Boolean"
    "enableSSLTracking Boolean"
    "enableSecurityIntegration Boolean"
    "enableUrlRewriting Boolean"
    "maxWaitTime Integer"
    "properties Property(TypedProperty)*"
    "sessionDRSPersistence DRSSettings"
    "sessionDatabasePersistence SessionDatabasePersistence"
    "sessionPersistenceMode ENUM(DATABASE, DATA_REPLICATION, NONE)"
    "tuningParams TuningParams"
  4. セッション・マネージャーの属性をセットアップします。 次の例では、 セッション・マネージャーに 4 つのトップレベル属性を設定します。 この例を変更して、セッション・マネージャーに他の属性を設定できます。 これには、Cookie、DRSSettings、SessionDataPersistence、および TuningParms オブジェクト・タイプのネストされた属性が含まれます。 それらのオブジェクト・タイプの属性をリストするには、 AdminConfig オブジェクトの attribute コマンドを使用します。
    • Jacl を使用:
      set attr0 [list enable true]
      set attr1 [list enableSecurityIntegration true]
      set attr2 [list maxWaitTime 30]
      set attr3 [list sessionPersistenceMode NONE]
      set attr4 [list enableCookies true]
      set attr5 [list invalidationTimeout 45]
      set tuningParmsDetailList [list $attr5]
      set tuningParamsList [list tuningParams $tuningParmsDetailList]
      set pwdList [list password 95ee608]
      set userList [list userId Administrator]
      set dsNameList [list datasourceJNDIName jdbc/session]
      set dbPersistenceList [list $dsNameList $userList $pwdList]
      set sessionDBPersistenceList [list $dbPersistenceList]
      set sessionDBPersistenceList [list sessionDatabasePersistence $dbPersistenceList]
      set kuki [list maximumAge 1000]
      set cookie [list $kuki]
      set cookieSettings [list defaultCookieSettings $cookie]
      set sessionManagerDetailList [list $attr0 $attr1 $attr2 $attr3 $attr4 $cookieSettings $tuningParamsList $sessionDBPersistenceList]
      set sessionMgr [list sessionManagement $sessionManagerDetailList]
      set id [$AdminConfig create ApplicationConfig $appDeploy [list $sessionMgr] configs]
      set targetMappings [lindex [$AdminConfig showAttribute $appDeploy targetMappings] 0]
      set attrs [list config $id]
      $AdminConfig modify $targetMappings [list $attrs]
      Jacl を使用した出力例:
      sessionManagement {{enableSecurityIntegration true} {maxWaitTime 30} {sessionPersistenceMode NONE} {enabled true}}
    • Jython を使用:
      attr0 = ['enable', 'true']
      attr1 = ['enableSecurityIntegration', 'true']
      attr2 = ['maxWaitTime', 30]
      attr3 = ['sessionPersistenceMode', 'NONE']
      attr4 = ['enableCookies', 'true']
      attr5 = ['invalidationTimeout', 45]
      tuningParmsDetailList = [attr5]
      tuningParamsList = ['tuningParams', tuningParmsDetailList]
      pwdList = ['password', '95ee608']
      userList = ['userId', 'Administrator']
      dsNameList = ['datasourceJNDIName', 'jdbc/session']
      dbPersistenceList = [dsNameList, userList, pwdList]
      sessionDBPersistenceList = [dbPersistenceList]
      sessionDBPersistenceList = ['sessionDatabasePersistence', dbPersistenceList]
      kuki = ['maximumAge', 1000]
      cookie = [kuki]
      cookieSettings = ['defaultCookieSettings', cookie]
      sessionManagerDetailList = [attr0, attr1, attr2, attr3, attr4, cookieSettings, tuningParamsList, sessionDBPersistenceList]
      sessionMgr = ['sessionManagement', sessionManagerDetailList]
      id = AdminConfig.create('ApplicationConfig', appDeploy,[sessionMgr], 'configs')
      targetMappings = AdminConfig.showAttribute(appDeploy, 'targetMappings')
      targetMappings = targetMappings[1:len(targetMappings)-1]
      print targetMappings
      attrs = ['config', id]
      AdminConfig.modify(targetMappings,[attrs])
      Jython を使用した出力例:
      [sessionManagement, [[enableSecurityIntegration, true], [maxWaitTime, 30], [sessionPersistenceMode, NONE]]
  5. Web モジュールの属性をセットアップします。 以下に例を示します。
    • Jacl を使用:
      set nameAttr [list name myWebModuleConfig]
      set descAttr [list description "Web Module config post create"]
      set webAttrs [list $nameAttr $descAttr $sessionMgr]
      出力例:
      {name myWebModuleConfig} {description {Web Module config post create}}
      {sessionManagement {{enableSecurityIntegration true} {maxWaitTime 30}
      {sessionPersistenceMode NONE} {enabled true}}}
      
    • Jython を使用:
      nameAttr = ['name', 'myWebModuleConfig']
      descAttr = ['description', "Web Module config post create"]
      webAttrs = [nameAttr, descAttr, sessionMgr]
      出力例:
      [[name, myWebModuleConfig], [description, "Web Module config post create"],
      [sessionManagement, [[enableSecurityIntegration, true], [maxWaitTime, 30],
      [sessionPersistenceMode, NONE], [enabled, true]]]]
    各部の意味は、次のとおりです。
    set Jacl コマンドです。
    nameAttrdescAttrwebAttrs 変数名です。
    $ 変数名を値で置換する Jacl 演算子です。
    name 属性です。
    myWebModuleConfig name 属性の値です。
    description 属性です。
    Web Module config post create description 属性の値です。
  6. アプリケーション内の Web モジュールごとにセッション・マネージャーを作成します。 次の例を変更して、Web モジュール構成内にセッション・マネージャーの他の属性を設定できます。 このステップにはターゲット・マッピングも定義する必要があります。
    • Jacl を使用:
      foreach module $mod1 {
      if {[regexp WebModuleDeployment $module] == 1} {
      		set moduleConfig [$AdminConfig create WebModuleConfig $module $webAttrs]
      		set targetMappings [lindex [$AdminConfig showAttribute $module targetMappings] 0]
      		set attrs [list config $moduleConfig]
      		$AdminConfig modify $targetMappings [list $attrs]
      	}
      }
    • Jython を使用:
      arrayModules = mod1[1:len(mod1)-1].split(" ")
      for module in arrayModules:
      if module.find('WebModuleDeployment') != -1:
      		AdminConfig.create('WebModuleConfig', module, webAttrs)
      targetMappings = targetMappings[1:len(targetMappings)-1]
      		attrs = ['config', moduleConfig]
      		AdminConfig.modify (targetMappings, [attrs])
    出力例:
    myWebModuleConfig(cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#WebModuleConfiguration_1)

    セッション・マネージャーを作成するときに tuningParamsList 属性を指定しないと、デプロイしたアプリケーションを始動する際にエラーを受け取ります。

  7. 構成の変更を保管します。
    以下の Jython コマンドを使用して、構成変更を保管します。
    AdminConfig.save()
  8. ノードを同期します (Network Deployment 環境の場合のみ)。 詳しくは、wsadmin ツールによるノードの同期化 の項目を参照してください。
タスク・トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 8:28:52 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.iseries.doc/info/iseriesnd/ae/txml_webmodules.html