+

Search Tips   |   Advanced Search

Sample custom adapters for federated repositories examples

Out of the box adapters for federated repositories provide File, LDAP, and Database adapters for our use. These adapters implement the com.ibm.wsspi.wim.Repository software programming interface (SPI). A virtual member manager custom adapter needs to implement the same SPI, irrespective of the type of repositories the adapter is interacting with. There is no restriction on the type of repositories that the custom adapter can interact with.


Develop custom adapters for federated repositories

Out of the box adapters for federated repositories provide File, LDAP and Database adapters for our use. All these adapters implement the com.ibm.wsspi.wim.Repository SPI. See the com.ibm.wsspi.wim.Repository SPI for more information. As you develop a virtual member manager custom adapter, we need to implement the same SPI.

Custom adapters for federated repositories must not depend on any WebSphere Application Server components, such as data sources and enterprise beans. These WAS components require that security is initialized and enabled prior to startup. If our implementation of custom adapters for federated repositories needs to use data sources to connect to a database, we need to use Java database connectivity (JDBC) to make the connection during server startup. Then, at a later time, switch to using the data sources when the data source is available.

There are examples of suggested behavior and requirements of custom adapters for federated repositories that we can find in the sample code.


A sample custom adapter for federated repositories

A sample custom adapter implementation has been provided as an example. The custom adapter is based on file repository. The sample source code and class files are bundled in the vmmsampleadapter.jar file.

Contents of the vmmsampleadapter.jar file are as follows:

The sample files should not be used in the production environment. We should make a copy of these files, rename them, and update them based on your specific adapter implementation. Refer to the Javadoc in the source code for more information.

com/ibm/ws/wim/sample/adapter/AbstractAdapterImpl.java

Provides an abstract implementation class which handles most of the repository independent internal operations for the adapter and defines some simple abstract methods that should be implemented by the custom adapter. For most cases, you may not need to change this file.

com/ibm/ws/wim/sample/adapter/SampleFileAdapter.java

Extends from the AbstractAdapterImpl class and implements the abstracts method. This class implements the abstract methods using file as the repository. Adapter providers can use this class as a reference to implement these methods specific to their adapters.

com/ibm/ws/wim/sample/adapter/XPathHelper.java

Defines a helper class to parse the XPath search expression and build the search tree. This helper class also contains the method to evaluate the search expression. If our repository supports a search expression, then we need to convert XPath expression to an expression that your repository can process and let your repository evaluate the expression. This helper class evaluates the search expression based on the use of dataobjects. We can overwrite the evaluate() method to perform the evaluation using other objects, such as java.util.Map.

Some utility classes have been provided to help adapter providers. Most of these utility methods are used in the sample adapter. Refer to the Javadoc information for more details.

  • Establishing custom adapters for federated repositories
  • Configure custom adapters for federated repositories using wsadmin
  • Use custom adapters for federated repositories
  • http://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.javadoc.vmm.doc/vmm/com/ibm/wsspi/wim/Repository.html