|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.priha.providers.FileProvider
public class FileProvider
A simple file system -based provider. This is not particularly optimized. Stores UUIDs and references as journaling files which are compacted at every N writes and on shutdown. If there is a power outage just in the middle of this process, it's possible that the file ends up being corrupted. Currently there is no way to rebuild the UUIDs.
The FileProvider does not support failure recovery at the moment. So it's probably not the best provider for production systems.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.priha.providers.PerformanceReporter |
---|
PerformanceReporter.Count |
Constructor Summary | |
---|---|
FileProvider()
|
Method Summary | |
---|---|
void |
addNode(StoreTransaction tx,
Path path,
QNodeDefinition def)
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. |
void |
copy(WorkspaceImpl ws,
Path srcpath,
Path destpath)
|
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. |
long |
getCount(PerformanceReporter.Count item)
|
ValueContainer |
getPropertyValue(WorkspaceImpl ws,
Path path)
Returns the value of a property. |
boolean |
itemExists(WorkspaceImpl ws,
Path path,
ItemType type)
A Node exists only if it has a primaryType.info in the directory. |
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.List<java.lang.String> |
listWorkspaces()
Lists all workspaces which are available in this Repository. |
protected static java.lang.String |
mangleName(java.lang.String name)
This makes sure that the name is still readable by the file system. |
void |
move(WorkspaceImpl ws,
Path srcpath,
Path destpath)
|
void |
open(RepositoryImpl rep,
javax.jcr.Credentials credentials,
java.lang.String workspaceName)
Opens a repository. |
void |
putPropertyValue(StoreTransaction tx,
Path path,
ValueContainer vc)
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 |
rename(StoreTransaction tx,
Path path,
Path.Component newName)
|
void |
reorderNodes(StoreTransaction tx,
Path internalPath,
java.util.List<Path> childOrder)
|
void |
resetCounts()
|
void |
start(RepositoryImpl rep,
java.util.Properties props)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileProvider() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Method Detail |
---|
public void addNode(StoreTransaction tx, Path path, QNodeDefinition def) throws javax.jcr.RepositoryException
RepositoryProvider
addNode
in interface RepositoryProvider
path
- Path to the node in this workspace.
javax.jcr.RepositoryException
- If the Node cannot be added.public java.util.List<java.lang.String> listWorkspaces()
RepositoryProvider
listWorkspaces
in interface RepositoryProvider
public void start(RepositoryImpl rep, java.util.Properties props) throws ConfigurationException
RepositoryProvider
start
in interface RepositoryProvider
rep
- The Repository which owns this provider.props
- A set of filtered properties for this provider.
ConfigurationException
- If the repository cannot be started due to a faulty configuration.ProviderManager.filterProperties(RepositoryImpl, String)
public void stop(RepositoryImpl rep)
RepositoryProvider
This method will only be called when the Repository shuts down.
stop
in interface RepositoryProvider
rep
- The Repository object.public void copy(WorkspaceImpl ws, Path srcpath, Path destpath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public java.util.List<Path> listNodes(WorkspaceImpl ws, Path parentpath) throws javax.jcr.NamespaceException, javax.jcr.RepositoryException
RepositoryProvider
listNodes
in interface RepositoryProvider
ws
- The Workspace.parentpath
- The path to the Node whose children should be listed.
javax.jcr.RepositoryException
- If the children cannot be found.
javax.jcr.NamespaceException
public java.util.List<QName> listProperties(WorkspaceImpl ws, Path path) throws javax.jcr.RepositoryException
RepositoryProvider
listProperties
in interface RepositoryProvider
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.public void move(WorkspaceImpl ws, Path srcpath, Path destpath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean itemExists(WorkspaceImpl ws, Path path, ItemType type)
itemExists
in interface RepositoryProvider
ws
- The workspace in which the existence of the Node is checked.path
- The path to the Node.type
- Type to check for
public void open(RepositoryImpl rep, javax.jcr.Credentials credentials, java.lang.String workspaceName) throws javax.jcr.RepositoryException, javax.jcr.NoSuchWorkspaceException
RepositoryProvider
open
in interface RepositoryProvider
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
public void close(WorkspaceImpl ws)
RepositoryProvider
close
in interface RepositoryProvider
ws
- The Workspace attached to the Session.public void putPropertyValue(StoreTransaction tx, Path path, ValueContainer vc) throws javax.jcr.RepositoryException
RepositoryProvider
putPropertyValue
in interface RepositoryProvider
vc
- The Property content to store.
javax.jcr.RepositoryException
- If the property cannot be stored.public ValueContainer getPropertyValue(WorkspaceImpl ws, Path path) throws javax.jcr.RepositoryException
RepositoryProvider
getPropertyValue
in interface RepositoryProvider
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.public void remove(StoreTransaction tx, Path path) throws javax.jcr.RepositoryException
RepositoryProvider
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.
remove
in interface RepositoryProvider
javax.jcr.RepositoryException
public Path findByUUID(WorkspaceImpl ws, java.lang.String uuid) throws javax.jcr.RepositoryException
RepositoryProvider
findByUUID
in interface RepositoryProvider
javax.jcr.ItemNotFoundException
- If the repository does not contain an UUID by this name.
javax.jcr.RepositoryException
public java.util.List<Path> findReferences(WorkspaceImpl ws, java.lang.String uuid) throws javax.jcr.RepositoryException
RepositoryProvider
findReferences
in interface RepositoryProvider
javax.jcr.RepositoryException
public long getCount(PerformanceReporter.Count item)
getCount
in interface PerformanceReporter
public void resetCounts()
resetCounts
in interface PerformanceReporter
protected static java.lang.String mangleName(java.lang.String name)
pagename
- The name to mangle
public void storeFinished(StoreTransaction tx)
RepositoryProvider
storeFinished
in interface RepositoryProvider
tx
- The same StoreTransaction object which was returned from storeStarted().public void storeCancelled(StoreTransaction tx)
RepositoryProvider
storeCancelled
in interface RepositoryProvider
tx
- The transaction from storeStarted().public StoreTransaction storeStarted(WorkspaceImpl ws)
RepositoryProvider
storeStarted
in interface RepositoryProvider
ws
- The workspace
public void reorderNodes(StoreTransaction tx, Path internalPath, java.util.List<Path> childOrder)
reorderNodes
in interface RepositoryProvider
public void rename(StoreTransaction tx, Path path, Path.Component newName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |