com.waveset.adapter
Class OS400ResourceAdapter

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

public class OS400ResourceAdapter
extends ResourceAdapterBase

Resource adapter built and tested on Release 4, Version 4 of OS/400, running on an AS/400 machine. Theoretically it should work for R4V2 and above. Uses the Java Toolbox Open version 2.0.3 to connect to the OS/400. The jar file jt400.jar should be in the class path. The Toolbox uses the IBM Host Servers on the AS/400 to supply access to a command interpreter and system objects. Configuring the host server is simple, and fully documented in the Java Toolbox documentation, available on the IBM web site.

The following excerpt from IBM documentation gives simple directions for setting up the host server on the AS/400:

Running IBM Toolbox for Java in a client/server environment requires that you enable the QUSER user profile, start the host servers, and have TCP/IP running. Perform these actions from an iSeries command line by running the following commands:

Type DSPUSRPRF USRPRF(QUSER) and press ENTER to enable the QUSER user profile. The resulting display shows the status for QUSER.

Type STRHOSTSVR and press ENTER to start the OS/400 host servers.

Type STRTCPSVR SERVER(*DDM) to start the TCP/IP server (with *DDM specified for the Server parameter).

Note: To run TCP/IP, you must have the TCP/IP Connectivity Utilities for AS/400 (licensed program 5722-TC1) installed on the server. For more information on host server options and TCP/IP, see the TCP/IP topic in the iSeries Information Center.

More details (including how to setup SSL) are available in the IBM docs.

By default, the Java Toolbox uses the following ports for connecting to the server:

449 AS Server Mapper.
8473 File.
8474 Print.
8475 Command.
8472 Data Queue.
8471 Database.
446 Record Level Access.
8470 Central.
8476 Sign-on.
9473 Secure File.
9474 Secure Print.
9475 Secure Command.
9472 Secure Data Queue.
9471 Secure Database.
448 Secure Record Level Access.
9470 Secure Central.
9476 Secure Sign-on.

Of these, currently ports 449, 8475, 446, and 8476 are used by the adapter, and need firewall holes created (if necessary.) For secure connections, 449, 9475, 448, and 9476 would need to be opened.

For some hints on parameters to use for this adapter, check out the OS/400 CRTUSRPRF command documentation, start at http://as400bks.rochester.ibm.com/cgi-bin/bookmgr/BOOKS/QB3AUP03/CCONTENTS and link through CRTUSRPRF. One gotcha to watch out for are that text arguments of the attributes TEXT, HOMEDIR, and LOCALE must be surrounded by single quotes. The adapter will take care of this for anything read from the resource, but not for user initiated values. Also the TEXT attribute requires escaping any single quotes with an additional single quote.


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 ACCOUNT_ATTRIBUTES
           
static java.lang.String CMD_ACGCDE
           
static java.lang.String CMD_ASTLVL
           
static java.lang.String CMD_ATNPGM
           
static java.lang.String CMD_CCSID
           
static java.lang.String CMD_CHRIDCTL
           
static java.lang.String CMD_CNTRYID
           
static java.lang.String CMD_CURLIB
           
static java.lang.String CMD_DAYS_UNTIL_PASSWORD_EXPIRES
           
static java.lang.String CMD_DLVRY
           
static java.lang.String CMD_DSPSGNINF
           
static java.lang.String CMD_GID
           
static java.lang.String CMD_GRPAUT
           
static java.lang.String CMD_GRPAUTTYP
           
static java.lang.String CMD_GRPPRF
           
static java.lang.String CMD_HACK_USERCLS
           
static java.lang.String CMD_HOMEDIR
           
static java.lang.String CMD_INLMNU
           
static java.lang.String CMD_INLPGM
           
static java.lang.String CMD_JOBD
           
static java.lang.String CMD_KBDBUF
           
static java.lang.String CMD_LANGID
           
static java.lang.String CMD_LMTCPB
           
static java.lang.String CMD_LMTDEVSSN
           
static java.lang.String CMD_LOCALE
           
static java.lang.String CMD_MAXSTG
           
static java.lang.String CMD_MSGQ
           
static java.lang.String CMD_OUTQ
           
static java.lang.String CMD_OWNER
           
static java.lang.String CMD_OWNOBJOPT
           
static java.lang.String CMD_PASSWORD_CHANGE_DATE
           
static java.lang.String CMD_PREVIOUS_SIGN_ON
           
static java.lang.String CMD_PRTDEV
           
static java.lang.String CMD_PWDEXP
           
