Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.content
Interface ContentStore
All Known Implementing Classes:
AbstractContentStore, FileContentStore

@org.alfresco.api.AlfrescoPublicApi
public interface ContentStore
Provides low-level retrieval of content readers and writers.

Implementations of this interface should be soley responsible for providing persistence and retrieval of the content against a content URL.

Content URLs must consist of a prefix or protocol followed by an implementation-specific identifier. For example, the content URL format for file stores is store://year/month/day/hour/minute/GUID.bin

Where the store cannot handle a particular content URL request, the UnsupportedContentUrlException must be generated. This will allow various implementations to provide fallback code to other stores where possible.

Where a store cannot serve a particular request because the functionality is just not available, the UnsupportedOperationException should be thrown. Once again, there may be fallback handling provided for these situations.

Since:
1.0
Author:
Derek Hulley

Field Summary
org.alfresco.repo.content.ContentContext
NEW_CONTENT_CONTEXT
          An empty content context used to retrieve completely new content.
PROTOCOL_DELIMITER
          The delimiter that must be found in all URLS, i.e ://
Method Summary
boolean
delete(String contentUrl)
          Deletes the content at the given URL.
boolean
exists(String contentUrl)
          Check for the existence of content in the store.
getReader(String contentUrl)
          Get the accessor with which to read from the content at the given URL.
getRootLocation()
          Get the location where the store is rooted.
long
getSpaceFree()
          Calculates the remaning free space in the underlying store.
long
getSpaceTotal()
          Calculates the total storage space of the underlying store.
void
getUrls(org.alfresco.repo.content.ContentStore.ContentUrlHandler handler)
          Deprecated. in 5.0. The API is no longer used by Alfresco; efficient APIs can be provided by the implementations, if required
void
getUrls(Date createdAfter, Date createdBefore, org.alfresco.repo.content.ContentStore.ContentUrlHandler handler)
          Deprecated. in 5.0. The API is no longer used by Alfresco; efficient APIs can be provided by the implementations, if required
getWriter(org.alfresco.repo.content.ContentContext context)
          Get an accessor with which to write content to a location within the store.
boolean
isContentUrlSupported(String contentUrl)
          Check if the content URL format is supported by the store.
boolean
isWriteSupported()
          Check if the store supports write requests.
Field Detail
NEW_CONTENT_CONTEXT
public static final org.alfresco.repo.content.ContentContext NEW_CONTENT_CONTEXT
An empty content context used to retrieve completely new content.
See Also:
getWriter(ContentContext)

PROTOCOL_DELIMITER
public static final String PROTOCOL_DELIMITER
The delimiter that must be found in all URLS, i.e ://
See Also:
Constant Field Values
Method Detail
isContentUrlSupported
boolean isContentUrlSupported(String contentUrl)
Check if the content URL format is supported by the store.
Parameters:
contentUrl - the content URL to check
Returns:
Returns true if none of the other methods on the store will throw an UnsupportedContentUrlException when given this URL.
Since:
2.1

isWriteSupported
boolean isWriteSupported()
Check if the store supports write requests.
Returns:
Return true is the store supports write operations
Since:
2.1

getSpaceFree
long getSpaceFree()
Calculates the remaning free space in the underlying store.

NOTE: For efficiency, some implementations may provide a guess.

Implementations should focus on calculating a size value quickly, rather than accurately.

Returns:
Returns the total, possibly approximate, free space (in bytes) available to the store or -1 if no size data is available.
Since:
3.3.3

getSpaceTotal
long getSpaceTotal()
Calculates the total storage space of the underlying store.

NOTE: For efficiency, some implementations may provide a guess.

Implementations should focus on calculating a size value quickly, rather than accurately.

Returns:
Returns the total, possibly approximate, size (in bytes) of the underlying store or -1 if no size data is available.
Since:
3.3.3

getRootLocation
String getRootLocation()
Get the location where the store is rooted. The format of the returned value will depend on the specific implementation of the store.
Returns:
Returns the store's root location or . if no information is available

exists
boolean exists(String contentUrl)
Check for the existence of content in the store.

The implementation of this may be more efficient than first getting a reader to check for existence, although that check should also be performed.

Parameters:
contentUrl - the path to the content
Returns:
Returns true if the content exists, otherwise false if the content doesn't exist or if the URL is not applicable to this store.
Throws:
org.alfresco.repo.content.UnsupportedContentUrlException - if the content URL supplied is not supported by the store
ContentIOException - if an IO error occurs
See Also:
ContentReader.exists()

getReader
ContentReader getReader(String contentUrl)
Get the accessor with which to read from the content at the given URL. The reader is stateful and can only be used once.
Parameters:
contentUrl - the path to where the content is located
Returns:
Returns a read-only content accessor for the given URL. There may be no content at the given URL, but the reader must still be returned.
Throws:
org.alfresco.repo.content.UnsupportedContentUrlException - if the content URL supplied is not supported by the store
ContentIOException - if an IO error occurs
See Also:
exists(String), ContentReader.exists(), EmptyContentReader

getWriter
ContentWriter getWriter(org.alfresco.repo.content.ContentContext context)
Get an accessor with which to write content to a location within the store. The writer is stateful and can only be used once. The location may be specified but must, in that case, be a valid and unused URL.

The store will ensure that the new content URL will be valid for all subsequent read attempts.

By supplying a reader to existing content, the store implementation may enable random access. The store implementation can enable this by copying the existing content into the new location before supplying a writer onto the new content.

Parameters:
context - the context of content.
Returns:
Returns a write-only content accessor
Throws:
UnsupportedOperationException - if the store is unable to provide the information
UnsupportedContentUrlException - if the content URL supplied is not supported by the store
ContentExistsException - if the content URL is already in use
ContentIOException - if an IO error occurs
See Also:
ContentAccessor.addListener(ContentStreamListener), ContentAccessor.getContentUrl()

getUrls
@Deprecated
void getUrls(org.alfresco.repo.content.ContentStore.ContentUrlHandler handler)
      throws ContentIOException
Deprecated. in 5.0. The API is no longer used by Alfresco; efficient APIs can be provided by the implementations, if required
Get all URLs for the store, regardless of creation time.
Throws:
ContentIOException - if an IO error occurs
UnsupportedOperationException - if the store is unable to provide the information
See Also:
getUrls(Date, Date, ContentUrlHandler)

getUrls
@Deprecated
void getUrls(Date createdAfter,
             Date createdBefore,
             org.alfresco.repo.content.ContentStore.ContentUrlHandler handler)
      throws ContentIOException
Deprecated. in 5.0. The API is no longer used by Alfresco; efficient APIs can be provided by the implementations, if required
Get a set of all content URLs in the store. This indicates all content available for reads.
Parameters:
createdAfter - all URLs returned must have been created after this date. May be null.
createdBefore - all URLs returned must have been created before this date. May be null.
handler - the callback that will passed each URL
Throws:
ContentIOException - if an error occurs
UnsupportedOperationException - if the store is unable to provide the information

delete
boolean delete(String contentUrl)
Deletes the content at the given URL.

A delete cannot be forced since it is much better to have the file remain longer than desired rather than deleted prematurely.

Parameters:
contentUrl - the URL of the content to delete
Returns:
Returns true if the content was deleted (either by this or another operation), otherwise false. If the content no longer exists, then true is returned.
Throws:
UnsupportedOperationException - if the store is unable to perform the action
UnsupportedContentUrlException - if the content URL supplied is not supported by the store
ContentIOException - if an error occurs if an IO error occurs

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.