com.ca.jcs
Class BaseConnector

java.lang.Object
  extended by org.apache.directory.server.core.partition.AbstractPartition
      extended by com.ca.jcs.BaseConnector
All Implemented Interfaces:
Activatable, CachingConnector, Connector, PartitionOps, OpProcessorStyleFactory, QuoteStringHandler, Partition
Direct Known Subclasses:
MetaConnector

public abstract class BaseConnector
extends AbstractPartition
implements PartitionOps, Connector, QuoteStringHandler

Represents an LDAP view onto an external remote managed endpoint system, whilst acting as an ApacheDS partition to which LDAP operations can be routed. Does its work by delegating LDAP requests to one of its processors (attribute-style, method-style or script-style) according to availability of implementation and metadata configuration.

Note that any checked or unchecked exceptions thrown by derived classes are caught and logged in PartitionLoaderService.


Field Summary
protected  List<String> acceptedUnknownAttrIds
           
protected  AttributeStyleOpProcessor attributeStyleOpProcessor
          Protected so that proxying done in set method can be skipped.
static String CONN_ACTIVATION_TIMEOUT
          Configures DefaultConnectorManager how many seconds to wait for an activation of an existing connector which is not yet activated.
static String CONN_DN
          If an attribute has a connectorMapTo= value matching this value in metadata and is named in the return attributes for a search, then its value will be set to the connector-speak DN relative to the managed system's root (ie ignoring any connectorBaseDn which may be configured) for each search result.
static String CONN_NAME
          Refer to CONN_DN, except allows for just the flat name rather then the connector-speak DN to be returned from a search.
static String CONN_NAME_ID
          Refer to CONN_NAME, allows any attribute mapped to this value to be set with the naming attribute like eTDYNNamingAttribute does when used with an ambiguous naming attribute, except this time it's unconditional and can always be used to look at the naming id.
static String CONN_PASS_THROUGH_SUFFIX
          Used when passing expensive to compute connector-speak values through filter expressions, to save re-evaluating them.
static int CONN_PASS_THROUGH_SUFFIX_LEN
           
static String CONN_ROLLBACK_CONNECTION_ATTRS
          Defines if ConnectorAttributesProcessor will rollback connection attributes after their unsuccessful modification, to go back to last working connection details for a given connector instance.
static String CONN_SKIP_PERSISTER_DELETE_ATTR
          Int attribute, which if present on Connector Type or Connector causes the persister to be skipped if set to "0" (or never deleted if "1") to allow testing of state saved by the persister.
static String CONN_SPEC
          Used to surround virtual attributes used as connectorMapTo values, which control and / or query JCS / connector behaviour rather than being sent on to the endpoint.
static String CONN_SPEC_INTERNAL
          Used to surround strings needing special treatment internally in JCS, these never pass out to the client of the JCS.
static int CONNECTOR_ATTR_INDEX
          Used to index array returned by splitConnectorPassThroughAttrId(String).
protected  Name connectorBaseDn
          Root DN in connector-speak, specifying root of subtree on endpoint system managed by this connector.
static LdapDN EMPTY_DN
          Empty DN signifying the connector's level in the DIT.
static int LDAP_ATTR_INDEX
          Used to index array returned by splitConnectorPassThroughAttrId(String).
static String LDAP_CONN_DN
          Special virtual LDAP attribute that can be presented to search() and lookup() and will return an object's connector DN.
protected  String ldapExceptionPrefix
           
protected  Logger log
           
static String SEARCH_RESULTS_STREAMING
          Allows optional configuration of streaming behaviour for a connector, where an attribute is mapped to it in metadata.
 
Fields inherited from interface com.ca.jcs.Connector
STATE_DELETING
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
BaseConnector()
           
BaseConnector(ConnectorType type, String name, Logger log)
           
BaseConnector(ConnectorType type, String name, Logger log, ConnectorConfig config)
           
 
Method Summary
 void activate()
          Activate connector, and hence allow it to start processing incoming LDAP requests.
 Name addConnectorBaseDN(Name name)
          Add base DN for this connector (in connector-speak) to provided name.
 String appQuoted(String str)
          Return str, ensuring it is quoted with quoteString if one has been configured.
 StringBuilder appQuoted(StringBuilder sb, String str)
          Appends str to sb, ensuring it is quoted with quoteString if one has been configured.
 void bind(LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId)
          Just stubs as connector does bind using stored credentials.
 String convertConnectorDNFromNativeName(String name)
          Some connectors like LND use a non-DN string syntax to represent their hierarchical names.
 String convertConnectorDNToNativeName(Name name)
          Some connectors like LND use a non-DN string syntax to represent their hierarchical names.
 ConnectionManager createConnectionManager()
          Create a connection manager, which is a concept expected to be supported by the vast majority of connectors.
 Name createConnectorDn(Name name)
          Create a concrete name matching name based on the value returned by isBehaviourStrictConnectorDns().
 Name createConnectorDn(String dnStr)
          Create a concrete name matching dnStr based on the value returned by isBehaviourStrictConnectorDns().
 MethodStyleOpProcessor createMethodStyleOpProcessor()
          Must be overridden by connectors that support the concept of method-style op processing, return null unless overridden.
 ObjectInfo createObjectInfo()
          Can be overridden by derived classes that need custom ObjectInfo implementations.
 ScriptStyleOpProcessor createScriptStyleOpProcessor()
          Must be overridden by connectors that support the concept of script-style op processing, return null unless overridden.
 TransactionManager createTransactionManager()
          Must be overridden by connectors that support the concept of a transaction manager, return null unless overridden.
 void deactivate()
          Deactivates this connector's connection manager if one exists.
protected  void doInit()
          Override this method to put your initialization code.
static String formatConnectorPassThroughAttrId(String ldapAttrId, String connAttrId)
          Used by concrete connector when resolving LDAP attributes with ambiguous connector mappings, to allow a chosen mapping to be explicitly chosen using specialised logic.
static String formatConnectorPassThroughValue(String value)
          Used by concrete connector when resolving LDAP attributes with ambiguous connector mappings, to allow a chosen mapping to be explicitly chosen using specialised logic.
 List<String> getAcceptedUnknownAttrIds()
           
 Attributes getAttributes()
           
 AttributeStyleOpProcessor getAttributeStyleOpProcessor()
          Allows for interposing opbindings proxy if needed - all concrete connector methods should consequently be called via it.
 AttributeTypeRegistry getAttributeTypeRegistry()
          Return the registry used by ApacheDS for this connector.
 HashSet<OpProcessor.MethodName> getAutoDirectAssocExlusions()
          Used by connectors for which isAutoDirectAssocRequired() returns true, where updates of associations after Delete / Rename or other operations are not required due to clean-up performed by the native system or because of special processing needs.
 CacheableStatus getCacheableStatus(ObjectInfo objInfo)
          Is the provided object potentially cacheable and if so, what should be cached?.
 CacheManager getCacheManager()
           
 ConnectionManager getConnectionManager()
           
 Name getConnectorBaseDn()
          Return base DN for this connector in connector-speak.
 ConnectorConfig getConnectorConfig()
          Return the configuration for this connector, usually initialized from /conf/connector.xml using Spring XML.
 Rdn getConnectorDnRdn(Name connDn, int i)
          Return the i-th Rdn from the provided connDn.
static String getConnectorPassThroughValue(String passThroughValue)
           
 String getLdapExceptionPrefix()
          Used by the framework and concrete connectors to distinguish exceptions orginating from within the JCS from those of the host container (ApacheDS).
 String getLdapNamingAttr()
          Return the LDAP naming attribute for this connector.
 String getLdapObjectClass()
          Return the LDAP object class matching this connector.
 Logger getLogger()
          Return the logger allocated by the JCS framework specifically for this connector instance.
 MethodStyleOpProcessor getMethodStyleOpProcessor()
           
 String getName()
          Return this connector's name.
 Partition getPartition()
          Get the ApacheDS partition associated with this connector.
static Attribute getPassThroughAttrIdToConnector(Attribute attr, String connAttrId)
           
 ScriptStyleOpProcessor getScriptStyleOpProcessor()
           
 int getStateFlags()
           
 LdapDN getStoredSuffix()
          Returns the DN matching this connector's suffix.
 TransactionManager getTransactionManager()
          Return transaction manager, which defaults to null but should be overridden by derived classes as appropriate.
 ConnectorType getType()
          Return the parent ConnectorType for this connector.
 LdapDN getUpSuffix()
           
 boolean isActivated()
          Returns true if the connector has been fully activated.
 boolean isAutoDirectAssocRequired()
          Defaults to isIndirectAssociations()==Boolean.FALSE.
 boolean isBehaviourCachingRequired()
          Does caching ever make sense for this connector's implementation (by default is false)?
 boolean isBehaviourSearchObjAsLookup()
          Behavioural method which should be overridden by derived classes if they want object-scope searches to be treated as lookup()s on the object referred to by the baseName.
 boolean isBehaviourSearchSingleClass()
          If a derived connector's implementational approach requires that it's OpProcessor.doSearch(com.ca.jcs.ObjectInfo, com.ca.jcs.filter.FilterInfo, java.util.Map, javax.naming.directory.SearchControls) method is called is only called for a single objectclass at a time, then they should override this method to return true.
 boolean isBehaviourStrictConnectorDns()
          Does this connector implementation require extra strictly conformant connector-speak DNs to be a) passed to it from the framework and b) passed back from it to the framework in search results (i.e.
 boolean isCachingActive()
          Returns true if caching was both requested and activated successfully.
 boolean isCachingPossible()
          Returns true if connector's configuration and coding permits caching.
 boolean isCachingRequired()
          Is LdapDN => {ConnectorDN, [objectclass]} caching required for this connector ?
 boolean isCheckObjectExistenceForDeletion()
          before deleting an object, is the check for its' existence necessary?
static boolean isConnectorPassThrough(String value)
          Return true if provided value should be passed through filter processing without further modification.
 boolean isHiddenLdapBaseDn()
           
 Boolean isIndirectAssociations()
           
 boolean isObjectClassRequired()
          True if connector need the "objectClass" attribute passed through to them when a) updating a child object or b) in search filters, otherwise false if this information is known contextually and this attribute should not be passed through.
 boolean isSuffix(LdapDN name)
          Returns true if the provided name matches the DN suffix for the Partition associated with this connector.
 NamingEnumeration<NameClassPair> list(LdapDN baseName)
          Must be defined due to requirements of the Partition interface, but is never called.
protected abstract  String[] mapAttributeIdsToConnector(Collection<MetaObjectClassMapping> classMaps, String[] ldapAttrIds, boolean singleObject)
          Map ldapAttrIds belonging to the LDAP object class matching objectInfo to their connector-speak equivalents, where the naming attribute is always forced to be present in the first position.
 String[] mapAttributeIdsToConnector(MetaObjectClassMapping classMap, String[] ldapAttrIds, boolean nullMeansAll)
          Helper method when only have a single classMap.
 void modifyAttributes(ModificationItem[] items)
          Apply modification items to the set of attributes currently recorded for this connector.
 boolean noQuote(String str)
          Returns true if either no quoteString has been configured for this connector, or if the provided str doesn't start and end with the configured quoteString.
protected  void passThroughAttrIdToConnector(Attributes attrs, String ldapAttrId, String connAttrId)
           
 void postProcessLdapSearchResult(Name connDn, MetaObjectClassMapping classMap, Set<String> requestedConnAttrIds, Attributes connAttrs, SearchResult sr)
          Plug-in point for connectors that must customize search result representation after DN and attributes have been fully mapped to LDAP, for instance to handle of connector-specific DN manipulation such as that required to handle "Unique OU" for LND connector.
protected  Name removeConnectorBaseDN(Name name)
          Remove base DN for this connector (in connector-speak) from provided name, if it is present.
 void setAcceptedUnknownAttrIds(List<String> acceptedUnknownAttrIds)
          When ConnectorConfig.isFailOnUnknownAttrIds() is true then this list can be used to define global attribute ids which aren't mapped, but shouldn't cause an add() or modify() operation to fail when they are mentioned (individual connector configs can add their own ones too if they wish).
 void setActivated(boolean activated)
           
 void setAttributes(Attributes attrs)
          Store the provided connector-speak attributes on this connector instance.
 void setAttributeStyleOpProcessor(AttributeStyleOpProcessor proc)
           
 void setCacheManager(CacheManager cacheManager)
           
 void setCachingRequired(boolean cachingRequired)
          Set cachingRequired, unless trying to activate it and connector and / or connector's configuration disallow it in which case cachingRequired is set to false.
 void setConnectionManager(ConnectionManager mgr)
           
 void setConnectorBaseDn(Name connectorBaseDn)
           
 void setConnectorConfig(ConnectorConfig cfg)
           
 void setLdapNamingAttr(String ldapNamingAttr)
           
 void setLdapObjectClass(String ldapObjectClass)
           
 void setLogger(Logger log)
           
 void setMethodStyleOpProcessor(MethodStyleOpProcessor proc)
          Should be called by connectors that implement operation bindings, eg JDBC stored procedures.
 void setName(String name)
           
 void setQuoteString(String quoteString)
          Return string needed to quote strings output to the endpoint system, defaults to null but can be overridden by derived connectors or set using MetaDataDefs.MD_QUOTE_STRING.
 void setScriptStyleOpProcessor(ScriptStyleOpProcessor proc)
           
 void setStateFlags(int stateFlags)
          Refer to STATE_* constants which can be ORed together, for instance Connector.STATE_DELETING.
 void setStoredSuffix(LdapDN storedSuffix)
           
 void setTransactionManager(TransactionManager mgr)
           
 void setType(ConnectorType type)
           
static String[] splitConnectorPassThroughAttrId(String ldapAttrId)
           
 String toString()
          Returns a string of the form "class:name [suffix]".
 void unbind(LdapDN bindDn)
          Just stubs as connector does bind using stored credentials.
static LdapDN upName(LdapDN name)
          Returns the human friendly equiavlent to the provided name (any OIDs are replaced with textual attribute names).
 
Methods inherited from class org.apache.directory.server.core.partition.AbstractPartition
destroy, doDestroy, getConfiguration, getFactoryConfiguration, getSuffix, hasEntry, init, isInitialized, lookup, modify, move, move, sync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ca.jcs.PartitionOps
add, delete, lookup, lookup, modify, modify, modifyRn, move, move, search, sync
 
Methods inherited from interface com.ca.jcs.Connector
convertAttributesFromConnector, convertDNFromConnector, convertDNToConnector, convertDNToConnector
 
Methods inherited from interface org.apache.directory.server.core.partition.Partition
add, delete, destroy, getSuffix, hasEntry, init, isInitialized, lookup, lookup, modify, modify, modifyRn, move, move, search, sync
 
Methods inherited from interface com.ca.jcs.processor.OpProcessorStyleFactory
createAttributeStyleOpProcessor
 

Field Detail

log

protected Logger log

acceptedUnknownAttrIds

protected List<String> acceptedUnknownAttrIds

attributeStyleOpProcessor

protected AttributeStyleOpProcessor attributeStyleOpProcessor
Protected so that proxying done in set method can be skipped.


connectorBaseDn

protected Name connectorBaseDn
Root DN in connector-speak, specifying root of subtree on endpoint system managed by this connector.


ldapExceptionPrefix

protected final String ldapExceptionPrefix

CONN_SPEC

public static final String CONN_SPEC
Used to surround virtual attributes used as connectorMapTo values, which control and / or query JCS / connector behaviour rather than being sent on to the endpoint.

See Also:
Constant Field Values

CONN_SPEC_INTERNAL

public static final String CONN_SPEC_INTERNAL
Used to surround strings needing special treatment internally in JCS, these never pass out to the client of the JCS.

See Also:
Constant Field Values

CONN_DN

public static final String CONN_DN
If an attribute has a connectorMapTo= value matching this value in metadata and is named in the return attributes for a search, then its value will be set to the connector-speak DN relative to the managed system's root (ie ignoring any connectorBaseDn which may be configured) for each search result.

See Also:
Constant Field Values

CONN_NAME

public static final String CONN_NAME
Refer to CONN_DN, except allows for just the flat name rather then the connector-speak DN to be returned from a search.

See Also:
Constant Field Values

CONN_NAME_ID

public static final String CONN_NAME_ID
Refer to CONN_NAME, allows any attribute mapped to this value to be set with the naming attribute like eTDYNNamingAttribute does when used with an ambiguous naming attribute, except this time it's unconditional and can always be used to look at the naming id.

See Also:
Constant Field Values

CONN_ROLLBACK_CONNECTION_ATTRS

public static final String CONN_ROLLBACK_CONNECTION_ATTRS
Defines if ConnectorAttributesProcessor will rollback connection attributes after their unsuccessful modification, to go back to last working connection details for a given connector instance.

See Also:
Constant Field Values

SEARCH_RESULTS_STREAMING

public static final String SEARCH_RESULTS_STREAMING
Allows optional configuration of streaming behaviour for a connector, where an attribute is mapped to it in metadata.

See Also:
Constant Field Values

CONN_SKIP_PERSISTER_DELETE_ATTR

public static final String CONN_SKIP_PERSISTER_DELETE_ATTR
Int attribute, which if present on Connector Type or Connector causes the persister to be skipped if set to "0" (or never deleted if "1") to allow testing of state saved by the persister.

See Also:
Constant Field Values

CONN_ACTIVATION_TIMEOUT

public static final String CONN_ACTIVATION_TIMEOUT
Configures DefaultConnectorManager how many seconds to wait for an activation of an existing connector which is not yet activated.

See Also:
Constant Field Values

LDAP_CONN_DN

public static final String LDAP_CONN_DN
Special virtual LDAP attribute that can be presented to search() and lookup() and will return an object's connector DN. Need a special attribute so that framework can retrieve this value regardless of metadata mappings (which are free to have their own client-visible LDAP attribute ids mapping to "dn").

See Also:
Constant Field Values

CONN_PASS_THROUGH_SUFFIX

public static final String CONN_PASS_THROUGH_SUFFIX
Used when passing expensive to compute connector-speak values through filter expressions, to save re-evaluating them.

See Also:
Constant Field Values

CONN_PASS_THROUGH_SUFFIX_LEN

public static final int CONN_PASS_THROUGH_SUFFIX_LEN

LDAP_ATTR_INDEX

public static final int LDAP_ATTR_INDEX
Used to index array returned by splitConnectorPassThroughAttrId(String).

See Also:
Constant Field Values

CONNECTOR_ATTR_INDEX

public static final int CONNECTOR_ATTR_INDEX
Used to index array returned by splitConnectorPassThroughAttrId(String).

See Also:
Constant Field Values

EMPTY_DN

public static final LdapDN EMPTY_DN
Empty DN signifying the connector's level in the DIT.

Constructor Detail

BaseConnector

public BaseConnector()

BaseConnector

public BaseConnector(ConnectorType type,
                     String name,
                     Logger log)

BaseConnector

public BaseConnector(ConnectorType type,
                     String name,
                     Logger log,
                     ConnectorConfig config)
Method Detail

createObjectInfo

public ObjectInfo createObjectInfo()
Can be overridden by derived classes that need custom ObjectInfo implementations.

Specified by:
createObjectInfo in interface Connector

convertConnectorDNToNativeName

public String convertConnectorDNToNativeName(Name name)
Some connectors like LND use a non-DN string syntax to represent their hierarchical names. Unless overridden returns name.toString(). Also see ObjectInfo.getConnectorNativeName().


convertConnectorDNFromNativeName

public String convertConnectorDNFromNativeName(String name)
Some connectors like LND use a non-DN string syntax to represent their hierarchical names. Unless overridden just returns name but otherwise may make use of domain knowledge to construct a valid connector-speak handle using DN syntax. Also see ObjectInfo.getConnectorNativeName().


getLdapExceptionPrefix

public String getLdapExceptionPrefix()
Description copied from interface: Connector
Used by the framework and concrete connectors to distinguish exceptions orginating from within the JCS from those of the host container (ApacheDS).

Specified by:
getLdapExceptionPrefix in interface Connector

getCacheManager

public CacheManager getCacheManager()
Specified by:
getCacheManager in interface CachingConnector

