com.waveset.adapter
Class ExampleSPML2ResourceAdapter

java.lang.Object
  extended bycom.waveset.adapter.ResourceAdapterBase
      extended bycom.waveset.adapter.ExampleSPML2ResourceAdapter
All Implemented Interfaces:
ResourceAdapter

public class ExampleSPML2ResourceAdapter
extends ResourceAdapterBase

This is an adapter that communicates SPML2 requests/responses to an external Web Service via SOAP over HTTP. This adapter assumes the SPML 2.0 DSML profile is supported by the provider.


Nested Class Summary
 class ExampleSPML2ResourceAdapter.ExampleSPML2AccountIterator
           
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapterBase
ResourceAdapterBase.SimpleAccountIterator
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapter
ResourceAdapter.ActionResult, ResourceAdapter.Features, ResourceAdapter.ObjectType
 
Field Summary
static java.lang.String CLASS
           
static java.lang.String code_id
           
static java.lang.String DSML_URN
          The URN for the SPML 2.0 DSML Profile
static java.lang.String RA_PASSWORD
          The password of the proxy user.
static java.lang.String RA_TARGETID
          The password of the proxy user.
static java.lang.String RA_URL
          The URL of the SPML web service.
static java.lang.String RA_USER
          The account name of the proxy user.
static java.lang.String TYPE
          The name of the resource type.
 
Fields inherited from class com.waveset.adapter.ResourceAdapterBase
_cache, _context, _excludedAccountsRule, _excludedAccountsRuleInited, _listAllObjectsAttrParse, _listAllObjectsAttrParseName, _listUserAttrParse, _listUserAttrParseName, _listUserGroupsAttrParse, _listUserGroupsAttrParseName, _resource, _thread, _trace, displayInfoCode, RA_BLOCKCOUNT, RA_LOGIN_ACTION, RA_LOGOFF_ACTION, RA_MULTI_VALUED_ATTRS, RA_TEST_MODE
 
Fields inherited from interface com.waveset.adapter.ResourceAdapter
CHANGE_PASSWORD_LOCATION, DISABLE, ENABLE, EXPIRE_PASSWORD, GUID, IGNORE_ATTR, NEW_ACCOUNT_ID, OP_DAYS_INACTIVE, OP_DISABLED, OP_DORMANT, OP_EXPIRED, OP_EXPIREDPWD, OP_INACTIVE, OP_LOCKED, OP_NO_PASSWORD_SET, OP_NOOWNERSHIP, OP_NOPASSWORDREQ, OP_NUMINACTIVEDAYS, OP_NUMPWDAYS, OP_PWNUMDAYS, RA_BASE_CTX, RA_DISPLAY_NAME_ATTR, RA_NEW_OBJECT_ID, RA_NEW_OBJECT_NAME, RA_OBJECT_ATTRIBUTES, RA_OBJECT_CLASS, RA_OBJECT_ID, RA_OBJECT_TYPE, RA_OP_TYPE, RA_RENAME_OP, RA_REQUESTOR, RA_SAVEAS_OP, RA_SEARCH_ATTRIBUTE_NAMES, RA_SEARCH_ATTRS_TO_GET, RA_SEARCH_CONTEXT, RA_SEARCH_FILTER, RA_SEARCH_RUN_AS_PASSWORD, RA_SEARCH_RUN_AS_USER, RA_SEARCH_SCOPE, RA_SEARCH_SCOPE_OBJECT, RA_SEARCH_SCOPE_ONE_LEVEL, RA_SEARCH_SCOPE_SUBTREE, RA_SEARCH_TIME_LIMIT, RESET_PASSWORD, SYSTEM_ATTRIBUTES, UNLOCK, WS_USER_PASSWORD
 
Constructor Summary
ExampleSPML2ResourceAdapter()
          Create an adapater instance, without a resource.
ExampleSPML2ResourceAdapter(Resource res, ObjectCache cache)
          Create an adapter instance for a resource.
 
