com.ca.jcs.util
Class FileConnectorPersister

java.lang.Object
  extended by com.ca.jcs.ConnectorPersister
      extended by com.ca.jcs.util.FileConnectorPersister

public class FileConnectorPersister
extends ConnectorPersister

Save and load information by XML encoding/decoding to local files, where all information about a connector type (including its child connectors) is placed in a single directory named after it. TODO 1. Splitting off of sensitive attributes so they can be obfuscated should be added - add new getter to ObjectClassMapping that returns a Set. 2. CONN_SKIP_PERSISTER_DELETE_ATTR added to allow testing of persisted state, when present persister state is left after deleting.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ca.jcs.ConnectorPersister
ConnectorPersister.State, ConnectorPersister.StateType
 
Field Summary
 
Fields inherited from class com.ca.jcs.ConnectorPersister
connectorManager, enabled, observers
 
Constructor Summary
FileConnectorPersister()
           
 
Method Summary
 void deleteConnectorState(LdapDN stateName, String connTypeName, String connName)
          Delete any state found for a given connector.
 void deleteConnectorTypeState(LdapDN stateName, String connTypeName)
          Delete any state found for a given connector type.
 String getConnectorFilePath(String connTypeName, String connName)
          Custom version of MetaConnectorFactory method that supports unique path generation and non-ambiguous re-calculation of connector type and connector name from the filename.
 List<String> getConnectorList(String connTypeName)
          Method to get the names of all persisted connectors for a given connector type.
 String getConnectorStateFileSuffix()
           
 String getConnectorTypeFilePath(String connTypeName)
          Custom version of MetaConnectorFactory method that supports unique path generation and non-ambiguous re-calculation of connector type name from the filename.
 List<String> getConnectorTypeList()
          Method to get the names of all persisted connector types.
 String getConnectorTypeMetadataFileSuffix()
           
 String getConnectorTypeOpBindingsFileSuffix()
           
 String getConnectorTypeStateFileSuffix()
           
 String getDirectory()
           
 boolean isObfuscatedSplitRequired()
           
 ConnectorPersister.State loadConnectorState(String connTypeName, String connName)
          Load a connector state from persistent storage.
 ConnectorPersister.State loadConnectorTypeState(String connTypeName)
          Load a connector type state from persistent storage.
 void saveConnectorState(Connector conn, ConnectorPersister.State state)
          Save the provided state for a connector.
 void saveConnectorTypeState(ConnectorType connType, ConnectorPersister.State state)
          Save the provided state for a connector type.
 void setConnectorManager(ConnectorManager manager)
           
 void setConnectorStateFileSuffix(String connectorStateFileSuffix)
           
 void setConnectorTypeMetadataFileSuffix(String connectorTypeMetadataFileSuffix)
           
 void setConnectorTypeOpBindingsFileSuffix(String connectorTypeOpBindingsFileSuffix)
           
 void setConnectorTypeStateFileSuffix(String connectorTypeStateFileSuffix)
           
 void setDirectory(String directory)
           
 
Methods inherited from class com.ca.jcs.ConnectorPersister
addObserver, isEnabled, notifyStateDeleted, notifyStateSaved, removeObserver, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileConnectorPersister

public FileConnectorPersister()
Method Detail

isObfuscatedSplitRequired

public boolean isObfuscatedSplitRequired()
Overrides:
isObfuscatedSplitRequired in class ConnectorPersister
Returns:
true if the connector manager should split off sensitive attributes and obfuscate their values, otherwise false.

setConnectorManager

public void setConnectorManager(ConnectorManager manager)
Overrides:
setConnectorManager in class ConnectorPersister

getDirectory

public String getDirectory()

setDirectory

public void setDirectory(String directory)

loadConnectorTypeState

public ConnectorPersister.State loadConnectorTypeState(String connTypeName)
Description copied from class: ConnectorPersister
Load a connector type state from persistent storage.

Specified by:
loadConnectorTypeState in class ConnectorPersister
Parameters:
connTypeName - the connector type name.
Returns:
an initialised state instance.

loadConnectorState

public ConnectorPersister.State loadConnectorState(String connTypeName,
                                                   String connName)