setCacheManager

public void setCacheManager(CacheManager cacheManager)
Specified by:
setCacheManager in interface CachingConnector

getCacheableStatus

public CacheableStatus getCacheableStatus(ObjectInfo objInfo)
Is the provided object potentially cacheable and if so, what should be cached?.

Specified by:
getCacheableStatus in interface CachingConnector

isBehaviourStrictConnectorDns

public boolean isBehaviourStrictConnectorDns()
Does this connector implementation require extra strictly conformant connector-speak DNs to be a) passed to it from the framework and b) passed back from it to the framework in search results (i.e. DNs conform to RFC 2253 so that LdapName can be used. Defaults to false so that connector-speak naming attributes can have characters like underscore etc in them in which case SimpleLdapName is used.

Returns:
False unless overridden by derived class.

createConnectorDn

public Name createConnectorDn(String dnStr)
                       throws InvalidNameException
Create a concrete name matching dnStr based on the value returned by isBehaviourStrictConnectorDns(). If true then an LdapName is returned, otherwise a SimpleLdapName is returned.

Throws:
InvalidNameException

createConnectorDn

public Name createConnectorDn(Name name)
                       throws InvalidNameException
Create a concrete name matching name based on the value returned by isBehaviourStrictConnectorDns(). If true then an LdapName is returned, otherwise a SimpleLdapName is returned.

Throws:
InvalidNameException

getConnectorDnRdn

public Rdn getConnectorDnRdn(Name connDn,
                             int i)
                      throws InvalidNameException
Return the i-th Rdn from the provided connDn.

Throws:
InvalidNameException

isBehaviourCachingRequired

public boolean isBehaviourCachingRequired()
Does caching ever make sense for this connector's implementation (by default is false)?


isCheckObjectExistenceForDeletion

public boolean isCheckObjectExistenceForDeletion()
before deleting an object, is the check for its' existence necessary?


isCachingRequired

public boolean isCachingRequired()
Is LdapDN => {ConnectorDN, [objectclass]} caching required for this connector ?

Specified by:
isCachingRequired in interface CachingConnector

setCachingRequired

public void setCachingRequired(boolean cachingRequired)
Set cachingRequired, unless trying to activate it and connector and / or connector's configuration disallow it in which case cachingRequired is set to false.

Specified by:
setCachingRequired in interface CachingConnector
Parameters:
cachingRequired - Desired state for caching.

isCachingPossible

public boolean isCachingPossible()
Returns true if connector's configuration and coding permits caching.


isCachingActive

public boolean isCachingActive()
Returns true if caching was both requested and activated successfully.

Specified by:
isCachingActive in interface CachingConnector

doInit

protected void doInit()
               throws NamingException
Override this method to put your initialization code.

Overrides:
doInit in class AbstractPartition
Throws:
NamingException

getAttributeTypeRegistry

public AttributeTypeRegistry getAttributeTypeRegistry()
Return the registry used by ApacheDS for this connector.


isSuffix

public boolean isSuffix(LdapDN name)
                 throws NamingException
Returns true if the provided name matches the DN suffix for the Partition associated with this connector. LDAP requests referencing this suffix or DNs below this suffix will be routed to this connector for processing.

Specified by:
isSuffix in interface Partition
Overrides:
isSuffix in class AbstractPartition
Throws:
NamingException

upName

public static LdapDN upName(LdapDN name)
                     throws InvalidNameException
Returns the human friendly equiavlent to the provided name (any OIDs are replaced with textual attribute names).

Throws:
InvalidNameException

getLogger

public Logger getLogger()
Return the logger allocated by the JCS framework specifically for this connector instance.

Specified by:
getLogger in interface Connector

setLogger

public void setLogger(Logger log)

getConnectorConfig

public ConnectorConfig getConnectorConfig()
Return the configuration for this connector, usually initialized from /conf/connector.xml using Spring XML.

Specified by:
getConnectorConfig in interface Connector

setConnectorConfig

public void setConnectorConfig(ConnectorConfig cfg)
Specified by:
setConnectorConfig in interface Connector

getAcceptedUnknownAttrIds

public List<String> getAcceptedUnknownAttrIds()

setAcceptedUnknownAttrIds

public void setAcceptedUnknownAttrIds(List<String> acceptedUnknownAttrIds)
When ConnectorConfig.isFailOnUnknownAttrIds() is true then this list can be used to define global attribute ids which aren't mapped, but shouldn't cause an add() or modify() operation to fail when they are mentioned (individual connector configs can add their own ones too if they wish).

Parameters:
acceptedUnknownAttrIds - List of legal, but never-the-less unmapped, LDAP attribute ids.

getAttributes

public Attributes getAttributes()
Specified by:
getAttributes in interface Connector

setAttributes

public void setAttributes(Attributes attrs)
                   throws NamingException
Store the provided connector-speak attributes on this connector instance.

Specified by:
setAttributes in interface Connector
Parameters:
attrs - Attributes passed to add() or
Throws:
NamingException

modifyAttributes

public void modifyAttributes(ModificationItem[] items)
                      throws NamingException
Apply modification items to the set of attributes currently recorded for this connector.

Specified by:
modifyAttributes in interface Connector
Throws:
NamingException

getName

public String getName()
Return this connector's name.

Specified by:
getName in interface Connector

setName

public void setName(String name)
Specified by:
setName in interface Connector

getType

public ConnectorType getType()
Return the parent ConnectorType for this connector.

Specified by:
getType in interface Connector

setType

public void setType(ConnectorType type)
Specified by:
setType in interface Connector

isActivated

public boolean isActivated()
Returns true if the connector has been fully activated.

Specified by:
isActivated in interface Connector

setActivated

public void setActivated(boolean activated)

getStateFlags

public int getStateFlags()
Specified by:
getStateFlags in interface Connector

setStateFlags

public void setStateFlags(int stateFlags)
Refer to STATE_* constants which can be ORed together, for instance Connector.STATE_DELETING.

Specified by:
setStateFlags in interface Connector

activate

public void activate()
              throws NamingException
Activate connector, and hence allow it to start processing incoming LDAP requests. This involves:
  1. checking all attributes provided are valid (all must have at least one value and be of type String or byte[].
  2. creating and registering the connection manager for this connector implementation.
  3. reading a connector base DN (distinguished name) which is optionally configured via the values of the attribute mapped to MetaConnector.CONN_BASE_DN_ATTR, which will be prepended to every connector DN before looking up the managed directory, and hence provides a restricted view onto a potentially larger managed directory. Note the actual activated field is managed by ConnectorAttributesProcessor so that the entire stack of activate() calls at all levels of derivation complete execution before the connector is considered "activated".
  4. testing the connection manager configuration by borrowing and returning a connection, unless isLazyConnect() returns false.

Specified by:
activate in interface Activatable
Specified by:
activate in interface Connector
Throws:
NamingException

deactivate

public void deactivate()
                throws NamingException
Deactivates this connector's connection manager if one exists.

Specified by:
deactivate in interface Activatable
Specified by:
deactivate in interface Connector
Throws:
NamingException

getTransactionManager

public TransactionManager getTransactionManager()
Return transaction manager, which defaults to null but should be overridden by derived classes as appropriate.

Specified by:
getTransactionManager in interface Connector
Returns:
Transaction manager, or null if none.
See Also:
NullTransactionManager

setTransactionManager

public void setTransactionManager(TransactionManager mgr)
Specified by:
setTransactionManager in interface Connector

setQuoteString

public void setQuoteString(String quoteString)
Return string needed to quote strings output to the endpoint system, defaults to null but can be overridden by derived connectors or set using MetaDataDefs.MD_QUOTE_STRING.

Specified by:
setQuoteString in interface QuoteStringHandler

noQuote

public boolean noQuote(String str)
Returns true if either no quoteString has been configured for this connector, or if the provided str doesn't start and end with the configured quoteString.


appQuoted

public StringBuilder appQuoted(StringBuilder sb,
                               String str)
Appends str to sb, ensuring it is quoted with quoteString if one has been configured.

Specified by:
appQuoted in interface QuoteStringHandler

appQuoted

public String appQuoted(String str)
Return str, ensuring it is quoted with quoteString if one has been configured.

Specified by:
appQuoted in interface QuoteStringHandler

getLdapObjectClass

public String getLdapObjectClass()
Return the LDAP object class matching this connector.

Specified by:
getLdapObjectClass in interface Connector

setLdapObjectClass

public void setLdapObjectClass(String ldapObjectClass)
Specified by:
setLdapObjectClass in interface Connector

getLdapNamingAttr

public String getLdapNamingAttr()
Return the LDAP naming attribute for this connector.

Specified by:
getLdapNamingAttr in interface Connector

setLdapNamingAttr

public void setLdapNamingAttr(String ldapNamingAttr)
Specified by:
setLdapNamingAttr in interface Connector

getPartition

public Partition getPartition()
Get the ApacheDS partition associated with this connector.

Specified by:
getPartition in interface Connector

getStoredSuffix

public LdapDN getStoredSuffix()
Returns the DN matching this connector's suffix.

Specified by:
getStoredSuffix in interface Connector

setStoredSuffix

public void setStoredSuffix(LdapDN storedSuffix)
Specified by:
setStoredSuffix in interface Connector

toString

public String toString()
Returns a string of the form "class:name [suffix]".

Overrides:
toString in class Object

list

public NamingEnumeration<NameClassPair> list(LdapDN baseName)
                                      throws NamingException
Must be defined due to requirements of the Partition interface, but is never called.

Specified by:
list in interface Partition
Throws:
NamingException

mapAttributeIdsToConnector

protected abstract String[] mapAttributeIdsToConnector(Collection<MetaObjectClassMapping> classMaps,
                                                       String[] ldapAttrIds,
                                                       boolean singleObject)
Map ldapAttrIds belonging to the LDAP object class matching objectInfo to their connector-speak equivalents, where the naming attribute is always forced to be present in the first position.

Parameters:
classMaps - List of MetaObjectClassMappings for all objectclasses that may be returned by a query.
ldapAttrIds - Ldap attributes ids requested by the client.
singleObject - Is only a single query result expected, in which case a null ldapAttrIds list is interpreted as meaning "all attributes". If false a null ldapAttrIds list is interpreted as meaning "all cheap attributes".
Returns:
ldapAttrIds mapped to connector speak, where the special attribute CONN_DN will be deleted if it is mapped to.

mapAttributeIdsToConnector

public String[] mapAttributeIdsToConnector(MetaObjectClassMapping classMap,
                                           String[] ldapAttrIds,
                                           boolean nullMeansAll)
Helper method when only have a single classMap.

See Also:
mapAttributeIdsToConnector(java.util.Collection, String[], boolean)

postProcessLdapSearchResult

public void postProcessLdapSearchResult(Name connDn,
                                        MetaObjectClassMapping classMap,
                                        Set<String> requestedConnAttrIds,
                                        Attributes connAttrs,
                                        SearchResult sr)
                                 throws NamingException
Plug-in point for connectors that must customize search result representation after DN and attributes have been fully mapped to LDAP, for instance to handle of connector-specific DN manipulation such as that required to handle "Unique OU" for LND connector. Is an empty stub unless it is overridden.

Specified by:
postProcessLdapSearchResult in interface Connector
Parameters:
connDn - Connector-speak DN for target object whose attributes have been converted to LDAP in sr.
classMap - Information about the class for the target object.
requestedConnAttrIds - Set containing all attribute names requested by the client, attribute names will have the exact case as specified for their connectorMapTo values in the metadata.
connAttrs - Original connector-speak attributes prior to being converted to LDAP and placed in sr.
sr - Search result, with LDAP DN and LDAP-speak attributes.
Throws:
NamingException

getAttributeStyleOpProcessor

public AttributeStyleOpProcessor getAttributeStyleOpProcessor()
Allows for interposing opbindings proxy if needed - all concrete connector methods should consequently be called via it.

Specified by:
getAttributeStyleOpProcessor in interface Connector

setAttributeStyleOpProcessor

public void setAttributeStyleOpProcessor(AttributeStyleOpProcessor proc)
Specified by:
setAttributeStyleOpProcessor in interface Connector

getMethodStyleOpProcessor

public MethodStyleOpProcessor getMethodStyleOpProcessor()
Specified by:
getMethodStyleOpProcessor in interface Connector

setMethodStyleOpProcessor

public void setMethodStyleOpProcessor(MethodStyleOpProcessor proc)
Should be called by connectors that implement operation bindings, eg JDBC stored procedures.

Specified by:
setMethodStyleOpProcessor in interface Connector
Parameters:
proc - Processor to be called after guard conditions have been checked against an operation to determine relevance.

getScriptStyleOpProcessor

public ScriptStyleOpProcessor getScriptStyleOpProcessor()
Specified by:
getScriptStyleOpProcessor in interface Connector

setScriptStyleOpProcessor

public void setScriptStyleOpProcessor(ScriptStyleOpProcessor proc)
Specified by:
setScriptStyleOpProcessor in interface Connector

createConnectionManager

public ConnectionManager createConnectionManager()
                                          throws NamingException
Create a connection manager, which is a concept expected to be supported by the vast majority of connectors. Some exceptional cases like JDBC in which many APIs take a DataSource (like a connection manager / pool itself) rather then a connection may throw a LdapOperationNotSupportedException exception when called.

Note that this method is defined to make the contract explicit for connector developers and for internal use with in the connector and its op processors, rather then to be called by components external to the connector. Default 'base' implementation below uses 'connectionManagerClass' spring property from connector.xml to locate the nominated connection manager (pooling) class and load/instantiate it for subsequent use. Specific connector implementations can override this and perform their own connection manager creation.

Specified by:
createConnectionManager in interface Connector
Returns:
Connection manager instance.
Throws:
NamingException

getConnectionManager

public ConnectionManager getConnectionManager()
Specified by:
getConnectionManager in interface Connector

setConnectionManager

public void setConnectionManager(ConnectionManager mgr)
Specified by:
setConnectionManager in interface Connector

createTransactionManager

public TransactionManager createTransactionManager()
Must be overridden by connectors that support the concept of a transaction manager, return null unless overridden.

Specified by:
createTransactionManager in interface Connector

createMethodStyleOpProcessor

public MethodStyleOpProcessor createMethodStyleOpProcessor()
Must be overridden by connectors that support the concept of method-style op processing, return null unless overridden.

Specified by:
createMethodStyleOpProcessor in interface OpProcessorStyleFactory

createScriptStyleOpProcessor

public ScriptStyleOpProcessor createScriptStyleOpProcessor()
Must be overridden by connectors that support the concept of script-style op processing, return null unless overridden.

Specified by:
createScriptStyleOpProcessor in interface OpProcessorStyleFactory

getUpSuffix

public LdapDN getUpSuffix()
                   throws NamingException
Specified by:
getUpSuffix in interface Partition
Throws:
NamingException

bind

public void bind(LdapDN bindDn,
                 byte[] credentials,
                 List mechanisms,
                 String saslAuthId)
          throws NamingException
Just stubs as connector does bind using stored credentials.

Specified by:
bind in interface Partition
Throws:
NamingException

unbind

public void unbind(LdapDN bindDn)
            throws NamingException
Just stubs as connector does bind using stored credentials.

Specified by:
unbind in interface Partition
Throws:
NamingException

isBehaviourSearchObjAsLookup

public boolean isBehaviourSearchObjAsLookup()
Behavioural method which should be overridden by derived classes if they want object-scope searches to be treated as lookup()s on the object referred to by the baseName.

Returns:
True if object-scope searches are to be implemented as lookups, false (the default) otherwise.

isBehaviourSearchSingleClass

public boolean isBehaviourSearchSingleClass()
If a derived connector's implementational approach requires that it's OpProcessor.doSearch(com.ca.jcs.ObjectInfo, com.ca.jcs.filter.FilterInfo, java.util.Map, javax.naming.directory.SearchControls) method is called is only called for a single objectclass at a time, then they should override this method to return true. This will cause the framework, for example, to decompose a subtree search with a filter like (objectclass=*) into a separate doSearch() call for each defined objectclass.


isObjectClassRequired

public boolean isObjectClassRequired()
True if connector need the "objectClass" attribute passed through to them when a) updating a child object or b) in search filters, otherwise false if this information is known contextually and this attribute should not be passed through. Unless overridden returns !isBehaviourSearchSingleClass().


isHiddenLdapBaseDn

public boolean isHiddenLdapBaseDn()
Returns:
True if the LDAP equivalent to the value contained in the attribute attribute mapped to MetaConnector.CONN_BASE_DN_ATTR should be hidden in DNs (distinguished names) returned by the managed system, and not expected to be present in LDAP DNs passed in. By default it is false so that LDAP DNs can be persistently stored and then later used against the same managed system, even if a different connector base DN is used to access it.

isIndirectAssociations

public Boolean isIndirectAssociations()
Returns:
Null if no special checks are required on associative attributes, otherwise derived connectors should return:
  1. Boolean.TRUE if only indirect associations are allowed
  2. Boolean.FALSE if only direct associations are allowed
  3. NULL if a mixture of both is allowed, as dictated by the metadata
      See Also:
      Association

isAutoDirectAssocRequired

public boolean isAutoDirectAssocRequired()
Defaults to isIndirectAssociations()==Boolean.FALSE. Derived connectors for which this condition is true, but which want to handle reverse virtual associations directly rather then relying on generic logic in AssocAttributeOpProcessorProxy should override to return false.

Returns:
True if reverse virtual attributes for direct associations should be handled generically by AssocAttributeOpProcessorProxy.
See Also:
getAutoDirectAssocExlusions()

