com.waveset.adapter
Class DB2ResourceAdapter

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

public class DB2ResourceAdapter
extends ResourceAdapterBase

Resource Adapter for DB2 server. Was developed and tested using IBM DB2 Universal Database version 7. DB2 performs authentication externally, and authorization internally. Authentication is performed through an accountID/password that is passed on to an external certifier. By default this is the operating system, though it could be a third party package. Authorization is done by mapping the accountID internally to various permissions at the database, index, package, schema, server, table, view, nickname and/or table space level. Granting authorization does not automatically authenticate the accountID (hence you can authorize nonexistent accounts.) Revoking authorization does not remove publicly availably authority from an accountID. The current configuration is to have the DB2 Connection app installed on the Lighthouse machine. Within this app, a local alias is made to the remote database. This allows the Adapter to make local calls to the database that are automatically forwarded through the alias to the remote database. This is the IBM recommended method for interfacing an application to a remote database. The downside is 1) that it requires some (fairly easy) up front installation and configuration of DB2 Connection, and 2) it takes configuration of the DB remote location out of Lighthouse.


Nested Class Summary
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapterBase
ResourceAdapterBase.SimpleAccountIterator
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapter
ResourceAdapter.ActionResult, ResourceAdapter.Features, ResourceAdapter.ObjectType
 
Field Summary
static java.lang.String code_id
           
static java.lang.String RA_ADMINACCT
           
static java.lang.String RA_ADMINPWD
           
static java.lang.String RA_DBNAME
           
static java.lang.String RA_JDBC_DRIVER
           
static java.lang.String RA_JDBC_SUBPROTOCOL
           
static java.lang.String RA_REMOVE_FOREIGN_GRANTS
           
static java.lang.String USER_AUTH_GRANTS
           
static java.lang.String USER_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, 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
DB2ResourceAdapter()
          Default constructor.
DB2ResourceAdapter(Resource res, ObjectCache cache)
          Constructor.
 
Method Summary
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Authenticate the user through the DB2 server based on username and password out of the login info.
 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.
 Resource createPrototypeResource()
          Utility method returns the static prototype resource.
 WSAttributes getAccountAttributes(java.lang.String accountIdentity)
          DB2 Adapter has no account attributes, this returns empty attributes.
 AccountIterator getAccountIterator()
          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 has any authority in the DB2 database, otherwise returns a null.
protected  WSUser getUser(WSUser user, boolean closeConnection)
          Returns a clone of the passed user if the user has any authority in the DB2 database, otherwise returns a null.
 java.util.ArrayList listAllObjects(java.lang.String objectType, java.util.Map options, java.lang.String runAsUser, EncryptedData runAsPassword)
          This method will return a list of object names of the specified object type.
protected  void realCreate(WSUser user, WavesetResult result)
          Create the user by granting and revoking the resource authorities.
protected  void realDelete(WSUser user, WavesetResult result)
          Deletes a user by deleting all grants, whether they were granted by Lighthouse or not.
protected  void realUpdate(WSUser user, WavesetResult result)
          Updates the user by granting and revoking the resource authorities.
protected  void startConnection()
          Starts up the database connection, ensuring that the jdbc driver has been initialized.
static Resource staticCreatePrototypeResource()
          Returns the prototype resource.
protected  void stopConnection()
          Delicately stops the database connection.
 
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, getAccountIterator, getAction, getActionNotFoundErrorMessage, getActionNotFoundMessage, getActionRunAsPassword, getActionRunAsUser, getActionTimeout, getActionType, getAdapter, getAdapter, getAdapter, getAdapterProxy, getAdapterProxy, getAllAccounts, getAttrNameFromMapName, getAttrNameFromMapName, getAttrParse, getAttrTypeFromMapName, getAttrTypeFromMapName, getAUserName, getBaseContextAttrName, getBaseContextObject, getBaseContexts, getBlockSize, getContext, getExcludedAccountsRule, getIdentity, getListAllObjectsAttrParse, getListUserAttrParse, getListUserGroupsAttrParse, getObject, getOptionalBooleanResAttrVal, getOptionalBooleanResAttrVal, getOptionalEncryptedResAttrVal, getOptionalResAttrVal, getOptionalStringResAttrVal, getRequiredResAttr, getRequiredResAttr, getRequiredResAttrVal, getRequiredResAttrVal, getRequiredResAttrVals, getRequiredUserAttributeNames, getResAttrValActionOnUser, getResAttrVals, getResource, getResourceAccounts, getResourceInfo, getResourceObjectAttrValNameAttr, getResourceObjectClassAttr, getResourceObjectTypePrefix, getSchemaMap, getUser, getWSAttrByMapName, getWSAttrByMapName, getWSAttrFromMap, handleActionResult, handleJavascriptActionResult, isAccountAttributeSecret, isExcludedAccount, isExcludedAccount, isFeatureEnabled, isSupported, isTestMode, listAllObjects, listObjects, listObjects, listObjectsOfType, lookupAction, lookupAction, lookupActions, namesEqual, objectClassesMatchType, println, realDisable, realEnable, restoreResourceObjectClassAttr, run, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsAccountDisable, supportsActions, 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
See Also:
Constant Field Values

RA_ADMINPWD

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

RA_DBNAME

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

RA_JDBC_DRIVER

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

RA_JDBC_SUBPROTOCOL

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

RA_REMOVE_FOREIGN_GRANTS

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

USER_PASSWORD

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

USER_AUTH_GRANTS

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

DB2ResourceAdapter

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


DB2ResourceAdapter

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

Method Detail

staticCreatePrototypeResource

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

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

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Authenticate the user through the DB2 server based on username and password out of the login info. DB2 does pass through authentication and will authenticate using a third party. Typically this would be the underlying operating system. 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
Throws:
WavesetException

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Checks to see whether a create account request for given user is likely to succeed. Checks that the user name and password are DB2 valid, and that a connection can be made to the database.

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

checkDeleteAccount

public WavesetResult checkDeleteAccount(WSUser user)
                                 throws WavesetException
Checks to see whether a delete account request for given user is likely to succeed. Checks that the user name and password are DB2 valid, and that a connection can be made to the database.

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

checkUpdateAccount

public WavesetResult checkUpdateAccount(WSUser user)
                                 throws WavesetException
Checks to see whether an update account request for given user is likely to succeed. Checks that the user name and password are DB2 valid, and that a connection can be made to the database.

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

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
Throws:
WavesetException

getAccountAttributes

public WSAttributes getAccountAttributes(java.lang.String accountIdentity)
                                  throws WavesetException
DB2 Adapter has no account attributes, this returns empty attributes.

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

getAccountIterator

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

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

getUser

public WSUser getUser(WSUser user)
               throws WavesetException
Returns a clone of the passed user if the user has any authority in the DB2 database, otherwise returns a null. Throws if something goes wrong.

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

getUser

protected WSUser getUser(WSUser user,
                         boolean closeConnection)
                  throws WavesetException
Returns a clone of the passed user if the user has any authority in the DB2 database, otherwise returns a null. Throws if something goes wrong.

Throws:
WavesetException

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Create the user by granting and revoking the resource authorities. Optionally (resource configurable) remove any existing authorities before creating the user.

Overrides:
realCreate in class ResourceAdapterBase
Throws:
WavesetException

realDelete

protected void realDelete(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Deletes a user by deleting all grants, whether they were granted by Lighthouse or not.

Overrides:
realDelete in class ResourceAdapterBase
Throws:
WavesetException

realUpdate

protected void realUpdate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Updates the user by granting and revoking the resource authorities. Optionally (resource configurable) remove any existing authorities before updating the user.

Overrides:
realUpdate in class ResourceAdapterBase
Throws:
WavesetException

startConnection

protected void startConnection()
                        throws WavesetException
Starts up the database connection, ensuring that the jdbc driver has been initialized.

Overrides:
startConnection in class ResourceAdapterBase
Throws:
WavesetException

stopConnection

protected void stopConnection()
                       throws WavesetException
Delicately stops the database connection.

Overrides:
stopConnection in class ResourceAdapterBase
Throws:
WavesetException

listAllObjects

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

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