|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wso2.registry.jdbc.BasicRegistry
public class BasicRegistry
This class contains JDBC based implementations of all Registry API methods. This invokes handlers through the HandlerManager for all the methods that allow handlers. Once the handler invocation is complete and if the processing is not completed, it handles the request using the generic procedure. For the methods that do not allow handlers, it simply processes the request using the database layer. A valid database connection has to be available in the Transaction's thread local varaible, when invoking methods of this class. Mehtods of this class neither start nor commit the transactions when performing the operations. The caller of this class should manage database transactions outside this class. There is only one instance of this class per registry instance. This instance can be invoked by many threads. So it has to be thread safe.
Field Summary | |
---|---|
static org.apache.commons.logging.Log |
log
|
Constructor Summary | |
---|---|
BasicRegistry(RegistryContext registryContext,
Repository repository,
VersionRepository versionRepository,
QueryProcessorManager queryProcessorManager)
Instantiates the BasicRegistry instance. |
Method Summary | |
---|---|
void |
addAssociation(java.lang.String sourcePath,
java.lang.String targetPath,
java.lang.String associationType)
Adds an association stating that the resource at "associationPath" associate on the resource at "associationPath". |
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 |
associateAspect(java.lang.String resourcePath,
java.lang.String name)
Associate an Aspect with a resource. |
void |
beginTransaction()
BasicRegistry does not implement transaction related methods as transactions has to be handled outside of the BasicRegistry. |
void |
commitTransaction()
BasicRegistry does not implement transaction related methods as transactions has to be handled outside of the BasicRegistry. |
java.lang.String |
copy(java.lang.String sourcePath,
java.lang.String targetPath)
|
void |
createVersion(java.lang.String path)
|
void |
delete(java.lang.String path)
Deletes the resource in the given path. |
void |
editComment(java.lang.String commentPath,
java.lang.String text)
Change the text of an existing comment. |
Collection |
executeQuery(java.lang.String path,
java.util.Map parameters)
Executes a custom query which lives at the given path in the Registry. |
Resource |
get(java.lang.String path)
Returns the resource in the given path. |
Collection |
get(java.lang.String path,
int start,
int pageSize)
Retrives a collection from the registry. |
Association[] |
getAllAssociations(java.lang.String resourcePath)
Get all associations of the given resource. |
java.lang.String[] |
getAspectActions(java.lang.String resourcePath,
java.lang.String aspectName)
Obtain a list of the available actions on a given resource for a given Aspect. |
Association[] |
getAssociations(java.lang.String resourcePath,
java.lang.String associationType)
Get all associations of the given resource for a give association type. |
java.lang.String[] |
getAvailableAspects()
Get a list of the available Aspects for this Registry |
float |
getAverageRating(java.lang.String resourcePath)
Returns the average rating (from all users) for the given resource. |
Comment[] |
getComments(java.lang.String resourcePath)
Returns all comments for the given resource. |
LogEntryCollection |
getLogCollection(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. |
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 |
RegistryContext |
getRegistryContext()
Get the configuration for this Registry |
Aspect |
getResourceAspect(Resource resource,
java.lang.String aspectName)
|
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)
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 new resource by importing the reosurce content from the given source URL. |
void |
invokeAspect(java.lang.String resourcePath,
java.lang.String aspectName,
java.lang.String action)
This invokes an action on a specified Aspect, which must be associated with the Resource at the given path. |
java.lang.String |
move(java.lang.String currentPath,
java.lang.String newPath)
|
Collection |
newCollection()
|
Resource |
newResource()
|
java.lang.String |
put(java.lang.String suggestedPath,
Resource resource)
Adds or updates resources in the registry. |
void |
rateResource(java.lang.String resourcePath,
int rating)
Rates the given resource. |
void |
removeAssociation(java.lang.String sourcePath,
java.lang.String targetPath,
java.lang.String associationType)
To remove an association for a 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 newName)
Move or rename a resource in the registry. |
boolean |
resourceExists(java.lang.String path)
Checks whether a resource exists in the registry. |
void |
restoreVersion(java.lang.String versionPath)
Reverts a resource to a given version. |
void |
rollbackTransaction()
BasicRegistry does not implement transaction related methods as transactions has to be handled outside of the BasicRegistry. |
Collection |
searchContent(java.lang.String keywords)
Search the content of resources |
void |
setRegistryContext(RegistryContext registryContext)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public BasicRegistry(RegistryContext registryContext, Repository repository, VersionRepository versionRepository, QueryProcessorManager queryProcessorManager)
registryContext
- RegistryContext instance containing the registry configuration.repository
- Repository instance.versionRepository
- VersionRepository instance.queryProcessorManager
- QueryProcessorManager instance.Method Detail |
---|
public void beginTransaction() throws RegistryException
beginTransaction
in interface Registry
RegistryException
- If an error occurs while starting a transactionpublic void commitTransaction() throws RegistryException
commitTransaction
in interface Registry
RegistryException
- If an error occurs while committing a transactionpublic void rollbackTransaction() throws RegistryException
rollbackTransaction
in interface Registry
RegistryException
- If an error occurs while rolling back a transactionpublic Resource newResource() throws RegistryException
newResource
in interface CoreRegistry
RegistryException
public Collection newCollection() throws RegistryException
newCollection
in interface CoreRegistry
RegistryException
public RegistryContext getRegistryContext()
Registry
getRegistryContext
in interface Registry
public void setRegistryContext(RegistryContext registryContext)
public Resource get(java.lang.String path) throws RegistryException
get
in interface CoreRegistry
path
- Path of the resource. e.g. /project1/server/deployment.xml
RegistryException
- ResourceNotFound exception is thrown if the resource is not in the
registrypublic Collection get(java.lang.String path, int start, int pageSize) throws RegistryException
get
in interface CoreRegistry
path
- Path of the collectionstart
- Starting child entry numberpageSize
- Number of entries per page
RegistryException
public boolean resourceExists(java.lang.String path) throws RegistryException
resourceExists
in interface CoreRegistry
path
- Path of resource
RegistryException
public java.lang.String put(java.lang.String suggestedPath, Resource resource) throws RegistryException
put
in interface CoreRegistry
suggestedPath
- the path which we'd like to use for the new resource.resource
- Resource instance for the new resource
RegistryException
- This exception is thrown for all database layer and handler
exceptions.public java.lang.String importResource(java.lang.String suggestedPath, java.lang.String sourceURL, Resource metadata) throws RegistryException
importResource
in interface Registry
suggestedPath
- Path to put the resource.sourceURL
- URL to import resource content.metadata
- Metadata for the new resource.
RegistryException
public void delete(java.lang.String path) throws RegistryException
delete
in interface CoreRegistry
path
- Path of the resource to be deleted.
RegistryException
- : if the user is not authorizedpublic java.lang.String rename(java.lang.String currentPath, java.lang.String newName) throws RegistryException
Registry
rename
in interface Registry
currentPath
- current path of the resourcenewName
- where we'd like to move the reosurce
RegistryException
- if something went wrongpublic java.lang.String move(java.lang.String currentPath, java.lang.String newPath) throws RegistryException
move
in interface Registry
RegistryException
public java.lang.String copy(java.lang.String sourcePath, java.lang.String targetPath) throws RegistryException
copy
in interface Registry
RegistryException
public void createVersion(java.lang.String path) throws RegistryException
createVersion
in interface Registry
RegistryException
public java.lang.String[] getVersions(java.lang.String path) throws RegistryException
Registry
getVersions
in interface Registry
path
- path of a current version of a resource
RegistryException
- if there is an errorpublic void restoreVersion(java.lang.String versionPath) throws RegistryException
Registry
restoreVersion
in interface Registry
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.
RegistryException
- if there is an errorpublic void addAssociation(java.lang.String sourcePath, java.lang.String targetPath, java.lang.String associationType) throws RegistryException
Registry
addAssociation
in interface Registry
sourcePath
- Path of the source resourcetargetPath
- Path of the target resourceassociationType
- Type of the association
RegistryException
- Depends on the implementationpublic void removeAssociation(java.lang.String sourcePath, java.lang.String targetPath, java.lang.String associationType) throws RegistryException
Registry
removeAssociation
in interface Registry
sourcePath
- Path of the source resourcetargetPath
- Path of the target resourceassociationType
- Type of the association
RegistryException
- Depends on the implementationpublic Association[] getAllAssociations(java.lang.String resourcePath) throws RegistryException
Registry
getAllAssociations
in interface Registry
resourcePath
- Path of the resource to analyse associations.
RegistryException
- : If something went wrongpublic Association[] getAssociations(java.lang.String resourcePath, java.lang.String associationType) throws RegistryException
Registry
getAssociations
in interface Registry
resourcePath
- Path of the resource to analyse associations.associationType
- : Type of the association , that could be dependecy , or some other type
RegistryException
- : If something went wrongpublic void applyTag(java.lang.String resourcePath, java.lang.String tag) throws RegistryException
applyTag
in interface Registry
resourcePath
- Path of the resource to be tagged.tag
- Tag. Any string can be used for the tag.
RegistryException
- ResourceNotFound exception is thrown if a resource does not exist
in the given path.public TaggedResourcePath[] getResourcePathsWithTag(java.lang.String tag) throws RegistryException
getResourcePathsWithTag
in interface Registry
tag
- Tag
RegistryException
- if an error occurspublic Tag[] getTags(java.lang.String resourcePath) throws RegistryException
getTags
in interface Registry
resourcePath
- Path of the resource
RegistryException
- ResourceNotFound exception is thrown if a resource does not exist
in the given path.public void removeTag(java.lang.String path, java.lang.String tag) throws RegistryException
Registry
removeTag
in interface Registry
path
- Resource path tagged with the given tag.tag
- Name of the tag to be removed.
RegistryException
- if there's a problempublic java.lang.String addComment(java.lang.String resourcePath, Comment comment) throws RegistryException
addComment
in interface Registry
resourcePath
- Path of the resource to add the comment.comment
- Comment instance for the new comment.
RegistryException
- ResourceNotFound exception is thrown if a resource does not exist
in the given path.public void editComment(java.lang.String commentPath, java.lang.String text) throws RegistryException
Registry
editComment
in interface Registry
commentPath
- path to comment resource ("..foo/r1;comment:1")text
- new text for the comment.
RegistryException
- Registry implementations may handle exceptions and throw
RegistryException if the exception has to be propagated to the
client.public Comment[] getComments(java.lang.String resourcePath) throws RegistryException
getComments
in interface Registry
resourcePath
- Path of the resource.
RegistryException
- Registry implementations may handle exceptions and throw
RegistryException if the exception has to be propagated to the
client.public void rateResource(java.lang.String resourcePath, int rating) throws RegistryException
rateResource
in interface Registry
resourcePath
- Path of the resource.rating
- rating value.
RegistryException
- ResourceNotFound exception is thrown if a resource does not exist
in the given path.public float getAverageRating(java.lang.String resourcePath) throws RegistryException
getAverageRating
in interface Registry
resourcePath
- Path of the resource.
RegistryException
- if an error occurspublic int getRating(java.lang.String path, java.lang.String userName) throws RegistryException
Registry
getRating
in interface Registry
path
- Path of the resourceuserName
- username of the user
RegistryException
- if there is a problempublic Collection executeQuery(java.lang.String path, java.util.Map parameters) throws RegistryException
Registry
executeQuery
in interface Registry
path
- Path of the query to execute.parameters
- a Map of query parameters (name -> value)
RegistryException
- depends on the implementation.public LogEntry[] getLogs(java.lang.String resourcePath, int action, java.lang.String userName, java.util.Date from, java.util.Date to, boolean recentFirst) throws RegistryException
Registry
getLogs
in interface Registry
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 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.
RegistryException
- if there is a problemAccepted values for action parameter
public LogEntryCollection getLogCollection(java.lang.String resourcePath, int action, java.lang.String userName, java.util.Date from, java.util.Date to, boolean recentFirst) throws RegistryException
Registry
getLogCollection
in interface Registry
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 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.
RegistryException
- if there is a problemAccepted values for action parameter
public java.lang.String[] getAvailableAspects()
Registry
getAvailableAspects
in interface Registry
public void associateAspect(java.lang.String resourcePath, java.lang.String name) throws RegistryException
Registry
associateAspect
in interface Registry
resourcePath
- Path of the resourcename
- Name of the aspect
RegistryException
- : If some thing went wrong while doing associating the phasepublic Aspect getResourceAspect(Resource resource, java.lang.String aspectName) throws RegistryException
RegistryException
public void invokeAspect(java.lang.String resourcePath, java.lang.String aspectName, java.lang.String action) throws RegistryException
Registry
invokeAspect
in interface Registry
resourcePath
- Path of the resourceaspectName
- Name of the aspectaction
- Which action was selected - actions are aspect-specific
RegistryException
- if the Aspect isn't associated with the Resource, or the action
isn't valid, or an Aspect-specific problem occurs.public java.lang.String[] getAspectActions(java.lang.String resourcePath, java.lang.String aspectName) throws RegistryException
Registry
getAspectActions
in interface Registry
resourcePath
- path of the ResourceaspectName
- name of the Aspect to query for available actions
RegistryException
- if the Aspect isn't associated or an Aspect-specific problem occurspublic Collection searchContent(java.lang.String keywords) throws RegistryException
Registry
searchContent
in interface Registry
keywords
- keywords to look for
RegistryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |