Nitido Inc.

com.nitido.nimx.services.datacontrol.sim
Class DataControlImpl

java.lang.Object
  extended by com.nitido.nim.DataControl
      extended by com.nitido.nimx.services.datacontrol.sim.DataControlImpl
All Implemented Interfaces:
NiMConstants, java.io.Serializable

public class DataControlImpl
extends DataControl
implements NiMConstants

A simulator implementation of DataControl.

This implementation will store all data in memory.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.nitido.nim.NiMConstants
ACTION_CREATE_NUGGET, ACTION_CREATE_NUGGET_BY_NAME, ACTION_CRED_SPACE_ADD, ACTION_CRED_SPACE_GET_KEYS, ACTION_CRED_SPACE_GET_KEYS_START_WITH, ACTION_CRED_SPACE_GET_VALUE, ACTION_CRED_SPACE_GET_VALUES, ACTION_CRED_SPACE_MODIFY, ACTION_CRED_SPACE_REMOVE_VALUE, ACTION_CRED_SPACE_REMOVE_VALUES, ACTION_CRED_SPACE_REPLACE, ACTION_DEPROVISION_ENTITY, ACTION_ENTITY_CHANGE_CRED, ACTION_LOG_EVENT, ACTION_PROVISION_ENTITY, ACTION_USER_SPACE_ADD, ACTION_USER_SPACE_GET_KEYS, ACTION_USER_SPACE_GET_KEYS_START_WITH, ACTION_USER_SPACE_GET_VALUE, ACTION_USER_SPACE_GET_VALUES, ACTION_USER_SPACE_MODIFY, ACTION_USER_SPACE_REMOVE_VALUE, ACTION_USER_SPACE_REMOVE_VALUES, ACTION_USER_SPACE_REPLACE, CONF_PREFIX_SECURITY_ACCESS, CONF_PREFIX_SECURITY_ALLOW, CONF_PREFIX_SECURITY_ASSIGN, CONF_PREFIX_SECURITY_RESOURCE, PARAM_CHANGE_CRED, PARAM_DEPROVISION_CREDENTIAL, PARAM_EVENT_NAME, PARAM_MODIFIER_CONTAINER, PARAM_NUGGET_CREATE_CRED, PARAM_NUGGET_NAME, PARAM_NUGGET_SETTINGS, PARAM_NUGGET_TYPE, PARAM_PROVISION_DESCRIPTOR, PARAM_SPACE_KEY, PARAM_SPACE_KEYS_START_WITH, PARAM_SPACE_VALUE, PREFIX_ACCESS_CLASS_IN_PACKAGE
 
Constructor Summary
DataControlImpl(Credential credential, java.util.HashMap settings)
          Default constructor that does nothing.
 
Method Summary
protected  void acquire()
          This method is used to establish a connection to the back-end data store.
protected  void activate()
          This method is used to activates the DataControl after the Entity object containing this DataControl is deserialized.
 void bind(Credential credential)
          This method is used to bind the given credential to the DataControl.
protected  void changeDataControlCredential(Credential newCred, boolean modBackend)
          This method changes and rebinds the "login" credential of the DataControl.
protected  void deactivate()
          This method is called to deactivate the DataControl.
protected  void destroy()
          This method is invoked when the associated Entity has been signaled as dying.
protected  java.lang.String[] getCredentialSpaceKeysImpl(java.lang.String startsWith)
          This method contains the actual implementation for the getCredentialSpaceKeys( startsWith ) method.
protected  java.util.Vector getFromCredentialSpaceImpl(java.lang.String key)
          This method contains the actual implementation for the getFromCredentialSpace( key ) method.
protected  java.util.Vector getFromUserSpaceImpl(java.lang.String key)
          This method contains the actual implementation for the getFromUserSpace() method.
protected  java.lang.String[] getUserSpaceKeysImpl(java.lang.String startsWith)
          This method contains the actual implementation for the getUserSpaceKeys() method.
protected  Credential getValueFromCredentialSpaceImpl(java.lang.String key)
          This method contains the actual implementation for the getValueFromCredentialSpace( key ) method.
protected  java.io.Serializable getValueFromUserSpaceImpl(java.lang.String key)
          This method contains the actual implementation for the getValueFromUserSpace() method.
protected  void initialize(java.util.HashMap settings)
          This method is used to initialize the DataControl with the given settings.
