@ConsumerType public interface CommentingProvider
CommentingProvider
represents a "configuration" used by the CommentManager
service to create
and store Comment
s and CommentCollection
s. In this way, multiple comment collections for the same
target can be supported (e.g. target-located author-comments/annotations vs. user-generated comments stored in
/content/usergenerated). A provider operates on a target-specific resource. Providers must register themselves as
OSGi-components and service on this interface in order for them to be automatically picked up by the CommentManager
. A provider also must announce the types of comments and collections it supports via the mandatory
OSGi service properties PROPERTY_COMMENT_TYPES
and PROPERTY_COLLECTION_TYPES
. A provider announces
the supported types like this:
\@Properties({ \@Property(name = CommentingProvider.PROPERTY_COMMENT_TYPES, classValue = MyComment.class), \@Property(name = CommentingProvider.PROPERTY_COLLECTION_TYPES, classValue = MyCommentCollection.class) })Implementations should implement
AdapterFactory
and provide the following adaptations for their respectively
supported comment and collection types: Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_COLLECTION_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for collections.
|
static java.lang.String |
PROPERTY_COMMENT_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for comments.
|
Modifier and Type | Method and Description |
---|---|
<C extends CommentCollection> |
createCollection(Resource target,
java.lang.Class<C> collectionType)
|
<C extends CommentCollection> |
getCollection(Resource target,
java.lang.Class<C> collectionType)
|
static final java.lang.String PROPERTY_COLLECTION_TYPES
static final java.lang.String PROPERTY_COMMENT_TYPES
<C extends CommentCollection> C getCollection(Resource target, java.lang.Class<C> collectionType)
C
- A collection type, extending CommentCollection
.target
- The target the collection belongs to.collectionType
- The type of the collection.null
if no collection exists.CommentException
- If target does not have collection of given collectionType
.<C extends CommentCollection> C createCollection(Resource target, java.lang.Class<C> collectionType)
C
- A collection type, extending CommentCollection
.target
- The target the collection belongs to.collectionType
- The type of the collection.CommentException
- If a collection already exists for on the target-specific root resource, or upon
encountering an error persisting.Copyright © 2010 - 2020 Adobe. All Rights Reserved