+

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 the 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.

 

Develop custom adapters for federated repositories

Out of the box adapters for federated repositories provide File, LDAP and Database adapters for the 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 WAS components, such as data sources and enterprise beans. These WAS components require that security is initialized and enabled prior to startup. If the 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 vmmsampleadapter.jar. The vmmsampleadapter.jar can be downloaded at this location: http://www.ibm.com/developerworks/websphere/downloads/samples/vmmsampleadapter.html.

Contents of the vmmsampleadapter.jar file are as follows:

The sample files should not be used in WAS NDion environment. You should make a copy of these files, rename them, and update them based on the specific adapter implementation. Refer to the Java doc 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 the repository supports a search expression, then you need to convert XPath expression to an expression that the repository can process and let the 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 http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/vmm/com/ibm/wsspi/wim/package-summary.html for more details.



 

Related tasks


Establishing custom adapters for federated repositories
Set custom adapters for federated repositories using wsadmin
Use custom adapters for federated repositories

 

Related information


http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/vmm/com/ibm/wsspi/wim/Repository.html