Interface Registry

  • All Superinterfaces:
    CoreRegistry

    public interface Registry
    extends CoreRegistry
    This is the "Full" Registry interface. It contains not only the get/put behavior from CoreRegistry, but also APIs which control tags, comments, ratings and versions.
    • Method Detail

      • getMetaData

        Resource getMetaData​(String path)
                      throws RegistryException
        Returns the meta data of the resource at a given path.
        Parameters:
        path - Path of the resource. e.g. /project1/server/deployment.xml
        Returns:
        Resource instance
        Throws:
        RegistryException - is thrown if the resource is not in the registry
      • importResource

        String importResource​(String suggestedPath,
                              String sourceURL,
                              Resource resource)
                       throws RegistryException
        Creates a resource by fetching the resource content from the given URL.
        Parameters:
        suggestedPath - path where we'd like to add the new resource. Although this path is specified by the caller of the method, resource may not be actually added at this path.
        sourceURL - where to fetch the resource content
        resource - a template Resource
        Returns:
        actual path to the new resource
        Throws:
        RegistryException - if we couldn't get or store the new resource
      • rename

        String rename​(String currentPath,
                      String newName)
               throws RegistryException
        Rename a resource in the registry. This is equivalent to 1) delete the resource, then 2) add the resource by the new name. The operation is atomic, so if it fails the old resource will still be there.
        Parameters:
        currentPath - current path of the resource
        newName - the name of the new resource
        Returns:
        the actual path for the new resource
        Throws:
        RegistryException - if something went wrong
      • move

        String move​(String currentPath,
                    String newPath)
             throws RegistryException
        Move a resource in the registry. This is equivalent to 1) delete the resource, then 2) add the resource to the new location. The operation is atomic, so if it fails the old resource will still be there.
        Parameters:
        currentPath - current path of the resource
        newPath - where we'd like to move the resource
        Returns:
        the actual path for the new resource
        Throws:
        RegistryException - if something went wrong
      • copy

        String copy​(String sourcePath,
                    String targetPath)
             throws RegistryException
        Copy a resource in the registry. The operation is atomic, so if the resource was a collection, all children and the collection would be copied in a single-go.
        Parameters:
        sourcePath - current path of the resource
        targetPath - where we'd like to copy the resource
        Returns:
        the actual path for the new resource
        Throws:
        RegistryException - if something went wrong
      • createVersion

        void createVersion​(String path)
                    throws RegistryException
        Creates a new version of the resource.
        Parameters:
        path - the resource path.
        Throws:
        RegistryException - if something went wrong.
      • getVersions

        String[] getVersions​(String path)
                      throws RegistryException
        Get a list of all versions of the resource located at the given path. Version paths are returned in the form /projects/resource?v=12
        Parameters:
        path - path of a current version of a resource
        Returns:
        a String array containing the individual paths of versions
        Throws:
        RegistryException - if there is an error
      • restoreVersion

        void restoreVersion​(String versionPath)
                     throws RegistryException
        Reverts a resource to a given version.
        Parameters:
        versionPath - path of the version to be reverted. It is not necessary to provide the path of the resource as it can be derived from the version path.
        Throws:
        RegistryException - if there is an error
      • addAssociation

        void addAssociation​(String sourcePath,
                            String targetPath,
                            String associationType)
                     throws RegistryException
        Adds an association stating that the resource at "associationPath" associate on the resource at "associationPath". Paths may be the resource paths of the current versions or paths of the old versions. If a path refers to the current version, it should contain the path in the form /c1/c2/r1. If it refers to an old version, it should be in the form /c1/c2/r1?v=2.
        Parameters:
        sourcePath - Path of the source resource
        targetPath - Path of the target resource
        associationType - Type of the association
        Throws:
        RegistryException - Depends on the implementation
      • removeAssociation

        void removeAssociation​(String sourcePath,
                               String targetPath,
                               String associationType)
                        throws RegistryException
        To remove an association for a given resource
        Parameters:
        sourcePath - Path of the source resource
        targetPath - Path of the target resource
        associationType - Type of the association
        Throws:
        RegistryException - Depends on the implementation
      • getAllAssociations

        Association[] getAllAssociations​(String resourcePath)
                                  throws RegistryException
        Get all associations of the given resource. This is a chain of association starting from the given resource both upwards (source to destination) and downwards (destination to source). T his is useful to analyse how changes to other resources would affect the given resource.
        Parameters:
        resourcePath - Path of the resource to analyse associations.
        Returns:
        List of Association
        Throws:
        RegistryException - If something went wrong
      • getAssociations

        Association[] getAssociations​(String resourcePath,
                                      String associationType)
                               throws RegistryException
        Get all associations of the given resource for a give association type. This is a chain of association starting from the given resource both upwards (source to destination) and downwards (destination to source). T his is useful to analyse how changes to other resources would affect the given resource.
        Parameters:
        resourcePath - Path of the resource to analyse associations.
        associationType - Type of the association , that could be dependency, or some other type.
        Returns:
        List of Association
        Throws:
        RegistryException - If something went wrong
      • applyTag

        void applyTag​(String resourcePath,
                      String tag)
               throws RegistryException
        Applies the given tag to the resource in the given path. If the given tag is not defined in the registry, it will be defined.
        Parameters:
        resourcePath - Path of the resource to be tagged.
        tag - Tag. Any string can be used for the tag.
        Throws:
        RegistryException - is thrown if a resource does not exist in the given path.
      • getResourcePathsWithTag

        TaggedResourcePath[] getResourcePathsWithTag​(String tag)
                                              throws RegistryException
        Returns the paths of all Resources that are tagged with the given tag.
        Parameters:
        tag - the tag to search for
        Returns:
        an array of TaggedResourcePaths
        Throws:
        RegistryException - if an error occurs
      • getTags

        Tag[] getTags​(String resourcePath)
               throws RegistryException
        Returns all tags used for tagging the given resource.
        Parameters:
        resourcePath - Path of the resource
        Returns:
        Tags tag names
        Throws:
        RegistryException - is thrown if a resource does not exist in the given path.
      • removeTag

        void removeTag​(String path,
                       String tag)
                throws RegistryException
        Removes a tag on a resource. If the resource at the path is owned by the current user, all taggings done using the given tag will be removed. If the resource is not owned by the current user, only the tagging done by the current user will be removed.
        Parameters:
        path - Resource path tagged with the given tag.
        tag - Name of the tag to be removed.
        Throws:
        RegistryException - if there's a problem
      • addComment

        String addComment​(String resourcePath,
                          Comment comment)
                   throws RegistryException
        Adds a comment to a resource.
        Parameters:
        resourcePath - Path of the resource to add the comment.
        comment - Comment instance for the new comment.
        Returns:
        the path of the new comment.
        Throws:
        RegistryException - is thrown if a resource does not exist in the given path.
      • editComment

        void editComment​(String commentPath,
                         String text)
                  throws RegistryException
        Change the text of an existing comment.
        Parameters:
        commentPath - path to comment resource ("..foo/r1;comment:1")
        text - new text for the comment.
        Throws:
        RegistryException - Registry implementations may handle exceptions and throw RegistryException if the exception has to be propagated to the client.
      • removeComment

        void removeComment​(String commentPath)
                    throws RegistryException
        Delete an existing comment.
        Parameters:
        commentPath - path to comment resource ("..foo/r1;comment:1")
        Throws:
        RegistryException - Registry implementations may handle exceptions and throw RegistryException if the exception has to be propagated to the client.
      • getComments

        Comment[] getComments​(String resourcePath)
                       throws RegistryException
        Get all comments for the given resource.
        Parameters:
        resourcePath - path of the resource.
        Returns:
        an array of Comment objects.
        Throws:
        RegistryException - Registry implementations may handle exceptions and throw RegistryException if the exception has to be propagated to the client.
      • rateResource

        void rateResource​(String resourcePath,
                          int rating)
                   throws RegistryException
        Rate the given resource.
        Parameters:
        resourcePath - Path of the resource.
        rating - Rating value between 1 and 5.
        Throws:
        RegistryException - Registry implementations may handle exceptions and throw RegistryException if the exception has to be propagated to the client.
      • getAverageRating

        float getAverageRating​(String resourcePath)
                        throws RegistryException
        Returns the average rating for the given resource. This is the average of all ratings done by all users for the given resource.
        Parameters:
        resourcePath - Path of the resource.
        Returns:
        Average rating between 1 and 5.
        Throws:
        RegistryException - if an error occurs
      • getRating

        int getRating​(String path,
                      String userName)
               throws RegistryException
        Returns the rating given to the specified resource by the given user
        Parameters:
        path - Path of the resource
        userName - username of the user
        Returns:
        rating given by the given user
        Throws:
        RegistryException - if there is a problem
      • executeQuery

        Collection executeQuery​(String path,
                                Map parameters)
                         throws RegistryException
        Executes a custom query which lives at the given path in the Registry.
        Parameters:
        path - Path of the query to execute.
        parameters - a Map of query parameters (name -> value)
        Returns:
        a Collection containing any resource paths which match the query
        Throws:
        RegistryException - depends on the implementation.
      • getLogs

        Activity[] getLogs​(String resourcePath,
                           int action,
                           String userName,
                           Date from,
                           Date to,
                           boolean recentFirst)
                    throws RegistryException
        Returns the logs of the activities occurred in the registry.
        Parameters:
        resourcePath - If given, only the logs related to the resource path will be returned. If null, logs for all resources will be returned.
        action - Only the logs pertaining to this action will be returned. For acceptable values, see LogEntry.
        userName - If given, only the logs for activities done by the given user will be returned. If null, logs for all users will be returned.
        from - If given, logs for activities occurred after the given date will be returned. If null, there will not be a bound for the starting date.
        to - If given, logs for activities occurred before the given date will be returned. If null, there will not be a bound for the ending date.
        recentFirst - If true, returned activities will be most-recent first. If false, returned activities will be oldest first.
        Returns:
        Array of LogEntry objects representing the logs
        Throws:
        RegistryException - if there is a problem
        See Also:
        Accepted values for action parameter
      • getAvailableAspects

        String[] getAvailableAspects()
        Get a list of the available Aspects for this Registry
        Returns:
        a String array containing available Aspect names
      • associateAspect

        void associateAspect​(String resourcePath,
                             String aspect)
                      throws RegistryException
        Associate an Aspect with a resource.
        Parameters:
        resourcePath - Path of the resource
        aspect - Name of the aspect
        Throws:
        RegistryException - If some thing went wrong while doing associating the phase
      • invokeAspect

        void invokeAspect​(String resourcePath,
                          String aspectName,
                          String action)
                   throws RegistryException
        This invokes an action on a specified Aspect, which must be associated with the Resource at the given path.
        Parameters:
        resourcePath - Path of the resource
        aspectName - Name of the aspect
        action - Which action was selected - actions are aspect-specific
        Throws:
        RegistryException - if the Aspect isn't associated with the Resource, or the action isn't valid, or an Aspect-specific problem occurs.
      • getAspectActions

        String[] getAspectActions​(String resourcePath,
                                  String aspectName)
                           throws RegistryException
        Obtain a list of the available actions on a given resource for a given Aspect. The Aspect must be associated with the Resource (@see associateAspect). The actions are determined by asking the Aspect itself, so they may change depending on the state of the Resource, the user who's asking, etc)
        Parameters:
        resourcePath - path of the Resource
        aspectName - name of the Aspect to query for available actions
        Returns:
        a String[] of action names
        Throws:
        RegistryException - if the Aspect isn't associated or an Aspect-specific problem occurs
      • searchContent

        Collection searchContent​(String keywords)
                          throws RegistryException
        Search the content of resources
        Parameters:
        keywords - keywords to look for
        Returns:
        the result set as a collection
        Throws:
        RegistryException - throws if the operation fail
      • createLink

        void createLink​(String path,
                        String target)
                 throws RegistryException
        Create a symbolic link or mount a registry
        Parameters:
        path - the mount path
        target - the point to be mounted
        Throws:
        RegistryException - throws if the operation fail
      • createLink

        void createLink​(String path,
                        String target,
                        String subTargetPath)
                 throws RegistryException
        Create a symbolic link or mount a registry
        Parameters:
        path - the mount path
        target - the point to be mounted
        subTargetPath - sub path in the remote instance to be mounted
        Throws:
        RegistryException - throws if the operation fail
      • removeLink

        void removeLink​(String path)
                 throws RegistryException
        Remove a symbolic link or mount point created
        Parameters:
        path - the mount path
        Throws:
        RegistryException - throws if the operation fail
      • restore

        void restore​(String path,
                     Reader reader)
              throws RegistryException
        Check in the input axiom element into database.
        Parameters:
        path - path to check in
        reader - reader containing resource
        Throws:
        RegistryException - throws if the operation fail
      • dump

        void dump​(String path,
                  Writer writer)
           throws RegistryException
        Check out the given path as an xml.
        Parameters:
        path - path to check out
        writer - writer to write the response
        Throws:
        RegistryException - throws if the operation fail
      • getEventingServiceURL

        String getEventingServiceURL​(String path)
                              throws RegistryException
        Gets the URL of the WS-Eventing Service.
        Parameters:
        path - the path to which the WS-Eventing Service URL is required
        Returns:
        the URL of the WS-Eventing Service
        Throws:
        RegistryException - throws if the operation fail
      • setEventingServiceURL

        void setEventingServiceURL​(String path,
                                   String eventingServiceURL)
                            throws RegistryException
        Sets the URL of the WS-Eventing Service.
        Parameters:
        path - the path to which the WS-Eventing Service URL is associated
        eventingServiceURL - the URL of the WS-Eventing Service
        Throws:
        RegistryException - throws if the operation fail