Description copied from class: ConnectorPersister
Load a connector state from persistent storage.

Specified by:
loadConnectorState in class ConnectorPersister
Parameters:
connTypeName - the connector type name.
connName - the connector name.
Returns:
an initialised state instance.

saveConnectorTypeState

public void saveConnectorTypeState(ConnectorType connType,
                                   ConnectorPersister.State state)
                            throws IOException
Description copied from class: ConnectorPersister
Save the provided state for a connector type.

Overrides:
saveConnectorTypeState in class ConnectorPersister
Parameters:
connType - the connector type to save.
state - an initialised state instance.
Throws:
IOException

saveConnectorState

public void saveConnectorState(Connector conn,
                               ConnectorPersister.State state)
                        throws IOException
Description copied from class: ConnectorPersister
Save the provided state for a connector. If conn is a meta connector then its MetaObjectClassMap can be accessed via its class mappings list and used to drive specialized logic if required. See ConnectorPersister.isObfuscatedSplitRequired()

Overrides:
saveConnectorState in class ConnectorPersister
Parameters:
conn - the connector to save.
state - an initialised state instance.
Throws:
IOException

deleteConnectorTypeState

public void deleteConnectorTypeState(LdapDN stateName,
                                     String connTypeName)
                              throws IOException
Description copied from class: ConnectorPersister
Delete any state found for a given connector type.

Overrides:
deleteConnectorTypeState in class ConnectorPersister
Parameters:
stateName - the state name
connTypeName - the connector type name.
Throws:
IOException

deleteConnectorState

public void deleteConnectorState(LdapDN stateName,
                                 String connTypeName,
                                 String connName)
                          throws IOException
Description copied from class: ConnectorPersister
Delete any state found for a given connector.

Overrides:
deleteConnectorState in class ConnectorPersister
Parameters:
stateName - the state name
connTypeName - the connector type name.
connName - the connector name.
Throws:
IOException

getConnectorStateFileSuffix

public String getConnectorStateFileSuffix()

getConnectorTypeStateFileSuffix

public String getConnectorTypeStateFileSuffix()

getConnectorTypeOpBindingsFileSuffix

public String getConnectorTypeOpBindingsFileSuffix()

getConnectorTypeMetadataFileSuffix

public String getConnectorTypeMetadataFileSuffix()

setConnectorStateFileSuffix

public void setConnectorStateFileSuffix(String connectorStateFileSuffix)

setConnectorTypeStateFileSuffix

public void setConnectorTypeStateFileSuffix(String connectorTypeStateFileSuffix)

setConnectorTypeOpBindingsFileSuffix

public void setConnectorTypeOpBindingsFileSuffix(String connectorTypeOpBindingsFileSuffix)

setConnectorTypeMetadataFileSuffix

public void setConnectorTypeMetadataFileSuffix(String connectorTypeMetadataFileSuffix)

getConnectorTypeList

public List<String> getConnectorTypeList()
                                  throws IOException
Description copied from class: ConnectorPersister
Method to get the names of all persisted connector types.

Specified by:
getConnectorTypeList in class ConnectorPersister
Returns:
list of connector type names.
Throws:
IOException

getConnectorList

public List<String> getConnectorList(String connTypeName)
                              throws IOException
Description copied from class: ConnectorPersister
Method to get the names of all persisted connectors for a given connector type.

Specified by:
getConnectorList in class ConnectorPersister
Parameters:
connTypeName - the connector type name
Returns:
list of connector names.
Throws:
IOException

getConnectorFilePath

public String getConnectorFilePath(String connTypeName,
                                   String connName)
Custom version of MetaConnectorFactory method that supports unique path generation and non-ambiguous re-calculation of connector type and connector name from the filename.

Parameters:
connTypeName - the connector type name.
connName - the connector name.
Returns:
the unique file path.

getConnectorTypeFilePath

public String getConnectorTypeFilePath(String connTypeName)
Custom version of MetaConnectorFactory method that supports unique path generation and non-ambiguous re-calculation of connector type name from the filename.

Parameters:
connTypeName - the connector type name.
Returns:
the unique file path.


Created 2011-07-14 13:27 EST