スクリプトを使用したアプリケーション・レベルでのステートフル・セッション Bean のフェイルオーバーの構成
スクリプトと wsadmin ツールを使用して、 ステートフル・セッション Bean のフェイルオーバー用に アプリケーションを構成します。
始める前に
このタスクを開始する前に、wsadmin ツールが稼働している必要があります。 詳しくは、『wsadmin スクリプト・クライアントの開始』を参照してください。
このタスクについて
AdminConfig オブジェクトを使用して、アプリケーションの構成を設定できます。このタスクでは、AdminConfig オブジェクトを 使用して、アプリケーションのすべての EJB モジュールに対する ステートフル・セッション Bean フェイルオーバー構成を 表示します。次に、AdminConfig オブジェクトを使用して、 同じアプリケーションのすべての EJB モジュールに対する ステートフル・セッション Bean フェイルオーバー構成を変更します。
手順
- wsadmin スクリプト・クライアントを開始します。
- Jacl を使用
wsadmin
- Jython を使用
wsadmin -lang Jython
- Jacl を使用
- アプリケーションのデプロイメント構成オブジェクトを識別して、
deployment 変数に割り当てます。例えば、次のようになります。
- Jacl を使用
set app [$AdminConfig getid /Deployment:EJBinWARTest/] set depObj [$AdminConfig showAttribute $app deployedObject]
- Jython を使用
app = AdminConfig.getid("/Deployment:EJBinWARTest/" ) depObj = AdminConfig.showAttribute(app, "deployedObject" )
- Jacl を使用
- アプリケーション構成オブジェクトを取得します。存在しない場合は、作成します。
- Jacl を使用
# Get the single application configuration object: set appConfig [lindex [$AdminConfig showAttribute $depObj configs] 0] # Create the application configuration object if not present: if { ($appConfig == "") } { puts "¥nappConfig not present - creating one" set appConfig [$AdminConfig create ApplicationConfig $depObj {{enableSFSBFailover true} {overrideDefaultDRSSettings false}}] set attrs [list config $appConfig] set targetMappings [lindex [$AdminConfig showAttribute $depObj targetMappings] 0] $AdminConfig modify $targetMappings [list $attrs] } else { puts "¥nappConfig present" }
- Jython を使用
appConfig = AdminConfig.showAttribute (depObj, 'configs') appConfig = appConfig.replace('[','').replace(']','') if (appConfig): print "¥nappConfig present" else: print "¥nappConfig not present - creating one" acAttrs = [] attr1 = ["enableSFSBFailover", "true"] attr2 = ["overrideDefaultDRSSettings", "false"] acAttrs.append(attr1) acAttrs.append(attr2) appConfig = AdminConfig.create('ApplicationConfig', depObj, acAttrs) tmAttrs = ['config', appConfig] targetMappings = AdminConfig.showAttribute (depObj, 'targetMappings') targetMappings = targetMappings[1:len(targetMappings)-1] AdminConfig.modify(targetMappings, [tmAttrs])
- Jacl を使用
- アプリケーションのステートフル・セッション Bean フェイルオーバー構成設定を表示します。
- Jacl を使用
puts "¥nStateful session bean failover settings at the application level" puts [$AdminConfig show $appConfig] # Show the drsSettings of the application: set drsSettings [$AdminConfig showAttribute $appConfig drsSettings] if { ($drsSettings == "") } { puts "drsSettings not present" } else { puts "¥ndrsSettings of the application:" puts [$AdminConfig show $drsSettings] }
- Jython を使用
print "¥nStateful session bean failover configuration of the application :" print AdminConfig.show(appConfig) drsSettings = AdminConfig.showAttribute (appConfig, 'drsSettings') if (drsSettings): print "¥ndrsSettings of the application:" print AdminConfig.show(drsSettings) else: print "drsSettings not present"
- Jacl を使用
- アプリケーションのステートフル・セッション Bean のフェイルオーバーを使用可能にします。
- Jacl を使用
$AdminConfig modify $appConfig {{enableSFSBFailover "true"}}
- Jython を使用
# Enable Stateful session bean failover for the application: AdminConfig.modify(appConfig, [['enableSFSBFailover', 'true']])
- Jacl を使用
- アプリケーションのデータ複製サービスの設定を追加または変更します。
- Jacl を使用
# To add or modify drsSettings for the application: set drsSettings [$AdminConfig showAttribute $appConfig drsSettings] if { ($drsSettings == "") } { puts "¥ndrsSettings not present - creating them" $AdminConfig create DRSSettings $appConfig "{messageBrokerDomainName ReplicationDomain2}" } else { set newMessageBrokerDomainName "{messageBrokerDomainName ReplicationDomain2}" $AdminConfig modify $drsSettings $newMessageBrokerDomainName } $AdminConfig modify $appConfig {{overrideDefaultDRSSettings "true"}} # Show the new or modified drsSettings of the application: set drsSettings [$AdminConfig showAttribute $appConfig drsSettings] puts "¥nModified drsSettings of the application:" puts [$AdminConfig show $drsSettings]
- Jython を使用
drsSettings = AdminConfig.showAttribute (appConfig, 'drsSettings') if (drsSettings): newMessageBrokerDomainName = "{messageBrokerDomainName ReplicationDomain2}" AdminConfig.modify(drsSettings, newMessageBrokerDomainName) else: print "¥ndrsSettings not present - creating them" drsAttr1 = ["messageBrokerDomainName","ReplicationDomain2"] drsAttrs = [] drsAttrs.append(drsAttr1) AdminConfig.create("DRSSettings",appConfig,drsAttrs) AdminConfig.modify(appConfig, [['overrideDefaultDRSSettings', 'true']]) # Show the new or modified drsSettings of the application: drsSettings = AdminConfig.showAttribute (appConfig, 'drsSettings') print "¥nNew or Modified drsSettings of the application:" print AdminConfig.show(drsSettings)
- Jacl を使用
関連タスク:


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_ejbsfsbapp
ファイル名:txml_ejbsfsbapp.html