Interface CommentManager


  • @ProviderType
    public interface CommentManager
    The CommentManager provides facilities to manage (create, get or remove) CommentCollections. This manager is registered as an OSGi-service and can be obtained via this interface class from the service registry. The manager produces typed collections. The type-specific collections are produced by CommentingProviders. The manager binds available factories and uses them to instantiate collections based on the given collection type.
    • Method Detail

      • getCollection

        <C extends CommentCollection> C getCollection​(Resource target,
                                                      java.lang.Class<C> collectionType)
        Retrieve a CommentCollection for the given target. The collection is instantiated using the given collectionType, as provided by the type-specific CommentingProvider.
        Type Parameters:
        C - A collection type, extending CommentCollection.
        Parameters:
        target - The Resource representing the target for which to retrieve the comment collection.
        collectionType - The desired type of the collection.
        Returns:
        The collection, or null if no collection of the requested type is present.
        Throws:
        CommentException - If no CommentingProvider could be found for the given collectionType.
        java.lang.IllegalArgumentException - If either target or collectionType is null.
      • getOrCreateCollection

        <C extends CommentCollection> C getOrCreateCollection​(Resource target,
                                                              java.lang.Class<C> collectionType)
        Retrieve or - if none exists - create a CommentCollection for the given target. The collection is instantiated using the given collectionType, as provided by the type-specific CommentingProvider.
        Type Parameters:
        C - A collection type, extending CommentCollection.
        Parameters:
        target - The Resource representing the target for which to create or retrieve the comment collection.
        collectionType - The desired type of the collection.
        Returns:
        The collection.
        Throws:
        CommentException - Upon encountering an error during creation of a collection, or if the collection already exists, or if no CommentingProvider could be found for the given collectionType.
        java.lang.IllegalArgumentException - If either target or collectionType is null.
      • createCollection

        <C extends CommentCollection> C createCollection​(Resource target,
                                                         java.lang.Class<C> collectionType)
        Create a CommentCollection for the given target. The collection is instantiated using the given collectionType, as provided by the type-specific CommentingProvider.
        Type Parameters:
        C - A collection type, extending CommentCollection.
        Parameters:
        target - The Resource representing the target for which to create the comment collection.
        collectionType - The desired type of the collection.
        Returns:
        The newly created collection.
        Throws:
        CommentException - Upon encountering an error during creation of a collection, or if the collection already exists, or if no CommentingProvider could be found for the given collectionType.
        java.lang.IllegalArgumentException - If either target or collectionType is null.