com.ca.jcs.standalone
Class StandaloneServerManager

java.lang.Object
  extended by com.ca.jcs.standalone.StandaloneServerManager
All Implemented Interfaces:
ConnectorPersisterObserver, CustomJdbmPartitionObserver

public class StandaloneServerManager
extends Object
implements ConnectorPersisterObserver, CustomJdbmPartitionObserver

Manager for functionality of the JCS when in "standalone" mode (no provisioning server).

When in standalone mode the JCS uses a searchable JDBM partition that provide configuration information about active and inactive connector types and connectors at all times.

Author:
fittr01

Field Summary
static String ATTR_CONFIG_CONTAINER_NAME
          Attribute name for a configuration container name
static String ATTR_CONFIG_PARAM_NAME
          Attribute name for a configuration param name
static String ATTR_CONFIG_PARAM_VALUE
          Attribute name for a configuration param value
static String ATTR_DOMAIN_COMPONENT
          Attribute name for a domain component
static String ATTR_NAMESPACE_FAMILY
          Attribute name for a namespace family (used by ConnXp to determine dynamic connectors)
static String ATTR_NAMESPACE_NAME
          Attribute name for a namespace name
static String ATTR_OBJECT_CLASS
          Attribute name for the object class
protected  CustomJdbmPartition configurationPartition
          JDBM partition used to provide SA JCS configuration
protected  ConnectorManager connectorManager
          Spring injected connector manager
protected  CustomJdbmPartition connectorPartition
          JDBM partition used to provide connector configuration information to ConnXp
protected  ConnectorPersister connectorPersister
          Spring injected connection config persister used to observe config changes
protected  LdapDN domainDn
          The DN of the standalone domain
protected  DirectoryServiceConfiguration dsCfg
          ApacheDS configuration
static String FILE_EXTENSION_JAR
          The file extension, including '.' for a JAR file
protected  String propertyOverrideFile
          Spring injected property override filename
protected  StandaloneServerConfiguration standaloneConfiguration
          Spring injected configuration for standalone mode
static String STARS
          80 stars, for use in logger
static String URL_PROTOCOL_FILE
          The URL protocol for a file contained on the filesystem
static String URL_PROTOCOL_JAR
          The URL protocol for a file contained within a JAR
static String VALUE_CONFIG_PARAM_DOMAIN
          Configuration param name value for the standalone domain
static String VALUE_CONFIG_PARAM_ENABLED
          Configuration param name value for whether standalone mode is enabled
static String VALUE_NAMESPACE_COMMON_OBJECTS
          Namespace name value for IM common objects
static String VALUE_NAMESPACE_FAMILY_DYNAMIC
          Namespace family value for dynamic connector types
static String VALUE_OBJECT_CLASS_CONFIG_CONT
          Object class value for a configuration container
static String VALUE_OBJECT_CLASS_CONFIG_PARAM
          Object class value for a configuration param
static String VALUE_OBJECT_CLASS_DC
          Object class value for a domain component
static String VALUE_OBJECT_CLASS_DYN_NAMESPACE
          Object class value for a dynamic namespace
static String VALUE_OBJECT_CLASS_NAMESPACE
          Object class value for a namespace
 
Constructor Summary
StandaloneServerManager()
           
 
Method Summary
protected  void addConnectorTypeToConnectorPartition(String configBase, String connTypeName, ConnectorPersister.State connTypeState)
          Method to add all configuration for a connector type to the connector configuration partition.
protected  void addEntryToConnectorPartition(LdapDN entryDn, ConnectorPersister.StateType type, Attributes attrs, Attributes obfuscatedAttrs)
          Add an entry to the connector configuration partition.
 void beforeModify(LdapDN name, ModificationItem[] items)
          CustomJdbmPartition callback method made before a configuration entry is modified.
 void cleanup()
          Deinitialise and remove any active partitions in ApacheDS.
protected  void createConfigurationPartition(DirectoryServiceConfiguration dsCfg)
          Method to create a JDBM partition that provides read/write access to SA JCS configuration.
protected  void createConnectorPartition(Rdn baseRdn, String domain, DirectoryServiceConfiguration dsCfg)
          Method to create a JDBM partition that provides read/write access to connector configuration.