getAutoDirectAssocExlusions

public HashSet<OpProcessor.MethodName> getAutoDirectAssocExlusions()
Used by connectors for which isAutoDirectAssocRequired() returns true, where updates of associations after Delete / Rename or other operations are not required due to clean-up performed by the native system or because of special processing needs. When exclusions are put into effect due to this method's return value, the concrete connector itself needs to take over responsibility for any splitting and processing of association values required. Some example exclusions are the AS4 endpoint which looks after the membership association itself when accounts or groups are deleted, as does the LND endpoint which cleans up natively after deletes and renames (the latter of which take an unknowable amount of time to be approved).

Returns:
Map of operation method names for which auto association handling should not be activated, or null if there are no such exclusions. Defaults to null unless overridden in derived classes.
See Also:
isAutoDirectAssocRequired()

getConnectorBaseDn

public Name getConnectorBaseDn()
Return base DN for this connector in connector-speak.


setConnectorBaseDn

public void setConnectorBaseDn(Name connectorBaseDn)
                        throws InvalidNameException
Throws:
InvalidNameException

addConnectorBaseDN

public Name addConnectorBaseDN(Name name)
                        throws NamingException
Add base DN for this connector (in connector-speak) to provided name.

Throws:
NamingException

removeConnectorBaseDN

