Package com.adobe.granite.comments
Interface CommentingProvider
- All Known Implementing Classes:
AbstractCommentingProvider
A
CommentingProvider represents a "configuration" used by the CommentManager service to create
and store Comments and CommentCollections. 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: - Adapt a target resource to any of the supported comment collections
- Adapt an actual comment collection resource to a supported comment collection
- Adapt an actual comment resource to a supported comment
- Target (e.g. /content/geometrixx/en): resource.adaptTo(CommentCollection.class)
- Collection Resource (e.g. /content/geometrixx/en/jcr:content/comments): resource.adaptTo(CommentCollection.class)
- Comment Resource (e.g. /content/geometrixx/en/jcr:content/comments/my_comment): resource.adaptTo(Comment.class)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<C extends CommentCollection>
CcreateCollection(Resource target, Class<C> collectionType) <C extends CommentCollection>
CgetCollection(Resource target, Class<C> collectionType)
-
Field Details
-
PROPERTY_COLLECTION_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for collections.- See Also:
-
PROPERTY_COMMENT_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for comments.- See Also:
-
-
Method Details
-
getCollection
- Type Parameters:
C- A collection type, extendingCommentCollection.- Parameters:
target- The target the collection belongs to.collectionType- The type of the collection.- Returns:
- An existing collection object of the given type, or
nullif no collection exists. - Throws:
CommentException- If target does not have collection of givencollectionType.
-
createCollection
- Type Parameters:
C- A collection type, extendingCommentCollection.- Parameters:
target- The target the collection belongs to.collectionType- The type of the collection.- Returns:
- A new collection object of the given type.
- Throws:
CommentException- If a collection already exists for on the target-specific root resource, or upon encountering an error persisting.
-