|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.adapter.ResourceAdapterBase
com.waveset.adapter.OS400ResourceAdapter
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 |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String RA_ADMINACCT
public static final java.lang.String RA_ADMINPWD
public static final java.lang.String RA_HOST
public static final java.lang.String RA_SSL
public static final java.lang.String USER_ACCOUNT
public static final java.lang.String USER_PASSWORD
public static final java.lang.String EXPIRE_PASSWORD
public static final java.lang.String LOGIN_USER
public static final java.lang.String LOGIN_PASSWORD
public static final java.lang.String DISPLAY_USER
public static final java.lang.String DISPLAY_PASSWORD
public static final java.lang.String RESOURCE_NAME
public static final java.lang.String RESOURCE_TYPE
public static final java.lang.String RESOURCE_USER_FORM
public static final java.lang.String CMD_ACGCDE
public static final java.lang.String CMD_ASTLVL
public static final java.lang.String CMD_ATNPGM
public static final java.lang.String CMD_CCSID
public static final java.lang.String CMD_CHRIDCTL
public static final java.lang.String CMD_CNTRYID
public static final java.lang.String CMD_CURLIB
public static final java.lang.String CMD_DSPSGNINF
public static final java.lang.String CMD_GRPAUT
public static final java.lang.String CMD_GRPAUTTYP
public static final java.lang.String CMD_GID
public static final java.lang.String CMD_GRPPRF
public static final java.lang.String CMD_HOMEDIR
public static final java.lang.String CMD_INLMNU
public static final java.lang.String CMD_INLPGM
public static final java.lang.String CMD_JOBD
public static final java.lang.String CMD_KBDBUF
public static final java.lang.String CMD_LANGID
public static final java.lang.String CMD_LMTCPB
public static final java.lang.String CMD_LMTDEVSSN
public static final java.lang.String CMD_SETJOBATR
public static final java.lang.String CMD_LOCALE
public static final java.lang.String CMD_MAXSTG
public static final java.lang.String CMD_DLVRY
public static final java.lang.String CMD_MSGQ
public static final java.lang.String CMD_SEV
public static final java.lang.String CMD_OUTQ
public static final java.lang.String CMD_OWNER
public static final java.lang.String CMD_PWDEXPITV
public static final java.lang.String CMD_PRTDEV
public static final java.lang.String CMD_PWDEXP
public static final java.lang.String CMD_SRTSEQ
public static final java.lang.String CMD_SPCAUT
public static final java.lang.String CMD_SPCENV
public static final java.lang.String CMD_STATUS
public static final java.lang.String CMD_SUPGRPPRF
public static final java.lang.String CMD_TEXT
public static final java.lang.String CMD_USRCLS
public static final java.lang.String CMD_UID
public static final java.lang.String CMD_USROPT
public static final java.lang.String CMD_OWNOBJOPT
public static final java.lang.String ACCOUNT_ATTRIBUTES
public static final java.lang.String CMD_HACK_USERCLS
public static final java.lang.String CMD_PREVIOUS_SIGN_ON
public static final java.lang.String CMD_PASSWORD_CHANGE_DATE
public static final java.lang.String CMD_SIGN_ON_ATTEMPTS_NOT_VALID
public static final java.lang.String CMD_DAYS_UNTIL_PASSWORD_EXPIRES
Constructor Detail |
public OS400ResourceAdapter() throws java.lang.Exception
public OS400ResourceAdapter(Resource res, ObjectCache cache) throws java.lang.Exception
res
- Resource to build the adapter for.cache
- Object cache for adapter.Method Detail |
public static Resource staticCreatePrototypeResource() throws WavesetException
WavesetException
- if resource construction failspublic WavesetResult authenticate(java.util.HashMap loginInfo) throws WavesetException
authenticate
in interface ResourceAdapter
authenticate
in class ResourceAdapterBase
loginInfo
- authentication details hopefully containing
username and password
WavesetException
- login info missing; user/password not
valid; as/400 not reachablepublic WavesetResult checkCreateAccount(WSUser user) throws WavesetException
checkCreateAccount
in interface ResourceAdapter
checkCreateAccount
in class ResourceAdapterBase
user
- user to check
WavesetException
- if check failspublic WavesetResult checkDeleteAccount(WSUser user) throws WavesetException
checkDeleteAccount
in interface ResourceAdapter
checkDeleteAccount
in class ResourceAdapterBase
user
- user to check
WavesetException
- if check failspublic WavesetResult checkUpdateAccount(WSUser user) throws WavesetException
checkUpdateAccount
in interface ResourceAdapter
checkUpdateAccount
in class ResourceAdapterBase
user
- user to check
WavesetException
- if check failsprotected java.lang.String constructCreateUserAttributeParameters(WSUser user)
user
- the user to get the parameter values from
protected java.lang.String constructUpdateUserAttributeParameters(WSUser user)
user
- the user to get the parameter values from
protected java.lang.String constructUserAttributeParameter(java.lang.String key, java.lang.String value)
key
- the parameter namevalue
- the paramter value
public Resource createPrototypeResource() throws WavesetException
createPrototypeResource
in interface ResourceAdapter
createPrototypeResource
in class ResourceAdapterBase
WavesetException
- if the resource can't be createdpublic WSAttributes getAccountAttributes(java.lang.String accountIdentity) throws WavesetException
getAccountAttributes
in interface ResourceAdapter
getAccountAttributes
in class ResourceAdapterBase
accountIdentity
- identity of user to get attributes for
WavesetException
- if adapter fails to get attributespublic AccountIterator getAccountIterator() throws WavesetException
getAccountIterator
in interface ResourceAdapter
getAccountIterator
in class ResourceAdapterBase
WavesetException
- if unable to get users from resourcepublic WSUser getUser(WSUser user) throws WavesetException
getUser
in interface ResourceAdapter
getUser
in class ResourceAdapterBase
user
- user to search for on resource.
WavesetException
- for system or connection failureprotected void realCreate(WSUser user, WavesetResult result) throws WavesetException
realCreate
in class ResourceAdapterBase
user
- the user to create on the resourceresult
- the result to append messages to
WavesetException
- if creation failsprotected void realDelete(WSUser user, WavesetResult result) throws WavesetException
realDelete
in class ResourceAdapterBase
user
- the user to delete on the resourceresult
- the result to append messages to
WavesetException
- if deletion failsprotected void realUpdate(WSUser user, WavesetResult result) throws WavesetException
realUpdate
in class ResourceAdapterBase
user
- the user to update on the resourceresult
- the result to append messages to
WavesetException
- if updating failsprotected void startConnection() throws WavesetException
startConnection
in class ResourceAdapterBase
WavesetException
- if the connection cannot be startedprotected void stopConnection() throws WavesetException
stopConnection
in class ResourceAdapterBase
WavesetException
- if the connection cannot be stoppedpublic AccountIterator getAccountIterator(java.util.Map params) throws WavesetException
getAccountIterator
in interface ResourceAdapter
getAccountIterator
in class ResourceAdapterBase
WavesetException
- if unable to get users from resourceprotected boolean isAllowableCreateUserAttribute(java.lang.String name)
name
- the name of the attribute to check
protected boolean isAllowableUpdateUserAttribute(java.lang.String name)
name
- the name of the attribute to check
protected java.lang.String getUserAttributeValue(WSUser user, java.lang.String mapName)
user
- the user to get the parameter values frommapName
- the parameter name on the resource
public boolean supportsActions()
supportsActions
in interface ResourceAdapter
supportsActions
in class ResourceAdapterBase
protected void runBeforeAction(WSUser user, WavesetResult result, java.lang.String operation) throws WavesetException
WavesetException
protected void runAfterAction(WSUser user, WavesetResult result, java.lang.String operation) throws WavesetException
WavesetException
protected boolean lookupAndRunAction(WSUser user, java.lang.String operation, java.lang.String timing, WavesetResult result) throws WavesetException
WavesetException
protected void runAction(java.lang.String action, WSUser user, java.lang.String operation, int timeout, WavesetResult result) throws WavesetException
WavesetException
protected java.lang.String addAttributesToAction(java.lang.String command, WSUser user)
public boolean supportsAccountDisable()
supportsAccountDisable
in interface ResourceAdapter
supportsAccountDisable
in class ResourceAdapterBase
public GenericObject getFeatures()
ResourceAdapterBase
getFeatures
in interface ResourceAdapter
getFeatures
in class ResourceAdapterBase
ResourceAdapter.Features
protected void realEnable(WSUser user, WavesetResult result) throws WavesetException
realEnable
in class ResourceAdapterBase
user
- the user to Enable
WavesetException
- if ENABLED failsprotected void realDisable(WSUser user, WavesetResult result) throws WavesetException
realDisable
in class ResourceAdapterBase
user
- the user to Disable
WavesetException
- if DISABLED failsprotected boolean runCommand(java.lang.String command, WavesetResult result) throws WavesetException
command
- Command to run on the OS400 resourceresult
- Result from running the command
WavesetException
- If an error occurs during execution
or the command is improperly formed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |