@AlfrescoPublicApi public class FileContentStore extends AbstractContentStore implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
simple content context.
The file names obey, as they must, the URL naming convention
as specified in the ContentStore interface.
The protocols handled are:
| Modifier and Type | Field and Description |
|---|---|
static String |
SPOOF_PROTOCOL |
static String |
STORE_PROTOCOL
store is the default prefix for file content URLs
|
contentLimitProvider| Constructor and Description |
|---|
FileContentStore(org.springframework.context.ApplicationContext context,
File rootDirectory)
Public constructor for programmatic use.
|
FileContentStore(org.springframework.context.ApplicationContext context,
File rootDirectory,
Map<String,Serializable> extendedEventParams) |
FileContentStore(org.springframework.context.ApplicationContext context,
String rootDirectoryStr)
Public constructor for programmatic use.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createNewFileStoreUrl()
Creates a new content URL.
|
boolean |
delete(String contentUrl)
Attempts to delete the content.
|
boolean |
exists(String contentUrl)
Performs a direct check against the file for its existence.
|
org.alfresco.service.cmr.repository.ContentReader |
getReader(String contentUrl)
This implementation requires that the URL start with
STORE_PROTOCOL or SPOOF_PROTOCOL |
String |
getRootLocation() |
long |
getSpaceFree()
Get the filesystem's free space.
|
long |
getSpaceTotal()
Get the filesystem's total space.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
String newContentUrl)
Returns a writer onto a location based on the date.
|
boolean |
isWriteSupported() |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
void |
setAllowRandomAccess(boolean allowRandomAccess)
Stores may optionally produce readers and writers that support random access.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setDeleteEmptyDirs(boolean deleteEmptyDirs)
Configure the FileContentStore to delete empty parent directories upon deleting a content URL.
|
void |
setFileContentUrlProvider(FileContentUrlProvider fileContentUrlProvider) |
void |
setReadOnly(boolean readOnly)
File stores may optionally be declared read-only.
|
String |
toString() |
getContentUrlParts, getWriter, isContentUrlSupported, isValidContentUrl, setContentLimitProviderpublic static final String STORE_PROTOCOL
ContentStore.PROTOCOL_DELIMITER,
Constant Field Valuespublic static final String SPOOF_PROTOCOL
public FileContentStore(org.springframework.context.ApplicationContext context,
String rootDirectoryStr)
context - application context through which events can be publishedrootDirectoryStr - the root under which files will be stored. The directory will be created if it does not exist.FileContentStore(File)public FileContentStore(org.springframework.context.ApplicationContext context,
File rootDirectory)
context - application context through which events can be publishedrootDirectory - the root under which files will be stored. The directory will be created if it does not exist.public FileContentStore(org.springframework.context.ApplicationContext context,
File rootDirectory,
Map<String,Serializable> extendedEventParams)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void setAllowRandomAccess(boolean allowRandomAccess)
This switch is primarily used during testing to ensure that the system has the ability to spoof random access in cases where the store is unable to produce readers and writers that allow random access. Typically, stream-based access would be an example.
allowRandomAccess - true to allow random access, false to have it fakedpublic void setReadOnly(boolean readOnly)
readOnly - true to force the store to only allow reads.public void setFileContentUrlProvider(FileContentUrlProvider fileContentUrlProvider)
public boolean isWriteSupported()
isWriteSupported in interface org.alfresco.repo.content.ContentStorepublic boolean exists(String contentUrl)
spoofed URLs, the URL always exists.exists in interface org.alfresco.repo.content.ContentStoreexists in class AbstractContentStorepublic long getSpaceFree()
getSpaceFree in interface org.alfresco.repo.content.ContentStoregetSpaceFree in class AbstractContentStorefree spacepublic long getSpaceTotal()
getSpaceTotal in interface org.alfresco.repo.content.ContentStoregetSpaceTotal in class AbstractContentStoretotal spacepublic String getRootLocation()
getRootLocation in interface org.alfresco.repo.content.ContentStoregetRootLocation in class AbstractContentStorepublic org.alfresco.service.cmr.repository.ContentReader getReader(String contentUrl)
STORE_PROTOCOL or SPOOF_PROTOCOLgetReader in interface org.alfresco.repo.content.ContentStorepublic org.alfresco.service.cmr.repository.ContentWriter getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
String newContentUrl)
getWriterInternal in class AbstractContentStoreexistingContentReader - the existing content readernewContentUrl - the new content urlpublic boolean delete(String contentUrl)
delete in interface org.alfresco.repo.content.ContentStoredelete in class AbstractContentStoreUnsupportedOperationException - if the store is read-onlysetReadOnly(boolean)public static String createNewFileStoreUrl()
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>public void setDeleteEmptyDirs(boolean deleteEmptyDirs)
deleteEmptyDirs - the deleteEmptyDirs to setCopyright © 2005–2018 Alfresco Software. All rights reserved.