Package com.adobe.granite.comments
Interface CommentingProvider
- 
- All Known Implementing Classes:
 AbstractCommentingProvider
@ConsumerType public interface CommentingProviderACommentingProviderrepresents a "configuration" used by theCommentManagerservice to create and storeComments andCommentCollections. 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 theCommentManager. A provider also must announce the types of comments and collections it supports via the mandatory OSGi service propertiesPROPERTY_COMMENT_TYPESandPROPERTY_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 implementAdapterFactoryand 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 Modifier and Type Field Description static java.lang.StringPROPERTY_COLLECTION_TYPESThe name of the OSGi service property that holds an array of classes this provider supports for collections.static java.lang.StringPROPERTY_COMMENT_TYPESThe name of the OSGi service property that holds an array of classes this provider supports for comments. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C extends CommentCollection>
CcreateCollection(Resource target, java.lang.Class<C> collectionType)<C extends CommentCollection>
CgetCollection(Resource target, java.lang.Class<C> collectionType) 
 - 
 
- 
- 
Field Detail
- 
PROPERTY_COLLECTION_TYPES
static final java.lang.String PROPERTY_COLLECTION_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for collections.- See Also:
 - Constant Field Values
 
 
- 
PROPERTY_COMMENT_TYPES
static final java.lang.String PROPERTY_COMMENT_TYPES
The name of the OSGi service property that holds an array of classes this provider supports for comments.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getCollection
<C extends CommentCollection> C getCollection(Resource target, java.lang.Class<C> collectionType)
- 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
<C extends CommentCollection> C createCollection(Resource target, java.lang.Class<C> collectionType)
- 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.
 
 - 
 
 -