protected  CustomJdbmPartition createCustomPartition(LdapDN suffix, Attributes attrs, DirectoryServiceConfiguration dsCfg)
          Method to create a new custom JDBM partition and add it to ApacheDS.
protected  void disableStandaloneMode()
          Internal method to disable the standalone mode of the JCS.
protected  void enableStandaloneMode()
          Internal method to enable the standalone mode of the JCS.
protected  List<String> getPartitionConnectorTypes()
          Internal method to get a list of connector types in the JDBM partition.
 void init(DirectoryServiceConfiguration dsCfg)
          Initialise method that takes ApacheDS configuration.
protected  boolean isMetadataOutdated(ImplBundle implBundle, ConnectorPersister.State connTypeState)
          Check whether the metadata used in a persisted connector type state has become outdated from the connector.
 boolean isStandaloneManagedDN(LdapDN dn)
          Return whether a DN is managed by the standalone server manager.
 boolean isStandaloneMode()
           
protected  void persistStandaloneConfiguration()
          Method to persist the current standalone configuration in the JCS properties override file.
protected  void populateConnectorPartition(String configBase)
          Method to populate the JDBM partition with static and dynamic connector configurations.
protected  void removeEntryFromConnectorPartition(LdapDN entryDn)
          Remove an entry from the JDBM partition, including any child nodes.
 NamingEnumeration<SearchResult> searchConnectorConfig(LdapDN baseName, Map<String,String> environment, ExprNode filter, SearchControls searchControls)
          Perform a search on the connector configuration partition.
 void setConnectorManager(ConnectorManager connectorManager)
           
 void setPropertyOverrideConfigurer(ListAwarePropertyOverrideConfigurer propertyOverrideConfigurer)
           
 void setStandaloneConfiguration(StandaloneServerConfiguration standaloneConfiguration)
           
 void stateDeleted(ConnectorPersister.StateType type, LdapDN stateName)
          ConnectorPersisterObserver callback method.
 void stateSaved(ConnectorPersister.State state)
          ConnectorPersisterObserver callback method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_PROTOCOL_JAR

public static final String URL_PROTOCOL_JAR
The URL protocol for a file contained within a JAR

See Also:
Constant Field Values

URL_PROTOCOL_FILE

public static final String URL_PROTOCOL_FILE
The URL protocol for a file contained on the filesystem

See Also:
Constant Field Values

FILE_EXTENSION_JAR

public static final String FILE_EXTENSION_JAR
The file extension, including '.' for a JAR file

See Also:
Constant Field Values

standaloneConfiguration

protected StandaloneServerConfiguration standaloneConfiguration
Spring injected configuration for standalone mode


connectorPersister

protected ConnectorPersister connectorPersister
Spring injected connection config persister used to observe config changes


connectorManager

protected ConnectorManager connectorManager
Spring injected connector manager


propertyOverrideFile

protected String propertyOverrideFile
Spring injected property override filename


connectorPartition

protected CustomJdbmPartition connectorPartition
JDBM partition used to provide connector configuration information to ConnXp


configurationPartition

protected CustomJdbmPartition configurationPartition
JDBM partition used to provide SA JCS configuration


domainDn

protected LdapDN domainDn
The DN of the standalone domain


dsCfg

protected DirectoryServiceConfiguration dsCfg
ApacheDS configuration


ATTR_OBJECT_CLASS

public static final String ATTR_OBJECT_CLASS
Attribute name for the object class

See Also:
Constant Field Values

ATTR_NAMESPACE_FAMILY

public static final String ATTR_NAMESPACE_FAMILY
Attribute name for a namespace family (used by ConnXp to determine dynamic connectors)

See Also:
Constant Field Values

VALUE_OBJECT_CLASS_DYN_NAMESPACE

public static final String VALUE_OBJECT_CLASS_DYN_NAMESPACE
Object class value for a dynamic namespace

See Also:
Constant Field Values

VALUE_NAMESPACE_FAMILY_DYNAMIC

public static final String VALUE_NAMESPACE_FAMILY_DYNAMIC
Namespace family value for dynamic connector types

See Also:
Constant Field Values

ATTR_NAMESPACE_NAME

public static final String ATTR_NAMESPACE_NAME
Attribute name for a namespace name

See Also:
Constant Field Values

ATTR_DOMAIN_COMPONENT

public static final String ATTR_DOMAIN_COMPONENT
Attribute name for a domain component

