com.waveset.adapter
Class ScriptedJdbcResourceAdapter

java.lang.Object
  extended bycom.waveset.adapter.ResourceAdapterBase
      extended bycom.waveset.adapter.JdbcResourceAdapter
          extended bycom.waveset.adapter.ScriptedJdbcResourceAdapter
All Implemented Interfaces:
ActiveSync, ResourceAdapter, com.waveset.adapter.script.ScriptedAdapter

public final class ScriptedJdbcResourceAdapter
extends JdbcResourceAdapter
implements ActiveSync, com.waveset.adapter.script.ScriptedAdapter

The ScriptedJdbcResourceAdapter is used to provision users which are represented as entries in one or more database tables. The adapter is agnostic of the particular table(s) in which the users are represented. The real logic of how to provision the users into the tables is delegated to scripts provided by the customer. The scripts (currently Beanshell and Javascript supported) are passed salient parameters like JDBC connection, user attributes, etc.).


Nested Class Summary
 
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 code_id
           
static java.lang.String DEFAULT_DRIVER
          The default value for the RA_DRIVER resource attribute.
static java.lang.String DEFAULT_PORT
          The default connect DB Server Port.
static java.lang.String DEFAULT_TEMPLATE
          The default connect URL template.
static java.lang.String DIRECT_MAP_MODE
          Possible values for RA_ATTR_MAP_MODE
static java.lang.String RA_ACCT_ITER_ACTIONS
           
static java.lang.String RA_ACTIVE_SYNC_ITER_ACTIONS
           
static java.lang.String RA_ATTR_MAP_MODE
           
static java.lang.String RA_AUTHENTICATION_ACTIONS
           
static java.lang.String RA_CREATE_USER_ACTIONS
           
static java.lang.String RA_DELETE_USER_ACTIONS
           
static java.lang.String RA_DISABLE_USER_ACTIONS
           
static java.lang.String RA_ENABLE_USER_ACTIONS
           
static java.lang.String RA_GET_USER_ACTIONS
          The list of resource attributes which will hold the name of a ResourceAction to accomplish the respective operation.
static java.lang.String RA_LISTALL_ACTIONS
           
static java.lang.String RA_TEST_ACTIONS
           
static java.lang.String RA_UPDATE_USER_ACTIONS
           
static java.lang.String RESOURCE_NAME
           
static java.lang.String RESOURCE_USER_FORM
           
static java.lang.String STRING_MAP_MODE
           
 
Fields inherited from class com.waveset.adapter.JdbcResourceAdapter
RA_DATABASE, RA_DRIVER, RA_HOST, RA_PASSWORD, RA_PORT, RA_QUOTING, RA_URL_PREFIX, RA_URL_TEMPLATE, RA_USER
 
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.ActiveSync
ACTIVE_SYNC_EVENT_RES_ATTRS_XML, ACTIVE_SYNC_STD_RES_ATTRS_XML, ATTR_IS_DELETED, DATE_FORMAT, DATE_TIME_FORMAT, RA_APPLY_META_VIEW, RA_ASSIGN_SOURCE_ON_CREATE, RA_CONFIRMATION_RULE, RA_CORRELATION_RULE, RA_CREATE_UNMATCHED, RA_DELETE_RULE, RA_FORM, RA_ID, RA_IDM_NAME_RULE, RA_LEGACY_EVENT_GEN, RA_LOG_LEVEL, RA_LOG_PATH, RA_LOG_SIZE, RA_MAX_AGE_LENGTH, RA_MAX_AGE_UNIT, RA_MAX_ARCHIVES, RA_NAME, RA_PARAMETERIZED_INPUT_FORM, RA_POPULATE_GLOBAL, RA_POSTPOLL_WORKFLOW, RA_PREPOLL_WORKFLOW, RA_PROCESS_RULE, RA_PROXY_ADMINISTRATOR, RA_RESET_TO_TODAY, RA_RESOLVE_PROCESS_RULE, RA_SCHEDULE_INTERVAL, RA_SCHEDULE_INTERVAL_COUNT, RA_SCHEDULE_START_DATE, RA_SCHEDULE_START_TIME, RA_SYNC_CONFIG_MODE, RA_SYNC_POST_PROCESS_FORM, RA_UPDATE_IF_DELETE, RA_USE_INPUT_FORM, TIME_FORMAT, TRACE_LEVEL_DEBUG, TRACE_LEVEL_ERROR, TRACE_LEVEL_INFO, TRACE_LEVEL_NONE, TRACE_LEVEL_WARNING
 
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
ScriptedJdbcResourceAdapter()
           
 
Method Summary
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Authenticates the user against the resource.
 WavesetResult checkCreateAccount(WSUser user)
           
 WavesetResult checkDeleteAccount(WSUser user)
           
 WavesetResult checkUpdateAccount(WSUser user)
           
 void closeConnection(java.sql.Connection con)
          Close a connection, making sure that autocommit is true before closing.
 Resource createPrototypeResource()
           
 WSUser createWSUserFromAttributes(java.lang.String identity, boolean isDisabled, java.util.Map attributeValues)
           
 AccountIterator getAccountIterator()
          Return an iterator that will iterate over all the accounts on a resource.
 AccountIterator getAccountIterator(java.util.Map options)
          Return an iterator that will iterate over all the accounts on a resource.
 java.lang.Object getAttributeValue(java.lang.String name)
          Required method implementation to get an attribute value.
 java.sql.Connection getConnection()
          Get a connection to the default database with the proxy user.
 GenericObject getFeatures()
          Expose features supported by the Resource Adapter.