protected  void modifyCredentialSpaceImpl(ModifierContainer container)
          This method provides the actual implementation to the modifyCredentialSpace() method.
protected  void modifyUserSpaceImpl(ModifierContainer container)
          This method contains the actual implementation for the modifyUserSpace( container ) method.
protected  void release()
          This method is used to release a connection to the back-end data store.
 
Methods inherited from class com.nitido.nim.DataControl
addToCredentialSpace, addToUserSpace, getCredentialSpaceKeys, getCredentialSpaceKeys, getFromCredentialSpace, getFromUserSpace, getUserSpaceKeys, getUserSpaceKeys, getValueFromCredentialSpace, getValueFromUserSpace, modifyCredentialSpace, modifyUserSpace, removeFromCredentialSpace, removeFromCredentialSpace, removeFromUserSpace, removeFromUserSpace, replaceInCredentialSpace, replaceInUserSpace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataControlImpl

public DataControlImpl(Credential credential,
                       java.util.HashMap settings)
                throws IllegalCredentialException,
                       DataControlException
Default constructor that does nothing.

Throws:
IllegalCredentialException
DataControlException
Method Detail

initialize

protected void initialize(java.util.HashMap settings)
                   throws DataControlException
Description copied from class: DataControl
This method is used to initialize the DataControl with the given settings. The contents of the settings container are specific to the concrete implementation of the class.

Specified by:
initialize in class DataControl
Parameters:
settings - Reference to the HashMap object that contains the parameters used to initialize the DataControl. The contents of this container are specific to the implementation of the class.
Throws:
DataControlException - If unable to initialize the DataControl

bind

public void bind(Credential credential)
          throws IllegalCredentialException,
                 DataControlException
Description copied from class: DataControl
This method is used to bind the given credential to the DataControl. All DataControl constructors must call this method.

Specified by:
bind in class DataControl
Parameters:
credential - Reference to the credential object used to authenticate the entity to the DataControl back-end data store.
Throws:
IllegalCredentialException - If the given credentials is not supported by the concrete DataControl implementation.
DataControlException - If unable to bind the credential to the back-end data store

acquire

protected void acquire()
                throws DataControlException
Description copied from class: DataControl
This method is used to establish a connection to the back-end data store. The method is called by each of the methods that access the data store.

Specified by:
acquire in class DataControl
Throws:
DataControlException - If unable to establish connection to the back-end data store.

release

protected void release()
                throws DataControlException
Description copied from class: DataControl
This method is used to release a connection to the back-end data store. The method is called by each of the methods that access the data store.

Specified by:
release in class DataControl
Throws:
DataControlException - If unable to close the connection to the back-end data store.

activate

protected void activate()
                 throws ActivationException
Description copied from class: DataControl
This method is used to activates the DataControl after the Entity object containing this DataControl is deserialized.

Specified by:
activate in class DataControl
Throws:
ActivationException - If unable to activate the DataControl

deactivate

protected void deactivate()
                   throws ActivationException
Description copied from class: DataControl
This method is called to deactivate the DataControl. This method is called by the Entity object that contains this DataControl when the Entity is being serialized.

Specified by:
deactivate in class DataControl
Throws:
ActivationException - If unable to de-activate the DataControl.

modifyCredentialSpaceImpl

protected void modifyCredentialSpaceImpl(ModifierContainer container)
                                  throws DataControlException
Description copied from class: DataControl
This method provides the actual implementation to the modifyCredentialSpace() method.

Since the modifyCredentialSpace() method has already called the acquire() and release() methods, implementations of this method only need to handle the core modification logic. It does not need to worry about connection and other low level system resource management.

Specified by:
modifyCredentialSpaceImpl in class DataControl
Parameters:
container - Encapsulates the list of modifications to be executed on the Credential space.
Throws:
DataControlException - This exception is thrown if unable to perform the requested modifications.

getValueFromCredentialSpaceImpl

protected Credential getValueFromCredentialSpaceImpl(java.lang.String key)
                                              throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getValueFromCredentialSpace( key ) method. This method is used to separate the logic for opening/closing connections from the actual operation logic.

Specified by:
getValueFromCredentialSpaceImpl in class DataControl
Parameters:
key - The key that uniquely identifies a set of credentials.
Returns:
The reference to the first credential instance that was previously associated to the given key. If the given key is not found, the method returns null.
Throws:
DataControlException - If unable to retrieve a credential from the credential store.

getFromCredentialSpaceImpl

