com.ca.jcs
Class PartitionLoaderService

java.lang.Object
  extended by org.apache.directory.server.core.interceptor.BaseInterceptor
      extended by com.ca.jcs.PartitionLoaderService
All Implemented Interfaces:
Interceptor

public class PartitionLoaderService
extends BaseInterceptor

A service that handles automatically lazy-loading/registering partitions based on sniffing DNs and delegating where necessary to the configured ConnectorManager. It also provides a logging point guaranteeing that any exceptions (caught or otherwise) are logged.

There are three levels of containment:

  1. Classes sharing a common partition implementation class. This relationship is not represented in the DIT.
  2. Shared metadata configuration file known as ConnectorType (aka ETA Namespace).
  3. Actual partition known as Connector (aka ETA directory and ApacheDS Partition).
There are two classifications of metadata which require their own type of handling:
  1. Connection related mappings. Attributes configuring connection information are actually stored on the ETA directory (partition level) but for complicated cases may encompass custom fields which are mapped to values by the connection mapping section in the ETA Namespace's metadata. Dealing with connection mapping changes will require careful thought once it is supported in the XPress GUI, as it won't be possible to change the metadata and all affected connectors atomically. There will most probably need to be a restriction placed on changing metadata for Namespaces which have child directories; namely that only new fields can be mapped to, rather then existing mappings changed to point to new fields.
  2. Non-connection related mappings - such as mappings from LDAP attribute names to names to be used on the remote system managed by a connector.

Note that this class is carefully wraps all calls it makes in try / catch blocks to ensure that any exceptions can be robustly tied to their originating LDAP request. Where these exceptions implement LdapException and valid LDAP result codes are known, it is sanity checked by against the per-operation sets defined in this class (where these sets are extensions of the allowable codes defined in ResultCodeEnum).


Field Summary
static String DEFAULT_BUNDLE
           
static ResultCodeEnum IMPS_PARTIAL_SUCCESS
          IM Provisioning Server treats this as meaning "partial success - re-read to see what happened" for ADD, MODIFY and DELETE requests.
static Map<String,Set<ResultCodeEnum>> OP_TO_RESULT_CODE_MAP
           
 
Constructor Summary
PartitionLoaderService()
           
 
Method Summary
 void add(NextInterceptor nextInterceptor, LdapDN name, Attributes attrs)
           
protected  boolean checkForPasswordChange(NextInterceptor nextInterceptor, LdapDN name, ModificationItem[] items)
           
 void delete(NextInterceptor nextInterceptor, LdapDN name)
           
 void destroy()
           
 ConnectorManager getConnectorManager()
           
 String getDnConnectorTypeKeyAttribute()
           
 String getDnManagedSuffix()
           
 String getInstalledConnectorsDn()
           
 Set<PasswordChangeObserver> getPasswordObservers()
           
 void init(DirectoryServiceConfiguration dsCfg, InterceptorConfiguration cfg)
           
 NamingEnumeration<NameClassPair> list(NextInterceptor nextInterceptor, LdapDN base)
           
 Attributes lookup(NextInterceptor nextInterceptor, LdapDN name)
           
 Attributes lookup(NextInterceptor nextInterceptor, LdapDN name, String[] attrIds)
           
 void modify(NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs)
          Modifies on unregistered Connector Types (Namespaces) and Connectors (directories) will results in previously persisted values being used for any attributes which are not provided to the modify() call.
 void modify(NextInterceptor nextInterceptor, LdapDN name, ModificationItem[] items)
           
 void modifyRn(NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean deleteOldRn)
           
 void move(NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName)
           
 void move(NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName, String newRn, boolean deleteOldRn)
           
 NamingEnumeration<SearchResult> search(NextInterceptor nextInterceptor, LdapDN baseName, Map env, ExprNode filter, SearchControls searchCtls)
           
 void setConnectorManager(ConnectorManager connectorManager)
           
 void setDnConnectorTypeKeyAttribute(String attrName)
           
 void setDnManagedSuffix(String suff)
           
 void setInstalledConnectorsDn(String installedConnectorsDn)
           
 void setStandaloneManager(StandaloneServerManager standaloneManager)
           
 
Methods inherited from class org.apache.directory.server.core.interceptor.BaseInterceptor
addContextPartition, bind, compare, getContext, getMatchedName, getPrincipal, getRootDSE, getSuffix, hasEntry, isSuffix, listSuffixes, removeContextPartition, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPS_PARTIAL_SUCCESS

public static final ResultCodeEnum IMPS_PARTIAL_SUCCESS
IM Provisioning Server treats this as meaning "partial success - re-read to see what happened" for ADD, MODIFY and DELETE requests.


DEFAULT_BUNDLE

public static final String DEFAULT_BUNDLE
See Also:
Constant Field Values

OP_TO_RESULT_CODE_MAP

public static final Map<String,Set<ResultCodeEnum>> OP_TO_RESULT_CODE_MAP
Constructor Detail