static java.lang.String CMD_PWDEXPITV
           
static java.lang.String CMD_SETJOBATR
           
static java.lang.String CMD_SEV
           
static java.lang.String CMD_SIGN_ON_ATTEMPTS_NOT_VALID
           
static java.lang.String CMD_SPCAUT
           
static java.lang.String CMD_SPCENV
           
static java.lang.String CMD_SRTSEQ
           
static java.lang.String CMD_STATUS
           
static java.lang.String CMD_SUPGRPPRF
           
static java.lang.String CMD_TEXT
           
static java.lang.String CMD_UID
           
static java.lang.String CMD_USRCLS
           
static java.lang.String CMD_USROPT
           
static java.lang.String code_id
           
static java.lang.String DISPLAY_PASSWORD
           
static java.lang.String DISPLAY_USER
           
static java.lang.String EXPIRE_PASSWORD
           
static java.lang.String LOGIN_PASSWORD
           
static java.lang.String LOGIN_USER
           
static java.lang.String RA_ADMINACCT
          Resource attribute name for admin account.
static java.lang.String RA_ADMINPWD
          Resource attribute name for the admin password.
static java.lang.String RA_HOST
          Resource attribute name for the AS/400 host ip address.
static java.lang.String RA_SSL
          Resource attribute name for the ssl flag.
static java.lang.String RESOURCE_NAME
           
static java.lang.String RESOURCE_TYPE
           
static java.lang.String RESOURCE_USER_FORM
           
static java.lang.String USER_ACCOUNT
          User attribute name for account id.
static java.lang.String USER_PASSWORD
          User attribute name for password.
 
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, 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
OS400ResourceAdapter()
          Default constructor.
OS400ResourceAdapter(Resource res, ObjectCache cache)
          Constructor.
 
Method Summary
protected  java.lang.String addAttributesToAction(java.lang.String command, WSUser user)
          addAttributesToAction Searches command string and pulls out schema variables, $var_name$ and replaces with value passed in.
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Authenticate user information.
 WavesetResult checkCreateAccount(WSUser user)
          Checks to see whether a create account request for given user is likely to succeed.
 WavesetResult checkDeleteAccount(WSUser user)
          Checks to see whether a delete account request for given user is likely to succeed.
 WavesetResult checkUpdateAccount(WSUser user)
          Checks to see whether an update account request for given user is likely to succeed.
protected  java.lang.String constructCreateUserAttributeParameters(WSUser user)
          Builds a list of parameters appropriate for the resource to either create or update users.
protected  java.lang.String constructUpdateUserAttributeParameters(WSUser user)
          Builds a list of parameters appropriate for the resource to either create or update users.
protected  java.lang.String constructUserAttributeParameter(java.lang.String key, java.lang.String value)
          Builds a OS/400 compatible command argument.
 Resource createPrototypeResource()
          Utility method returns the static prototype resource.
 WSAttributes getAccountAttributes(java.lang.String accountIdentity)
          Returns account attributes for an identity.
 AccountIterator getAccountIterator()
          Constructs and returns an account iterator.
 AccountIterator getAccountIterator(java.util.Map params)
          Author: Will Droste Constructs and returns an account iterator.
 GenericObject getFeatures()
          Expose features supported by the Resource Adapter.
 WSUser getUser(WSUser user)
          Returns a clone of the passed user if the user is on the OS400 system, otherwise returns a null.
protected  java.lang.String getUserAttributeValue(WSUser user, java.lang.String mapName)
          Gets a single parameter value for the user on the resource with the given map name.
protected  boolean isAllowableCreateUserAttribute(java.lang.String name)
          Reports whether a given attribute name is legal on the create.
protected  boolean isAllowableUpdateUserAttribute(java.lang.String name)
          Reports whether a given attribute name is legal on the update.
protected  boolean lookupAndRunAction(WSUser user, java.lang.String operation, java.lang.String timing, WavesetResult result)
          lookupAndRunAction
protected  void realCreate(WSUser user, WavesetResult result)
          Create a user on the OS/400 resource.
protected  void realDelete(WSUser user, WavesetResult result)
          Delete a user on the OS/400 resource.
protected  void realDisable(WSUser user, WavesetResult result)
          Sets STATUS to *DISABLED and ResourceInfo Disabled 'true'
protected  void realEnable(WSUser user, WavesetResult result)
          Sets STATUS to *ENABLED and ResourceInfo Disabled 'false'
protected  void realUpdate(WSUser user, WavesetResult result)
          Update a user on the OS/400 resource.
