Class StandaloneLdapApiService

  • All Implemented Interfaces:
    org.apache.directory.api.ldap.codec.api.LdapApiService

    public class StandaloneLdapApiService
    extends org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService
    The default LdapApiService implementation. It loads the Controls, ExtendedOperations and IntermediateResponses as defined in the following system parameters :
    • Controls :
      • apacheds.request.controls
      • apacheds.response.controls
      • default.controls
    • ExtendedOperations :
      • apacheds.extendedOperations
      • extra.extendedOperations
    • IntermediateResponses :
      • apacheds.intermediateResponses
    Version:
    $Rev$, $Date$
    Author:
    Apache Directory Project
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static List<String> getControlsFromSystemProperties​(StandaloneLdapApiService.ControlType type)
      Parses the system properties to obtain the controls list.
      private static List<String> getExtendedOperationsFromSystemProperties()
      Parses the system properties to obtain the extended operations.
      private static List<String> getIntermediateResponsesFromSystemProperties()
      Parses the system properties to obtain the intermediate responses.
      private void loadControl​(String controlFQCN, Map<String,​org.apache.directory.api.ldap.codec.api.ControlFactory<? extends org.apache.directory.api.ldap.model.message.Control>> controlFactories)
      Loads a control from its FQCN.
      private void loadControls​(List<String> controlsList, Map<String,​org.apache.directory.api.ldap.codec.api.ControlFactory<? extends org.apache.directory.api.ldap.model.message.Control>> controlFactories)
      Loads a list of controls from their FQCN.
      private void loadExtendedOperations​(List<String> extendedOperationsList)
      Loads a list of extended operation from their FQCN
      private void loadExtendedRequest​(String extendedRequestFQCN)
      Loads an extended request from its FQCN
      private void loadIntermediateResponse​(String intermediateResponseFQCN)
      Loads an intermediate responses from its FQCN
      private void loadIntermediateResponse​(List<String> intermediateResponsesList)
      Loads a list of intermediate responses from their FQCN
      • Methods inherited from class org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService

        fromJndi, fromJndi, fromJndiRequestControl, fromJndiResponseControl, getDnFactory, getExtendedRequestFactories, getExtendedResponseFactories, getIntermediateResponseFactories, getProtocolCodecFactory, getRequestControlFactories, getResponseControlFactories, isControlRegistered, isExtendedRequestRegistered, isExtendedResponseRegistered, isIntermediateResponseRegistered, registeredExtendedRequests, registeredExtendedResponses, registeredIntermediateResponses, registeredRequestControls, registeredResponseControls, registerExtendedRequest, registerExtendedResponse, registerIntermediateResponse, registerProtocolCodecFactory, registerRequestControl, registerResponseControl, setDnfactory, setExtendedRequestFactories, setExtendedResponseFactories, setIntermediateResponseFactories, setProtocolCodecFactory, setRequestControlFactories, setResponseControlFactories, toJndi, toJndi, toJndiControl, toString, unregisterExtendedRequest, unregisterExtendedResponse, unregisterIntermediateResponse, unregisterRequestControl, unregisterResponseControl
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
        A logger
      • REQUEST_CONTROLS_LIST

        public static final String REQUEST_CONTROLS_LIST
        The list of request controls to load at startup
        See Also:
        Constant Field Values
      • RESPONSE_CONTROLS_LIST

        public static final String RESPONSE_CONTROLS_LIST
        The list of response controls to load at startup
        See Also:
        Constant Field Values
      • EXTENDED_OPERATIONS_LIST

        public static final String EXTENDED_OPERATIONS_LIST
        The list of extended operations to load at startup
        See Also:
        Constant Field Values
      • INTERMEDIATE_RESPONSES_LIST

        public static final String INTERMEDIATE_RESPONSES_LIST
        The list of Intermediate responses to load at startup
        See Also:
        Constant Field Values
      • OLD_DEFAULT_CONTROLS_LIST

        private static final String OLD_DEFAULT_CONTROLS_LIST
        The (old) list of default controls to load at startup
        See Also:
        Constant Field Values
      • OLD_EXTRA_EXTENDED_OPERATION_LIST

        private static final String OLD_EXTRA_EXTENDED_OPERATION_LIST
        The (old) list of extra extended operations to load at startup
        See Also:
        Constant Field Values
    • Constructor Detail

      • StandaloneLdapApiService

        public StandaloneLdapApiService()
                                 throws Exception
        Creates a new instance of StandaloneLdapCodecService.

        The following pom configuration is intended for use by unit test running tools like Maven's surefire:
           <properties>
             <codec.plugin.directory>${project.build.directory}/pluginDirectory</codec.plugin.directory>
           </properties>
        
           <build>
             <plugins>
               <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <groupId>org.apache.maven.plugins</groupId>
                 <configuration>
                   <systemPropertyVariables>
                     <workingDirectory>${basedir}/target</workingDirectory>
                     <felix.cache.rootdir>
                       ${project.build.directory}
                     </felix.cache.rootdir>
                     <felix.cache.locking>
                       true
                     </felix.cache.locking>
                     <org.osgi.framework.storage.clean>
                       onFirstInit
                     </org.osgi.framework.storage.clean>
                     <org.osgi.framework.storage>
                       osgi-cache
                     </org.osgi.framework.storage>
                     <codec.plugin.directory>
                       ${codec.plugin.directory}
                     </codec.plugin.directory>
                   </systemPropertyVariables>
                 </configuration>
               </plugin>
        
               <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                   <execution>
                     <id>copy</id>
                     <phase>compile</phase>
                     <goals>
                       <goal>copy</goal>
                     </goals>
                     <configuration>
                       <artifactItems>
                         <artifactItem>
                           <groupId>${project.groupId}</groupId>
                           <artifactId>api-ldap-extras-codec</artifactId>
                           <version>${project.version}</version>
                           <outputDirectory>${codec.plugin.directory}</outputDirectory>
                         </artifactItem>
                       </artifactItems>
                     </configuration>
                   </execution>
                 </executions>
               </plugin>
             </plugins>
           </build>
         
        Throws:
        Exception - If we had an issue initializing the LDAP service
      • StandaloneLdapApiService

        public StandaloneLdapApiService​(List<String> requestControls,
                                        List<String> responseControls,
                                        List<String> extendedOperations,
                                        List<String> intermediateResponses)
                                 throws Exception
        Creates a new instance of StandaloneLdapApiService.
        Parameters:
        requestControls - The list of request controls to store
        responseControls - The list of response controls to store
        extendedOperations - The list of extended operations to store
        intermediateResponses - The list of intermediate responsess to store
        Throws:
        Exception - If we had an issue with one of the two lists
    • Method Detail

      • getControlsFromSystemProperties

        private static List<String> getControlsFromSystemProperties​(StandaloneLdapApiService.ControlType type)
        Parses the system properties to obtain the controls list.
        Parameters:
        type - The control's type
        Returns:
        A list of controls
      • getExtendedOperationsFromSystemProperties

        private static List<String> getExtendedOperationsFromSystemProperties()
        Parses the system properties to obtain the extended operations. Such extended operations are stored in the apacheds.extendedOperations and default.extendedOperation.requests system properties.
        Returns:
        a list of extended operation
      • getIntermediateResponsesFromSystemProperties

        private static List<String> getIntermediateResponsesFromSystemProperties()
        Parses the system properties to obtain the intermediate responses. Such intermediate responses are stored in the apacheds.intermediateResponses and default.intermediateResponses.requests system properties.
        Returns:
        a list of intermediate responses
      • loadControls

        private void loadControls​(List<String> controlsList,
                                  Map<String,​org.apache.directory.api.ldap.codec.api.ControlFactory<? extends org.apache.directory.api.ldap.model.message.Control>> controlFactories)
                           throws Exception
        Loads a list of controls from their FQCN.
        Parameters:
        controlsList - The list of controls to load
        controlFactories - The set of control factories already loaded
        Throws:
        Exception - if a control could not be loaded
      • loadControl

        private void loadControl​(String controlFQCN,
                                 Map<String,​org.apache.directory.api.ldap.codec.api.ControlFactory<? extends org.apache.directory.api.ldap.model.message.Control>> controlFactories)
                          throws Exception
        Loads a control from its FQCN.
        Parameters:
        controlFQCN - The control FQCN
        controlFactories - The set of control factories already loaded
        Throws:
        Exception - If the control could not be loaded
      • loadExtendedOperations

        private void loadExtendedOperations​(List<String> extendedOperationsList)
                                     throws Exception
        Loads a list of extended operation from their FQCN
        Parameters:
        extendedOperationsList - The list of extended operations to load
        Throws:
        Exception - If an extended operations cannot be loaded
      • loadExtendedRequest

        private void loadExtendedRequest​(String extendedRequestFQCN)
                                  throws Exception
        Loads an extended request from its FQCN
        Parameters:
        extendedRequestFQCN - The extended operations to load
        Throws:
        Exception - If the extended operations cannot be loaded
      • loadIntermediateResponse

        private void loadIntermediateResponse​(List<String> intermediateResponsesList)
                                       throws Exception
        Loads a list of intermediate responses from their FQCN
        Parameters:
        intermediateResponsesList - The list of intermediate response to load
        Throws:
        Exception - If one of the intermediate response cannot be loaded
      • loadIntermediateResponse

        private void loadIntermediateResponse​(String intermediateResponseFQCN)
                                       throws Exception
        Loads an intermediate responses from its FQCN
        Parameters:
        intermediateResponseFQCN - The intermediate response to load
        Throws:
        Exception - If the intermediate response cannot be loaded