protected  java.util.List getResourceAttributeActions(java.lang.String resAttrName, boolean required)
           
 WSUser getUser(WSUser user)
          Retrieve information about an account, and package it as a WSUser object.
 void init()
          Initialize the source adapter.
 java.util.ArrayList listAllObjects(java.lang.String resourceObjectType, java.util.Map options, java.lang.String runAsUser, EncryptedData runAsPassword)
          This method will return a list of object names of the specified object type.
 int poll()
          the poll method.
protected  void processUpdates(java.util.List updates, java.lang.String command, com.waveset.adapter.iapi.IAPI prox)
          Take a list of Maps that are rows of the audit data and turn them into IAPI calls.
protected  void realCreate(WSUser user, WavesetResult result)
          Needs to be overridden by subclass if default createAccounts() implementation is used.
protected  void realCreateOrUpdate(WSUser user, WavesetResult result, java.lang.String operation)
          This method is called by realCreate and realUpdate
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.
 WSAttributes reverseMap(java.util.Map map)
          Convert the host attribute map into WSAttributes
 WavesetResult run(ResourceAction action, java.util.Map args)
          Runs a ResourceAction with additional args; could be null.
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Required method implementation to set an attribute value.
 void shutdown()
          Called once when the adapter is unloaded.
 void startConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
static Resource staticCreatePrototypeResource()
          Create the prototype resource.
 void stopConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
 boolean supportsAccountDisable()
          Indicates whether or not this resource supports account disable.
 boolean supportsActions()
           
 WavesetResult testConfiguration()
          Default implementation of test method, calls check create.
protected  void traceAndLog(long traceLevel, java.lang.String method, int logLevel, java.lang.String message)
           
protected  void traceAndLogCommand(long traceLevel, java.lang.String method, int logLevel, java.util.Map user, java.lang.String command, WavesetResult result)
          Log whatever we want to from an update.
 
Methods inherited from class com.waveset.adapter.JdbcResourceAdapter
addAttributeValue, addQuoted, attributeRequiresQuotingInSQL, closeResult, closeStatement, decodeCommaList, dumpResult, encodeCommaList, execProcedure, execProcedure, execSql, execSql, execSql, flushResults, flushResultsQuietly, formatTemplateUrl, formatUrl, formatUrl, getConnection, getConnection, getConnectionString, getConnectionUrl, getConnectionUrl, getEncryptedResourceAttribute, getResourceAttribute, mergeCommaLists, mergeStringLists, println, queryInt, queryString, setDebug
 
Methods inherited from class com.waveset.adapter.ResourceAdapterBase
checkForNoPasswordInSchema, checkSyntax, createAccount, createAccounts, createIdentity, createObject, deleteAccount, deleteAccount, deleteAccounts, deleteObject, disableAccount, disableAccounts, dnsEqual, dnsEqual, enableAccount, enableAccounts, executeResourceAttributeJavascriptAction, fillInResourceInfo, fillInResourceInfo, getAccountAttributes, 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, listObjects, listObjects, listObjectsOfType, lookupAction, lookupAction, lookupActions, namesEqual, objectClassesMatchType, println, restoreResourceObjectClassAttr, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsCaseInsensitiveAccountIds, supportsContainerObjectTypes, supportsExcludedAccounts, supportsResourceAccount, supportsScanning, updateAccount, updateAccounts, updateObject, 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

DEFAULT_PORT