Method Summary
protected  org.openspml.v2.msg.spmlsuspend.ActiveResponse activeRequest(java.lang.String identity)
          Executes an ActiveRequest
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Check to see if a user account and password is valid.
 WSUser buildUser(org.openspml.v2.msg.spml.PSO pso)
          Build the base user object given a PSO (SearchResponse)
 WSUser buildUser(java.lang.String id)
          Build the base user object given an id.
 WavesetResult checkCreateAccount(WSUser user)
          Checks to see if an account can be created.
 WavesetResult checkDeleteAccount(WSUser user)
           
 WavesetResult checkUpdateAccount(WSUser user)
           
 WavesetResult createObject(GenericObject object, java.util.Map options)
          Creates the specified objectId of type objectType using the list of attributes provided.
 Resource createPrototypeResource()
          Create the prototype instance.
 WavesetResult deleteObject(GenericObject object, java.util.Map options)
          Deletes the requested objectId of the requested objectType from the resource.
protected  org.openspml.v2.msg.pass.ExpirePasswordResponse expirePasswordRequest(java.lang.String identity)
          Executes a ExpirePasswordRequest
 AccountIterator getAccountIterator()
           
 java.lang.Object getAttributeValue(java.lang.String name)
          These are methods implemented in sources to get and set attributes.
 GenericObject getFeatures()
          Expose features supported by the Resource Adapter.
 WSUser getUser(WSUser iduser)
          Retrieve information about an account, and package it as a WSUser object.
 java.util.List listObjects(java.lang.String objectType, java.util.Map options)
          Default implementation calls older method ResourceAdapterBase.listAllObjects(String, Map, String, EncryptedData), which does not support newer options (such as "searchContext" or "searchFilter").
protected  org.openspml.v2.msg.spml.ListTargetsResponse listTargetsRequest(java.lang.String profile)
          Executes a ListTargetRequest
protected  org.openspml.v2.msg.spml.LookupResponse lookupRequest(java.lang.String identity)
          Executes a LookupRequest
protected  void outputResponse(org.openspml.v2.msg.spml.Response response)
           
protected  void realCreate(WSUser user, WavesetResult result)
          Create a new user account on the resource.
protected  void realDelete(WSUser user, WavesetResult result)
          Needs to be overridden by subclass if default deleteAccounts() implementation is used.
protected  void realDisable(WSUser user, WavesetResult result)
           
protected  void realEnable(WSUser user, WavesetResult result)
           
protected  void realUpdate(WSUser user, WavesetResult result)
          Needs to be overridden by subclass if default updateAccounts() implementation is used.
protected  org.openspml.v2.msg.pass.ResetPasswordResponse resetPasswordRequest(java.lang.String identity)
          Executes a ResetPasswordRequest
protected  org.openspml.v2.msg.spmlsuspend.ResumeResponse resumeRequest(java.lang.String identity, java.util.Date effectiveDate)
          Executes a ResumeRequest
protected  WSAttribute reverseMapAttr(java.lang.String attr, java.lang.Object value)
          Map from a resource attribute to a waveset attribute.
protected  org.openspml.v2.msg.spmlsearch.SearchResponse searchRequest(org.openspml.v2.msg.spmlsearch.Query query)
           
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          These are methods implemented in sources to get and set attributes.
protected  org.openspml.v2.msg.pass.SetPasswordResponse setPasswordRequest(java.lang.String identity, java.lang.String password, java.lang.String currentPassword)
          Executes a SetPasswordRequest
protected  void startConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
static Resource staticCreatePrototypeResource()
          Create resource prototype.
protected  void stopConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
 boolean supportsAccountDisable()
          This method indicates to the server that this resource natively supports account enable and disable.
 boolean supportsCaseInsensitiveAccountIds()
          This method will return whether the resource adapter supports case insensitive account Ids or not.