See Also:
Constant Field Values

ATTR_CONFIG_CONTAINER_NAME

public static final String ATTR_CONFIG_CONTAINER_NAME
Attribute name for a configuration container name

See Also:
Constant Field Values

ATTR_CONFIG_PARAM_NAME

public static final String ATTR_CONFIG_PARAM_NAME
Attribute name for a configuration param name

See Also:
Constant Field Values

ATTR_CONFIG_PARAM_VALUE

public static final String ATTR_CONFIG_PARAM_VALUE
Attribute name for a configuration param value

See Also:
Constant Field Values

VALUE_OBJECT_CLASS_NAMESPACE

public static final String VALUE_OBJECT_CLASS_NAMESPACE
Object class value for a namespace

See Also:
Constant Field Values

VALUE_OBJECT_CLASS_DC

public static final String VALUE_OBJECT_CLASS_DC
Object class value for a domain component

See Also:
Constant Field Values

VALUE_OBJECT_CLASS_CONFIG_CONT

public static final String VALUE_OBJECT_CLASS_CONFIG_CONT
Object class value for a configuration container

See Also:
Constant Field Values

VALUE_OBJECT_CLASS_CONFIG_PARAM

public static final String VALUE_OBJECT_CLASS_CONFIG_PARAM
Object class value for a configuration param

See Also:
Constant Field Values

VALUE_NAMESPACE_COMMON_OBJECTS

public static final String VALUE_NAMESPACE_COMMON_OBJECTS
Namespace name value for IM common objects

See Also:
Constant Field Values

VALUE_CONFIG_PARAM_ENABLED

public static final String VALUE_CONFIG_PARAM_ENABLED
Configuration param name value for whether standalone mode is enabled

See Also:
Constant Field Values

VALUE_CONFIG_PARAM_DOMAIN

public static final String VALUE_CONFIG_PARAM_DOMAIN
Configuration param name value for the standalone domain

See Also:
Constant Field Values

STARS

public static final String STARS
80 stars, for use in logger

See Also:
Constant Field Values
Constructor Detail

StandaloneServerManager

public StandaloneServerManager()
Method Detail

init

public void init(DirectoryServiceConfiguration dsCfg)
Initialise method that takes ApacheDS configuration.

Parameters:
dsCfg - Directory service configuration.

cleanup

public void cleanup()
             throws NamingException
Deinitialise and remove any active partitions in ApacheDS.

Throws:
NamingException

isStandaloneManagedDN

public boolean isStandaloneManagedDN(LdapDN dn)
Return whether a DN is managed by the standalone server manager.

Parameters:
dn - the dn to check.
Returns:
true if the DN is part of the standalone domain DIT.

getPartitionConnectorTypes

protected List<String> getPartitionConnectorTypes()
                                           throws NamingException
Internal method to get a list of connector types in the JDBM partition.

Returns:
list of connector type names.
Throws:
NamingException

searchConnectorConfig

public NamingEnumeration<SearchResult> searchConnectorConfig(LdapDN baseName,
                                                             Map<String,String> environment,
                                                             ExprNode filter,
                                                             SearchControls searchControls)
                                                      throws NamingException
Perform a search on the connector configuration partition.

Parameters:
baseName - the LDAP base name to use in the search.
environment - the LDAP environment.
filter - the filter to use in the search.
searchControls - the controls for the search. eg scope.
Returns:
the search results.
Throws:
NamingException

enableStandaloneMode

protected void enableStandaloneMode()
                             throws NamingException
Internal method to enable the standalone mode of the JCS.

Throws:
NamingException

disableStandaloneMode

protected void disableStandaloneMode()
                              throws NamingException
Internal method to disable the standalone mode of the JCS.

Throws:
NamingException

createCustomPartition

protected CustomJdbmPartition createCustomPartition(LdapDN suffix,
                                                    Attributes attrs,
                                                    DirectoryServiceConfiguration dsCfg)
                                             throws NamingException
Method to create a new custom JDBM partition and add it to ApacheDS.

Parameters:
suffix - the DN of the partition suffix.
attrs - the attributes of the root entry.
dsCfg - directory configuration.
Returns:
the new partition.
Throws:
NamingException

createConfigurationPartition

protected void createConfigurationPartition(DirectoryServiceConfiguration dsCfg)
                                     throws NamingException
