public interface ContentProvider extends Identifiable
Represents a content provider which is used to add, get, update and delete content. The content provider itself needs to check if it is able to resolve a given ContentReference
and if it supports versioning of the content.
Modifier and Type | Method and Description |
---|---|
void |
addContent(ContentScope contentScope,
ContentReference contentReference,
ContentMetadata contentMetadata,
org.springframework.core.io.Resource resource,
long 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,
String contentSourceId)
Deletes the content that is associated to the supplied ContentSourceId for the
ContentScope . |
org.springframework.core.io.Resource |
getContent(ContentScope contentScope,
ContentReference contentReference)
Returns the latest version of the content within the content scope.
|
org.springframework.core.io.Resource |
getContent(ContentScope contentScope,
ContentReference contentReference,
String version)
Returns the specified version of the content.
|
Optional<ContentMetadata> |
getContentMetadata(ContentScope contentScope,
ContentReference contentReference)
Returns the metadata of the latest version of the content.
|
Optional<ContentMetadata> |
getContentMetadata(ContentScope contentScope,
ContentReference contentReference,
String version)
Returns the metadata of the supplied version of the content.
|
Optional<ContentReference> |
getContentReference(ContentScope contentScope,
String contentReferenceId)
Gets the content reference associated to the supplied ContentReferenceId for the
ContentScope . |
List<ContentReference> |
getContentReferences(ContentScope contentScope,
String 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,
String 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,
org.springframework.core.io.Resource resource,
long inputStreamLength,
ContentMetadata contentMetadata)
Updates the specified
ContentReference with the specified InputStream . |
ContentReference |
updateContent(ContentScope contentScope,
ContentReference contentReference,
org.springframework.core.io.Resource inputStream,
long inputStreamLength,
ContentMetadata contentMetadata,
boolean overwrite)
Updates the specified
ContentReference with the specified InputStream . |
void |
updateContentMetadata(ContentScope contentScope,
ContentReference contentReference,
ContentMetadata contentMetadata)
Updates the content metadata.
|
getId
String getName()
Returns the name of the content provider.
boolean supportsVersioning()
Returns true if the content provider supports versioning, false otherwise.
boolean supports(ContentReference contentReference)
Returns true if the specified 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)
Creates a new ContentReference
for the specified ContentInfo
.
ContentInfo
void addContent(ContentScope contentScope, ContentReference contentReference, ContentMetadata contentMetadata, org.springframework.core.io.Resource resource, long inputStreamLength)
Add content with the specified 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 dataresource
- 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 validorg.springframework.core.io.Resource getContent(ContentScope contentScope, ContentReference contentReference)
Returns the latest version of the content within the content scope. The version of the specified 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 oneorg.springframework.core.io.Resource getContent(ContentScope contentScope, ContentReference contentReference, String version)
Returns the specified version of the content. The version of the specified 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 oneOptional<ContentMetadata> getContentMetadata(ContentScope contentScope, ContentReference contentReference)
Returns the metadata of the latest version of the content. The version of the specified 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 validOptional<ContentMetadata> getContentMetadata(ContentScope contentScope, ContentReference contentReference, String version)
Returns the metadata of the supplied version of the content. The version of the specified 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)
Returns a list with all versions of the content of the specified 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, String contentSourceId)
Gets a list of all the content references associated to the supplied 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 undefinedOptional<ContentReference> getContentReference(ContentScope contentScope, String contentReferenceId)
Gets the content reference associated to the supplied 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, org.springframework.core.io.Resource resource, long inputStreamLength, ContentMetadata contentMetadata)
Updates the specified 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 updatedresource
- 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, org.springframework.core.io.Resource inputStream, long inputStreamLength, ContentMetadata contentMetadata, boolean overwrite)
Updates the specified 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, ContentMetadata contentMetadata)
Updates the content metadata.
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, String contentSourceId)
Sets the 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)
Deletes all the content of the content provider for the supplied 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)
Deletes all versions of the specified 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)
Deletes a specific version of the specified 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, String contentSourceId)
Deletes the content that is associated to the supplied ContentSourceId for the ContentScope
.
contentScope
- the content scopecontentSourceId
- the content source idContentException
- if there is an error deleting the contentIllegalArgumentException
- if the arguments are nullvoid processContent(ContentScope contentScope, ContentProcessor contentProcessor)
Process all content in the given provider with the processor
contentProcessor
- content processor to process contentCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.