protected  org.openspml.v2.msg.spmlsuspend.SuspendResponse suspendRequest(java.lang.String identity, java.util.Date effectiveDate)
          Executes a SuspendRequest
 WavesetResult updateObject(GenericObject object, java.util.Map options)
          Updates the specified objectId of type objectType using the list of attributes provided.
protected  org.openspml.v2.msg.pass.ValidatePasswordResponse validatePasswordRequest(java.lang.String identity, java.lang.String password)
          Executes a ValidatePasswordRequest
 
Methods inherited from class com.waveset.adapter.ResourceAdapterBase
checkForNoPasswordInSchema, checkSyntax, createAccount, createAccounts, createIdentity, deleteAccount, deleteAccount, deleteAccounts, disableAccount, disableAccounts, dnsEqual, dnsEqual, enableAccount, enableAccounts, executeResourceAttributeJavascriptAction, fillInResourceInfo, fillInResourceInfo, getAccountAttributes, getAccountIterator, getAccountIterator, getAction, getActionNotFoundErrorMessage, getActionNotFoundMessage, getActionRunAsPassword, getActionRunAsUser, getActionTimeout, getActionType, getAdapter, getAdapter, getAdapter, getAdapterProxy, getAdapterProxy, getAllAccounts, getAttrNameFromMapName, getAttrNameFromMapName, getAttrParse, getAttrTypeFromMapName, getAttrTypeFromMapName, getAUserName, getBaseContextAttrName, getBaseContextObject, getBaseContexts, getBlockSize, getContext, getExcludedAccountsRule, getIdentity, getListAllObjectsAttrParse, getListUserAttrParse, getListUserGroupsAttrParse, getObject, getOptionalBooleanResAttrVal, getOptionalBooleanResAttrVal, getOptionalEncryptedResAttrVal, getOptionalResAttrVal, getOptionalStringResAttrVal, getRequiredResAttr, getRequiredResAttr, getRequiredResAttrVal, getRequiredResAttrVal, getRequiredResAttrVals, getRequiredUserAttributeNames, getResAttrValActionOnUser, getResAttrVals, getResource, getResourceAccounts, getResourceInfo, getResourceObjectAttrValNameAttr, getResourceObjectClassAttr, getResourceObjectTypePrefix, getSchemaMap, getUser, getWSAttrByMapName, getWSAttrByMapName, getWSAttrFromMap, handleActionResult, handleJavascriptActionResult, isAccountAttributeSecret, isExcludedAccount, isExcludedAccount, isFeatureEnabled, isSupported, isTestMode, listAllObjects, listAllObjects, listObjects, listObjectsOfType, lookupAction, lookupAction, lookupActions, namesEqual, objectClassesMatchType, println, restoreResourceObjectClassAttr, run, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsActions, supportsContainerObjectTypes, supportsExcludedAccounts, supportsResourceAccount, supportsScanning, testConfiguration, updateAccount, updateAccounts, updateResourceAccount, updateResourceIdentity, vmStoreBoot, vmStoreGet, vmStoreInit, vmStoreLatch, vmStorePut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

CLASS

public static final java.lang.String CLASS
See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
The name of the resource type.

See Also:
Constant Field Values

RA_URL

public static final java.lang.String RA_URL
The URL of the SPML web service. This combines what other adapters split out into seperate host and port attributes, but exposing the full URL may be necessary to account for changes to deployment location.

See Also:
Constant Field Values

RA_USER

public static final java.lang.String RA_USER
The account name of the proxy user.

See Also:
Constant Field Values

RA_PASSWORD

public static final java.lang.String RA_PASSWORD
The password of the proxy user.

See Also:
Constant Field Values

RA_TARGETID

public static final java.lang.String RA_TARGETID
The password of the proxy user.

See Also:
Constant Field Values

DSML_URN

public static final java.lang.String DSML_URN
The URN for the SPML 2.0 DSML Profile

See Also:
Constant Field Values
Constructor Detail

