public class Repository extends Object
Constructor and Description |
---|
Repository(DataAccessManager dataAccessManager,
VersionRepository versionRepository,
boolean versionOnChange,
RecursionRepository recursionRepository)
Constructs a Repository
|
Modifier and Type | Method and Description |
---|---|
String |
copy(ResourcePath sourceResourcePath,
ResourcePath targetResourcePath)
Method to copy a resource from source to target.
|
void |
delete(String _path)
Deletes the pure resource referred by the path.
|
void |
deleteNode(ResourceIDImpl resourceID,
ResourceDO resourceDO,
boolean keepAuthorization)
Method to delete just the node in the collection hierarchy.
|
void |
deleteSubTree(ResourceIDImpl resourceID,
ResourceDO resourceDO,
boolean keepAuthorization)
Method to delete a sub tree of the collection hierarchy.
|
void |
dump(String _path,
Writer writer)
Method to do a dump.
|
protected void |
dumpLite(String _path,
Writer writer) |
Resource |
get(String path)
Gets the pure resource referred by the given path.
|
Collection |
get(String path,
int start,
int pageLen)
Method to get a paged collection.
|
Resource |
getMetaData(String path)
Gets the meta data of resource referred by the given path.
|
String |
importResource(String path,
String sourceURL,
Resource metaResource)
Creates a resource with the content imported from the source URL and meta data extracted from
the given meta data resource instance.
|
String |
move(ResourcePath oldResourcePath,
String newPath)
Moves the resource at oldPath to the newPath.
|
String |
moveRecursively(ResourceIDImpl sourceID,
String targetPath,
ResourceIDImpl targetParentResourceID)
Method to do a recursive move.
|
void |
prepareDumpRestore(String path)
This will delete only the current resource, keeps the authorizations.
|
void |
prepareVersionRestore(String _path)
This will delete the entire resource, except it keeps the authorizations.
|
void |
put(String path,
Resource resource)
Adds or updates the resource in the given path with the given resource.
|
String |
rename(ResourcePath oldResourcePath,
String newName)
Renames the resource at oldPath with the given newName.
|
boolean |
resourceExists(String path)
Checks if a pure resource exists in the given path.
|
void |
restore(String _path,
Reader reader)
Method to restore a dump.
|
public Repository(DataAccessManager dataAccessManager, VersionRepository versionRepository, boolean versionOnChange, RecursionRepository recursionRepository)
dataAccessManager
- the data access manager that is used for database communication.versionRepository
- the version repository.versionOnChange
- whether versioning needs to be done on change.recursionRepository
- the recursion repository for recursive operations.public boolean resourceExists(String path) throws RegistryException
path
- Path of a possible pure resource.RegistryException
- if the operation failed.public Resource getMetaData(String path) throws RegistryException
path
- Path of a "pure" resource. Path should map to an actual resource stored in the
database. Paths referring to virtual resource are not handled (e.g.
/c1/r1;comments).RegistryException
- if the operation failed.public Resource get(String path) throws RegistryException
path
- Path of a "pure" resource. Path should map to an actual resource stored in the
database. Paths referring to virtual resource are not handled (e.g.
/c1/r1;comments).RegistryException
- if the operation failed.public Collection get(String path, int start, int pageLen) throws RegistryException
path
- the collection path.start
- the starting index.pageLen
- the page length.RegistryException
- if the operation failed.public void put(String path, Resource resource) throws RegistryException
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.RegistryException
- if the operation failed.public String importResource(String path, String sourceURL, Resource metaResource) throws RegistryException
path
- Path to put the resourcesourceURL
- URL to import resource contentmetaResource
- Meta data for the new resource is extracted from this meta data resourceRegistryException
- for all exceptional scenariospublic void delete(String _path) throws RegistryException
_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.RegistryException
- if the operation failed.public void prepareVersionRestore(String _path) throws RegistryException
_path
- the path to be restored.RegistryException
- if the operation failed.public void prepareDumpRestore(String path) throws RegistryException
path
- the path to be prepared to restore.RegistryException
- if the operation failed.public void deleteSubTree(ResourceIDImpl resourceID, ResourceDO resourceDO, boolean keepAuthorization) throws RegistryException
resourceID
- the resource identifier.resourceDO
- the resource data object.keepAuthorization
- whether to keep authorizations.RegistryException
- if the operation failed.public void deleteNode(ResourceIDImpl resourceID, ResourceDO resourceDO, boolean keepAuthorization) throws RegistryException
resourceID
- the resource identifier.resourceDO
- the resource data object.keepAuthorization
- whether to keep authorizations.RegistryException
- if the operation failed.public String rename(ResourcePath oldResourcePath, String newName) throws RegistryException
oldResourcePath
- Path of the resource to be renamed.newName
- New name for the resource. Name should not contain "/".RegistryException
- if the operation failed.public String move(ResourcePath oldResourcePath, String newPath) throws RegistryException
oldResourcePath
- Path of a existing resourcenewPath
- New path of the resourceRegistryException
- if the operation failed.public String moveRecursively(ResourceIDImpl sourceID, String targetPath, ResourceIDImpl targetParentResourceID) throws RegistryException
sourceID
- the source resource's identifier.targetPath
- the target resource path.targetParentResourceID
- the target resource's parent's identifier.RegistryException
- if the operation failed.public String copy(ResourcePath sourceResourcePath, ResourcePath targetResourcePath) throws RegistryException
sourceResourcePath
- the source path.targetResourcePath
- the target path.RegistryException
- if the operation failed.public void restore(String _path, Reader reader) throws RegistryException
_path
- the path to restore from a dump.reader
- the reader used.RegistryException
- if the operation failed.public void dump(String _path, Writer writer) throws RegistryException
_path
- the path to obtain the dump from.writer
- the writer used.RegistryException
- if the operation failed.protected void dumpLite(String _path, Writer writer) throws RegistryException
RegistryException
Copyright © 2015 WSO2 Inc. All Rights Reserved.