PartitionLoaderService

public PartitionLoaderService()
Method Detail

getInstalledConnectorsDn

public String getInstalledConnectorsDn()

setInstalledConnectorsDn

public void setInstalledConnectorsDn(String installedConnectorsDn)

getConnectorManager

public ConnectorManager getConnectorManager()

setConnectorManager

public void setConnectorManager(ConnectorManager connectorManager)

getDnManagedSuffix

public String getDnManagedSuffix()

setDnManagedSuffix

public void setDnManagedSuffix(String suff)

getDnConnectorTypeKeyAttribute

public String getDnConnectorTypeKeyAttribute()

setDnConnectorTypeKeyAttribute

public void setDnConnectorTypeKeyAttribute(String attrName)

init

public void init(DirectoryServiceConfiguration dsCfg,
                 InterceptorConfiguration cfg)
          throws NamingException
Specified by:
init in interface Interceptor
Overrides:
init in class BaseInterceptor
Throws:
NamingException

destroy

public void destroy()
Specified by:
destroy in interface Interceptor
Overrides:
destroy in class BaseInterceptor

add

public void add(NextInterceptor nextInterceptor,
                LdapDN name,
                Attributes attrs)
         throws NamingException
Specified by:
add in interface Interceptor
Overrides:
add in class BaseInterceptor
Throws:
NamingException

delete

public void delete(NextInterceptor nextInterceptor,
                   LdapDN name)
            throws NamingException
Specified by:
delete in interface Interceptor
Overrides:
delete in class BaseInterceptor
Throws:
NamingException

modify

public void modify(NextInterceptor nextInterceptor,
                   LdapDN name,
                   int modOp,
                   Attributes attrs)
            throws NamingException
Modifies on unregistered Connector Types (Namespaces) and Connectors (directories) will results in previously persisted values being used for any attributes which are not provided to the modify() call. Note both flavours of modify() have to be implemented, unlike for AbstractDirectoryPartitions, where this flavour of modify is expressed using the other.

Specified by:
modify in interface Interceptor
Overrides:
modify in class BaseInterceptor
Throws:
NamingException

modify

public void modify(NextInterceptor nextInterceptor,
                   LdapDN name,
                   ModificationItem[] items)
            throws NamingException
Specified by:
modify in interface Interceptor
Overrides:
modify in class BaseInterceptor
Throws:
NamingException

modifyRn

public void modifyRn(NextInterceptor nextInterceptor,
                     LdapDN name,
                     String newRn,
                     boolean deleteOldRn)
              throws NamingException
Specified by:
modifyRn in interface Interceptor
Overrides:
modifyRn in class BaseInterceptor
Throws:
NamingException

move

public void move(NextInterceptor nextInterceptor,
                 LdapDN name,
                 LdapDN newParentName)
          throws NamingException
Specified by:
move in interface Interceptor
Overrides:
move in class BaseInterceptor
Throws:
NamingException

move

public void move(NextInterceptor nextInterceptor,
                 LdapDN name,
                 LdapDN newParentName,
                 String newRn,
                 boolean deleteOldRn)
          throws NamingException
Specified by:
move in interface Interceptor
Overrides:
move in class BaseInterceptor
Throws:
NamingException

search

public NamingEnumeration<SearchResult> search(NextInterceptor nextInterceptor,
                                              LdapDN baseName,
                                              Map env,
                                              ExprNode filter,
                                              SearchControls searchCtls)
                                       throws NamingException
Specified by:
search in interface Interceptor
Overrides:
search in class BaseInterceptor
Throws:
NamingException

list

public NamingEnumeration<NameClassPair> list(NextInterceptor nextInterceptor,
                                             LdapDN base)
                                      throws NamingException
Specified by:
list in interface Interceptor
Overrides:
list in class BaseInterceptor
Throws:
NamingException

lookup

public Attributes lookup(NextInterceptor nextInterceptor,
                         LdapDN name)
                  throws NamingException
Specified by:
lookup in interface Interceptor
Overrides:
lookup in class BaseInterceptor
Throws:
NamingException

lookup

public Attributes lookup(NextInterceptor nextInterceptor,
                         LdapDN name,
                         String[] attrIds)
                  throws NamingException
Specified by:
lookup in interface Interceptor
Overrides:
lookup in class BaseInterceptor
Throws:
NamingException

checkForPasswordChange

protected boolean checkForPasswordChange(NextInterceptor nextInterceptor,
                                         LdapDN name,
                                         ModificationItem[] items)
                                  throws NamingException
Throws:
NamingException

setStandaloneManager

public void setStandaloneManager(StandaloneServerManager standaloneManager)
Parameters:
standaloneManager - the StandaloneServerManager to set

getPasswordObservers

public Set<PasswordChangeObserver> getPasswordObservers()
Returns:
the passwordObservers


Created 2011-07-14 13:27 EST