public static final java.lang.String DEFAULT_PORT
The default connect DB Server Port.

See Also:
Constant Field Values

DEFAULT_DRIVER

public static final java.lang.String DEFAULT_DRIVER
The default value for the RA_DRIVER resource attribute.

See Also:
Constant Field Values

DEFAULT_TEMPLATE

public static final java.lang.String DEFAULT_TEMPLATE
The default connect URL template.

See Also:
Constant Field Values

RA_ATTR_MAP_MODE

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

DIRECT_MAP_MODE

public static final java.lang.String DIRECT_MAP_MODE
Possible values for RA_ATTR_MAP_MODE

See Also:
Constant Field Values

STRING_MAP_MODE

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

RA_GET_USER_ACTIONS

public static final java.lang.String RA_GET_USER_ACTIONS
The list of resource attributes which will hold the name of a ResourceAction to accomplish the respective operation.

See Also:
Constant Field Values

RA_CREATE_USER_ACTIONS

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

RA_UPDATE_USER_ACTIONS

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

RA_DELETE_USER_ACTIONS

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

RA_DISABLE_USER_ACTIONS

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

RA_ENABLE_USER_ACTIONS

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

RA_AUTHENTICATION_ACTIONS

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

RA_LISTALL_ACTIONS

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

RA_ACCT_ITER_ACTIONS

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

RA_ACTIVE_SYNC_ITER_ACTIONS

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

RA_TEST_ACTIONS

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

RESOURCE_NAME

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

RESOURCE_USER_FORM

public static final java.lang.String RESOURCE_USER_FORM
See Also:
Constant Field Values
Constructor Detail

ScriptedJdbcResourceAdapter

public ScriptedJdbcResourceAdapter()
Method Detail

staticCreatePrototypeResource

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

Throws:
WavesetException

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Specified by:
createPrototypeResource in interface ResourceAdapter
Specified by:
createPrototypeResource in class ResourceAdapterBase
Throws:
WavesetException

startConnection

public 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

public 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

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Specified by:
checkCreateAccount in interface ResourceAdapter
Specified by:
checkCreateAccount 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

checkDeleteAccount

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

getUser

public WSUser getUser(WSUser user)
               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.

Specified by:
getUser in interface ResourceAdapter
Overrides:
getUser in class ResourceAdapterBase
Returns:
"null" if there is no account that corresponds to the user.
Throws:
WavesetException

realCreate

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

Overrides:
realCreate 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

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

supportsActions

public boolean supportsActions()
Specified by:
supportsActions in interface ResourceAdapter
Overrides:
supportsActions in class ResourceAdapterBase

run

public WavesetResult run(ResourceAction action,
                         java.util.Map args)
                  throws WavesetException
Runs a ResourceAction with additional args; could be null.

Specified by:
run in interface ResourceAdapter
Overrides:
run in class ResourceAdapterBase
Parameters:
action - the action to run
args - passed to the action script; can be null
Returns:
a result with the results of the action execution.
Throws:
WavesetException

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Description copied from interface: ResourceAdapter
Authenticates the user against the resource. If authentication is successful, the authenticated id will be returned. If more info is required to complete authentication the result will contain the required info

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

getFeatures

public GenericObject getFeatures()
Description copied from class: ResourceAdapterBase
Expose features supported by the Resource Adapter. Note: ActiveSync is considered a facet, not a feature.

Specified by:
getFeatures in interface ResourceAdapter
Overrides:
getFeatures in class ResourceAdapterBase
Returns:
Features supported by this resource adapter.
See Also:
ResourceAdapter.Features

supportsAccountDisable

public boolean supportsAccountDisable()
Description copied from interface: ResourceAdapter
Indicates whether or not this resource supports account disable. If it does not, the provisioning engine will attempt to simulate disable by generating random passwords. If we end up with more of these "can you do this" methods, we might want to generalize it into a more extensible way to describe features and levels of support.

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

createWSUserFromAttributes

public WSUser createWSUserFromAttributes(java.lang.String identity,
                                         boolean isDisabled,
                                         java.util.Map attributeValues)
                                  throws WavesetException
Specified by:
createWSUserFromAttributes in interface com.waveset.adapter.script.ScriptedAdapter
Throws:
WavesetException

reverseMap

public WSAttributes reverseMap(java.util.Map map)
                        throws WavesetException
Convert the host attribute map into WSAttributes

Parameters:
map - Map of host field names and values
Returns:
WSAttributes corresponding to the initial Map
Throws:
WavesetException

getResourceAttributeActions