ExampleSPML2ResourceAdapter

public ExampleSPML2ResourceAdapter(Resource res,
                                   ObjectCache cache)
Create an adapter instance for a resource.


ExampleSPML2ResourceAdapter

public ExampleSPML2ResourceAdapter()
Create an adapater instance, without a resource.

Method Detail

staticCreatePrototypeResource

public static Resource staticCreatePrototypeResource()
                                              throws WavesetException
Create resource prototype.

Throws:
WavesetException

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Create the prototype instance.

Specified by:
createPrototypeResource in interface ResourceAdapter
Specified by:
createPrototypeResource in class ResourceAdapterBase
Throws:
WavesetException

getFeatures

public GenericObject getFeatures()
Expose features supported by the Resource Adapter.

Specified by:
getFeatures in interface ResourceAdapter
Overrides:
getFeatures in class ResourceAdapterBase
Returns:
GenericObject containing Features, as both key and value, which are supported by this resource adapter.
See Also:
ResourceAdapter.Features

supportsCaseInsensitiveAccountIds

public boolean supportsCaseInsensitiveAccountIds()
This method will return whether the resource adapter supports case insensitive account Ids or not. If the resource does support allow case insensitive names, then this method should be removed as the default implementation, in ResourceAdapterBase, returns true. If the resource supports case sensitive names, then this method should be implemented to return false.

Specified by:
supportsCaseInsensitiveAccountIds in interface ResourceAdapter
Overrides:
supportsCaseInsensitiveAccountIds in class ResourceAdapterBase

supportsAccountDisable

public boolean supportsAccountDisable()
This method indicates to the server that this resource natively supports account enable and disable. If the resource does not natively support account enable and disable, then this method should be removed as the default implementation, in ResourceAdapterBase, returns false.

Specified by:
supportsAccountDisable in interface ResourceAdapter
Overrides:
supportsAccountDisable in class ResourceAdapterBase

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
                                   throws WavesetException
These are methods implemented in sources to get and set attributes. Since this is a source with a resource, just pass the calls through.

Throws:
WavesetException

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
                       throws WavesetException
These are methods implemented in sources to get and set attributes. Since this is a source with a resource, just pass the calls through.

Throws:
WavesetException

reverseMapAttr

protected WSAttribute reverseMapAttr(java.lang.String attr,
                                     java.lang.Object value)
Map from a resource attribute to a waveset attribute. Return null if there's no mapping.


outputResponse

protected final void outputResponse(org.openspml.v2.msg.spml.Response response)

listTargetsRequest

protected org.openspml.v2.msg.spml.ListTargetsResponse listTargetsRequest(java.lang.String profile)
                                                                   throws WavesetException
Executes a ListTargetRequest

Throws:
WavesetException

lookupRequest

protected org.openspml.v2.msg.spml.LookupResponse lookupRequest(java.lang.String identity)
                                                         throws WavesetException
Executes a LookupRequest

Throws:
WavesetException

setPasswordRequest

protected org.openspml.v2.msg.pass.SetPasswordResponse setPasswordRequest(java.lang.String identity,
                                                                          java.lang.String password,
                                                                          java.lang.String currentPassword)
                                                                   throws WavesetException
Executes a SetPasswordRequest

Throws:
WavesetException

expirePasswordRequest

protected org.openspml.v2.msg.pass.ExpirePasswordResponse expirePasswordRequest(java.lang.String identity)
                                                                         throws WavesetException
Executes a ExpirePasswordRequest

Throws:
WavesetException

resetPasswordRequest

protected org.openspml.v2.msg.pass.ResetPasswordResponse resetPasswordRequest(java.lang.String identity)
                                                                       throws WavesetException
Executes a ResetPasswordRequest

Throws:
WavesetException

validatePasswordRequest

protected org.openspml.v2.msg.pass.ValidatePasswordResponse validatePasswordRequest(java.lang.String identity,
                                                                                    java.lang.String password)
                                                                             throws WavesetException
