public interface ContentProvider extends Identifiable<ContentProviderId>
ContentReference
and if it supports versioning of the content.Modifier and Type | Method and Description |
---|---|
void |
addContent(ContentScope contentScope,
ContentReference contentReference,
com.google.common.base.Optional<ContentMetadata> contentMetadata,
InputStream inputStream,
int inputStreamLength)
Add content with the specified
ContentInfo and the content itself as InputStream . |
ContentReference |
createContentReference(ContentInfo contentInfo)
Creates a new
ContentReference for the specified ContentInfo . |
void |
deleteContent(ContentScope contentScope)
Deletes all the content of the content provider for the supplied
ContentScope . |
int |
deleteContent(ContentScope contentScope,
ContentReference contentReference)
Deletes all versions of the specified
ContentReference such that the passed in ContentReference cannot be used anymore to retrieve content. |
void |
deleteContent(ContentScope contentScope,
ContentReference contentReference,
String version)
Deletes a specific version of the specified
ContentReference such that the passed in ContentReference cannot be used anymore to retrieve content with that
version. |
List<ContentReference> |
deleteContent(ContentScope contentScope,
ContentSourceId contentSourceId)
Deletes the content that is associated to the supplied
ContentSourceId for the ContentScope . |
InputStream |
getContent(ContentScope contentScope,
ContentReference contentReference)
Returns the latest version of the content within the content scope.
|
InputStream |
getContent(ContentScope contentScope,
ContentReference contentReference,
String version)
Returns the specified version of the content.
|
com.google.common.base.Optional<ContentMetadata> |
getContentMetadata(ContentScope contentScope,
ContentReference contentReference)
Returns the metadata of the latest version of the content.
|
com.google.common.base.Optional<ContentMetadata> |
getContentMetadata(ContentScope contentScope,
ContentReference contentReference,
String version)
Returns the metadata of the supplied version of the content.
|
com.google.common.base.Optional<ContentReference> |
getContentReference(ContentScope contentScope,
ContentReferenceId contentReferenceId)
Gets the content reference associated to the supplied
ContentReferenceId for the ContentScope . |
List<ContentReference> |
getContentReferences(ContentScope contentScope,
ContentSourceId contentSourceId)
Gets a list of all the content references associated to the supplied
ContentSourceId for the ContentScope . |
List<String> |
getContentVersions(ContentScope contentScope,
ContentReference contentReference)
Returns a list with all versions of the content of the specified
ContentReference . |
String |
getName()
Returns the name of the content provider.
|
void |
processContent(ContentScope contentScope,
ContentProcessor contentProcessor)
Process all content in the given provider with the processor
|
void |
setContentSourceId(ContentScope contentScope,
ContentReference contentReference,
ContentSourceId contentSourceId)
Sets the
ContentSourceId for a selected ContentReference . |
boolean |
supports(ContentReference contentReference)
Returns true if the specified
ContentReference is resolvable by the content provider, false otherwise. |
boolean |
supportsVersioning()
Returns true if the content provider supports versioning, false otherwise.
|
ContentReference |
updateContent(ContentScope contentScope,
ContentReference contentReference,
InputStream inputStream,
int inputStreamLength,
com.google.common.base.Optional<ContentMetadata> contentMetadata)
Updates the specified
ContentReference with the specified InputStream . |
ContentReference |
updateContent(ContentScope contentScope,
ContentReference contentReference,
InputStream inputStream,
int inputStreamLength,
com.google.common.base.Optional<ContentMetadata> contentMetadata,
boolean overwrite)
Updates the specified
ContentReference with the specified InputStream . |
void |
updateContentMetadata(ContentScope contentScope,
ContentReference contentReference,
com.google.common.base.Optional<ContentMetadata> contentMetadata)
Updates the content metadata.
|
getId
String getName()
boolean supportsVersioning()
boolean supports(ContentReference contentReference)
ContentReference
is resolvable by the content provider, false otherwise.contentReference
- the content reference to be checkedContentReference
is resolvable by the content provider, false otherwise.ContentReference createContentReference(ContentInfo contentInfo)
ContentReference
for the specified ContentInfo
.ContentInfo
void addContent(ContentScope contentScope, ContentReference contentReference, com.google.common.base.Optional<ContentMetadata> contentMetadata, InputStream inputStream, int inputStreamLength)
ContentInfo
and the content itself as InputStream
. The provided InputStream
will always be closed.contentScope
- the content scope.contentReference
- the content referencecontentMetadata
- the content meta datainputStream
- the content as input streaminputStreamLength
- the length of the input streamContentException
- if there is an error with the specified input stream or the content could not be addedIllegalArgumentException
- if the content provider id of the content info is not equal to the content provider's one or if the specified input stream or its length is
not validInputStream getContent(ContentScope contentScope, ContentReference contentReference)
ContentReference
is not taken into account.contentScope
- the content scopecontentReference
- the content reference of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content is not found for the specified content reference and scopeIllegalArgumentException
- if the content provider id of the content reference is not equal to the content provider's oneInputStream getContent(ContentScope contentScope, ContentReference contentReference, String version)
ContentReference
is not taken into account.contentScope
- the content scopecontentReference
- the content reference of the content to be returnedversion
- the version of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content or the specified version of it is not found for the specified content reference and scopeIllegalArgumentException
- if the content provider id of the content reference is not equal to the content provider's onecom.google.common.base.Optional<ContentMetadata> getContentMetadata(ContentScope contentScope, ContentReference contentReference)
ContentReference
is not taken into account.contentScope
- the content scopecontentReference
- the content reference of the content to be returnedContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content (and the content metadata) is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not validcom.google.common.base.Optional<ContentMetadata> getContentMetadata(ContentScope contentScope, ContentReference contentReference, String version)
ContentReference
is not taken into account.contentScope
- the content scopecontentReference
- the content reference of the content to be returnedversion
- the versionContentException
- if there is an error while retrieving the contentContentNotFoundException
- if the content (and the content metadata) is not found for the specified content referenceContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not validList<String> getContentVersions(ContentScope contentScope, ContentReference contentReference)
ContentReference
. The first entry of the list holds the first version and the last entry the last
one.contentScope
- the content scopecontentReference
- the content reference of the content versions to be returnedContentNotFoundException
- if no versions of the content is found for the specified content reference and scopeIllegalArgumentException
- if the content provider id of the content reference is not equal to the content provider's oneList<ContentReference> getContentReferences(ContentScope contentScope, ContentSourceId contentSourceId)
ContentSourceId
for the ContentScope
.
In case of a multi-versioned content reference, the last version is retrieved.contentScope
- the content scopecontentSourceId
- the content source idContentException
- if there is an error while retrieving the contentIllegalArgumentException
- if the content source id is null or undefinedcom.google.common.base.Optional<ContentReference> getContentReference(ContentScope contentScope, ContentReferenceId contentReferenceId)
ContentReferenceId
for the ContentScope
.
In case of a multi-versioned content reference, the last version is retrieved.contentScope
- the content scopecontentReferenceId
- the content reference idContentException
- if there is an error while retrieving the content referenceContentReference updateContent(ContentScope contentScope, ContentReference contentReference, InputStream inputStream, int inputStreamLength, com.google.common.base.Optional<ContentMetadata> contentMetadata)
ContentReference
with the specified InputStream
. A new ContentReference
will be returned with the new version set. The source
id and the version of the specified content reference are ignored. The source id set at the the creation of the content reference is used for the new reference. The provided
InputStream
will always be closed.contentScope
- the content scopecontentReference
- the content reference to be updatedinputStream
- the updated content as input streaminputStreamLength
- the length of the input streamcontentMetadata
- the optional content metadataContentException
- if there is an error with the specified input stream or the content could not be addedContentNotFoundException
- if the content to be updated is not found for the specified content reference and scopeIllegalArgumentException
- if the content provider id of the content reference is not equal to the content provider's one or if the specified input stream or its
length is not valid.ContentReference updateContent(ContentScope contentScope, ContentReference contentReference, InputStream inputStream, int inputStreamLength, com.google.common.base.Optional<ContentMetadata> contentMetadata, boolean overwrite)
ContentReference
with the specified InputStream
. A new ContentReference
will be returned with the new version set if the
overwrite flag is set to false. The same ContentReference will be returned if the overwrite flag is set to true. The source id and the version of the specified content
reference are ignored. The source id set at the the creation of the content reference is used for the new reference. The provided InputStream
will always be closed.contentScope
- the content scopecontentReference
- the content reference to be updatedinputStream
- the updated content as input streaminputStreamLength
- the length of the input streamcontentMetadata
- the optional content metadataoverwrite
- true if the content that is about to be updated shall be overwritten, otherwise falseContentException
- if there is an error with the specified input stream or the content could not be addedContentNotFoundException
- if the content to be updated is not found for the specified content reference and scopeIllegalArgumentException
- if the content scope is not valid or if the content provider id of the content reference is not equal to the content provider's one or if
the specified input stream or its length is not valid.void updateContentMetadata(ContentScope contentScope, ContentReference contentReference, com.google.common.base.Optional<ContentMetadata> contentMetadata)
contentScope
- the content scopecontentReference
- the content referencecontentMetadata
- the content metadataContentException
- if there is an error updating the content metadataContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference is not valid or if the provided content metadata object size field is not a non-zero positive numbervoid setContentSourceId(ContentScope contentScope, ContentReference contentReference, ContentSourceId contentSourceId)
ContentSourceId
for a selected ContentReference
. All the versions of the content reference are updated.contentScope
- the content scopecontentReference
- the content referencecontentSourceId
- the content source idContentException
- if there is an error updating the content source idContentProviderNotFoundException
- if the content provider with the content provider id of the content reference is not foundIllegalArgumentException
- if the content reference or the content source id are not validvoid deleteContent(ContentScope contentScope)
ContentScope
. CAUTION: This method is very destructive. All the configured content providers are
called to delete the content. This method is intended only for maintenance purposes.ContentException
- if there is an error deleting the contentint deleteContent(ContentScope contentScope, ContentReference contentReference)
ContentReference
such that the passed in ContentReference
cannot be used anymore to retrieve content. If the last
content reference of a scope is deleted, the scope itself will not be considered valid anymore.contentScope
- the content scopecontentReference
- the content reference to be deletedContentException
- if there is an error while deleting the contentContentNotFoundException
- if the content is not found for the specified content reference and scopeIllegalArgumentException
- if the content reference or the content provider are not valid of if the content provider id of the content reference is not equal to the
content provider's onevoid deleteContent(ContentScope contentScope, ContentReference contentReference, String version)
ContentReference
such that the passed in ContentReference
cannot be used anymore to retrieve content with that
version. If all content versions are deleted the whole content gets deleted (same as deleteContent(ContentScope, ContentReference)
). If the last content reference
of a scope is deleted, the scope itself will not be considered valid anymore.contentScope
- the content scopecontentReference
- the content reference to be deletedversion
- the version of the content to be deletedContentException
- if there is an error while deleting the version of the contentContentNotFoundException
- if the content or the specified version of it is not found for the specified content reference and scopeIllegalArgumentException
- if the content scope or the content reference or the version are not valid or if the content provider id of the content reference is not
equal to the content provider's oneList<ContentReference> deleteContent(ContentScope contentScope, ContentSourceId contentSourceId)
ContentSourceId
for the ContentScope
.contentScope
- the content scopecontentSourceId
- the content source idContentException
- if there is an error deleting the contentIllegalArgumentException
- if the arguments are null or the content source id is ContentSourceId.UNDEFINED
void processContent(ContentScope contentScope, ContentProcessor contentProcessor)
contentProcessor
- content processor to process contentCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.