org.wso2.registry.jdbc
Class Repository

java.lang.Object
  extended by org.wso2.registry.jdbc.Repository

public class Repository
extends java.lang.Object

Encapsulates the retrieving, storing, modifing and deleting of resources. This class only deals with the current versions of resources and it is unware of any versioning or snapshot activity. Only the current version related tables are accessed and updated from the methods of this class.


Field Summary
static org.apache.commons.logging.Log log
           
 
Constructor Summary
Repository(javax.sql.DataSource dataSource)
           
 
Method Summary
 java.lang.String copy(java.lang.String sourcePath, java.lang.String targetPath)
           
 void delete(java.lang.String path)
          Deletes the pure resource refered by the path.
 Resource get(java.lang.String path)
          Gets the pure resource referred by the given path.
 Collection get(java.lang.String path, int start, int pageLen)
           
 java.lang.String importResource(java.lang.String path, java.lang.String sourceURL, Resource metadata)
          Creates a resource with the content imported from the source URL and metadata extracted from the given metadata resource instance.
 java.lang.String move(java.lang.String oldPath, java.lang.String newPath)
          Moves the resource at oldPath to the newPath.
 void put(java.lang.String path, Resource resource)
          Adds or updates the resource in the given path with the given resource.
 java.lang.String rename(java.lang.String oldPath, java.lang.String newName)
          Renames the resource at oldPath with the given newName.
 boolean resourceExists(java.lang.String path)
          Checks if a pure resource exists in the given path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.commons.logging.Log log
Constructor Detail

Repository

public Repository(javax.sql.DataSource dataSource)
Method Detail

resourceExists

public boolean resourceExists(java.lang.String path)
                       throws RegistryException
Checks if a pure resource exists in the given path.

Parameters:
path - Path of a possible pure resource.
Returns:
ture if a resource exists in the given path. false otherwise.
Throws:
RegistryException

get

public Resource get(java.lang.String path)
             throws RegistryException
Gets the pure resource referred by the given path. If purePath referes to a specific version of the resource, this gives the refered version. If path does not contain version information, this gives the current version of the resource.

Parameters:
path - Path of a "pure" resource. Path should map to an actual resource stored in the database. Paths refering to virtual resource are not handled (e.g. /c1/r1;comments).
Returns:
Resource refered by the given path. Resource can be a file or a collection.
Throws:
RegistryException

get

public Collection get(java.lang.String path,
                      int start,
                      int pageLen)
               throws RegistryException
Throws:
RegistryException

put

public void put(java.lang.String path,
                Resource resource)
         throws RegistryException
Adds or updates the resource in the given path with the given resource. Put is executed if the current user has authorization to do so. Below is the method of evaluating authorizations.

Parameters:
path - Path of the resource to be added or updated. Path should only refer to current version a pure resource. i.e. Path should not contain any version information as it is impossible to add or update old versions.
resource - Resource to be added or updated.
Throws:
RegistryException

importResource

public java.lang.String importResource(java.lang.String path,
                                       java.lang.String sourceURL,
                                       Resource metadata)
                                throws RegistryException
Creates a resource with the content imported from the source URL and metadata extracted from the given metadata resource instance. Then the created resource is put to the registry using the Repository.put() method.

Parameters:
path - Path to put the resource
sourceURL - URL to import resource content
metadata - Metadata for the new resource is extracted from this metadata resource
Returns:
Actual path where the new resource is stored in the registry
Throws:
RegistryException - for all exceptional scenarios

delete

public void delete(java.lang.String path)
            throws RegistryException
Deletes the pure resource refered by the path.

Parameters:
path - path Path of the resource deleted. Path should only refer to current version a pure resource. i.e. Path should not contain any version information as it is impossible to delete old versions.
Throws:
RegistryException

rename

public java.lang.String rename(java.lang.String oldPath,
                               java.lang.String newName)
                        throws RegistryException
Renames the resource at oldPath with the given newName. If oldPath is "/projects/esb/config.xml" and newName is "synapse.xml" then the new path of the resource will be "/projects/esb/synapse.xml". If the renamed resource is a collection, paths of all its desendants will also be changed.

Parameters:
oldPath - Pure path of the resource to be renamed.
newName - New name for the resource. Name should not contain "/".
Returns:
New path of the resource.
Throws:
RegistryException

move

public java.lang.String move(java.lang.String oldPath,
                             java.lang.String newPath)
                      throws RegistryException
Moves the resource at oldPath to the newPath. If the resource is a collection, all its descendant resources will also be moved.

Parameters:
oldPath - Path of a existing resource
newPath - New path of the resource
Returns:
the actual new path
Throws:
RegistryException

copy

public java.lang.String copy(java.lang.String sourcePath,
                             java.lang.String targetPath)
                      throws RegistryException
Throws:
RegistryException


Copyright © 2007 Apache Web Services Project. All Rights Reserved.