protected Name removeConnectorBaseDN(Name name)
                              throws NamingException
Remove base DN for this connector (in connector-speak) from provided name, if it is present.

Throws:
NamingException

isConnectorPassThrough

public static boolean isConnectorPassThrough(String value)
Return true if provided value should be passed through filter processing without further modification.


formatConnectorPassThroughAttrId

public static String formatConnectorPassThroughAttrId(String ldapAttrId,
                                                      String connAttrId)
Used by concrete connector when resolving LDAP attributes with ambiguous connector mappings, to allow a chosen mapping to be explicitly chosen using specialised logic.


formatConnectorPassThroughValue

public static String formatConnectorPassThroughValue(String value)
Used by concrete connector when resolving LDAP attributes with ambiguous connector mappings, to allow a chosen mapping to be explicitly chosen using specialised logic.


getConnectorPassThroughValue

public static String getConnectorPassThroughValue(String passThroughValue)

splitConnectorPassThroughAttrId

public static String[] splitConnectorPassThroughAttrId(String ldapAttrId)

getPassThroughAttrIdToConnector

public static Attribute getPassThroughAttrIdToConnector(Attribute attr,
                                                        String connAttrId)

passThroughAttrIdToConnector

protected void passThroughAttrIdToConnector(Attributes attrs,
                                            String ldapAttrId,
                                            String connAttrId)


Created 2011-07-14 13:27 EST