org.wso2.registry
Interface Registry

All Superinterfaces:
CoreRegistry
All Known Implementing Classes:
InMemoryJDBCRegistry, InMemoryRegistry, JDBCRegistry, RemoteRegistry, SecureRegistry

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/versions/etc.


Method Summary
 java.lang.String addComment(java.lang.String resourcePath, Comment comment)
          Adds a comment to a resource.
 void applyTag(java.lang.String resourcePath, java.lang.String tag)
          Applies the given tag to the resource in the given path.
 void editComment(java.lang.String commentPath, java.lang.String text)
          Change the text of an existing comment.
 Resource executeQuery(java.lang.String path, java.util.Map parameters)
          Executes a custom query which lives at the given path in the Registry.
 float getAverageRating(java.lang.String resourcePath)
          Returns the average rating for the given resource.
 Comment[] getComments(java.lang.String resourcePath)
          Get all comments for the given resource.
 LogEntry[] getLogs(java.lang.String resourcePath, int action, java.lang.String userName, java.util.Date from, java.util.Date to, boolean recentFirst)
          Returns the logs of the activities occured in the registy.
 int getRating(java.lang.String path, java.lang.String userName)
          Returns the rating given to the specified resource by the given user
 TaggedResourcePath[] getResourcePathsWithTag(java.lang.String tag)
          Returns the paths of all Resources that are tagged with the given tag.
 Tag[] getTags(java.lang.String resourcePath)
          Returns all tags used for tagging the given resource.
 java.lang.String[] getVersions(java.lang.String path)
          Get a list of all versions of the resource located at the given path.
 java.lang.String importResource(java.lang.String suggestedPath, java.lang.String sourceURL, Resource metadata)
          Creates a resource by fetching the resource content from the given URL.
 void rateResource(java.lang.String resourcePath, int rating)
          Rate the given resource.
 void removeTag(java.lang.String path, java.lang.String tag)
          Removes a tag on a resource.
 java.lang.String rename(java.lang.String currentPath, java.lang.String newPath)
          Move or rename a resource in the registry.
 void restoreVersion(java.lang.String versionPath)
          Reverts a resource to a given version.
 
Methods inherited from interface org.wso2.registry.CoreRegistry
delete, get, put, resourceExists
 

Method Detail

importResource

java.lang.String importResource(java.lang.String suggestedPath,
                                java.lang.String sourceURL,
                                Resource metadata)
                                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
metadata - a template Resource
Returns:
actual path to the new resource
Throws:
RegistryException - if we couldn't get or store the new resource

rename

java.lang.String rename(java.lang.String currentPath,
                        java.lang.String newPath)
                        throws RegistryException
Move or rename 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 reosurce
Returns:
the actual path for the new resource
Throws:
RegistryException - if something went wrong

getVersions

java.lang.String[] getVersions(java.lang.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/myresource?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(java.lang.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

applyTag

void applyTag(java.lang.String resourcePath,
              java.lang.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(java.lang.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(java.lang.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(java.lang.String path,
               java.lang.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

java.lang.String addComment(java.lang.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(java.lang.String commentPath,
                 java.lang.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.

getComments

Comment[] getComments(java.lang.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(java.lang.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(java.lang.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(java.lang.String path,
              java.lang.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

Resource executeQuery(java.lang.String path,
                      java.util.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:
RowSet containing the fields specified in the query.
Throws:
RegistryException - depends on the implementation.

getLogs

LogEntry[] getLogs(java.lang.String resourcePath,
                   int action,
                   java.lang.String userName,
                   java.util.Date from,
                   java.util.Date to,
                   boolean recentFirst)
                   throws RegistryException
Returns the logs of the activities occured in the registy.

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.
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 occured 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 occured 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


Copyright © 2007 Apache Web Services Project. All Rights Reserved.