public class DirectoryServiceImpl extends DefaultComponent implements DirectoryService
Modifier and Type | Field and Description |
---|---|
protected static String |
DELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIX |
protected DirectoryRegistry |
registry |
lastModified, name
SYSTEM_DIRECTORY_TYPE
Constructor and Description |
---|
DirectoryServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
List<Directory> |
getDirectories()
Gets all the directories.
|
Directory |
getDirectory(String id)
Return the directory with the given id.
|
Directory |
getDirectory(String id,
DocumentModel documentContext)
Returns the directory for the specified id and document context.
|
protected DirectoryConfiguration |
getDirectoryConfiguration(DocumentModel documentContext) |
BaseDirectoryDescriptor |
getDirectoryDescriptor(String id)
Gets the effective directory descriptor for the given directory.
|
String |
getDirectoryIdField(String directoryName)
Gets the id field for a directory.
|
List<String> |
getDirectoryNames()
Gets the directory ids.
|
protected Directory |
getDirectoryOrFail(String name) |
protected Directory |
getDirectoryOrFail(String id,
DocumentModel documentContext) |
String |
getDirectoryPasswordField(String directoryName)
Gets the password field for a directory.
|
String |
getDirectorySchema(String directoryName)
Gets the schema for a directory.
|
String |
getParentDirectoryName(String directoryName)
Gets the parent directory id a directory.
|
protected String |
getWaitingLocalDirectoryName(String directoryName,
DirectoryConfiguration configuration)
This will return the local directory name according the local configuration.
|
Session |
open(String directoryName)
Opens a session on specified directory.
|
Session |
open(String directoryName,
DocumentModel documentContext)
Opens a session on the directory for the specified context.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
registerDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
INTERNAL registers a directory descriptor.
|
void |
start(ComponentContext context)
Start the component.
|
void |
unregisterDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
INTERNAL unregisters a directory descriptor.
|
getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterContribution, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
protected static final String DELIMITER_BETWEEN_DIRECTORY_NAME_AND_SUFFIX
protected DirectoryRegistry registry
public DirectoryServiceImpl()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void registerDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
DirectoryService
registerDirectoryDescriptor
in interface DirectoryService
public void unregisterDirectoryDescriptor(BaseDirectoryDescriptor descriptor)
DirectoryService
unregisterDirectoryDescriptor
in interface DirectoryService
public void start(ComponentContext context)
Component
start
in interface Component
start
in class DefaultComponent
protected DirectoryConfiguration getDirectoryConfiguration(DocumentModel documentContext)
protected String getWaitingLocalDirectoryName(String directoryName, DirectoryConfiguration configuration)
public BaseDirectoryDescriptor getDirectoryDescriptor(String id)
DirectoryService
getDirectoryDescriptor
in interface DirectoryService
id
- the directory idnull
if not registeredpublic Directory getDirectory(String id)
DirectoryService
If the id is null
, returns null
.
getDirectory
in interface DirectoryService
id
- the directory idnull
if not foundpublic Directory getDirectory(String id, DocumentModel documentContext)
DirectoryService
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
.
getDirectory
in interface DirectoryService
id
- the directory iddocumentContext
- the document contextnull
if not foundprotected Directory getDirectoryOrFail(String name)
protected Directory getDirectoryOrFail(String id, DocumentModel documentContext)
public List<Directory> getDirectories()
DirectoryService
getDirectories
in interface DirectoryService
public List<String> getDirectoryNames()
DirectoryService
getDirectoryNames
in interface DirectoryService
public String getDirectorySchema(String directoryName)
DirectoryService
getDirectorySchema
in interface DirectoryService
directoryName
- the directory idpublic String getDirectoryIdField(String directoryName)
DirectoryService
getDirectoryIdField
in interface DirectoryService
directoryName
- the directory idpublic String getDirectoryPasswordField(String directoryName)
DirectoryService
getDirectoryPasswordField
in interface DirectoryService
public String getParentDirectoryName(String directoryName)
DirectoryService
getParentDirectoryName
in interface DirectoryService
directoryName
- the directory idnull
public Session open(String directoryName)
DirectoryService
This method prefers to throw rather than returning null.
open
in interface DirectoryService
public Session open(String directoryName, DocumentModel documentContext)
DirectoryService
This method prefers to throw rather than returning null.
open
in interface DirectoryService
Copyright © 2018 Nuxeo. All rights reserved.