protected java.util.Vector getFromCredentialSpaceImpl(java.lang.String key)
                                               throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getFromCredentialSpace( key ) method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation

Specified by:
getFromCredentialSpaceImpl in class DataControl
Parameters:
key - The key used to identify the requested credentials.
Returns:
A Vector with all the credentials associated with the given key. If no credential is found with the given key then this method returns an empty vector.
Throws:
DataControlException - If unable to retrieve the credentials from the credential store.

getCredentialSpaceKeysImpl

protected java.lang.String[] getCredentialSpaceKeysImpl(java.lang.String startsWith)
                                                 throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getCredentialSpaceKeys( startsWith ) method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation

Specified by:
getCredentialSpaceKeysImpl in class DataControl
Parameters:
startsWith - The prefix of the requested credential keys.
Returns:
A String array with the keys that start with the given prefix. If the given prefix is null, this method returns all the available keys. Finally if no keys are found with the given key, this method returns an empty array.
Throws:
DataControlException - If unable to fetch the credential space.

modifyUserSpaceImpl

protected void modifyUserSpaceImpl(ModifierContainer container)
                            throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the modifyUserSpace( container ) method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation.

Specified by:
modifyUserSpaceImpl in class DataControl
Parameters:
container - Encapsulates the list of modifications to be executed on the user space of the entity.
Throws:
DataControlException - If unable to perform any of the requested modifications.

getValueFromUserSpaceImpl

protected java.io.Serializable getValueFromUserSpaceImpl(java.lang.String key)
                                                  throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getValueFromUserSpace() method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation.

Specified by:
getValueFromUserSpaceImpl in class DataControl
Parameters:
key - The key that uniquely idenfifies a set of objects in the user space.
Returns:
The first object reference that matches the given key.
Throws:
DataControlException - If unable to retrieve the requested object from the user space.

getFromUserSpaceImpl

protected java.util.Vector getFromUserSpaceImpl(java.lang.String key)
                                         throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getFromUserSpace() method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation.

Specified by:
getFromUserSpaceImpl in class DataControl
Parameters:
key - The key used to identify the set of objects in the user space.
Returns:
A Vector with all the objects associated with the given key. If the given key is not found, this method returns an empty vector.
Throws:
DataControlException - If Unable to retrieve requested information from the user space.

getUserSpaceKeysImpl

protected java.lang.String[] getUserSpaceKeysImpl(java.lang.String startsWith)
                                           throws DataControlException
Description copied from class: DataControl
This method contains the actual implementation for the getUserSpaceKeys() method. This method is used to separate the logic for opening/closing connections from the actual logic to perform the operation.

Specified by:
getUserSpaceKeysImpl in class DataControl
Parameters:
startsWith - The prefix string used to search for the currently available user space keys. If no key matches the given prefix, this method returns an empty array
Returns:
A String array with the user space keys that matches the given prefix. If no match is found, the method returns an empty array.
Throws:
DataControlException - If unable to retrieve the requested information from the user space

changeDataControlCredential

protected void changeDataControlCredential(Credential newCred,
                                           boolean modBackend)
                                    throws IllegalCredentialException,
                                           DataControlException
Description copied from class: DataControl
This method changes and rebinds the "login" credential of the DataControl. This method should change the last previous binded user's token to the credential specified by the newCred parameter. It is usually used for changing user pasword. If all you want to do is switching to another user or "super user", you should call the bind() method instead. Service Developer NOTE: Unlike other member methods, this method does not have a base class method that automatically called the "acquire() and release()" method. The implementation of this method must remember to make the backend connection themselves. We do not call the acquire() and release() automatically because the underlying implementation may not need to login as the current user (e.g. it may need to connect as the super user first).

Specified by:
changeDataControlCredential in class DataControl
Parameters:
newCred - The new credential to be changed for the currently binded user.
modBackend - If this flag is set to true, this method should change the login credential in the backend server as specified. Otherwise, this method only need to change how this DataControl establish the connection to the backend.
Throws:
IllegalCredentialException - If the given credentials is not supported by the DataControl.
DataControlException - If unable to bind the credential to the DataControl.

destroy

protected void destroy()
Description copied from class: DataControl
This method is invoked when the associated Entity has been signaled as dying. This method should cleaned up all the resources associated to the DataControl that cannot be removed by the garbage collector.

Specified by:
destroy in class DataControl

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.