com.waveset.adapter
Class DatabaseTableResourceAdapter

java.lang.Object
  extended bycom.waveset.adapter.ResourceAdapterBase
      extended bycom.waveset.adapter.JdbcResourceAdapter
          extended bycom.waveset.adapter.DatabaseTableResourceAdapter
All Implemented Interfaces:
ActiveSync, ResourceAdapter

public class DatabaseTableResourceAdapter
extends JdbcResourceAdapter
implements ActiveSync

The DatabaseTableResourceAdapter is a basic, but easy to use adapter for accounts in a relational database.

It supports create, update, and delete actions. It can also be used for pass-thru authentication, although it assumes the password is in clear text in the database. It supports reconcilation via getAccountIterator().

This adapter assumes that all the user account data is stored in a single database table. The delete action is implemented to simply remove the row from the table.

A custom form 'Resource Wizard Database Table' has been written to make configuration very easy.

It now also supports active sync. The active sync configuration permits additional attributes to allow you to restrict the accounts returned for active sync create/update processing. Currently there is no means to perform active sync delete processing since the default delete behavior is to delete the row.


Nested Class Summary
static class DatabaseTableResourceAdapter.Param
           
static class DatabaseTableResourceAdapter.StrictMapResolver
          A class that implements the VariableResolver interface.
static class DatabaseTableResourceAdapter.VariableChecker
          VariableChecker verifies that a variables appear in the LHS of the schema map.
 
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 LAST_FETCHED_CONJUNCTION
           
static java.lang.String LAST_FETCHED_PREDICATE
           
static java.lang.String ORDER_BY_CLAUSE
           
static java.lang.String RA_KEY_COLUMN
           
static java.lang.String RA_NO_PASSWORDS
           
static java.lang.String RA_PASSWORD_COLUMN
           
static java.lang.String RA_PROCESS_NAME
          Deprecated. As of IdM 5.5. Use RA_PROCESS_RULE instead.
static java.lang.String RA_STATIC_SEARCH_PREDICATE
          Active Sync-related resource attribute names
static java.lang.String RA_TABLE
           
 
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
DatabaseTableResourceAdapter()
           
 
Method Summary
 WavesetResult activeSyncTestConfiguration()
           
 void addQuotedName(java.lang.StringBuffer b, java.lang.String s)
          Add a quoted string to a SQL statement we're building in a buffer.
static void addQuotedName(java.lang.StringBuffer b, java.lang.String s, java.lang.String quoting)
           
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Check to see if a user account and password is valid.
protected  com.waveset.adapter.iapi.IAPI buildEventLegacy(com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRow row, java.lang.String command)
          Extract the user identity information and attributes, create: - an IAPIUser object to update Lighthouse, or - an IAIProcess object for launching a workflow and return it.
 void callCompleted(com.waveset.adapter.iapi.IAPI call)
          An call generated by this resource adapter has completed.
 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()
           
protected  void execOracleSqlWithParams(java.lang.String id, java.sql.Connection con, java.lang.String stmt, DatabaseTableResourceAdapter.Param[] params, int ignoreError)
          Execute a statment, with multiple parameter substitutions.
protected  void execSqlWithParams(java.lang.String id, java.sql.Connection con, java.lang.String stmt, DatabaseTableResourceAdapter.Param[] params)
          Execute a statment, with multiple parameter substitutions.
protected  void execSqlWithParams(java.lang.String id, java.sql.Connection con, java.lang.String stmt, DatabaseTableResourceAdapter.Param[] params, int ignoreError)
          Execute a statment, with multiple parameter substitutions.
protected  void execStandardSqlWithParams(java.lang.String id, java.sql.Connection con, java.lang.String stmt, DatabaseTableResourceAdapter.Param[] params, int ignoreError)
           
 AccountIterator getAccountIterator()
          Return an iterator that will iterate over all the accounts on a resource.
 AccountIterator getAccountIterator(java.util.Map searchParams)
          Like getAccountIterator but takes a Map param.
 java.lang.Object getAttributeValue(java.lang.String name)
          Required method implementation to get an attribute value.
