Jython または Jacl スクリプト言語を wsadmin ツールとともに使用して、
フェデレーテッド・リポジトリー構成ファイルにカスタム・アダプターを定義できます。
始める前に
アプリケーション・サーバーをシャットダウンします。
このタスクについて
フェデレーテッド・リポジトリー構成ファイル
wimconfig.xml は、
WebSphere Application Server 6.1.x でサポートされており、
app_server_root/profiles/profile_name/config/cells/cell_name/wim/config ディレクトリーにあります。
以下のステップを使用して、フェデレーテッド・リポジトリー構成ファイルと、
構成ファイル内で定義されているレルムに、カスタム・アダプターを追加します。
プロシージャー
- テキスト・エディターで wimconfig.xml ファイルを開きます。
- ファイルに新規の config:repositories エレメントを追加します。
このエレメントは、config:realmConfiguration エレメントの前に配置します。
次の例では、com.ibm.ws.wim.adapter.sample.SampleFileAdapter クラスを使用するようにカスタム・リポジトリーを構成し、
SampleFileRepository リポジトリーを ID として設定します。
<config:repositories adapterClassName="com.ibm.ws.wim.adapter.sample.SampleFileAdapter"
id="SampleFileRepository"/>
- wimconfig.xml ファイルを保管し、テキスト・エディターを閉じます。
- 提供された vmmsampleadapter.jar ファイルを app_server_root/lib にコピーします。
- 次のコマンドを入力して、wsadmin ツールを開始します。
wsadmin –conntype none
- 共通リポジトリー構成内のページングを使用不可にします。
ページングを使用不可にするには、
updateIdMgrRepository コマンドの supportPaging パラメーターを false に設定します。
注: サンプル・アダプターはページングをサポートしていないため、このステップを実行する必要があります。
以下の例では、SampleFileRepository リポジトリーをカスタム・リポジトリーの ID として使用します。
Jython を使用:
AdminTask.updateIdMgrRepository('-id SampleFileRepository -supportPaging false')
Jacl を使用:
$AdminTask updateIdMgrRepository {-id SampleFileRepository -supportPaging
false}
注: サンプル・リポジトリーの構成が完了するまで、警告が表示されます。
- アダプターのための必要なカスタム・プロパティーを追加します。
複数のプロパティーを追加するには、setIdMgrCustomProperty コマンドを繰り返し使用します。
複数のプロパティーを構成に追加する場合、このコマンドは、プロパティーごとに 1 回使用します。
指定したリポジトリーのカスタム・プロパティーを追加する場合、
「名前」と「値」の両方のパラメーターを使用する必要があります。
例えば、fileName というカスタム・プロパティーを追加するには、次のコマンドを入力します。
注: SampleFileRepository を使用する場合は、
次の例のファイルが実装により作成されます。
Jython を使用:
AdminTask.setIdMgrCustomProperty('-id SampleFileRepository
-name fileName -value "c:¥sampleFileRegistry.xml"')
Jacl を使用:
$AdminTask setIdMgrCustomProperty {-id SampleFileRepository -name fileName
-value "c:¥sampleFileRegistry.xml"}
- アダプター構成にベース・エントリーを追加します。
次の例の addIdMgrRepositoryBaseEntry コマンドを使用して、
指定したリポジトリーのベース・エントリーの名前を指定します。
Jython を使用:
AdminTask.addIdMgrRepositoryBaseEntry('-id SampleFileRepository
-name o=sampleFileRepository')
Jacl を使用:
$AdminTask addIdMgrRepositoryBaseEntry {-id SampleFileRepository
-name o=sampleFileRepository}
- addIdMgrRealmBaseEntry コマンドを使用して、レルムにベース・エントリーを追加します。
これにより、レルムがリポジトリーにリンクされます。
注: デフォルト・レルム名は defaultWIMFileBasedRealm です。
このレルム名を名前変更した場合は、defaultWIMFileBasedRealm の代わりに新規レルム名を使用します。
Jython を使用:
AdminTask.addIdMgrRealmBaseEntry('-name defaultWIMFileBasedRealm
-baseEntry o=sampleFileRepository')
Jacl を使用:
$AdminTask addIdMgrRealmBaseEntry {-name defaultWIMFileBasedRealm
-baseEntry o=sampleFileRepository}
- 構成の変更を保管します。 以下のコマンドを入力して、
新規構成を保管し、wsadmin ツールを閉じます。
Jython を使用:
AdminConfig.save()exit
Jacl を使用:
$AdminConfig save
exit
次の例では、新規に改訂された
wimconfig.xml ファイルの完全なテキストを表示します。
<!--
Begin Copyright
Licensed Materials - Property of IBM
virtual member manager
(C) Copyright IBM Corp. 2005 All Rights Reserved.
End Copyright
-->
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:config="http://www.ibm.com/websphere/wim
/config" xmlns:sdo="commonj.sdo">
<config:configurationProvider maxPagingResults="500" maxSearchResults="4500" maxTotalPagingResults="1000"
pagedCacheTimeOut="900" pagingEntityObject="true" searchTimeOut="600000">
<config:dynamicModel xsdFileName="wimdatagraph.xsd"/>
<config:supportedEntityTypes defaultParent="o=defaultWIMFileBasedRealm" name="Group">
<config:rdnProperties>cn</config:rdnProperties>
</config:supportedEntityTypes>
<config:supportedEntityTypes defaultParent="o=defaultWIMFileBasedRealm" name="OrgContainer">
<config:rdnProperties>o</config:rdnProperties>
<config:rdnProperties>ou</config:rdnProperties>
<config:rdnProperties>dc</config:rdnProperties>
<config:rdnProperties>cn</config:rdnProperties>
</config:supportedEntityTypes>
<config:supportedEntityTypes defaultParent="o=defaultWIMFileBasedRealm" name="PersonAccount">
<config:rdnProperties>uid</config:rdnProperties>
</config:supportedEntityTypes>
<config:repositories xsi:type="config:FileRepositoryType" adapterClassName="com.ibm.ws.wim.adapter.file.was.FileAdapter"
id="InternalFileRepository" supportPaging="false" supportSorting="false" messageDigestAlgorithm="SHA-1">
<config:baseEntries name="o=defaultWIMFileBasedRealm"/>
</config:repositories>
<config:repositories adapterClassName="com.ibm.ws.wim.adapter.sample.SampleFileAdapter†id=" SampleFileRepository="">
<config:CustomProperties name="fileName" value="c:¥sampleFileRegistry.xml"/>
<config:baseEntries name="o=sampleFileRepository"/>
</config:repositories>
<config:realmConfiguration defaultRealm="defaultWIMFileBasedRealm">
<config:realms delimiter="@" name="defaultWIMFileBasedRealm" securityUse="active">
<config:participatingBaseEntries name="o=defaultWIMFileBasedRealm"/>
<config:participatingBaseEntries name="o=sampleFileRepository"/>
<config:uniqueUserIdMapping propertyForInput="uniqueName" propertyForOutput="uniqueName"/>
<config:userSecurityNameMapping propertyForInput="principalName" propertyForOutput="principalName"/>
<config:userDisplayNameMapping propertyForInput="principalName" propertyForOutput="principalName"/>
<config:uniqueGroupIdMapping propertyForInput="uniqueName" propertyForOutput="uniqueName"/>
<config:groupSecurityNameMapping propertyForInput="cn" propertyForOutput="cn"/>
<config:groupDisplayNameMapping propertyForInput="cn" propertyForOutput="cn"/>
</config:realms>
</config:realmConfiguration>
</config:configurationProvider></sdo:datagraph>
- アプリケーション・サーバーを再始動します。