protected  void runAction(java.lang.String action, WSUser user, java.lang.String operation, int timeout, WavesetResult result)
          runAction
protected  void runAfterAction(WSUser user, WavesetResult result, java.lang.String operation)
          runAfterAction
protected  void runBeforeAction(WSUser user, WavesetResult result, java.lang.String operation)
          runBeforeAction
protected  boolean runCommand(java.lang.String command, WavesetResult result)
          Runs a generated command on the OS400 resource.
protected  void startConnection()
          Starts up the admin OS400 connection.
static Resource staticCreatePrototypeResource()
          Returns the prototype resource.
protected  void stopConnection()
          Stops the OS400 admin connection.
 boolean supportsAccountDisable()
          Whether the resource can enable and disable accounts.
 boolean supportsActions()
          Whether the resource will support Before/After actions.
 
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, 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, restoreResourceObjectClassAttr, run, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsCaseInsensitiveAccountIds, supportsContainerObjectTypes, supportsExcludedAccounts, supportsResourceAccount, supportsScanning, testConfiguration, 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_ADMINACCT

public static final java.lang.String RA_ADMINACCT
Resource attribute name for admin account.

See Also:
Constant Field Values

RA_ADMINPWD

public static final java.lang.String RA_ADMINPWD
Resource attribute name for the admin password.

See Also:
Constant Field Values

RA_HOST

public static final java.lang.String RA_HOST
Resource attribute name for the AS/400 host ip address.

See Also:
Constant Field Values

RA_SSL

public static final java.lang.String RA_SSL
Resource attribute name for the ssl flag.

See Also:
Constant Field Values

USER_ACCOUNT

public static final java.lang.String USER_ACCOUNT
User attribute name for account id.

See Also:
Constant Field Values

USER_PASSWORD

public static final java.lang.String USER_PASSWORD
User attribute name for password.

See Also:
Constant Field Values

EXPIRE_PASSWORD

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

LOGIN_USER

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

LOGIN_PASSWORD

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

DISPLAY_USER

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

DISPLAY_PASSWORD

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

RESOURCE_NAME

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

RESOURCE_TYPE

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

RESOURCE_USER_FORM

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

CMD_ACGCDE

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

CMD_ASTLVL

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

CMD_ATNPGM

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

CMD_CCSID

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

CMD_CHRIDCTL

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

CMD_CNTRYID

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

CMD_CURLIB

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

CMD_DSPSGNINF

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

CMD_GRPAUT

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

CMD_GRPAUTTYP

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

CMD_GID

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

CMD_GRPPRF

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

CMD_HOMEDIR

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

CMD_INLMNU

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

CMD_INLPGM

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

CMD_JOBD

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

CMD_KBDBUF

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

CMD_LANGID

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

CMD_LMTCPB

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

CMD_LMTDEVSSN

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

CMD_SETJOBATR

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

CMD_LOCALE

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

CMD_MAXSTG

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

CMD_DLVRY

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

CMD_MSGQ

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

CMD_SEV

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

CMD_OUTQ

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

CMD_OWNER

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

CMD_PWDEXPITV

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

CMD_PRTDEV

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

CMD_PWDEXP

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

CMD_SRTSEQ

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

CMD_SPCAUT

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

CMD_SPCENV

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

CMD_STATUS

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

CMD_SUPGRPPRF

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

CMD_TEXT

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

CMD_USRCLS

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

CMD_UID

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

CMD_USROPT

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

CMD_OWNOBJOPT

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

ACCOUNT_ATTRIBUTES

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

CMD_HACK_USERCLS

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

CMD_PREVIOUS_SIGN_ON

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

CMD_PASSWORD_CHANGE_DATE

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

CMD_SIGN_ON_ATTEMPTS_NOT_VALID

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

CMD_DAYS_UNTIL_PASSWORD_EXPIRES

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

OS400ResourceAdapter

public OS400ResourceAdapter()
                     throws java.lang.Exception
Default constructor.


OS400ResourceAdapter

public OS400ResourceAdapter(Resource res,
                            ObjectCache cache)
                     throws java.lang.Exception
Constructor.

Parameters:
res - Resource to build the adapter for.
cache - Object cache for adapter.
Method Detail

staticCreatePrototypeResource

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

Returns:
prototype resource for this adapter.
Throws:
WavesetException - if resource construction fails

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Authenticate user information. Will throw an exception if the user is not authentic or the request is invalid.

