com.waveset.adapter
Class MySQLResourceAdapter

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

public class MySQLResourceAdapter
extends ResourceAdapterBase

The MySQLResourceAdapter provides very basic management of users for a MySQL installation. This adapter can create, update, and delete users as well as list and iterate over them. The only attribute that can change on an update is the password. All other attributes are created from the template or model user provided as a resource attribute.


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 MYSQL_JDBC
          Default JDBC driver for MySQL
static java.lang.String MYSQL_URL
          Default JDBC URL for MySQL
static java.lang.String RA_DRIVER
          Driver and URL information
static java.lang.String RA_HOST
          The name of the host used to communicate with the resource.
static java.lang.String RA_PASSWORD
          The password for the account name used to connect to the resource.
static java.lang.String RA_PORT
          The port on which to communicate to the resource.
static java.lang.String RA_URL_PREFIX
           
static java.lang.String RA_USER
          The account name used to connect to the resource.
static java.lang.String RA_USERMODEL
          The name of an existing user account that new users will be modeled after.
 
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
MySQLResourceAdapter()
           
MySQLResourceAdapter(Resource res, ObjectCache cache)
           
 
Method Summary
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Authenticate a user to the MySQL server.
 WavesetResult checkCreateAccount(WSUser user)
          Checks to see if an account can be created.In this case, just check connectivity to the MySQL server.
 WavesetResult checkDeleteAccount(WSUser user)
          Check to see if the account can be deleted.
 WavesetResult checkUpdateAccount(WSUser user)
          Check to see if the account can be updated.
 Resource createPrototypeResource()
           
 WSAttributes getAccountAttributes(java.lang.String accountIdentity)
          Fetch any account attributes specified.
 AccountIterator getAccountIterator()
           
 GenericObject getFeatures()
          Doesn't support AccountIterator or listAllObjects of accounts.
 WSUser getUser(WSUser user)
          Retrieve information about an account, and package it as a WSUser object.
protected  void realCreate(WSUser user, WavesetResult result)
          Creates an account on the MySQL server.
protected  void realDelete(WSUser user, WavesetResult result)
          The real work for user deletion gets done in this method.
protected  void realUpdate(WSUser user, WavesetResult result)
          Needs to be overridden by subclass if default updateAccounts() implementation is used.
protected  void startConnection()
          Create a connection to the MySQL server.
static Resource staticCreatePrototypeResource()
           
protected  void stopConnection()
          Drop the connection to the MySQL server.
 WavesetResult testConfiguration()
          Checks connectivity to the MySQL server.
 
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, 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

MYSQL_JDBC

public static final java.lang.String MYSQL_JDBC
Default JDBC driver for MySQL

See Also:
Constant Field Values

MYSQL_URL

public static final java.lang.String MYSQL_URL
Default JDBC URL for MySQL

See Also:
Constant Field Values

RA_HOST

public static final java.lang.String RA_HOST
The name of the host used to communicate with the resource.

See Also:
Constant Field Values

RA_PORT

public static final java.lang.String RA_PORT
The port on which to communicate to the resource.

See Also:
Constant Field Values

RA_DRIVER

public static final java.lang.String RA_DRIVER
Driver and URL information

See Also:
Constant Field Values

RA_URL_PREFIX

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

RA_USER

public static final java.lang.String RA_USER
The account name used to connect to the resource.

See Also:
Constant Field Values

RA_PASSWORD

public static final java.lang.String RA_PASSWORD
The password for the account name used to connect to the resource.

See Also:
Constant Field Values

RA_USERMODEL

public static final java.lang.String RA_USERMODEL
The name of an existing user account that new users will be modeled after.

See Also:
Constant Field Values
Constructor Detail

MySQLResourceAdapter

public MySQLResourceAdapter(Resource res,
                            ObjectCache cache)

MySQLResourceAdapter

public MySQLResourceAdapter()
Method Detail

staticCreatePrototypeResource

public static Resource staticCreatePrototypeResource()
                                              throws WavesetException
Throws:
WavesetException

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Specified by:
createPrototypeResource in interface ResourceAdapter
Specified by:
createPrototypeResource in class ResourceAdapterBase
Throws:
WavesetException

checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Checks to see if an account can be created.In this case, just check connectivity to the MySQL server.

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

getUser

public WSUser getUser(WSUser user)
               throws WavesetException
Retrieve information about an account, and package it as a WSUser object.

Information required to identify the resource account is supplied in another WSUser object.

The returned user object will resemble the source object, but will have its account attribute list filled in.

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

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Creates an account on the MySQL server. The new account is created from the 'model user' specified in the resource attributes.

Overrides:
realCreate in class ResourceAdapterBase
Throws:
WavesetException

checkUpdateAccount

public WavesetResult checkUpdateAccount(WSUser user)
                                 throws WavesetException
Check to see if the account can be updated.

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

realUpdate

protected void realUpdate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default updateAccounts() implementation is used.

Overrides:
realUpdate in class ResourceAdapterBase
Throws:
WavesetException

checkDeleteAccount

public WavesetResult checkDeleteAccount(WSUser user)
                                 throws WavesetException
Check to see if the account can be deleted. See checkCreate for list of things that can be checked (with the exception of the account attribute compliance). Receives a User object as input. The user's identity on this resource will be used to identify the account to be deleted. checkDeleteAccount should not fail if account does not exist

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

realDelete

protected void realDelete(WSUser user,
                          WavesetResult result)
                   throws WavesetException
The real work for user deletion gets done in this method. Delete the user from the user, db, tables_priv, and columns_priv tables.

Overrides:
realDelete in class ResourceAdapterBase
Throws:
WavesetException

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class ResourceAdapterBase
Throws:
WavesetException

getAccountAttributes

public WSAttributes getAccountAttributes(java.lang.String accountIdentity)
                                  throws WavesetException
Fetch any account attributes specified.

Specified by:
getAccountAttributes in interface ResourceAdapter
Overrides:
getAccountAttributes in class ResourceAdapterBase
Returns:
MySQL does not have any account atributes.
Throws:
WavesetException

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Authenticate a user to the MySQL server. The user information (username and password) are provided in the loginInfo and they are passed to the MySQL server for authentication.

Specified by:
authenticate in interface ResourceAdapter
Specified by:
authenticate in class ResourceAdapterBase
Parameters:
loginInfo - Specifies the username and password to authenticate with.
Throws:
WavesetException

startConnection

protected void startConnection()
                        throws WavesetException
Create a connection to the MySQL server. If a connection is already established, do nothing.

Overrides:
startConnection in class ResourceAdapterBase
Throws:
WavesetException

stopConnection

protected void stopConnection()
                       throws WavesetException
Drop the connection to the MySQL server.

Overrides:
stopConnection in class ResourceAdapterBase
Throws:
WavesetException

getFeatures

public GenericObject getFeatures()
Doesn't support AccountIterator or listAllObjects of accounts. Remove from feature map.

Specified by:
getFeatures in interface ResourceAdapter
Overrides:
getFeatures in class ResourceAdapterBase
Returns:
Features supported by this resource adapter.
See Also:
ResourceAdapter.Features

testConfiguration

public WavesetResult testConfiguration()
                                throws WavesetException
Checks connectivity to the MySQL server.

Specified by:
testConfiguration in interface ResourceAdapter
Overrides:
testConfiguration in class ResourceAdapterBase
Throws:
WavesetException - if connectivity can't be established