Class LDAPRegistry


  • public class LDAPRegistry
    extends DBRegistry
    A class represents a registry where all the schema (object classes and attribute) information is stored. Attribute mappers can be registered with this registry. Given the schema information stored, this registry has knowledge to convert a Java object into a LDAPAttributeSet or vice versa.
    Version:
    $Revision$, $Date$
    Author:
    thomask
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger logger  
    • Constructor Summary

      Constructors 
      Constructor Description
      LDAPRegistry()
      Constructs registry.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      netscape.ldap.LDAPAttributeSet createLDAPAttributeSet​(IDBObj obj)
      Creates attribute set from object.
      IDBObj createObject​(netscape.ldap.LDAPAttributeSet attrs)
      Creates object from attribute set.
      IConfigStore getConfigStore()
      Retrieves configuration store.
      java.lang.String getFilter​(java.lang.String filter)
      Creates LDAP-based search filters with help of registered mappers.
      java.lang.String getFilter​(java.lang.String filter, IFilterConverter c)
      Creates LDAP-based search filters with help of registered mappers.
      java.lang.String getId()
      Retrieves subsystem identifier.
      java.lang.String[] getLDAPAttributes​(java.lang.String[] attrs)
      Retrieves a list of LDAP attributes that are associated with the given attributes.
      void init​(IConfigStore config)
      Initializes the internal registery.
      boolean isAttributeRegistered​(java.lang.String ufName)
      See if an attribute is registered.
      boolean isObjectClassRegistered​(java.lang.String className)
      See if an object class is registered.
      void mapObject​(IDBObj parent, java.lang.String name, java.lang.Object obj, netscape.ldap.LDAPAttributeSet attrs)
      Maps object into LDAP attribute set.
      void registerAttribute​(java.lang.String ufName, DBAttrMapper mapper)
      Registers attribute mapper.
      void registerDynamicMapper​(DBDynAttrMapper mapper)
      Registers a dynamic attribute mapper.
      void registerObjectClass​(java.lang.String className, java.lang.String[] ldapNames)
      Registers object class.
      void setId​(java.lang.String id)
      Sets subsystem identifier.
      void shutdown()
      Shutdowns this subsystem gracefully.
      void startup()
      Starts up this subsystem.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static final org.slf4j.Logger logger
    • Constructor Detail

      • LDAPRegistry

        public LDAPRegistry()
        Constructs registry.
    • Method Detail

      • getId

        public java.lang.String getId()
        Retrieves subsystem identifier.
        Overrides:
        getId in class DBRegistry
      • setId

        public void setId​(java.lang.String id)
                   throws EBaseException
        Sets subsystem identifier. This is an internal subsystem, and is not loadable.
        Overrides:
        setId in class DBRegistry
        Throws:
        EBaseException
      • init

        public void init​(IConfigStore config)
                  throws EBaseException
        Initializes the internal registery. Connects to the data source, and create a pool of connection of which applications can use. Optionally, check the integrity of the database.
        Overrides:
        init in class DBRegistry
        Throws:
        EBaseException
      • shutdown

        public void shutdown()
        Shutdowns this subsystem gracefully.
        Overrides:
        shutdown in class DBRegistry
      • registerObjectClass

        public void registerObjectClass​(java.lang.String className,
                                        java.lang.String[] ldapNames)
                                 throws EDBException
        Registers object class.
        Overrides:
        registerObjectClass in class DBRegistry
        Parameters:
        className - java class to create for the object classes
        ldapNames - a list of LDAP object classes
        Throws:
        EDBException - failed to register
      • isObjectClassRegistered

        public boolean isObjectClassRegistered​(java.lang.String className)
        See if an object class is registered.
        Overrides:
        isObjectClassRegistered in class DBRegistry
        Parameters:
        className - java class to create
        Returns:
        true if object class is registered already
      • registerAttribute

        public void registerAttribute​(java.lang.String ufName,
                                      DBAttrMapper mapper)
                               throws EDBException
        Registers attribute mapper.
        Overrides:
        registerAttribute in class DBRegistry
        Parameters:
        ufName - LDAP attribute name
        mapper - mapper to invoke for the attribute
        Throws:
        EDBException - failed to register
      • isAttributeRegistered

        public boolean isAttributeRegistered​(java.lang.String ufName)
        See if an attribute is registered.
        Overrides:
        isAttributeRegistered in class DBRegistry
        Parameters:
        ufName - attribute name
        Returns:
        true if attribute is registered already
      • getFilter

        public java.lang.String getFilter​(java.lang.String filter)
                                   throws EBaseException
        Creates LDAP-based search filters with help of registered mappers. Parses filter from filter string specified in RFC1558.
        Overrides:
        getFilter in class DBRegistry
        Parameters:
        filter - CMS-based filter
        Returns:
        LDAP-based filter string
        Throws:
        EBaseException - failed to convert filter
      • getFilter

        public java.lang.String getFilter​(java.lang.String filter,
                                          IFilterConverter c)
                                   throws EBaseException
        Description copied from class: DBRegistry
        Creates LDAP-based search filters with help of registered mappers.
        Overrides:
        getFilter in class DBRegistry
        Parameters:
        filter - CMS-based filter
        c - filter converter
        Returns:
        LDAP-based filter string
        Throws:
        EBaseException - failed to convert filter
      • mapObject

        public void mapObject​(IDBObj parent,
                              java.lang.String name,
                              java.lang.Object obj,
                              netscape.ldap.LDAPAttributeSet attrs)
                       throws EBaseException
        Maps object into LDAP attribute set.
        Overrides:
        mapObject in class DBRegistry
        Parameters:
        parent - object's parent
        name - name of the object
        obj - object to be mapped
        attrs - LDAP attribute set
        Throws:
        EBaseException - failed to map object
      • getLDAPAttributes

        public java.lang.String[] getLDAPAttributes​(java.lang.String[] attrs)
                                             throws EBaseException
        Retrieves a list of LDAP attributes that are associated with the given attributes. This method is used for searches, to map the database attributes to LDAP attributes.
        Overrides:
        getLDAPAttributes in class DBRegistry
        Parameters:
        attrs - attributes
        Returns:
        LDAP-based attributes
        Throws:
        EBaseException - failed to map attributes
      • createObject

        public IDBObj createObject​(netscape.ldap.LDAPAttributeSet attrs)
                            throws EDBException
        Creates object from attribute set.
        Overrides:
        createObject in class DBRegistry
        Parameters:
        attrs - LDAP attribute set
        Returns:
        database object
        Throws:
        EDBException