Specified by:
authenticate in interface ResourceAdapter
Specified by:
authenticate in class ResourceAdapterBase
Parameters:
loginInfo - authentication details hopefully containing username and password
Throws:
WavesetException - login info missing; user/password not valid; as/400 not reachable

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Checks to see whether a create account request for given user is likely to succeed. Test connection and admin authentication only.

Specified by:
checkCreateAccount in interface ResourceAdapter
Specified by:
checkCreateAccount in class ResourceAdapterBase
Parameters:
user - user to check
Returns:
waveset result if check succeeds
Throws:
WavesetException - if check fails

checkDeleteAccount

public WavesetResult checkDeleteAccount(WSUser user)
                                 throws WavesetException
Checks to see whether a delete account request for given user is likely to succeed. Test connection and admin authentication only.

Specified by:
checkDeleteAccount in interface ResourceAdapter
Specified by:
checkDeleteAccount in class ResourceAdapterBase
Parameters:
user - user to check
Returns:
waveset result if check succeeds
Throws:
WavesetException - if check fails

checkUpdateAccount

public WavesetResult checkUpdateAccount(WSUser user)
                                 throws WavesetException
Checks to see whether an update account request for given user is likely to succeed. Test connection and admin authentication only.

Specified by:
checkUpdateAccount in interface ResourceAdapter
Specified by:
checkUpdateAccount in class ResourceAdapterBase
Parameters:
user - user to check
Returns:
waveset result if check succeeds
Throws:
WavesetException - if check fails

constructCreateUserAttributeParameters

protected java.lang.String constructCreateUserAttributeParameters(WSUser user)
Builds a list of parameters appropriate for the resource to either create or update users. Defers to the to determine whether a particular attribute is legal (isAllowableCreateUserAttribute) and how to format and add the parameter (addParameterToList).

Parameters:
user - the user to get the parameter values from
Returns:
a complete formatted parameter list for use in creating users

constructUpdateUserAttributeParameters

protected java.lang.String constructUpdateUserAttributeParameters(WSUser user)
Builds a list of parameters appropriate for the resource to either create or update users. Defers to the to determine whether a particular attribute is legal (isAllowableUpdateUserAttribute) and how to format and add the parameter (addParameterToList).

Parameters:
user - the user to get the parameter values from
Returns:
a complete formatted parameter list for use in updating users

constructUserAttributeParameter

protected java.lang.String constructUserAttributeParameter(java.lang.String key,
                                                           java.lang.String value)
Builds a OS/400 compatible command argument.

Parameters:
key - the parameter name
value - the paramter value
Returns:
a single formatted key value parameter option

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Utility method returns the static prototype resource.

Specified by:
createPrototypeResource in interface ResourceAdapter
Specified by:
createPrototypeResource in class ResourceAdapterBase
Returns:
the created resource
Throws:
WavesetException - if the resource can't be created

getAccountAttributes

public WSAttributes getAccountAttributes(java.lang.String accountIdentity)
                                  throws WavesetException
Returns account attributes for an identity. Not implemented.

Specified by:
getAccountAttributes in interface ResourceAdapter
Overrides:
getAccountAttributes in class ResourceAdapterBase
Parameters:
accountIdentity - identity of user to get attributes for
Returns:
attributes for identity
Throws:
WavesetException - if adapter fails to get attributes

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Constructs and returns an account iterator.

Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class ResourceAdapterBase
Returns:
an account iterator containing all users on the resource
Throws:
WavesetException - if unable to get users from resource

getUser

public WSUser getUser(WSUser user)
               throws WavesetException
Returns a clone of the passed user if the user is on the OS400 system, otherwise returns a null. Throws if something goes wrong.

Specified by:
getUser in interface ResourceAdapter
Overrides:
getUser in class ResourceAdapterBase
Parameters:
user - user to search for on resource.
Returns:
clone of passed user assuming user exists on resource, otherwise null
Throws:
WavesetException - for system or connection failure

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Create a user on the OS/400 resource.

Overrides:
realCreate in class ResourceAdapterBase
Parameters:
user - the user to create on the resource
result - the result to append messages to
Throws:
WavesetException - if creation fails

realDelete

protected void realDelete(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Delete a user on the OS/400 resource. If possible, assigns any owned objects to the user's group profile. If the user has no group profile (under attribute 'GRPPRF') owned objects are assigned to the Q Default Owner user (QDFTOWN) so that they won't be deleted or orphaned.

Overrides:
realDelete in class ResourceAdapterBase
Parameters:
user - the user to delete on the resource
result - the result to append messages to
Throws:
WavesetException - if deletion fails

realUpdate

protected void realUpdate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Update a user on the OS/400 resource.

Overrides:
realUpdate in class ResourceAdapterBase
Parameters:
user - the user to update on the resource
result - the result to append messages to
Throws:
WavesetException - if updating fails

startConnection

protected void startConnection()
                        throws WavesetException
Starts up the admin OS400 connection.

Overrides:
startConnection in class ResourceAdapterBase
Throws:
WavesetException - if the connection cannot be started

stopConnection

protected void stopConnection()
                       throws WavesetException
Stops the OS400 admin connection.

Overrides:
stopConnection in class ResourceAdapterBase
Throws:
WavesetException - if the connection cannot be stopped

getAccountIterator

public AccountIterator getAccountIterator(java.util.Map params)
                                   throws WavesetException
Author: Will Droste Constructs and returns an account iterator. Map Parameters:

Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class ResourceAdapterBase
Returns:
an account iterator containing all users on the resource
Throws:
WavesetException - if unable to get users from resource

isAllowableCreateUserAttribute

protected boolean isAllowableCreateUserAttribute(java.lang.String name)
Reports whether a given attribute name is legal on the create. This is useful for implementing either exclusion lists, or inclusion lists.

Parameters:
name - the name of the attribute to check
Returns:
true if attribute is allowable for user creation, false if not

isAllowableUpdateUserAttribute

protected boolean isAllowableUpdateUserAttribute(java.lang.String name)
Reports whether a given attribute name is legal on the update. This is useful for implementing either exclusion lists, or inclusion lists.

Parameters:
name - the name of the attribute to check
Returns:
true if attribute is allowable for user update, false if not

getUserAttributeValue

protected java.lang.String getUserAttributeValue(WSUser user,
                                                 java.lang.String mapName)
Gets a single parameter value for the user on the resource with the given map name.

Parameters:
user - the user to get the parameter values from
mapName - the parameter name on the resource
Returns:
a complete formatted parameter list for use in updating users

supportsActions

public boolean supportsActions()
Whether the resource will support Before/After actions.

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

runBeforeAction

protected void runBeforeAction(WSUser user,
                               WavesetResult result,
                               java.lang.String operation)
                        throws WavesetException
runBeforeAction

Throws:
WavesetException

runAfterAction

protected void runAfterAction(WSUser user,
                              WavesetResult result,
                              java.lang.String operation)
                       throws WavesetException
runAfterAction

Throws:
WavesetException

lookupAndRunAction

protected boolean lookupAndRunAction(WSUser user,
                                     java.lang.String operation,
                                     java.lang.String timing,
                                     WavesetResult result)
                              throws WavesetException
lookupAndRunAction

Throws:
WavesetException

runAction

protected void runAction(java.lang.String action,
                         WSUser user,
                         java.lang.String operation,
                         int timeout,
                         WavesetResult result)
                  throws WavesetException
runAction

Throws:
WavesetException

addAttributesToAction

protected java.lang.String addAttributesToAction(java.lang.String command,
                                                 WSUser user)
addAttributesToAction Searches command string and pulls out schema variables, $var_name$ and replaces with value passed in.


supportsAccountDisable

public boolean supportsAccountDisable()
Whether the resource can enable and disable accounts.

Specified by:
supportsAccountDisable in interface ResourceAdapter
Overrides:
supportsAccountDisable in class ResourceAdapterBase
Returns:
boolean if Account Disable supported

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

realEnable

protected void realEnable(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Sets STATUS to *ENABLED and ResourceInfo Disabled 'false'

Overrides:
realEnable in class ResourceAdapterBase
Parameters:
user - the user to Enable
Returns:
none
Throws:
WavesetException - if ENABLED fails

realDisable

protected void realDisable(WSUser user,
                           WavesetResult result)
                    throws WavesetException
Sets STATUS to *DISABLED and ResourceInfo Disabled 'true'

Overrides:
realDisable in class ResourceAdapterBase
Parameters:
user - the user to Disable
Returns:
none
Throws:
WavesetException - if DISABLED fails

runCommand

protected boolean runCommand(java.lang.String command,
                             WavesetResult result)
                      throws WavesetException
Runs a generated command on the OS400 resource.

Parameters:
command - Command to run on the OS400 resource
result - Result from running the command
Returns:
Returns true if successful false otherwise.
Throws:
WavesetException - If an error occurs during execution or the command is improperly formed.