Executes a ValidatePasswordRequest

Throws:
WavesetException

searchRequest

protected org.openspml.v2.msg.spmlsearch.SearchResponse searchRequest(org.openspml.v2.msg.spmlsearch.Query query)
                                                               throws WavesetException
Throws:
WavesetException

suspendRequest

protected org.openspml.v2.msg.spmlsuspend.SuspendResponse suspendRequest(java.lang.String identity,
                                                                         java.util.Date effectiveDate)
                                                                  throws WavesetException
Executes a SuspendRequest

Throws:
WavesetException

resumeRequest

protected org.openspml.v2.msg.spmlsuspend.ResumeResponse resumeRequest(java.lang.String identity,
                                                                       java.util.Date effectiveDate)
                                                                throws WavesetException
Executes a ResumeRequest

Throws:
WavesetException

activeRequest

protected org.openspml.v2.msg.spmlsuspend.ActiveResponse activeRequest(java.lang.String identity)
                                                                throws WavesetException
Executes an ActiveRequest

Throws:
WavesetException

startConnection

protected void startConnection()
                        throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default createAccounts() implementation is used.

Overrides:
startConnection in class ResourceAdapterBase
Throws:
WavesetException

stopConnection

protected void stopConnection()
                       throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default createAccounts() implementation is used.

Overrides:
stopConnection in class ResourceAdapterBase
Throws:
WavesetException

buildUser

public WSUser buildUser(java.lang.String id)
Build the base user object given an id.


buildUser

public WSUser buildUser(org.openspml.v2.msg.spml.PSO pso)
Build the base user object given a PSO (SearchResponse)


getUser

public WSUser getUser(WSUser iduser)
               throws WavesetException
Retrieve information about an account, and package it as a WSUser object.

Information required to identify the resource account is supplied in another WSUser object.

The returned user object will resemble the source object, but will have its account attribute list filled in.

Returns "null" if there is no account that corresponds to the user.

Specified by:
getUser in interface ResourceAdapter
Overrides:
getUser in class ResourceAdapterBase
Throws:
WavesetException

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Checks to see if an account can be created. Ignore since we're not using this now.

Specified by:
checkCreateAccount in interface ResourceAdapter
Specified by:
checkCreateAccount in class ResourceAdapterBase
Throws:
WavesetException

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Create a new user account on the resource.

Overrides:
realCreate in class ResourceAdapterBase
Throws:
WavesetException

checkUpdateAccount

public WavesetResult checkUpdateAccount(WSUser user)
                                 throws WavesetException
Specified by:
checkUpdateAccount in interface ResourceAdapter
Specified by:
checkUpdateAccount in class ResourceAdapterBase
Throws:
WavesetException

realUpdate

protected void realUpdate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default updateAccounts() implementation is used.

Overrides:
realUpdate in class ResourceAdapterBase
Throws:
WavesetException

checkDeleteAccount

public WavesetResult checkDeleteAccount(WSUser user)
                                 throws WavesetException
Specified by:
checkDeleteAccount in interface ResourceAdapter
Specified by:
checkDeleteAccount in class ResourceAdapterBase
Throws:
WavesetException

realDelete

