public class EmbeddedRegistry extends Object implements Registry
| Constructor and Description |
|---|
EmbeddedRegistry()
Default constructor.
|
EmbeddedRegistry(RegistryContext registryContext,
org.wso2.carbon.user.core.service.RealmService realmService)
Constructs a Embedded registry to be used with secure registries.
|
| Modifier and Type | Method and Description |
|---|---|
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,
org.wso2.carbon.registry.api.Comment comment) |
String |
addComment(String resourcePath,
Comment comment)
Adds a comment to a resource.
|
void |
applyTag(String resourcePath,
String tag)
Applies the given tag to the resource in the given path.
|
void |
associateAspect(String resourcePath,
String aspectName)
Associate an Aspect with a resource.
|
void |
beginTransaction()
Start a new transaction
|
void |
commitTransaction()
Commit the currently active transaction
|
void |
configure(DataAccessManager dataAccessManager,
org.wso2.carbon.user.core.service.RealmService realmService)
Configures and initiates the Embedded registry with a (new) data source and a realm.
|
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 targetSubPath)
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 |
dumpLite(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 path)
Returns the average rating for the given resource.
|
Comment[] |
getComments(String path)
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)
Returns the logs of the activities occurred in the registry.
|
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 path)
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,
org.wso2.carbon.registry.api.Resource resource) |
String |
importResource(String suggestedPath,
String sourceURL,
Resource metaResource)
Creates a resource by fetching the resource content from the given URL.
|
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,
org.wso2.carbon.registry.api.Resource resource) |
String |
put(String suggestedPath,
Resource resource)
Adds or updates resources in the registry.
|
void |
rateResource(String resourcePath,
int rating)
Rate the given resource.
|
boolean |
removeAspect(String name)
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.
|
public EmbeddedRegistry()
configure(org.wso2.carbon.registry.core.dataaccess.DataAccessManager, org.wso2.carbon.user.core.service.RealmService)
method, if it is instantiated using this constructor.public EmbeddedRegistry(RegistryContext registryContext, org.wso2.carbon.user.core.service.RealmService realmService) throws RegistryException
registryContext - RegistryContext containing our configuration and data access manager.
Note that this may or may not be the same data source as the User
Manager.realmService - User manager realm service handle authorizations.RegistryException - If something went wrongpublic void configure(DataAccessManager dataAccessManager, org.wso2.carbon.user.core.service.RealmService realmService) throws RegistryException
dataAccessManager - the data access manager to userealmService - the User manager realm service handle authorizations.RegistryException - If something went wrong while initpublic void beginTransaction()
throws RegistryException
TransactionManagerbeginTransaction in interface TransactionManagerRegistryException - If an error occurs while starting a transactionpublic void rollbackTransaction()
throws RegistryException
TransactionManagerrollbackTransaction in interface TransactionManagerRegistryException - If an error occurs while rolling back a transactionpublic void commitTransaction()
throws RegistryException
TransactionManagercommitTransaction in interface TransactionManagerRegistryException - If an error occurs while committing a transactionpublic RegistryContext getRegistryContext()
Registrypublic Resource newResource() throws RegistryException
CoreRegistrynewResource in interface org.wso2.carbon.registry.api.CoreRegistryRegistryException - if the operation failed.public Collection newCollection() throws RegistryException
CoreRegistrynewCollection in interface org.wso2.carbon.registry.api.CoreRegistryRegistryException - if the operation failed.public Resource get(String path) throws RegistryException
CoreRegistryget in interface org.wso2.carbon.registry.api.CoreRegistrypath - Path of the resource. e.g. /project1/server/deployment.xmlRegistryException - is thrown if the resource is not in the registrypublic Resource getMetaData(String path) throws RegistryException
RegistrygetMetaData in interface org.wso2.carbon.registry.api.Registrypath - Path of the resource. e.g. /project1/server/deployment.xmlRegistryException - is thrown if the resource is not in the registrypublic String importResource(String suggestedPath, String sourceURL, org.wso2.carbon.registry.api.Resource resource) throws org.wso2.carbon.registry.api.RegistryException
importResource in interface org.wso2.carbon.registry.api.Registryorg.wso2.carbon.registry.api.RegistryExceptionpublic Collection get(String path, int start, int pageSize) throws RegistryException
CoreRegistryget in interface org.wso2.carbon.registry.api.CoreRegistrypath - 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 returnRegistryException - 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.public boolean resourceExists(String path) throws RegistryException
CoreRegistryresourceExists in interface org.wso2.carbon.registry.api.CoreRegistrypath - Path of the resource to be checkedRegistryException - if an error occurspublic String put(String suggestedPath, org.wso2.carbon.registry.api.Resource resource) throws org.wso2.carbon.registry.api.RegistryException
put in interface org.wso2.carbon.registry.api.CoreRegistryorg.wso2.carbon.registry.api.RegistryExceptionpublic String put(String suggestedPath, Resource resource) throws RegistryException
CoreRegistrysuggestedPath - the path which we'd like to use for the new resource.resource - Resource instance for the new resourceRegistryException - is thrown depending on the implementation.public String importResource(String suggestedPath, String sourceURL, Resource metaResource) throws RegistryException
RegistrysuggestedPath - 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 contentmetaResource - a template ResourceRegistryException - if we couldn't get or store the new resourcepublic void delete(String path) throws RegistryException
CoreRegistrydelete in interface org.wso2.carbon.registry.api.CoreRegistrypath - Path of the resource to be deleted.RegistryException - is thrown depending on the implementation.public String rename(String currentPath, String newName) throws RegistryException
Registryrename in interface org.wso2.carbon.registry.api.RegistrycurrentPath - current path of the resourcenewName - the name of the new resourceRegistryException - if something went wrongpublic String move(String currentPath, String newPath) throws RegistryException
Registrymove in interface org.wso2.carbon.registry.api.RegistrycurrentPath - current path of the resourcenewPath - where we'd like to move the resourceRegistryException - if something went wrongpublic String copy(String sourcePath, String targetPath) throws RegistryException
Registrycopy in interface org.wso2.carbon.registry.api.RegistrysourcePath - current path of the resourcetargetPath - where we'd like to copy the resourceRegistryException - if something went wrongpublic void createVersion(String path) throws RegistryException
RegistrycreateVersion in interface org.wso2.carbon.registry.api.Registrypath - the resource path.RegistryException - if something went wrong.public String[] getVersions(String path) throws RegistryException
RegistrygetVersions in interface org.wso2.carbon.registry.api.Registrypath - path of a current version of a resourceRegistryException - if there is an errorpublic void restoreVersion(String versionPath) throws RegistryException
RegistryrestoreVersion in interface org.wso2.carbon.registry.api.RegistryversionPath - 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(String sourcePath, String targetPath, String associationType) throws RegistryException
RegistryaddAssociation in interface org.wso2.carbon.registry.api.RegistrysourcePath - Path of the source resourcetargetPath - Path of the target resourceassociationType - Type of the associationRegistryException - Depends on the implementationpublic void removeAssociation(String sourcePath, String targetPath, String associationType) throws RegistryException
RegistryremoveAssociation in interface org.wso2.carbon.registry.api.RegistrysourcePath - Path of the source resourcetargetPath - Path of the target resourceassociationType - Type of the associationRegistryException - Depends on the implementationpublic Association[] getAllAssociations(String resourcePath) throws RegistryException
RegistrygetAllAssociations in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resource to analyse associations.RegistryException - If something went wrongpublic Association[] getAssociations(String resourcePath, String associationType) throws RegistryException
RegistrygetAssociations in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resource to analyse associations.associationType - Type of the association , that could be dependency, or some other
type.RegistryException - If something went wrongpublic void applyTag(String resourcePath, String tag) throws RegistryException
RegistryapplyTag in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resource to be tagged.tag - Tag. Any string can be used for the tag.RegistryException - is thrown if a resource does not exist in the given path.public TaggedResourcePath[] getResourcePathsWithTag(String tag) throws RegistryException
RegistrygetResourcePathsWithTag in interface org.wso2.carbon.registry.api.Registrytag - the tag to search forRegistryException - if an error occurspublic Tag[] getTags(String path) throws RegistryException
RegistrygetTags in interface org.wso2.carbon.registry.api.Registrypath - Path of the resourceRegistryException - is thrown if a resource does not exist in the given path.public void removeTag(String path, String tag) throws RegistryException
RegistryremoveTag in interface org.wso2.carbon.registry.api.Registrypath - Resource path tagged with the given tag.tag - Name of the tag to be removed.RegistryException - if there's a problempublic String addComment(String resourcePath, org.wso2.carbon.registry.api.Comment comment) throws org.wso2.carbon.registry.api.RegistryException
addComment in interface org.wso2.carbon.registry.api.Registryorg.wso2.carbon.registry.api.RegistryExceptionpublic String addComment(String resourcePath, Comment comment) throws RegistryException
RegistryresourcePath - Path of the resource to add the comment.comment - Comment instance for the new comment.RegistryException - is thrown if a resource does not exist in the given path.public void editComment(String commentPath, String text) throws RegistryException
RegistryeditComment in interface org.wso2.carbon.registry.api.RegistrycommentPath - 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 void removeComment(String commentPath) throws RegistryException
RegistryremoveComment in interface org.wso2.carbon.registry.api.RegistrycommentPath - path to comment resource ("..foo/r1;comment:1")RegistryException - Registry implementations may handle exceptions and throw
RegistryException if the exception has to be propagated to the
client.public Comment[] getComments(String path) throws RegistryException
RegistrygetComments in interface org.wso2.carbon.registry.api.Registrypath - 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(String resourcePath, int rating) throws RegistryException
RegistryrateResource in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resource.rating - Rating value between 1 and 5.RegistryException - Registry implementations may handle exceptions and throw
RegistryException if the exception has to be propagated to the
client.public float getAverageRating(String path) throws RegistryException
RegistrygetAverageRating in interface org.wso2.carbon.registry.api.Registrypath - Path of the resource.RegistryException - if an error occurspublic int getRating(String path, String userName) throws RegistryException
RegistrygetRating in interface org.wso2.carbon.registry.api.Registrypath - Path of the resourceuserName - username of the userRegistryException - if there is a problempublic Collection executeQuery(String path, Map parameters) throws RegistryException
RegistryexecuteQuery in interface org.wso2.carbon.registry.api.Registrypath - Path of the query to execute.parameters - a Map of query parameters (name -> value)RegistryException - depends on the implementation.public LogEntry[] getLogs(String resourcePath, int action, String userName, Date from, Date to, boolean recentFirst) throws RegistryException
RegistrygetLogs in interface org.wso2.carbon.registry.api.RegistryresourcePath - 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.RegistryException - if there is a problemAccepted values for action parameterpublic LogEntryCollection getLogCollection(String resourcePath, int action, String userName, Date from, Date to, boolean recentFirst) throws RegistryException
RegistryresourcePath - 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.RegistryException - if there is a problemAccepted values for action parameterpublic String[] getAvailableAspects()
RegistrygetAvailableAspects in interface org.wso2.carbon.registry.api.Registrypublic void associateAspect(String resourcePath, String aspectName) throws RegistryException
RegistryassociateAspect in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resourceaspectName - Name of the aspectRegistryException - If some thing went wrong while doing associating the phasepublic void invokeAspect(String resourcePath, String aspectName, String action) throws RegistryException
RegistryinvokeAspect in interface org.wso2.carbon.registry.api.RegistryresourcePath - Path of the resourceaspectName - Name of the aspectaction - Which action was selected - actions are aspect-specificRegistryException - if the Aspect isn't associated with the Resource, or the action
isn't valid, or an Aspect-specific problem occurs.public void invokeAspect(String resourcePath, String aspectName, String action, Map<String,String> parameters) throws RegistryException
RegistryresourcePath - Path of the resourceaspectName - Name of the aspectaction - Which action was selected - actions are aspect-specificparameters - Parameters to be used for the operationRegistryException - if the Aspect isn't associated with the Resource, or the action
isn't valid, or an Aspect-specific problem occurs.public String[] getAspectActions(String resourcePath, String aspectName) throws RegistryException
RegistrygetAspectActions in interface org.wso2.carbon.registry.api.RegistryresourcePath - path of the ResourceaspectName - name of the Aspect to query for available actionsRegistryException - if the Aspect isn't associated or an Aspect-specific problem
occurspublic Collection searchContent(String keywords) throws RegistryException
RegistrysearchContent in interface org.wso2.carbon.registry.api.Registrykeywords - keywords to look forRegistryException - throws if the operation failpublic void createLink(String path, String target) throws RegistryException
RegistrycreateLink in interface org.wso2.carbon.registry.api.Registrypath - the mount pathtarget - the point to be mountedRegistryException - throws if the operation failpublic void createLink(String path, String target, String targetSubPath) throws RegistryException
RegistrycreateLink in interface org.wso2.carbon.registry.api.Registrypath - the mount pathtarget - the point to be mountedtargetSubPath - sub path in the remote instance to be mountedRegistryException - throws if the operation failpublic void removeLink(String path) throws RegistryException
RegistryremoveLink in interface org.wso2.carbon.registry.api.Registrypath - the mount pathRegistryException - throws if the operation failpublic void restore(String path, Reader reader) throws RegistryException
Registryrestore in interface org.wso2.carbon.registry.api.Registrypath - path to check inreader - reader containing resourceRegistryException - throws if the operation failpublic void dump(String path, Writer writer) throws RegistryException
Registrydump in interface org.wso2.carbon.registry.api.Registrypath - path to check outwriter - writer to write the responseRegistryException - throws if the operation failpublic String getEventingServiceURL(String path) throws RegistryException
RegistrygetEventingServiceURL in interface org.wso2.carbon.registry.api.Registrypath - the path to which the WS-Eventing Service URL is requiredRegistryException - throws if the operation failpublic void setEventingServiceURL(String path, String eventingServiceURL) throws RegistryException
RegistrysetEventingServiceURL in interface org.wso2.carbon.registry.api.Registrypath - the path to which the WS-Eventing Service URL is associatedeventingServiceURL - the URL of the WS-Eventing ServiceRegistryException - throws if the operation failpublic boolean addAspect(String name, Aspect aspect) throws RegistryException
Registryname - the name of the aspect to be addedaspect - the name of the aspect object to be added to registry contextRegistryException - throws if the operation failpublic boolean removeAspect(String name) throws RegistryException
Registryname - the name of the aspect to be removedRegistryException - throws if the operation failpublic boolean removeVersionHistory(String path, long snapshotId) throws RegistryException
Registrypath - the path of the resourceRegistryException - throws if the operation fails.public void dumpLite(String path, Writer writer) throws RegistryException
Registrypath - path to check outwriter - writer to write the responseRegistryException - throws if the operation failCopyright © 2015 WSO2 Inc. All Rights Reserved.