protected  byte[] getBytesFromObject(java.lang.String columnName, java.lang.Object binaryObj)
          Return the byte[] value from binaryObj.
 java.sql.Connection getConnection()
          Get a connection to the default database with the proxy user.
 GenericObject getFeatures()
          Expose features supported by the Resource Adapter.
 WSUser getUser(WSUser idUser)
          Public adapter method to get the current user information.
 void init()
          Initialize the source adapter.
 int poll()
          the poll method.
protected  void processUpdates(com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRows updateRows, 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)
          Create a new account.
protected  void realDelete(WSUser user, WavesetResult result)
          Delete the account for real.
protected  void realUpdate(WSUser user, WavesetResult result)
          Update a user
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Required method implementation to set an attribute value.
protected  void setBinaryParam(java.sql.PreparedStatement statement, int statementIndex, byte[] value)
          Set a value in a PreparedStatement for binary parameter.
 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.
 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, com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRow update, java.lang.String command, WavesetResult result)
          Log whatever we want to from an update.
protected  boolean useLegacyEventGeneration()
          Determines if the adapter should generate IAPI events with the legacy logic or use the standard rules based event generation logic.
 
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, listAllObjects, listObjects, listObjects, listObjectsOfType, lookupAction, lookupAction, lookupActions, namesEqual, objectClassesMatchType, println, realDisable, realEnable, restoreResourceObjectClassAttr, run, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsAccountDisable, supportsActions, 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

RA_TABLE

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

RA_KEY_COLUMN

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

RA_PASSWORD_COLUMN

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

RA_NO_PASSWORDS

public static final java.lang.String RA_NO_PASSWORDS
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_STATIC_SEARCH_PREDICATE

public static final java.lang.String RA_STATIC_SEARCH_PREDICATE
Active Sync-related resource attribute names

See Also:
Constant Field Values

RA_PROCESS_NAME

public static final java.lang.String RA_PROCESS_NAME
Deprecated. As of IdM 5.5. Use RA_PROCESS_RULE instead.

See Also:
Constant Field Values

LAST_FETCHED_PREDICATE

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

LAST_FETCHED_CONJUNCTION

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

ORDER_BY_CLAUSE

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

DatabaseTableResourceAdapter

public DatabaseTableResourceAdapter()
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

realCreate

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

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
Update a user

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
Delete the account for real. Assumes that a delete of the account means to remove the respective row. Override this if different behavior is expected.

Overrides:
realDelete in class ResourceAdapterBase
Throws:
WavesetException

getUser

public WSUser getUser(WSUser idUser)
               throws WavesetException
Public adapter method to get the current user information.

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

getBytesFromObject

protected byte[] getBytesFromObject(java.lang.String columnName,
                                    java.lang.Object binaryObj)
                             throws java.sql.SQLException,
                                    InternalError,
                                    WavesetException
Return the byte[] value from binaryObj.

This method can be overridden if needed to define additional coercions.

Parameters:
columnName - the binary column name from which the value was retrieved via a call to ResultSet#getObject()
binaryObj - the value retrieved for the binary column
Returns:
the byte[] value coercion of the binaryObj
Throws:
java.sql.SQLException
InternalError
WavesetException - if no conversion defined

setBinaryParam

protected void setBinaryParam(java.sql.PreparedStatement statement,
                              int statementIndex,
                              byte[] value)
                       throws java.sql.SQLException
Set a value in a PreparedStatement for binary parameter.

Override this if it needs to something other than:
  statement.setBytes(statementIndex, value);

Parameters:
statement - the statement
statementIndex - the index of the parameter to set
value - the byte[] value to which the parameter should be set
Throws:
java.sql.SQLException

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

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

execSqlWithParams

protected void execSqlWithParams(java.lang.String id,
                                 java.sql.Connection con,
                                 java.lang.String stmt,
                                 DatabaseTableResourceAdapter.Param[] params)
                          throws WavesetException
Execute a statment, with multiple parameter substitutions.

Parameters:
id - user id
con - JDBC Connection
stmt - SQL statement to execute (with '?' holders for parameter substitutions)
params - the values to set for the parameter substitutions
Throws:
WavesetException

execSqlWithParams

protected void execSqlWithParams(java.lang.String id,
                                 java.sql.Connection con,
                                 java.lang.String stmt,
                                 DatabaseTableResourceAdapter.Param[] params,
                                 int ignoreError)
                          throws WavesetException
Execute a statment, with multiple parameter substitutions.

