org.wso2.registry
Interface Registry

All Known Implementing Classes:
InMemoryRegistry, JDBCRegistry, SecureRegistry

public interface Registry

API for the Registry. Java applications should use this API to access the registry.


Method Summary
 void 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 delete(java.lang.String path)
          Deletes the resource in the given path.
 Resource executeQuery(java.lang.String path, java.lang.Object[] parameters)
          Executes a custom query defined by users.
 Resource get(java.lang.String path)
          Returns the resource in the given path.
 float getAverageRating(java.lang.String resourcePath)
          Returns the avarage rating for the given resource.
 Comment[] getComments(java.lang.String resourcePath)
          Retruns all comments for the given resource.
 LogEntry[] getLogs(java.lang.String resourcePath, java.lang.String userName, java.util.Date from, java.util.Date to)
          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 the resources, which are tagged using 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)
          Returns the paths of the versions of the resource located at the given path.
 void put(java.lang.String path, Resource resource)
          Adds or updates resources in the registry.
 void rateResource(java.lang.String resourcePath, int rating)
          Rates the given resource.
 boolean resourceExists(java.lang.String path)
          Check whether a resource exist in the given path
 void restoreVersion(java.lang.String versionPath)
          Reverts a resource to a given version.
 

Method Detail

get

Resource get(java.lang.String path)
             throws RegistryException
Returns the resource in the 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

resourceExists

boolean resourceExists(java.lang.String path)
                       throws RegistryException
Check whether a resource exist in the given path

Parameters:
path - Path of the resource to be checked
Returns:
true if a resource exist in the given path, false otherwise.
Throws:
RegistryException - if an error occurs

put

void put(java.lang.String path,
         Resource resource)
         throws RegistryException
Adds or updates resources in the registry. If there is no resource in the given path, resource is added. If a resource already exist in the given path, it will be replaced with the new resource.

Parameters:
path - Path of the new resource
resource - Resource instance for the new resource
Throws:
RegistryException - is thrown if the storage exception is encountered.

delete

void delete(java.lang.String path)
            throws RegistryException
Deletes the resource in the given path. If the path refers to a directory, all child resources of the directory will also be deleted.

Parameters:
path - Path of the resource to be deleted.
Throws:
RegistryException - is thrown depending on the implementation.

getVersions

java.lang.String[] getVersions(java.lang.String path)
                               throws RegistryException
Returns the paths of the 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:
Paths of versions
Throws:
RegistryException

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

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 the resources, which are tagged using the given tag.

Parameters:
tag - Tag
Returns:
Resource paths
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.

addComment

void 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.
Throws:
RegistryException - is thrown if a resource does not exist in the given path.

getComments

Comment[] getComments(java.lang.String resourcePath)
                      throws RegistryException
Retruns all comments for the given resource.

Parameters:
resourcePath - Path of the resource.
Returns:
Array of Comment objects.
Throws:
RegistryException - if an error occurs

rateResource

void rateResource(java.lang.String resourcePath,
                  int rating)
                  throws RegistryException
Rates the given resource.

Parameters:
resourcePath - Path of the resource.
rating - rating value between 1 and 5.
Throws:
RegistryException - is thrown if a resource does not exist in the given path.

getAverageRating

float getAverageRating(java.lang.String resourcePath)
                       throws RegistryException
Returns the avarage 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

executeQuery

Resource executeQuery(java.lang.String path,
                      java.lang.Object[] parameters)
                      throws RegistryException
Executes a custom query defined by users. Returned RowSet contains fields of tables specified by the custom query.

Parameters:
path - Path of the query to execute.
parameters - Query parameters.
Returns:
RowSet containing the fields specified in the query.
Throws:
RegistryException - depends on the implementation.

getLogs

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

Parameters:
resourcePath - If given, only the logs related to the resource path is returned. If null, logs for all resources 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.
Returns:
Array of LogEntry objects representing the logs
Throws:
RegistryException


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