org.wso2.carbon.registry.core.ghostregistry
Class GhostRegistry

java.lang.Object
  extended by org.wso2.carbon.registry.core.ghostregistry.GhostRegistry
All Implemented Interfaces:
org.wso2.carbon.registry.api.CoreRegistry, org.wso2.carbon.registry.api.Registry, TransactionManager

public class GhostRegistry
extends Object
implements Registry

This implements the Ghost lazy loading pattern for the Registry. An actual registry instance will not be created until first access.


Constructor Summary
GhostRegistry(org.wso2.carbon.registry.api.RegistryService registryService, int tenantId, org.wso2.carbon.context.RegistryType registryType)
           
 
Method Summary
 boolean addAspect(String name, Aspect aspect)
          Add aspect by passing a name and the aspect object.
 void addAssociation(String sourcePath, String targetPath, String associationType)
          Adds an association stating that the resource at "associationPath" associate on the resource at "associationPath".
 String addComment(String resourcePath, Comment comment)
          Adds a comment to a resource.
 String addComment(String resourcePath, org.wso2.carbon.registry.api.Comment comment)
           
 void applyTag(String resourcePath, String tag)
          Applies the given tag to the resource in the given path.
 void associateAspect(String resourcePath, String aspect)
          Associate an Aspect with a resource.
 void beginTransaction()
          Start a new transaction
 void commitTransaction()
          Commit the currently active transaction
 String copy(String sourcePath, String targetPath)
          Copy a resource in the registry.
 void createLink(String path, String target)
          Create a symbolic link or mount a registry
 void createLink(String path, String target, String subTargetPath)
          Create a symbolic link or mount a registry
 void createVersion(String path)
          Creates a new version of the resource.
 void delete(String path)
          Deletes the resource at the given path.
 void dump(String path, Writer writer)
          Check out the given path as an xml.
 void editComment(String commentPath, String text)
          Change the text of an existing comment.
 Collection executeQuery(String path, Map parameters)
          Executes a custom query which lives at the given path in the Registry.
 Resource get(String path)
          Returns the resource at the given path.
 Collection get(String path, int start, int pageSize)
          Returns the Collection at the given path, with the content paginated according to the arguments.
 Association[] getAllAssociations(String resourcePath)
          Get all associations of the given resource.
 String[] getAspectActions(String resourcePath, String aspectName)
          Obtain a list of the available actions on a given resource for a given Aspect.
 Association[] getAssociations(String resourcePath, String associationType)
          Get all associations of the given resource for a give association type.
 String[] getAvailableAspects()
          Get a list of the available Aspects for this Registry
 float getAverageRating(String resourcePath)
          Returns the average rating for the given resource.
 Comment[] getComments(String resourcePath)
          Get all comments for the given resource.
 String getEventingServiceURL(String path)
          Gets the URL of the WS-Eventing Service.
 LogEntryCollection getLogCollection(String resourcePath, int action, String userName, Date from, Date to, boolean recentFirst)
          Deprecated. 
 LogEntry[] getLogs(String resourcePath, int action, String userName, Date from, Date to, boolean recentFirst)
          Returns the logs of the activities occurred in the registry.
 Resource getMetaData(String path)
          Returns the meta data of the resource at a given path.
 int getRating(String path, String userName)
          Returns the rating given to the specified resource by the given user
 RegistryContext getRegistryContext()
          Get the configuration for this Registry
 TaggedResourcePath[] getResourcePathsWithTag(String tag)
          Returns the paths of all Resources that are tagged with the given tag.
 Tag[] getTags(String resourcePath)
          Returns all tags used for tagging the given resource.
 String[] getVersions(String path)
          Get a list of all versions of the resource located at the given path.
 String importResource(String suggestedPath, String sourceURL, Resource resource)
          Creates a resource by fetching the resource content from the given URL.
 String importResource(String suggestedPath, String sourceURL, org.wso2.carbon.registry.api.Resource resource)
           
 void invokeAspect(String resourcePath, String aspectName, String action)
          This invokes an action on a specified Aspect, which must be associated with the Resource at the given path.
 void invokeAspect(String resourcePath, String aspectName, String action, Map<String,String> parameters)
          This invokes an action on a specified Aspect, which must be associated with the Resource at the given path.
 String move(String currentPath, String newPath)
          Move a resource in the registry.
 Collection newCollection()
          Creates a new collection.
 Resource newResource()
          Creates a new resource.
 String put(String suggestedPath, Resource resource)
          Adds or updates resources in the registry.
 String put(String suggestedPath, org.wso2.carbon.registry.api.Resource resource)
           
 void rateResource(String resourcePath, int rating)
          Rate the given resource.
 boolean removeAspect(String aspect)
          Remove the given aspect from registry context.
 void removeAssociation(String sourcePath, String targetPath, String associationType)
          To remove an association for a given resource
 void removeComment(String commentPath)
          Delete an existing comment.
 void removeLink(String path)
          Remove a symbolic link or mount point created
 void removeTag(String path, String tag)
          Removes a tag on a resource.
 boolean removeVersionHistory(String path, long snapshotId)
          Removes a given version history of a resource.
 String rename(String currentPath, String newName)
          Rename a resource in the registry.
 boolean resourceExists(String path)
          Check whether a resource exists at the given path
 void restore(String path, Reader reader)
          Check in the input axiom element into database.
 void restoreVersion(String versionPath)
          Reverts a resource to a given version.
 void rollbackTransaction()
          Rollback the currently active transaction
 Collection searchContent(String keywords)
          Search the content of resources
 void setEventingServiceURL(String path, String eventingServiceURL)
          Sets the URL of the WS-Eventing Service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GhostRegistry