Parameters:
id - user id
con - JDBC Connection
stmt - SQL statement to execute (with '?' holders for parameter substitutions)
params - the values to set for the parameter substitutions
Throws:
WavesetException

execStandardSqlWithParams

protected void execStandardSqlWithParams(java.lang.String id,
                                         java.sql.Connection con,
                                         java.lang.String stmt,
                                         DatabaseTableResourceAdapter.Param[] params,
                                         int ignoreError)
                                  throws WavesetException
Throws:
WavesetException

execOracleSqlWithParams

protected void execOracleSqlWithParams(java.lang.String id,
                                       java.sql.Connection con,
                                       java.lang.String stmt,
                                       DatabaseTableResourceAdapter.Param[] params,
                                       int ignoreError)
                                throws WavesetException
Execute a statment, with multiple parameter substitutions.

Parameters:
id - user id
con - JDBC Connection
stmt - SQL statement to execute (with '?' holders for parameter substitutions)
params - the values to set for the parameter substitutions
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 searchParams)
                                   throws WavesetException
Description copied from interface: ResourceAdapter
Like getAccountIterator but takes a Map param. Supported entries are: "Search Filter String" : a String to put in the LDAP search filter. For standard object types (group, user), this will be appended in a string like (&(objectclass=class))

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

getFeatures

public GenericObject getFeatures()
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:
GenericObject containing Features, as both key and value, which are supported by this resource adapter.
See Also:
ResourceAdapter.Features

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

callCompleted

public void callCompleted(com.waveset.adapter.iapi.IAPI call)
An call generated by this resource adapter has completed. Check the result of the call, propogate the result back to the source (like updating a column in a database), and delete it if we are done.

If this does not delete the call, there must be something else that deletes it - or it will just go away when it expires.

See Also:


buildEventLegacy

protected com.waveset.adapter.iapi.IAPI buildEventLegacy(com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRow row,
                                                         java.lang.String command)
                                                  throws WavesetException,
                                                         com.waveset.adapter.iapi.IAPIException
Extract the user identity information and attributes, create: - an IAPIUser object to update Lighthouse, or - an IAIProcess object for launching a workflow and return it. The attributes that are placed in the IAPI object will end up in the resource form (if defined) under the activeSync namespace. For example, if the following code is used: Map attrs = new HashMap; attrs.put("name","bob"); IAPI iapi = IAPIFactory.getIAPIUser(null, userMap,IAPIUser.COMMAND_UPDATE,(ResourceAdapterBase)this); in the form, you could have a field like: activeSync.name and username would get the name bob.

Parameters:
row - - the data to build an event from. @see UpdateRow
Returns:
an IAPI object ready for submit(). Return null if this event should be dropped.
Throws:
WavesetException
com.waveset.adapter.iapi.IAPIException

useLegacyEventGeneration

protected boolean useLegacyEventGeneration()
Determines if the adapter should generate IAPI events with the legacy logic or use the standard rules based event generation logic.


processUpdates

protected void processUpdates(com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRows updateRows,
                              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

traceAndLogCommand

protected void traceAndLogCommand(long traceLevel,
                                  java.lang.String method,
                                  int logLevel,
                                  com.waveset.adapter.DatabaseTableResourceAdapter.UpdateRow update,
                                  java.lang.String command,
                                  WavesetResult result)
Log whatever we want to from an update.


activeSyncTestConfiguration

public WavesetResult activeSyncTestConfiguration()
                                          throws WavesetException
Throws:
WavesetException

traceAndLog

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

addQuotedName

public void addQuotedName(java.lang.StringBuffer b,
                          java.lang.String s)
Add a quoted string to a SQL statement we're building in a buffer. Generally used for entity names. If the attribute might be an integer, then call addAttributeValue() instead, which factors in the syntax of the attribute when determining whether or not to quote the value. Database systems from different vendors are very inconsistent in what they require to be quoted and how. A single vendor's system may require different kinds of quoting depending on the setting of options and modes. There are five quoting strategies: None, Single, Double, Back and Brackets. We let the user choose, thru a resource attribute, when it is appropriate to do quoting and how


addQuotedName

public static void addQuotedName(java.lang.StringBuffer b,
                                 java.lang.String s,
                                 java.lang.String quoting)

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

closeConnection

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

Overrides:
closeConnection in class JdbcResourceAdapter