|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface RepositoryProvider
A few ground rules:
Priha RepositoryManager ensures that methods which modify the repository (addNode(), close(), copy(), move(), open(), putPropertyValue(), remove(), start(), stop(), storeFinished(), storeStarted()) are single-threaded. However, the rest of the methods which are supposed to read from the repository, are protected by a read lock, and therefore they can be accessed at the same time from multiple threads. If you do any modifications anywhere, make sure these are thread-safe.
The RepositoryProvider lifecycle is as follows.
start()
method to notify that it exists.open() method.close() method
is called.stop() method
will be called. Priha installs its own shutdown hook for this case.
| Method Summary | |
|---|---|
void |
addNode(StoreTransaction tx,
Path path,
QNodeDefinition definition)
Adds a new Node to the repository to the given Path. |
void |
close(WorkspaceImpl ws)
The repository will no longer be used by a session, so any session-specific things can now be deallocated. |
Path |
findByUUID(WorkspaceImpl ws,
java.lang.String uuid)
If an item by this UUID exists, returns a Path. |
java.util.List<Path> |
findReferences(WorkspaceImpl ws,
java.lang.String uuid)
Finds all the Property paths which are of type REFERENCE and whose content is equal to the UUID given. |
ValueContainer |
getPropertyValue(WorkspaceImpl ws,
Path path)
Returns the value of a property. |
boolean |
itemExists(WorkspaceImpl ws,
Path path,
ItemType type)
Returns true, if the Item exists and is of given type. |
java.util.List<Path> |
listNodes(WorkspaceImpl ws,
Path parentpath)
Lists all the Nodes from the repository which belong to this parent. |
java.util.List<QName> |
listProperties(WorkspaceImpl ws,
Path path)
Returns a list of properties for a Node. |
java.util.Collection<java.lang.String> |
listWorkspaces()
Lists all workspaces which are available in this Repository. |
void |
open(RepositoryImpl rep,
javax.jcr.Credentials credentials,
java.lang.String workspaceName)
Opens a repository. |
void |
putPropertyValue(StoreTransaction tx,
Path path,
ValueContainer property)
Sets or adds a new Property to the repository. |
void |
remove(StoreTransaction tx,
Path path)
Removes a node or a property from the repository. |
void |
reorderNodes(StoreTransaction tx,
Path path,
java.util.List<Path> childOrder)
|
void |
start(RepositoryImpl repository,
java.util.Properties properties)
Starts access to a repository. |
void |
stop(RepositoryImpl rep)
Stops a given repository. |
void |
storeCancelled(StoreTransaction tx)
If the store has been cancelled and changes need to be rolled back. |
void |
storeFinished(StoreTransaction tx)
This method is called when the repository-changing operation is complete. |
StoreTransaction |
storeStarted(WorkspaceImpl ws)
This method is called whenever Priha starts a transaction which will save the contents of the repository. |
| Method Detail |
|---|
void open(RepositoryImpl rep,
javax.jcr.Credentials credentials,
java.lang.String workspaceName)
throws javax.jcr.RepositoryException,
javax.jcr.NoSuchWorkspaceException
rep - The Repository which owns this Provider.credentials - The Credentials object passed to the Session.open() call. May be null,
if there were no credentials.workspaceName - The workspace which will be accessed.
javax.jcr.NoSuchWorkspaceException - if no such workspace exists.
javax.jcr.RepositoryException
void start(RepositoryImpl repository,
java.util.Properties properties)
throws ConfigurationException
repository - The Repository which owns this provider.properties - A set of filtered properties for this provider.
ConfigurationException - If the repository cannot be started due to a faulty configuration.ProviderManager.filterProperties(RepositoryImpl, String)void stop(RepositoryImpl rep)
This method will only be called when the Repository shuts down.
rep - The Repository object.void close(WorkspaceImpl ws)
ws - The Workspace attached to the Session.
java.util.Collection<java.lang.String> listWorkspaces()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
java.util.List<QName> listProperties(WorkspaceImpl ws,
Path path)
throws javax.jcr.PathNotFoundException,
javax.jcr.RepositoryException
ws - The Workspace in which the properties should be located.path - The path of the Node.
javax.jcr.PathNotFoundException - If the path given does not exist.
javax.jcr.RepositoryException - If something goes wrong.
ValueContainer getPropertyValue(WorkspaceImpl ws,
Path path)
throws javax.jcr.PathNotFoundException,
javax.jcr.RepositoryException
ws - The workspace in which the property value should be located.path - The path to the Property
javax.jcr.RepositoryException - If something goes wrong.
javax.jcr.PathNotFoundException - If there is nothing at the end of this Path, i.e. the object could not be found.
boolean itemExists(WorkspaceImpl ws,
Path path,
ItemType type)
throws javax.jcr.RepositoryException
ws - The workspace in which the existence of the Node is checked.path - The path to the Node.type - Type to check for
javax.jcr.RepositoryException
java.util.List<Path> listNodes(WorkspaceImpl ws,
Path parentpath)
throws javax.jcr.RepositoryException
ws - The Workspace.parentpath - The path to the Node whose children should be listed.
javax.jcr.RepositoryException - If the children cannot be found.
Path findByUUID(WorkspaceImpl ws,
java.lang.String uuid)
throws javax.jcr.ItemNotFoundException,
javax.jcr.RepositoryException
ws - uuid -
javax.jcr.ItemNotFoundException - If the repository does not contain an UUID by this name.
javax.jcr.RepositoryException
java.util.List<Path> findReferences(WorkspaceImpl ws,
java.lang.String uuid)
throws javax.jcr.RepositoryException
ws - uuid -
javax.jcr.RepositoryException
void addNode(StoreTransaction tx,
Path path,
QNodeDefinition definition)
throws javax.jcr.RepositoryException
ws - The workspace.path - Path to the node in this workspace.
javax.jcr.RepositoryException - If the Node cannot be added.
void putPropertyValue(StoreTransaction tx,
Path path,
ValueContainer property)
throws javax.jcr.RepositoryException
ws - The workspaceproperty - The Property content to store.
javax.jcr.RepositoryException - If the property cannot be stored.
void remove(StoreTransaction tx,
Path path)
throws javax.jcr.RepositoryException
In addition, it MUST NOT be an error if remove() is called on a path which is already removed. In such a case, remove() shall fail silently.
ws - path -
javax.jcr.RepositoryException
StoreTransaction storeStarted(WorkspaceImpl ws)
throws javax.jcr.RepositoryException
ws - The workspace
javax.jcr.RepositoryException
void storeFinished(StoreTransaction tx)
throws javax.jcr.RepositoryException
tx - The same StoreTransaction object which was returned from storeStarted().
javax.jcr.RepositoryException
void storeCancelled(StoreTransaction tx)
throws javax.jcr.RepositoryException
tx - The transaction from storeStarted().
javax.jcr.RepositoryException
void reorderNodes(StoreTransaction tx,
Path path,
java.util.List<Path> childOrder)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||