You can use the Jython or Jacl scripting language with
the wsadmin tool to define custom adapters in the federated repositories
configuration file.
Before you begin
Shut down the application server.
About this task
Use the following steps to add a custom adapter to any
federated repositories configuration file and to any realm defined
within the configuration file.
The following examples use the SampleFileRepository repository
as the identifier for the custom repository.
Note: For additional
information about the commands to use for this topic, see the IdMgrRepositoryConfig
command group for the AdminTask object topic.
Procedure
- Enter the following command to start the wsadmin tool:
wsadmin –conntype none
- Use the createIdMgrCustomRepository command
to add a custom repository and specify the adapter class.
The
following example configures a custom repository to use the com.ibm.ws.wim.adapter.sample.SampleFileAdapter class
and sets the SampleFileRepository repository as the identifier.
Using
Jython:
AdminTask.createIdMgrCustomRepository('-id SampleFileRepository -adapterClassName com.ibm.ws.wim.adapter.sample.SampleFileAdapter')
Using
Jacl:
createIdMgrCustomRepository {-id SampleFileRepository -adapterClassName com.ibm.ws.wim.adapter.sample.SampleFileAdapter}
- Copy the vmmsampleadapter.jar file
that is provided to app_server_root/lib.
- Disable paging in the common repository configuration.
Set the supportPaging parameter for the updateIdMgrRepository
command to false to disable paging.
Note: You
must perform this step because the sample adapter does not support
paging.
The following examples use the SampleFileRepository repository
as the identifier for the custom repository.
Using Jython:
AdminTask.updateIdMgrRepository('-id SampleFileRepository -supportPaging false')
Using
Jacl:
$AdminTask updateIdMgrRepository {-id SampleFileRepository -supportPaging
false}
Note: A warning will appear until the configuration
of the sample repository is complete.
- Add the necessary custom properties for the adapter.
Use the setIdMgrCustomProperty command repeatedly to add multiple
properties. Use this command once per property to add multiple properties
to your configuration. You must use both the name and value parameters
to add the custom property for the specified repository. For example,
to add a custom property of fileName, enter the following
command.
Note: If you are using SampleFileRepository, the file
in the example below is created by the implementation.
Using
Jython:
AdminTask.setIdMgrCustomProperty('-id SampleFileRepository
-name fileName -value "c:\sampleFileRegistry.xml"')
Using
Jacl:
$AdminTask setIdMgrCustomProperty {-id SampleFileRepository -name fileName
-value "c:\sampleFileRegistry.xml"}
- Add a base entry to the adapter configuration. Use
the following example addIdMgrRepositoryBaseEntry command to specify
the name of the base entry for the specified repository:
Using Jython:
AdminTask.addIdMgrRepositoryBaseEntry('-id SampleFileRepository
-name o=sampleFileRepository')
Using Jacl:
$AdminTask addIdMgrRepositoryBaseEntry {-id SampleFileRepository
-name o=sampleFileRepository}
- Use the addIdMgrRealmBaseEntry command to add the base
entry to the realm, which links the realm with the repository.
Note: The default realm name is defaultWIMFileBasedRealm. If
this realm name was renamed, use the new realm name instead of defaultWIMFileBasedRealm.
Using
Jython:
AdminTask.addIdMgrRealmBaseEntry('-name defaultWIMFileBasedRealm
-baseEntry o=sampleFileRepository')
Using Jacl:
$AdminTask addIdMgrRealmBaseEntry {-name defaultWIMFileBasedRealm
-baseEntry o=sampleFileRepository}
- Save your configuration changes. Enter the following
commands to save the new configuration and close the wsadmin tool:
Using Jython:
AdminConfig.save()
exit
Using Jacl:
$AdminConfig save
exit
The following example displays the complete
text of the newly-revised
wimconfig.xml file:
Note: The
federated repositories configuration file,
wimconfig.xml,
is located in the
app_server_root/profiles/profile_name/config/cells/cell_name/wim/config directory.
<!--
Begin Copyright
Licensed Materials - Property of IBM
virtual member manager
(C) Copyright IBM Corp. 2005 All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
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>
- Restart the application server.