public GhostRegistry(org.wso2.carbon.registry.api.RegistryService registryService,
                     int tenantId,
                     org.wso2.carbon.context.RegistryType registryType)
Method Detail

getMetaData

public Resource getMetaData(String path)
                     throws RegistryException
Description copied from interface: Registry
Returns the meta data of the resource at a given path.

Specified by:
getMetaData in interface org.wso2.carbon.registry.api.Registry
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

public String importResource(String suggestedPath,
                             String sourceURL,
                             Resource resource)
                      throws RegistryException
Description copied from interface: Registry
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

public String rename(String currentPath,
                     String newName)
              throws RegistryException
Description copied from interface: Registry
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.

Specified by:
rename in interface org.wso2.carbon.registry.api.Registry
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

public String move(String currentPath,
                   String newPath)
            throws RegistryException
Description copied from interface: Registry
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.

Specified by:
move in interface org.wso2.carbon.registry.api.Registry
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

public String copy(String sourcePath,
                   String targetPath)
            throws RegistryException
Description copied from interface: Registry
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.

Specified by:
copy in interface org.wso2.carbon.registry.api.Registry
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

public void createVersion(String path)
                   throws RegistryException
Description copied from interface: Registry
Creates a new version of the resource.

Specified by:
createVersion in interface org.wso2.carbon.registry.api.Registry
Parameters:
path - the resource path.
Throws:
RegistryException - if something went wrong.

getVersions

public String[] getVersions(String path)
                     throws RegistryException
Description copied from interface: Registry
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

Specified by:
getVersions in interface org.wso2.carbon.registry.api.Registry
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

public void restoreVersion(String versionPath)
                    throws RegistryException
Description copied from interface: Registry
Reverts a resource to a given version.

Specified by:
restoreVersion in interface org.wso2.carbon.registry.api.Registry
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

public void addAssociation(String sourcePath,
                           String targetPath,
                           String associationType)
                    throws RegistryException
Description copied from interface: Registry
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.

Specified by:
addAssociation in interface org.wso2.carbon.registry.api.Registry
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

public void removeAssociation(String sourcePath,
                              String targetPath,
                              String associationType)
                       throws RegistryException
Description copied from interface: Registry
To remove an association for a given resource

Specified by:
removeAssociation in interface org.wso2.carbon.registry.api.Registry
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

public Association[] getAllAssociations(String resourcePath)
                                 throws RegistryException
Description copied from interface: Registry
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.

Specified by:
getAllAssociations in interface org.wso2.carbon.registry.api.Registry
Parameters:
resourcePath - Path of the resource to analyse associations.
Returns:
List of Association
Throws:
RegistryException - If something went wrong

getAssociations

public Association[] getAssociations(String resourcePath,
                                     String associationType)
                              throws RegistryException
Description copied from interface: Registry
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.

Specified by:
getAssociations in interface org.wso2.carbon.registry.api.Registry
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

public void applyTag(String resourcePath,
                     String tag)
              throws RegistryException
Description copied from interface: Registry
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.

Specified by:
applyTag in interface org.wso2.carbon.registry.api.Registry
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

public TaggedResourcePath[] getResourcePathsWithTag(String tag)
                                             throws RegistryException
Description copied from interface: Registry
Returns the paths of all Resources that are tagged with the given tag.

Specified by:
getResourcePathsWithTag in interface org.wso2.carbon.registry.api.Registry
Parameters:
tag - the tag to search for
Returns:
an array of TaggedResourcePaths
Throws:
RegistryException - if an error occurs

getTags

public Tag[] getTags(String resourcePath)
              throws RegistryException
Description copied from interface: Registry
Returns all tags used for tagging the given resource.

Specified by:
getTags in interface org.wso2.carbon.registry.api.Registry
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

public void removeTag(String path,
                      String tag)
               throws RegistryException
Description copied from interface: Registry
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.

Specified by:
removeTag in interface org.wso2.carbon.registry.api.Registry
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

public String addComment(String resourcePath,
                         Comment comment)
                  throws RegistryException
Description copied from interface: Registry
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

public void editComment(String commentPath,
                        String text)
                 throws RegistryException
Description copied from interface: Registry
Change the text of an existing comment.

Specified by:
editComment in interface org.wso2.carbon.registry.api.Registry
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

public void removeComment(String commentPath)
                   throws RegistryException
Description copied from interface: Registry
Delete an existing comment.

Specified by:
removeComment in interface org.wso2.carbon.registry.api.Registry
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

public Comment[] getComments(String resourcePath)
                      throws RegistryException
Description copied from interface: Registry
Get all comments for the given resource.

Specified by:
getComments in interface org.wso2.carbon.registry.api.Registry
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

public void rateResource(String resourcePath,
                         int rating)
                  throws RegistryException
Description copied from interface: Registry
Rate the given resource.

Specified by:
rateResource in interface org.wso2.carbon.registry.api.Registry
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

public float getAverageRating(String resourcePath)
                       throws RegistryException
Description copied from interface: Registry
Returns the average rating for the given resource. This is the average of all ratings done by all users for the given resource.

Specified by:
getAverageRating in interface org.wso2.carbon.registry.api.Registry
Parameters:
resourcePath - Path of the resource.
Returns:
Average rating between 1 and 5.
Throws:
RegistryException - if an error occurs

getRating

public int getRating(String path,
                     String userName)
              throws RegistryException
Description copied from interface: Registry
Returns the rating given to the specified resource by the given user

Specified by:
getRating in interface org.wso2.carbon.registry.api.Registry
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

public Collection executeQuery(String path,
                               Map parameters)
                        throws RegistryException
Description copied from interface: Registry
Executes a custom query which lives at the given path in the Registry.

Specified by:
executeQuery in interface org.wso2.carbon.registry.api.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.

getAvailableAspects

public String[] getAvailableAspects()
Description copied from interface: Registry
Get a list of the available Aspects for this Registry

Specified by:
getAvailableAspects in interface org.wso2.carbon.registry.api.Registry
Returns:
a String array containing available Aspect names

associateAspect

public void associateAspect(String resourcePath,
                            String aspect)
                     throws RegistryException
Description copied from interface: Registry
Associate an Aspect with a resource.

Specified by:
associateAspect in interface org.wso2.carbon.registry.api.Registry
Parameters:
resourcePath - Path of the resource
aspect - Name of the aspect
Throws:
RegistryException - If some thing went wrong while doing associating the phase

invokeAspect

public void invokeAspect(String resourcePath,
                         String aspectName,
                         String action)
                  throws RegistryException
Description copied from interface: Registry
This invokes an action on a specified Aspect, which must be associated with the Resource at the given path.

Specified by:
invokeAspect in interface org.wso2.carbon.registry.api.Registry
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

public String[] getAspectActions(String resourcePath,
                                 String aspectName)
                          throws RegistryException
Description copied from interface: Registry
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)

Specified by:
getAspectActions in interface org.wso2.carbon.registry.api.Registry
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

public Collection searchContent(String keywords)
                         throws RegistryException
Description copied from interface: Registry
Search the content of resources

Specified by:
searchContent in interface org.wso2.carbon.registry.api.Registry
Parameters:
keywords - keywords to look for
Returns:
the result set as a collection
Throws:
RegistryException - throws if the operation fail

createLink

public void createLink(String path,
                       String target)
                throws RegistryException
Description copied from interface: Registry
Create a symbolic link or mount a registry

Specified by:
createLink in interface org.wso2.carbon.registry.api.Registry
Parameters:
path - the mount path
target - the point to be mounted
Throws:
RegistryException - throws if the operation fail

createLink

public void createLink(String path,
                       String target,
                       String subTargetPath)
                throws RegistryException
Description copied from interface: Registry
Create a symbolic link or mount a registry

Specified by:
createLink in interface org.wso2.carbon.registry.api.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

public void removeLink(String path)
                throws RegistryException
Description copied from interface: Registry
Remove a symbolic link or mount point created

Specified by:
removeLink in interface org.wso2.carbon.registry.api.Registry
Parameters:
path - the mount path
Throws:
RegistryException - throws if the operation fail

restore

public void restore(String path,
                    Reader reader)
             throws RegistryException
Description copied from interface: Registry
Check in the input axiom element into database.

Specified by:
restore in interface org.wso2.carbon.registry.api.Registry
Parameters:
path - path to check in
reader - reader containing resource
Throws:
RegistryException - throws if the operation fail

dump

public void dump(String path,
                 Writer writer)
          throws RegistryException
Description copied from interface: Registry
Check out the given path as an xml.

Specified by:
dump in interface org.wso2.carbon.registry.api.Registry
Parameters:
path - path to check out
writer - writer to write the response
Throws:
RegistryException - throws if the operation fail

getEventingServiceURL

public String getEventingServiceURL(String path)
                             throws RegistryException
Description copied from interface: Registry
Gets the URL of the WS-Eventing Service.

Specified by:
getEventingServiceURL in interface org.wso2.carbon.registry.api.Registry
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

public void setEventingServiceURL(String path,
                                  String eventingServiceURL)
                           throws RegistryException
Description copied from interface: Registry
Sets the URL of the WS-Eventing Service.

Specified by:
setEventingServiceURL in interface org.wso2.carbon.registry.api.Registry
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

newResource

public Resource newResource()
                     throws RegistryException
Description copied from interface: CoreRegistry
Creates a new resource.

Specified by:
newResource in interface org.wso2.carbon.registry.api.CoreRegistry
Returns:
the created resource.
Throws:
RegistryException - if the operation failed.

newCollection

public Collection newCollection()
                         throws RegistryException
Description copied from interface: CoreRegistry
Creates a new collection.

Specified by:
newCollection in interface org.wso2.carbon.registry.api.CoreRegistry
Returns:
the created collection.
Throws:
RegistryException - if the operation failed.

get

public Resource get(String path)
             throws RegistryException
Description copied from interface: CoreRegistry
Returns the resource at the given path.

Specified by:
get in interface org.wso2.carbon.registry.api.CoreRegistry
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

get

public Collection get(String path,
                      int start,
                      int pageSize)
               throws RegistryException
Description copied from interface: CoreRegistry
Returns the Collection at the given path, with the content paginated according to the arguments.

Specified by:
get in interface org.wso2.carbon.registry.api.CoreRegistry
Parameters:
path - the path of the collection. MUST point to a collection!
start - the initial index of the child to return. If there are fewer children than the specified value, a RegistryException will be thrown.
pageSize - the maximum number of results to return
Returns:
a Collection containing the specified results in the content
Throws:
RegistryException - if the resource is not found, or if the path does not reference a Collection, or if the start index is greater than the number of children.

resourceExists

public boolean resourceExists(String path)
                       throws RegistryException
Description copied from interface: CoreRegistry
Check whether a resource exists at the given path

Specified by:
resourceExists in interface org.wso2.carbon.registry.api.CoreRegistry
Parameters:
path - Path of the resource to be checked
Returns:
true if a resource exists at the given path, false otherwise.
Throws:
RegistryException - if an error occurs

delete

public void delete(String path)
            throws RegistryException
Description copied from interface: CoreRegistry
Deletes the resource at the given path. If the path refers to a directory, all child resources of the directory will also be deleted.

Specified by:
delete in interface org.wso2.carbon.registry.api.CoreRegistry
Parameters:
path - Path of the resource to be deleted.
Throws:
RegistryException - is thrown depending on the implementation.

put

public String put(String suggestedPath,
                  Resource resource)
           throws RegistryException
Description copied from interface: CoreRegistry
Adds or updates resources in the registry. If there is no resource at the given path, resource is added. If a resource already exist at the given path, it will be replaced with the new resource.

Parameters:
suggestedPath - the path which we'd like to use for the new resource.
resource - Resource instance for the new resource
Returns:
the actual path that the server chose to use for our Resource
Throws:
RegistryException - is thrown depending on the implementation.

put

public String put(String suggestedPath,
                  org.wso2.carbon.registry.api.Resource resource)
           throws org.wso2.carbon.registry.api.RegistryException
Specified by:
put in interface org.wso2.carbon.registry.api.CoreRegistry
Throws:
org.wso2.carbon.registry.api.RegistryException

beginTransaction

public void beginTransaction()
                      throws RegistryException
Description copied from interface: TransactionManager
Start a new transaction

Specified by:
beginTransaction in interface TransactionManager
Throws:
RegistryException - If an error occurs while starting a transaction

commitTransaction

public void commitTransaction()
                       throws RegistryException
Description copied from interface: TransactionManager
Commit the currently active transaction

Specified by:
commitTransaction in interface TransactionManager
Throws:
RegistryException - If an error occurs while committing a transaction

rollbackTransaction

public void rollbackTransaction()
                         throws RegistryException
Description copied from interface: TransactionManager
Rollback the currently active transaction

Specified by:
rollbackTransaction in interface TransactionManager
Throws:
RegistryException - If an error occurs while rolling back a transaction

addComment

public String addComment(String resourcePath,
                         org.wso2.carbon.registry.api.Comment comment)
                  throws org.wso2.carbon.registry.api.RegistryException
Specified by:
addComment in interface org.wso2.carbon.registry.api.Registry
Throws:
org.wso2.carbon.registry.api.RegistryException

importResource

public String importResource(String suggestedPath,
                             String sourceURL,
                             org.wso2.carbon.registry.api.Resource resource)
                      throws org.wso2.carbon.registry.api.RegistryException
Specified by:
importResource in interface org.wso2.carbon.registry.api.Registry
Throws:
org.wso2.carbon.registry.api.RegistryException

getLogs

public LogEntry[] getLogs(String resourcePath,
                          int action,
                          String userName,
                          Date from,
                          Date to,
                          boolean recentFirst)
                   throws RegistryException
Description copied from interface: Registry
Returns the logs of the activities occurred in the registry.

Specified by:
getLogs in interface org.wso2.carbon.registry.api.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

getLogCollection

@Deprecated
public LogEntryCollection getLogCollection(String resourcePath,
                                                      int action,
                                                      String userName,
                                                      Date from,
                                                      Date to,
                                                      boolean recentFirst)
                                    throws RegistryException
Deprecated. 

Description copied from interface: Registry
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:
LogEntryCollection representing collection of log entries
Throws:
RegistryException - if there is a problem
See Also:
Accepted values for action parameter

invokeAspect

public void invokeAspect(String resourcePath,
                         String aspectName,
                         String action,
                         Map<String,String> parameters)
                  throws RegistryException
Description copied from interface: Registry
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
parameters - Parameters to be used for the operation
Throws:
RegistryException - if the Aspect isn't associated with the Resource, or the action isn't valid, or an Aspect-specific problem occurs.

removeAspect

public boolean removeAspect(String aspect)
                     throws RegistryException
Description copied from interface: Registry
Remove the given aspect from registry context.

Parameters:
aspect - the name of the aspect to be removed
Returns:
return true if the operation finished successful, false otherwise.
Throws:
RegistryException - throws if the operation fail

addAspect

public boolean addAspect(String name,
                         Aspect aspect)
                  throws RegistryException
Description copied from interface: Registry
Add aspect by passing a name and the aspect object.

Parameters:
name - the name of the aspect to be added
aspect - the name of the aspect object to be added to registry context
Returns:
return true if the operation finished successful, false otherwise.
Throws:
RegistryException - throws if the operation fail

removeVersionHistory

public boolean removeVersionHistory(String path,
                                    long snapshotId)
                             throws RegistryException
Description copied from interface: Registry
Removes a given version history of a resource.

Parameters:
path - the path of the resource
Returns:
return true if the operation finished successful, false otherwise.
Throws:
RegistryException - throws if the operation fails.

getRegistryContext

public RegistryContext getRegistryContext()
Description copied from interface: Registry
Get the configuration for this Registry

Returns:
the currently active RegistryContext, or null


Copyright © 2013 WSO2 Inc. All Rights Reserved.