protected void realDelete(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default deleteAccounts() implementation is used.

Overrides:
realDelete in class ResourceAdapterBase
Throws:
WavesetException

realEnable

protected void realEnable(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Overrides:
realEnable in class ResourceAdapterBase
Throws:
WavesetException

realDisable

protected void realDisable(WSUser user,
                           WavesetResult result)
                    throws WavesetException
Overrides:
realDisable in class ResourceAdapterBase
Throws:
WavesetException

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class ResourceAdapterBase
Throws:
WavesetException

createObject

public WavesetResult createObject(GenericObject object,
                                  java.util.Map options)
                           throws WavesetException
Description copied from class: ResourceAdapterBase
Creates the specified objectId of type objectType using the list of attributes provided.

Specified by:
createObject in interface ResourceAdapter
Overrides:
createObject in class ResourceAdapterBase
Parameters:
object - - a GenericObject containing the objectType, objectId, and list of attributes to be set on the new object
options - - several options can be specified which control the behavior of the search for referenced objects (e.g. group members) They include:
    "searchContext" - the value of this option determines within what context to perform search (ResourceAdapter.RA_SEARCH_CONTEXT). If no value, will assume search should be done from logical top.
  1. "searchScope" - specifies whether the search should be done on the current object, only within the context of the specified "searchContainer", or in all subcontext within the specified "searchContainer" (ResourceAdapter.RA_SEARCH_SCOPE). Valid values are "object", "oneLevel", or "subTree" indicates that the search should be performed on all sub containers within the specified "searchContainer".
  2. "searchTimeLimit" - the timelimit in milliseconds a search should not exceed (ResourceAdapter.RA_SEARCH_TIME_LIMIT).
  3. "searchAttributeNames" - a list of one or more attribute names used as the component of the tuple when searching for referenced objects (Resource_Adapter.RA_SEARCH_ATTRIBUTES).
    Throws:
    WavesetException

updateObject

public WavesetResult updateObject(GenericObject object,
                                  java.util.Map options)
                           throws WavesetException
Description copied from class: ResourceAdapterBase
Updates the specified objectId of type objectType using the list of attributes provided.

Specified by:
updateObject in interface ResourceAdapter
Overrides:
updateObject in class ResourceAdapterBase
Parameters:
object - - a GenericObject containing the objectType, objectId, and list of new and changed attributes to be set on the object
options - - several options can be specified which control the behavior of the search for referenced objects (e.g. group members) They include:
    "searchContext" - the value of this option determines within what context to perform search (ResourceAdapter.RA_SEARCH_CONTEXT). If no value, will assume search should be done from logical top.
  1. "searchScope" - specifies whether the search should be done on the current object, only within the context of the specified "searchContainer", or in all subcontext within the specified "searchContainer" (ResourceAdapter.RA_SEARCH_SCOPE). Valid values are "object", "oneLevel", or "subTree" indicates that the search should be performed on all sub containers within the specified "searchContainer".
  2. "searchTimeLimit" - the timelimit in milliseconds a search should not exceed (ResourceAdapter.RA_SEARCH_TIME_LIMIT).
  3. "searchAttributeNames" - a list of one or more attribute names used as the component of the tuple when searching for referenced objects (Resource_Adapter.RA_SEARCH_ATTRIBUTES).
    Throws:
    WavesetException

deleteObject

public WavesetResult deleteObject(GenericObject object,
                                  java.util.Map options)
                           throws WavesetException
Description copied from class: ResourceAdapterBase
Deletes the requested objectId of the requested objectType from the resource.

Specified by:
deleteObject in interface ResourceAdapter
Overrides:
deleteObject in class ResourceAdapterBase
Parameters:
options - - not currently used because the objectId and objectType parameters uniquely identify the object to delete.
Throws:
WavesetException

listObjects

public java.util.List listObjects(java.lang.String objectType,
                                  java.util.Map options)
                           throws WavesetException
Description copied from class: ResourceAdapterBase
Default implementation calls older method ResourceAdapterBase.listAllObjects(String, Map, String, EncryptedData), which does not support newer options (such as "searchContext" or "searchFilter").

Each ResourceAdapter subclass should override this default implementation as soon as possible with an implementation that supports the options specified in {#listObjects(ObjectType, Map)}.

Specified by:
listObjects in interface ResourceAdapter
Overrides:
listObjects in class ResourceAdapterBase
Throws:
WavesetException

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Check to see if a user account and password is valid.

Specified by:
authenticate in interface ResourceAdapter
Specified by:
authenticate in class ResourceAdapterBase
Throws:
WavesetException