Class DirectoryServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.directory.DirectoryServiceImpl
-
- All Implemented Interfaces:
DirectoryService,Adaptable,Component,Extensible,TimestampedService
public class DirectoryServiceImpl extends DefaultComponent implements DirectoryService
-
-
Field Summary
Fields Modifier and Type Field Description static DurationCLUSTER_START_DURATION_DEFAULTstatic StringCLUSTER_START_DURATION_PROPprotected static StringDELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIXprotected DirectoryRegistryregistry-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Fields inherited from interface org.nuxeo.ecm.directory.api.DirectoryService
SYSTEM_DIRECTORY_TYPE
-
-
Constructor Summary
Constructors Constructor Description DirectoryServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ComponentContext context)Activates the component.voiddeactivate(ComponentContext context)Deactivates the component.intgetApplicationStartedOrder()The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).List<Directory>getDirectories()Gets all the directories.DirectorygetDirectory(String id)Return the directory with the given id.DirectorygetDirectory(String id, DocumentModel documentContext)Returns the directory for the specified id and document context.protected DirectoryConfigurationgetDirectoryConfiguration(DocumentModel documentContext)BaseDirectoryDescriptorgetDirectoryDescriptor(String id)Gets the effective directory descriptor for the given directory.StringgetDirectoryIdField(String directoryName)Gets the id field for a directory.List<String>getDirectoryNames()Gets the directory ids.protected DirectorygetDirectoryOrFail(String name)protected DirectorygetDirectoryOrFail(String id, DocumentModel documentContext)StringgetDirectoryPasswordField(String directoryName)Gets the password field for a directory.StringgetDirectorySchema(String directoryName)Gets the schema for a directory.StringgetParentDirectoryName(String directoryName)Gets the parent directory id a directory.protected StringgetWaitingLocalDirectoryName(String directoryName, DirectoryConfiguration configuration)This will return the local directory name according the local configuration.voidloadFromCSV(String directoryName, Blob dataBlob, String dataLoadingPolicy)Loads a CSV into the givendirectoryName.Sessionopen(String directoryName)Opens a session on specified directory.Sessionopen(String directoryName, DocumentModel documentContext)Opens a session on the directory for the specified context.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidregisterDirectoryDescriptor(BaseDirectoryDescriptor descriptor)INTERNAL registers a directory descriptor.protected voidstart()voidstart(ComponentContext context)Start the component.voidunregisterDirectoryDescriptor(BaseDirectoryDescriptor descriptor)INTERNAL unregisters a directory descriptor.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted
-
-
-
-
Field Detail
-
CLUSTER_START_DURATION_PROP
public static final String CLUSTER_START_DURATION_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
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
-
registry
protected DirectoryRegistry registry
-
-
Constructor Detail
-
DirectoryServiceImpl
public DirectoryServiceImpl()
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
registerDirectoryDescriptor
public void registerDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
Description copied from interface:DirectoryServiceINTERNAL registers a directory descriptor.- Specified by:
registerDirectoryDescriptorin interfaceDirectoryService
-
unregisterDirectoryDescriptor
public void unregisterDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
Description copied from interface:DirectoryServiceINTERNAL unregisters a directory descriptor.- Specified by:
unregisterDirectoryDescriptorin interfaceDirectoryService
-
loadFromCSV
public void loadFromCSV(String directoryName, Blob dataBlob, String dataLoadingPolicy)
Description copied from interface:DirectoryServiceLoads a CSV into the givendirectoryName.- Specified by:
loadFromCSVin interfaceDirectoryService- See Also:
BaseDirectoryDescriptor.DATA_LOADING_POLICIES
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:ComponentThe component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
start
protected void start()
-
getDirectoryConfiguration
protected DirectoryConfiguration getDirectoryConfiguration(DocumentModel documentContext)
-
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.
-
getDirectoryDescriptor
public BaseDirectoryDescriptor getDirectoryDescriptor(String id)
Description copied from interface:DirectoryServiceGets the effective directory descriptor for the given directory.- Specified by:
getDirectoryDescriptorin interfaceDirectoryService- Parameters:
id- the directory id- Returns:
- the effective directory descriptor, or
nullif not registered
-
getDirectory
public Directory getDirectory(String id)
Description copied from interface:DirectoryServiceReturn the directory with the given id.If the id is
null, returnsnull.- Specified by:
getDirectoryin interfaceDirectoryService- Parameters:
id- the directory id- Returns:
- the directory, or
nullif not found
-
getDirectory
public Directory getDirectory(String id, DocumentModel documentContext)
Description copied from interface:DirectoryServiceReturns 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, returnsnull.- Specified by:
getDirectoryin interfaceDirectoryService- Parameters:
id- the directory iddocumentContext- the document context- Returns:
- the directory, or
nullif not found
-
getDirectoryOrFail
protected Directory getDirectoryOrFail(String name)
-
getDirectoryOrFail
protected Directory getDirectoryOrFail(String id, DocumentModel documentContext)
-
getDirectories
public List<Directory> getDirectories()
Description copied from interface:DirectoryServiceGets all the directories.- Specified by:
getDirectoriesin interfaceDirectoryService
-
getDirectoryNames
public List<String> getDirectoryNames()
Description copied from interface:DirectoryServiceGets the directory ids.- Specified by:
getDirectoryNamesin interfaceDirectoryService
-
getDirectorySchema
public String getDirectorySchema(String directoryName)
Description copied from interface:DirectoryServiceGets the schema for a directory.- Specified by:
getDirectorySchemain interfaceDirectoryService- Parameters:
directoryName- the directory id- Returns:
- the schema for the directory
-
getDirectoryIdField
public String getDirectoryIdField(String directoryName)
Description copied from interface:DirectoryServiceGets the id field for a directory.- Specified by:
getDirectoryIdFieldin interfaceDirectoryService- Parameters:
directoryName- the directory id- Returns:
- the id field for the directory
-
getDirectoryPasswordField
public String getDirectoryPasswordField(String directoryName)
Description copied from interface:DirectoryServiceGets the password field for a directory.- Specified by:
getDirectoryPasswordFieldin interfaceDirectoryService- Parameters:
directoryName- the directory name- Returns:
- the password field for the directory
-
getParentDirectoryName
public String getParentDirectoryName(String directoryName)
Description copied from interface:DirectoryServiceGets the parent directory id a directory.- Specified by:
getParentDirectoryNamein interfaceDirectoryService- Parameters:
directoryName- the directory id- Returns:
- the parent directory id, which may be
null
-
open
public Session open(String directoryName)
Description copied from interface:DirectoryServiceOpens a session on specified directory.This method prefers to throw rather than returning null.
- Specified by:
openin interfaceDirectoryService- Returns:
- the session
-
open
public Session open(String directoryName, DocumentModel documentContext)
Description copied from interface:DirectoryServiceOpens 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:
openin interfaceDirectoryService- Returns:
- the session
-
-