Class DirectoryServiceImpl

    • Field Detail

      • CLUSTER_START_DURATION_DEFAULT

        public static final Duration CLUSTER_START_DURATION_DEFAULT
        Since:
        11.1
      • DELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIX

        protected static final String DELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • DirectoryServiceImpl

        public DirectoryServiceImpl()
    • Method Detail

      • activate

        public void activate​(ComponentContext context)
        Description copied from interface: Component
        Activates the component.

        This method is called by the runtime when a component is activated.

        Specified by:
        activate in interface Component
        Overrides:
        activate in class DefaultComponent
        Parameters:
        context - the runtime context
      • deactivate

        public void deactivate​(ComponentContext context)
        Description copied from interface: Component
        Deactivates the component.

        This method is called by the runtime when a component is deactivated.

        Specified by:
        deactivate in interface Component
        Overrides:
        deactivate in class DefaultComponent
        Parameters:
        context - the runtime context
      • start

        protected void start()
      • getWaitingLocalDirectoryName

        protected String getWaitingLocalDirectoryName​(String directoryName,
                                                      DirectoryConfiguration configuration)
        This will return the local directory name according the local configuration. If the local configuration is null or the suffix value is null or the suffix value trimmed is an empty string the returned value is the directoryName given in parameter. If not this is directoryName + DELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIX + suffix. if directoryName is null, return null.
      • getDirectory

        public Directory getDirectory​(String id)
        Description copied from interface: DirectoryService
        Return the directory with the given id.

        If the id is null, returns null.

        Specified by:
        getDirectory in interface DirectoryService
        Parameters:
        id - the directory id
        Returns:
        the directory, or null if not found
      • getDirectory

        public Directory getDirectory​(String id,
                                      DocumentModel documentContext)
        Description copied from interface: DirectoryService
        Returns the directory for the specified id and document context.

        The context is given by the document. The document service will try to find the directory local configuration of the document that will specify the suffix. The directory service will fetch the id + suffix found. If no local configuration is found the service will return the directory with the given id.

        If the id is null, returns null.

        Specified by:
        getDirectory in interface DirectoryService
        Parameters:
        id - the directory id
        documentContext - the document context
        Returns:
        the directory, or null if not found
      • getDirectoryOrFail

        protected Directory getDirectoryOrFail​(String name)
      • getDirectorySchema

        public String getDirectorySchema​(String directoryName)
        Description copied from interface: DirectoryService
        Gets the schema for a directory.
        Specified by:
        getDirectorySchema in interface DirectoryService
        Parameters:
        directoryName - the directory id
        Returns:
        the schema for the directory
      • getDirectoryIdField

        public String getDirectoryIdField​(String directoryName)
        Description copied from interface: DirectoryService
        Gets the id field for a directory.
        Specified by:
        getDirectoryIdField in interface DirectoryService
        Parameters:
        directoryName - the directory id
        Returns:
        the id field for the directory
      • getDirectoryPasswordField

        public String getDirectoryPasswordField​(String directoryName)
        Description copied from interface: DirectoryService
        Gets the password field for a directory.
        Specified by:
        getDirectoryPasswordField in interface DirectoryService
        Parameters:
        directoryName - the directory name
        Returns:
        the password field for the directory
      • getParentDirectoryName

        public String getParentDirectoryName​(String directoryName)
        Description copied from interface: DirectoryService
        Gets the parent directory id a directory.
        Specified by:
        getParentDirectoryName in interface DirectoryService
        Parameters:
        directoryName - the directory id
        Returns:
        the parent directory id, which may be null
      • open

        public Session open​(String directoryName)
        Description copied from interface: DirectoryService
        Opens a session on specified directory.

        This method prefers to throw rather than returning null.

        Specified by:
        open in interface DirectoryService
        Returns:
        the session
      • open

        public Session open​(String directoryName,
                            DocumentModel documentContext)
        Description copied from interface: DirectoryService
        Opens a session on the directory for the specified context. The context is given by the document. The document service will try to find the directory local configuration of the document that will specify the suffix. the directory will fetch the directoryName + suffix found. If no local configuration is found the service will return the directoryName directory.

        This method prefers to throw rather than returning null.

        Specified by:
        open in interface DirectoryService
        Returns:
        the session