Class StoreAdapter
- java.lang.Object
- 
- com.unboundid.directory.sdk.broker.api.StoreAdapter
 
- 
- All Implemented Interfaces:
- Configurable,- ExampleUsageProvider,- UnboundIDExtension
 
 @Extensible @BrokerExtension @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class StoreAdapter extends java.lang.Object implements UnboundIDExtension, Configurable, ExampleUsageProvider This class defines an API that must be implemented by extensions that need to store user data in some non-LDAP data store. This adapter API is generic and can support a wide range of repositories. When using multiple PingAuthorize Server instances in a deployment, the data store should be accessible from all instances.After the Store Adapter is initialized (via the initializeStoreAdapter() method), all methods will be guarded by a call to isAvailable()to make sure that the adapter is currently connected and ready to service requests. If this returnsfalse, the SCIMResourceType will return an appropriate 503 response code to clients until the adapter becomes available again.Configuring Store AdaptersIn order to configure a store adapter created using this API, use a command like:dsconfig create-store-adapter \ ---adapter-name "{name}" \ --type third-party \ --set "extension-class:{class-name}" \ --set "extension-argument:{name=value}"where "{name}" is the name to use for the store adapter instance, "{class-name}" is the fully-qualified name of the Java class that extendscom.unboundid.directory.sdk.broker.api.StoreAdapter, and "{name=value}" represents name-value pairs for any arguments to provide to the store adapter. If multiple arguments should be provided to the extension, then the "--set extension-argument:{name=value}" option should be provided multiple times.
- 
- 
Constructor SummaryConstructors Constructor Description StoreAdapter()Creates a new instance of this store adapter.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Stringcreate(StoreCreateRequest request)Create the specified entry in the native data store.voiddefineConfigArguments(ArgumentParser parser)Updates the provided argument parser to define any configuration arguments which may be used by this extension.abstract voiddelete(StoreDeleteRequest request)Delete the specified entry from the native data store.voidfinalizeStoreAdapter()This hook is called when the SCIMResourceType is disabled or the PingAuthorize Server shuts down.java.util.Map<java.util.List<java.lang.String>,java.lang.String>getExamplesArgumentSets()Retrieves a map containing examples of configurations that may be used for this extension.abstract java.lang.String[]getExtensionDescription()Retrieves a human-readable description for this extension.abstract java.lang.StringgetExtensionName()Retrieves a human-readable name for this extension.java.util.Collection<StoreAttributeDefinition>getNativeSchema()Retrieves a collection of attribute definitions describing the schema for objects supported by this Store Adapter.voidinitializeStoreAdapter(BrokerContext serverContext, StoreAdapterConfig config, ArgumentParser parser)Initializes this store adapter.abstract booleanisAvailable()Determines whether this Store Adapter is currently available and in-service.abstract java.lang.Stringretrieve(StoreRetrieveRequest request)Fetches the specified entry.abstract voidsearch(StoreSearchRequest request)Search for entries in the native store which could match the specified criteria.abstract java.lang.Stringupdate(StoreUpdateRequest request)Update the specified entry in the native data store.
 
- 
- 
- 
Constructor Detail- 
StoreAdapterpublic StoreAdapter() Creates a new instance of this store adapter. All implementations must include a default constructor, but any initialization should generally be done in theinitializeStoreAdapter(com.unboundid.directory.sdk.broker.types.BrokerContext, com.unboundid.directory.sdk.broker.config.StoreAdapterConfig, com.unboundid.util.args.ArgumentParser)method.
 
- 
 - 
Method Detail- 
getExtensionNamepublic abstract java.lang.String getExtensionName() Retrieves a human-readable name for this extension.- Specified by:
- getExtensionNamein interface- UnboundIDExtension
- Returns:
- A human-readable name for this extension.
 
 - 
getExtensionDescriptionpublic abstract java.lang.String[] getExtensionDescription() Retrieves a human-readable description for this extension. Each element of the array that is returned will be considered a separate paragraph in generated documentation.- Specified by:
- getExtensionDescriptionin interface- UnboundIDExtension
- Returns:
- A human-readable description for this extension, or nullor an empty array if no description should be available.
 
 - 
getExamplesArgumentSetspublic java.util.Map<java.util.List<java.lang.String>,java.lang.String> getExamplesArgumentSets() Retrieves a map containing examples of configurations that may be used for this extension. The map key should be a list of sample arguments, and the corresponding value should be a description of the behavior that will be exhibited by the extension when used with that configuration.- Specified by:
- getExamplesArgumentSetsin interface- ExampleUsageProvider
- Returns:
- A map containing examples of configurations that may be used for
          this extension.  It may be nullor empty if there should not be any example argument sets.
 
 - 
defineConfigArgumentspublic void defineConfigArguments(ArgumentParser parser) throws ArgumentException Updates the provided argument parser to define any configuration arguments which may be used by this extension. The argument parser may also be updated to define relationships between arguments (e.g., to specify required, exclusive, or dependent argument sets).- Specified by:
- defineConfigArgumentsin interface- Configurable
- Parameters:
- parser- The argument parser to be updated with the configuration arguments which may be used by this extension.
- Throws:
- ArgumentException- If a problem is encountered while updating the provided argument parser.
 
 - 
initializeStoreAdapterpublic void initializeStoreAdapter(BrokerContext serverContext, StoreAdapterConfig config, ArgumentParser parser) throws java.lang.Exception Initializes this store adapter. Any initialization should be performed here. This method should generally store theBrokerContextin a class member so that it can be used elsewhere in the implementation.The default implementation is empty. - Parameters:
- serverContext- A handle to the server context for the server in which this extension is running. Extensions should typically store this in a class member.
- config- The general configuration for this object.
- parser- The argument parser which has been initialized from the configuration for this store adapter.
- Throws:
- java.lang.Exception- If a problem occurs while initializing this store adapter.
 
 - 
finalizeStoreAdapterpublic void finalizeStoreAdapter() This hook is called when the SCIMResourceType is disabled or the PingAuthorize Server shuts down. Any clean-up of this store adapter should be performed here.The default implementation is empty. 
 - 
getNativeSchemapublic java.util.Collection<StoreAttributeDefinition> getNativeSchema() Retrieves a collection of attribute definitions describing the schema for objects supported by this Store Adapter. The default implementation returns an empty collection indicating that the schema is not defined. Use StoreAttributeDefinition.Builder to create instances of StoreAttributeDefinition.- Returns:
- The attribute definitions describing the schema, or an empty collection if the schema is not defined.
 
 - 
isAvailablepublic abstract boolean isAvailable() Determines whether this Store Adapter is currently available and in-service. This may returnfalsein the case that all backend servers are down, for example; during this time the SCIMResourceType will return an appropriate 503 response code to clients.- Returns:
- trueif the Store Adapter initialized and connected;- falseotherwise.
 
 - 
retrievepublic abstract java.lang.String retrieve(StoreRetrieveRequest request) throws com.unboundid.scim2.common.exceptions.ScimException Fetches the specified entry.- Parameters:
- request- The retrieve request.
- Returns:
- The retrieved entry as a JSON object. This string can be created by any JSON library. For example, the Jackson library's ObjectNode.toString() or the UnboundID LDAP SDK's JSONObject.toString().
- Throws:
- com.unboundid.scim2.common.exceptions.ScimException- If there is a problem fulfilling the request.
 
 - 
searchpublic abstract void search(StoreSearchRequest request) throws com.unboundid.scim2.common.exceptions.ScimException Search for entries in the native store which could match the specified criteria. The contract is for the store adapter to return a superset of matching entries, i.e. The store adapter must return all entries which match the specified filter but may also return entries which do not match. The results from the store adapter are subsequently filtered by the PingAuthorize Server.- Parameters:
- request- The search request.
- Throws:
- com.unboundid.scim2.common.exceptions.ScimException- If there is a problem fulfilling the search request.
 
 - 
createpublic abstract java.lang.String create(StoreCreateRequest request) throws com.unboundid.scim2.common.exceptions.ScimException Create the specified entry in the native data store.- Parameters:
- request- The create request.
- Returns:
- The entry that was just created as a JSON object. This string can be created by any JSON library. For example, the Jackson library's ObjectNode.toString() or the UnboundID LDAP SDK's JSONObject.toString().
- Throws:
- com.unboundid.scim2.common.exceptions.ScimException- If there is a problem creating the entry.
 
 - 
updatepublic abstract java.lang.String update(StoreUpdateRequest request) throws com.unboundid.scim2.common.exceptions.ScimException Update the specified entry in the native data store.- Parameters:
- request- The update request.
- Returns:
- The updated resource as a JSON object. This string can be created by any JSON library. For example, the Jackson library's ObjectNode.toString() or the UnboundID LDAP SDK's JSONObject.toString().
- Throws:
- com.unboundid.scim2.common.exceptions.ScimException- If there is a problem modifying the entry.
 
 - 
deletepublic abstract void delete(StoreDeleteRequest request) throws com.unboundid.scim2.common.exceptions.ScimException Delete the specified entry from the native data store.- Parameters:
- request- The delete request.
- Throws:
- com.unboundid.scim2.common.exceptions.ScimException- If there is a problem deleting the entry.
 
 
- 
 
-