protected java.util.List getResourceAttributeActions(java.lang.String resAttrName,
                                                     boolean required)
                                              throws WavesetException
Parameters:
resAttrName -
Returns:
Throws:
WavesetException

testConfiguration

public WavesetResult testConfiguration()
                                throws WavesetException
Description copied from class: ResourceAdapterBase
Default implementation of test method, calls check create. It is strongly preferred that this is overrided by derived classes so that a real test can be done without burdening the checkCreate method with a large overhead. On errors, an exception can be thrown or the error can be returned in the WavesetResult. Errors in the result will generate a test failure message, messages will appear for success or failure.

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

listAllObjects

public java.util.ArrayList listAllObjects(java.lang.String resourceObjectType,
                                          java.util.Map options,
                                          java.lang.String runAsUser,
                                          EncryptedData runAsPassword)
                                   throws WavesetException
Description copied from interface: ResourceAdapter
This method will return a list of object names of the specified object type. If you need to be able to specify which attrs to return, use listObjects instead

Specified by:
listAllObjects in interface ResourceAdapter
Overrides:
listAllObjects in class ResourceAdapterBase
Parameters:
resourceObjectType - - a type of object that is either well-known or is meaningful to the resource. Every resource is expected to recognize certain values. For example, listAllObjects(ACCOUNT) should return a list of all account names.
options - - a map of options
runAsUser - - (optional) if specified, connect as this user to list all objects of the specified type.
runAsPassword - - (optional) if specified, connect with this password to list all objects of the specified type.
Returns:
a list of all objects of a specified type.
Throws:
WavesetException

realCreateOrUpdate

protected void realCreateOrUpdate(WSUser user,
                                  WavesetResult result,
                                  java.lang.String operation)
                           throws WavesetException
This method is called by realCreate and realUpdate

Throws:
WavesetException

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Return an iterator that will iterate over all the accounts on a resource.

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

getAccountIterator

public AccountIterator getAccountIterator(java.util.Map options)
                                   throws WavesetException
Return an iterator that will iterate over all the accounts on a resource.

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

init

public void init()
          throws java.lang.Exception
Initialize the source adapter. Throw exception if initialization failed and the adapter will not be loaded. After init, poll() will be called at each scheduling interval and shutdown() when the adapter is unloaded.

Specified by:
init in interface ActiveSync
Throws:
java.lang.Exception

shutdown

public void shutdown()
Called once when the adapter is unloaded. This is where you can cleanup sockets, etc. If the server is just shutdown, though, this is not called.

Specified by:
shutdown in interface ActiveSync

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
                                   throws WavesetException
Required method implementation to get an attribute value. Since this is a source with a resource, this just a pass-thru method to get resource attribute values.

Specified by:
getAttributeValue in interface ActiveSync
Throws:
WavesetException

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
                       throws WavesetException
Required method implementation to set an attribute value. Since this is a source with a resource, this just a pass-thru method to set resource attribute values. This is an "in memory" change only.

Specified by:
setAttributeValue in interface ActiveSync
Throws:
WavesetException

poll

public int poll()
the poll method. Called at a configurable interval, this polls the remote resource for changes, converts them to IAPI calls, and posts them back to the server.

Specified by:
poll in interface ActiveSync
Returns:
0 if no work done, n if n calls processed, < 0 if error and should no longer be polled.

processUpdates

protected void processUpdates(java.util.List updates,
                              java.lang.String command,
                              com.waveset.adapter.iapi.IAPI prox)
                       throws WavesetException,
                              com.waveset.adapter.iapi.IAPIException
Take a list of Maps that are rows of the audit data and turn them into IAPI calls.

Throws:
WavesetException
com.waveset.adapter.iapi.IAPIException

closeConnection

public void closeConnection(java.sql.Connection con)
Close a connection, making sure that autocommit is true before closing.

Overrides:
closeConnection in class JdbcResourceAdapter

getConnection

public java.sql.Connection getConnection()
                                  throws WavesetException
Get a connection to the default database with the proxy user. Make sure that autoCommit is set to true.

Overrides:
getConnection in class JdbcResourceAdapter
Throws:
WavesetException

traceAndLogCommand

protected void traceAndLogCommand(long traceLevel,
                                  java.lang.String method,
                                  int logLevel,
                                  java.util.Map user,
                                  java.lang.String command,
                                  WavesetResult result)
Log whatever we want to from an update.


traceAndLog

protected void traceAndLog(long traceLevel,
                           java.lang.String method,
                           int logLevel,
                           java.lang.String message)