public class FileContentStore extends AbstractContentStore implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener
simple content context.
The file names obey, as they must, the URL naming convention
as specified in the ContentStore interface.
ContentStore.ContentUrlHandler| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
STORE_PROTOCOL
store is the new prefix for file content URLs
|
contentLimitProviderNEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER| Constructor and Description |
|---|
FileContentStore(org.springframework.context.ApplicationContext context,
java.io.File rootDirectory)
Public constructor for programmatic use.
|
FileContentStore(org.springframework.context.ApplicationContext context,
java.lang.String rootDirectoryStr)
Public constructor for programmatic use.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
createNewFileStoreUrl()
Creates a new content URL.
|
boolean |
delete(java.lang.String contentUrl)
Attempts to delete the content.
|
boolean |
exists(java.lang.String contentUrl)
Performs a direct check against the file for its existence.
|
org.alfresco.service.cmr.repository.ContentReader |
getReader(java.lang.String contentUrl)
This implementation requires that the URL start with
FileContentStore.STORE_PROTOCOL. |
java.lang.String |
getRootLocation()
Get the location where the store is rooted.
|
long |
getSpaceFree()
Get the filesystem's free space.
|
long |
getSpaceTotal()
Get the filesystem's total space.
|
void |
getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
Gets the urls.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
Returns a writer onto a location based on the date.
|
boolean |
isWriteSupported()
Check if the store supports write requests.
|
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 |
setReadOnly(boolean readOnly)
File stores may optionally be declared read-only.
|
java.lang.String |
toString() |
getContentUrlParts, getSpaceUsed, getTotalSize, getUrls, getWriter, getWriter, isContentUrlSupported, isValidContentUrl, setContentLimitProviderpublic static final java.lang.String STORE_PROTOCOL
public FileContentStore(org.springframework.context.ApplicationContext context,
java.lang.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.FileContentStore(File)public FileContentStore(org.springframework.context.ApplicationContext context,
java.io.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 java.lang.String toString()
toString in class java.lang.Objectpublic 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 boolean isWriteSupported()
ContentStoreisWriteSupported in interface ContentStorepublic boolean exists(java.lang.String contentUrl)
exists in interface ContentStoreexists in class AbstractContentStorecontentUrl - the path to the contentContentReader.exists()public long getSpaceFree()
getSpaceFree in interface ContentStoregetSpaceFree in class AbstractContentStorefree spacepublic long getSpaceTotal()
getSpaceTotal in interface ContentStoregetSpaceTotal in class AbstractContentStoretotal spacepublic java.lang.String getRootLocation()
AbstractContentStoregetRootLocation in interface ContentStoregetRootLocation in class AbstractContentStorepublic org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
FileContentStore.STORE_PROTOCOL.getReader in interface ContentStorecontentUrl - the path to where the content is locatedContentStore.exists(String),
ContentReader.exists(),
EmptyContentReaderpublic org.alfresco.service.cmr.repository.ContentWriter getWriterInternal(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
java.lang.String newContentUrl)
getWriterInternal in class AbstractContentStoreexistingContentReader - the existing content readernewContentUrl - the new content urlpublic void getUrls(java.util.Date createdAfter,
java.util.Date createdBefore,
ContentStore.ContentUrlHandler handler)
getUrls in interface ContentStoregetUrls in class AbstractContentStorecreatedAfter - the created after datecreatedBefore - the created before dat6ehandler - the handlerpublic boolean delete(java.lang.String contentUrl)
delete in interface ContentStoredelete in class AbstractContentStorecontentUrl - the URL of the content to deletejava.lang.UnsupportedOperationException - if the store is read-onlyFileContentStore.setReadOnly(boolean)public static java.lang.String createNewFileStoreUrl()
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListenerpublic void setDeleteEmptyDirs(boolean deleteEmptyDirs)
deleteEmptyDirs - the deleteEmptyDirs to setCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.