|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wso2.registry.jdbc.JDBCRegistry
public class JDBCRegistry
JDBC based implementation of the Registry. This will be used mostly as the back-end by other Registry implementations. This can use either an in-memory database or a external database configured using data source. At the initializing, it checks if a data source named "jdbc/WSO2RegistryDB" is configured. If such data source is found, it is used as the database. If a data source is not found, an in-memory database is created using the HSQL.
| Constructor Summary | |
|---|---|
JDBCRegistry()
Default constructor. |
|
JDBCRegistry(javax.sql.DataSource dataSource)
Constructs a JDBC registry to be used without any security (authorizations on actions). |
|
JDBCRegistry(javax.sql.DataSource dataSource,
org.wso2.usermanager.Realm realm)
Constructs a JDBC registry to be used with secure registries. |
|
| Method Summary | |
|---|---|
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 |
configure(javax.sql.DataSource dataSource,
RegistryRealm realm)
Configures and initiates the JDBC registry with a (new) datasource and a realm. |
void |
defineQuery(java.lang.String name,
java.lang.String query)
|
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. |
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 in the given path. |
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. |
org.wso2.usermanager.Realm |
getDefaultRealm()
|
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 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 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)
Rates 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. |
void |
shutdown()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDBCRegistry()
public JDBCRegistry(javax.sql.DataSource dataSource)
throws RegistryException
dataSource - Data source to be used to store resources and metadata.
RegistryException - : If something went wrong while init
public JDBCRegistry(javax.sql.DataSource dataSource,
org.wso2.usermanager.Realm realm)
throws RegistryException
dataSource - Data source to be used to store resources and metadata. Note that the same
data source may or may not be used as the data source of user manager.realm - User manager realm to handle authorizations. It is strongly recommended to
use a realm instance constructed using the RegistryRealmFactory. All
initial users, roles and authorizations will be set on realms obtained
using the RegistryRealmFactory.
RegistryException - : If something went wrong| Method Detail |
|---|
public void configure(javax.sql.DataSource dataSource,
RegistryRealm realm)
throws RegistryException
dataSource - the DataSource to userealm - Realm to use
RegistryException - : If something went wrong while initpublic org.wso2.usermanager.Realm getDefaultRealm()
public Resource get(java.lang.String path)
throws RegistryException
get in interface CoreRegistrypath - Path of the resource. e.g. /project1/server/deployment.xml
RegistryException - ResourceNotFound exception is thrown if the resource is not in the
registry
public boolean resourceExists(java.lang.String path)
throws RegistryException
CoreRegistry
resourceExists in interface CoreRegistrypath - Path of the resource to be checked
RegistryException - if an error occurs
public java.lang.String put(java.lang.String suggestedPath,
Resource resource)
throws RegistryException
put in interface CoreRegistrysuggestedPath - the path which we'd like to use for the new resource.resource - Resource instance for the new resource
RegistryException
public java.lang.String importResource(java.lang.String suggestedPath,
java.lang.String sourceURL,
Resource metadata)
throws RegistryException
Registry
importResource in interface 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 contentmetadata - a template Resource
RegistryException - if we couldn't get or store the new resource
public java.lang.String rename(java.lang.String currentPath,
java.lang.String newPath)
throws RegistryException
Registry
rename in interface RegistrycurrentPath - current path of the resourcenewPath - where we'd like to move the reosurce
RegistryException - if something went wrong
public void delete(java.lang.String path)
throws RegistryException
delete in interface CoreRegistrypath - Path of the resource to be deleted.
RegistryException - : if the user is not authorized
public java.lang.String[] getVersions(java.lang.String path)
throws RegistryException
Registry
getVersions in interface Registrypath - path of a current version of a resource
RegistryException - if there is an error
public void restoreVersion(java.lang.String versionPath)
throws RegistryException
Registry
restoreVersion in interface 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 error
public void applyTag(java.lang.String resourcePath,
java.lang.String tag)
throws RegistryException
applyTag in interface RegistryresourcePath - 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 Registrytag - Tag
RegistryException - if an error occurs
public Tag[] getTags(java.lang.String resourcePath)
throws RegistryException
getTags in interface RegistryresourcePath - 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 Registrypath - Resource path tagged with the given tag.tag - Name of the tag to be removed.
RegistryException - if there's a problem
public java.lang.String addComment(java.lang.String resourcePath,
Comment comment)
throws RegistryException
addComment in interface RegistryresourcePath - 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 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 Comment[] getComments(java.lang.String resourcePath)
throws RegistryException
getComments in interface RegistryresourcePath - 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 RegistryresourcePath - 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 RegistryresourcePath - Path of the resource.
RegistryException - if an error occurs
public int getRating(java.lang.String path,
java.lang.String userName)
throws RegistryException
Registry
getRating in interface Registrypath - Path of the resourceuserName - username of the user
RegistryException - if there is a problem
public void defineQuery(java.lang.String name,
java.lang.String query)
throws RegistryException
RegistryException
public Resource executeQuery(java.lang.String path,
java.util.Map parameters)
throws RegistryException
Registry
executeQuery in interface Registrypath - Path of the query to execute.parameters - a Map of query parameters (name -> value)
RegistryException - depends on the implementation.
public void shutdown()
throws RegistryException
RegistryException
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 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.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 problem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||