com.waveset.adapter
Class FlatFileActiveSyncAdapter

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

public class FlatFileActiveSyncAdapter
extends SkeletonResourceAdapter
implements ActiveSync

ActiveSync adapter that can be used to process CSV files in a variety of ways.


Nested Class Summary
 class FlatFileActiveSyncAdapter.FlatFileAccountIterator
           
 
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_ACCOUNTID_RHS
           
static java.lang.String RA_ALLOWED_ERROR_COUNT
           
static java.lang.String RA_DIFF_FLATFILE
           
static java.lang.String RA_FILE_ENCODING
           
static java.lang.String RA_FILE_FORMAT
           
static java.lang.String RA_FILENAME
           
static java.lang.String RA_TRACK_TIMESTAMP
           
static java.lang.String RA_UNIQUE_KEY
           
static java.lang.String TYPE_CSV
           
static java.lang.String TYPE_LDIF
           
static java.lang.String TYPE_PIPE
           
 
Fields inherited from class com.waveset.adapter.SkeletonResourceAdapter
DISPLAY_PASSWORD, DISPLAY_USER, LOGIN_PASSWORD, LOGIN_USER, RA_HOST, RA_NAME1, RA_NAME2, RA_PASSWORD, RA_PORT, RA_USER, RESOURCE_NAME, RESOURCE_USER_FORM
 
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_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
FlatFileActiveSyncAdapter()
           
 
Method Summary
protected  WSUser buildUser(java.util.Map attributes)
          Build the user object given a set of attributes
 void callCompleted(com.waveset.adapter.iapi.IAPI call)
          An call generated by this resource adapter has completed.
 WavesetResult checkCreateAccount(WSUser user)
          Checks to see if an account can be created.
protected  void connect()
           
 Resource createPrototypeResource()
           
protected  void disconnect()
           
 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.
 void init()
          Initialize the source adapter.
 int poll()
          the poll method.
protected  int processFlatFile(FlatFileIterator itr)
           
protected  boolean processLine(java.util.Map valueMap)
          Called for each line of values in the CSV file.
protected  void realCreate(WSUser user, WavesetResult result)
          Create a new user account on the resource This method is called by createAccounts (the multiuser create method).
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          These are methods implemented in sources to get and set attributes.
 void shutdown()
          Called once when the adapter is unloaded.
static Resource staticCreatePrototypeResource()
           
 WavesetResult testConfiguration()
          Default implementation of test method, calls check create.
 
Methods inherited from class com.waveset.adapter.SkeletonResourceAdapter
authenticate, checkDeleteAccount, checkUpdateAccount, createObject, deleteObject, doCreateOrUpdateObjectRequest, getAccountAttributes, getUser, listObjects, realDelete, realDisable, realEnable, realUpdate, startConnection, stopConnection, supportsAccountDisable, supportsCaseInsensitiveAccountIds, updateObject
 
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, 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, 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

RA_FILENAME

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

RA_FILE_FORMAT

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

RA_FILE_ENCODING

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

TYPE_CSV

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

TYPE_LDIF

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

TYPE_PIPE

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

DEFAULT_ACCOUNTID_RHS

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

RA_ALLOWED_ERROR_COUNT

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

RA_TRACK_TIMESTAMP

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

RA_DIFF_FLATFILE

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

RA_UNIQUE_KEY

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

FlatFileActiveSyncAdapter

public FlatFileActiveSyncAdapter()
Method Detail

staticCreatePrototypeResource

public static Resource staticCreatePrototypeResource()
                                              throws WavesetException
Throws:
WavesetException

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Specified by:
createPrototypeResource in interface ResourceAdapter
Overrides:
createPrototypeResource in class SkeletonResourceAdapter
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

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

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Description copied from class: SkeletonResourceAdapter
Checks to see if an account can be created. Some of the things that might be checked are as follows: - can basic connectivity to the resource be established? - Do the account attribute values comply with all (if any) resource specific restrictions or policies that haven't been checked at a higher level? Currently there are 3 check methods: checkCreateAccount, checkDeleteAccount and checkUpdate account. All three of these methods could be performing similar actions, such as ensuring that the resource is available. These common actions can be moved to a common function such as doBasicCheck() which any/all check methods could call. Then the individual check methods would do additional checks to ensure that user accounts can be added, modified or deleted. checkCreateAccount is not designed to ensure that the account creation will succeed, only that the likelyhood of success is good. checkCreateAccount does not need to check to see if the account already exists. The provisioner method will follow checkCreateAccount with a getUser call.

Specified by:
checkCreateAccount in interface ResourceAdapter
Overrides:
checkCreateAccount in class SkeletonResourceAdapter
Throws:
WavesetException

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Description copied from class: SkeletonResourceAdapter
Create a new user account on the resource This method is called by createAccounts (the multiuser create method). CreateAccounts will open a connection, call realCreate for each user being created, then close the connection.

Overrides:
realCreate in class SkeletonResourceAdapter
Throws:
WavesetException

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.

Specified by:
getAttributeValue in interface ActiveSync
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.

Specified by:
setAttributeValue in interface ActiveSync
Throws:
WavesetException

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

connect

protected void connect()
                throws WavesetException
Throws:
WavesetException

disconnect

protected void disconnect()

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

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class SkeletonResourceAdapter
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

processFlatFile

protected int processFlatFile(FlatFileIterator itr)
                       throws java.io.IOException
Throws:
java.io.IOException

processLine

protected boolean processLine(java.util.Map valueMap)
Called for each line of values in the CSV file. Simply calls buildEvent() and does all necessary error handling and reporting that can be handled in a generic fashion.

Returns:
A boolean indicator of success or failure. The polling routine in this adapter will fail out after a set number of failures to prevent a faulty CSV file from corrupting the system.

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.

Parameters:
call - -
See Also:


buildUser

protected WSUser buildUser(java.util.Map attributes)
                    throws WavesetException
Build the user object given a set of attributes

Throws:
WavesetException