Method to create a JDBM partition that provides read/write access to SA JCS configuration.

Parameters:
dsCfg - directory configuration.
Throws:
NamingException

createConnectorPartition

protected void createConnectorPartition(Rdn baseRdn,
                                        String domain,
                                        DirectoryServiceConfiguration dsCfg)
                                 throws NamingException
Method to create a JDBM partition that provides read/write access to connector configuration.

Parameters:
baseRdn - the domain component rdn to use for the partition.
domain - the name of the IMPS compatible domain.
dsCfg - directory configuration.
Throws:
NamingException

populateConnectorPartition

protected void populateConnectorPartition(String configBase)
                                   throws NamingException
Method to populate the JDBM partition with static and dynamic connector configurations.

Parameters:
configBase - the base DN of configuration information.
Throws:
NamingException

addConnectorTypeToConnectorPartition

protected void addConnectorTypeToConnectorPartition(String configBase,
                                                    String connTypeName,
                                                    ConnectorPersister.State connTypeState)
                                             throws NamingException
Method to add all configuration for a connector type to the connector configuration partition.

Parameters:
configBase - the base DN of configuration information.
connTypeName - the connector type name.
connTypeState - the connector type persisted state, or null.
Throws:
NamingException

isMetadataOutdated

protected boolean isMetadataOutdated(ImplBundle implBundle,
                                     ConnectorPersister.State connTypeState)
Check whether the metadata used in a persisted connector type state has become outdated from the connector.

Parameters:
implBundle - the ImplBundle for the connector type.
connTypeState - the connector type state.
Returns:
true if the metadata needs re-generation.

addEntryToConnectorPartition

protected void addEntryToConnectorPartition(LdapDN entryDn,
                                            ConnectorPersister.StateType type,
                                            Attributes attrs,
                                            Attributes obfuscatedAttrs)
                                     throws NamingException
Add an entry to the connector configuration partition.

Parameters:
entryDn - the DN of the new entry.
type - the type of entry.
attrs - the attributes to use for the new entry.
obfuscatedAttrs - the obfuscated attributes, or null.
Throws:
NamingException

removeEntryFromConnectorPartition

protected void removeEntryFromConnectorPartition(LdapDN entryDn)
                                          throws NamingException
Remove an entry from the JDBM partition, including any child nodes.

Parameters:
entryDn - the DN of the entry.
Throws:
NamingException

stateSaved

public void stateSaved(ConnectorPersister.State state)
ConnectorPersisterObserver callback method.

Specified by:
stateSaved in interface ConnectorPersisterObserver
Parameters:
state - the state that was saved.

stateDeleted

public void stateDeleted(ConnectorPersister.StateType type,
                         LdapDN stateName)
ConnectorPersisterObserver callback method.

Specified by:
stateDeleted in interface ConnectorPersisterObserver
Parameters:
type - the type of state entry deleted.
stateName - the name of the state deleted.

beforeModify

public void beforeModify(LdapDN name,
                         ModificationItem[] items)
                  throws NamingException
CustomJdbmPartition callback method made before a configuration entry is modified.

Specified by:
beforeModify in interface CustomJdbmPartitionObserver
Parameters:
name - the distinguished name of the entry to modify.
items - the ModificationItems used to affect the modification with
Throws:
NamingException - to be thrown if the modify should not occur.

persistStandaloneConfiguration

protected void persistStandaloneConfiguration()
                                       throws NamingException
Method to persist the current standalone configuration in the JCS properties override file.

Throws:
NamingException

isStandaloneMode

public boolean isStandaloneMode()
Returns:
the standaloneConfiguration

setStandaloneConfiguration

public void setStandaloneConfiguration(StandaloneServerConfiguration standaloneConfiguration)
Parameters:
standaloneConfiguration - the standaloneConfiguration to set

setConnectorManager

public void setConnectorManager(ConnectorManager connectorManager)
Parameters:
connectorManager - the connectorManager to set

setPropertyOverrideConfigurer

public void setPropertyOverrideConfigurer(ListAwarePropertyOverrideConfigurer propertyOverrideConfigurer)
                                   throws IOException
Parameters:
propertyOverrideConfigurer - the propertyOverrideConfigurer to set
Throws:
IOException


Created 2011-07-14 13:27 EST