|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wso2.registry.app.RemoteRegistry
public class RemoteRegistry
Field Summary |
---|
Fields inherited from interface org.wso2.registry.app.APPConstants |
---|
COMMENTID_QNAME, COMMENTS_QNAME, IMPORT_MEDIATYPE, NAMESPACE, PARAMETER_AVERAGE_RATINGS, PARAMETER_COMMENTS, PARAMETER_LOGS, PARAMETER_QUERY, PARAMETER_RATINGS, PARAMETER_RENAME, PARAMETER_RESOURCE_EXIST, PARAMETER_RESTORE, PARAMETER_TAG_PATHS, PARAMETER_TAGS, PARAMETER_TAGS_REMOVED, PARAMETER_VERSION, QNAME_AVGRATING |
Constructor Summary | |
---|---|
RemoteRegistry(java.net.URL registryURL)
To create a remote registry need to provide a URL of a remote registry and the URL should be something like http://localhost:8080/wso2registry/atom/r1 |
|
RemoteRegistry(java.net.URL registryURL,
java.lang.String userName,
java.lang.String password)
To create a remote registry to connect to a secure registry or a registry where we need to pass userName and the password to perform any operation. |
Method Summary | |
---|---|
java.lang.String |
addComment(java.lang.String resourcePath,
Comment comment)
Adds a comment to a resource. |
static void |
addPropertyExtensionElement(java.util.Properties properties,
org.apache.abdera.Abdera abdera,
org.apache.abdera.model.ExtensibleElement entry,
javax.xml.namespace.QName node1name,
javax.xml.namespace.QName node2Name)
This will generate extension element and that will add to the entry , the created element will be something like |
void |
applyTag(java.lang.String resourcePath,
java.lang.String tag)
Applies the given tag to the resource in the given path. |
static void |
createPropertiesFromExtensionElement(Properties properties,
Resource resource)
|
static java.util.Map |
decodeParametesAsString(java.lang.String value)
|
void |
delete(java.lang.String path)
Deletes the resource at the given path. |
void |
editComment(java.lang.String commentPath,
java.lang.String text)
Change the text of an existing comment. |
static java.lang.String |
encodeParametersAsString(java.util.Map parameters)
|
static java.lang.String |
encodeURL(java.lang.String path)
|
Resource |
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 at the given path. |
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. |
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)
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. |
boolean |
resourceExists(java.lang.String path)
Check whether a resource exists at the given path |
void |
restoreVersion(java.lang.String versionPath)
Reverts a resource to a given version. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RemoteRegistry(java.net.URL registryURL)
registryURL
- : URL to the registry or to the resourcepublic RemoteRegistry(java.net.URL registryURL, java.lang.String userName, java.lang.String password)
registryURL
- : URL to the registry or to the resourceuserName
- : user name of the registry , value can be null , if the value is null
then the user will be the anonymous.password
- : password , value can be nullMethod Detail |
---|
public Resource get(java.lang.String path) throws RegistryException
CoreRegistry
get
in interface CoreRegistry
path
- Path of the resource. e.g. /project1/server/deployment.xml
RegistryException
- is thrown if the resource is not in the registrypublic boolean resourceExists(java.lang.String path) throws RegistryException
CoreRegistry
resourceExists
in interface CoreRegistry
path
- Path of the resource to be checked
RegistryException
- if an error occurspublic java.lang.String put(java.lang.String suggestedPath, Resource resource) throws RegistryException
CoreRegistry
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
public static void createPropertiesFromExtensionElement(Properties properties, Resource resource)
public static void addPropertyExtensionElement(java.util.Properties properties, org.apache.abdera.Abdera abdera, org.apache.abdera.model.ExtensibleElement entry, javax.xml.namespace.QName node1name, javax.xml.namespace.QName node2Name)
properties
- : List of Name value pairsabdera
- : Abdera instanceentry
- : Instanc of entery where extension element need to addnode1name
- : Name of node 1node2Name
- : Name of node 2public java.lang.String importResource(java.lang.String suggestedPath, java.lang.String sourceURL, Resource metadata) throws RegistryException
Registry
importResource
in interface Registry
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 contentmetadata
- a template Resource
RegistryException
- if we couldn't get or store the new resourcepublic void delete(java.lang.String path) throws RegistryException
CoreRegistry
delete
in interface CoreRegistry
path
- Path of the resource to be deleted.
RegistryException
- is thrown depending on the implementation.public java.lang.String rename(java.lang.String currentPath, java.lang.String newPath) throws RegistryException
Registry
rename
in interface Registry
currentPath
- current path of the resourcenewPath
- where we'd like to move the reosurce
RegistryException
- if something went wrongpublic 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 applyTag(java.lang.String resourcePath, java.lang.String tag) throws RegistryException
Registry
applyTag
in interface Registry
resourcePath
- 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(java.lang.String tag) throws RegistryException
Registry
getResourcePathsWithTag
in interface Registry
tag
- the tag to search for
RegistryException
- if an error occurspublic Tag[] getTags(java.lang.String resourcePath) throws RegistryException
Registry
getTags
in interface Registry
resourcePath
- Path of the resource
RegistryException
- 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
Registry
addComment
in interface Registry
resourcePath
- 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(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
Registry
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
Registry
rateResource
in interface Registry
resourcePath
- 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(java.lang.String resourcePath) throws RegistryException
Registry
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 Resource 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 static java.lang.String encodeParametersAsString(java.util.Map parameters)
public static java.util.Map decodeParametesAsString(java.lang.String value)
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.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 problempublic static java.lang.String encodeURL(java.lang.String path)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |