org.alfresco.repo.avm
Class AVMServiceImpl

java.lang.Object
  extended by org.alfresco.repo.avm.AVMServiceImpl
All Implemented Interfaces:
AVMService

public class AVMServiceImpl
extends java.lang.Object
implements AVMService

Implements the AVMService.


Field Summary
static java.lang.String SYSTEM
           
 
Constructor Summary
AVMServiceImpl()
          Basic constructor for the service.
 
Method Summary
 void addAspect(java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Add an aspect to an AVM node.
 void copy(int srcVersion, java.lang.String srcPath, java.lang.String dstPath, java.lang.String name)
          Copy (possibly recursively) the source into the destination directory.
 void createBranch(int version, java.lang.String srcPath, java.lang.String dstPath, java.lang.String name)
          Create a branch.
 void createDirectory(java.lang.String path, java.lang.String name)
          Create a directory.
 void createDirectory(java.lang.String path, java.lang.String name, java.util.List aspects, java.util.Map properties)
          Create a new directory with aspects and properties.
 java.io.OutputStream createFile(java.lang.String path, java.lang.String name)
          Create a new file.
 void createFile(java.lang.String path, java.lang.String name, java.io.InputStream in)
          Create a file with content specified by the InputStream.
 void createFile(java.lang.String path, java.lang.String name, java.io.InputStream in, java.util.List aspects, java.util.Map properties)
          Create a new "plain" (non-layered) file with aspects and properties.
 void createLayeredDirectory(java.lang.String srcPath, java.lang.String parent, java.lang.String name)
          Create a new layered directory.
 void createLayeredFile(java.lang.String srcPath, java.lang.String parent, java.lang.String name)
          Create a new layered file.
 java.util.Map createSnapshot(java.lang.String store, java.lang.String tag, java.lang.String description)
          Snapshot the given AVMStore.
 void createStore(java.lang.String name)
          Create an AVMStore with the given name (it must not exist).
 void createStore(java.lang.String name, java.util.Map props)
          Create an AVMStore with the given name (it must not exist) and set store properties.
 void deleteNodeProperties(java.lang.String path)
          Delete all the properties attached to an AVM node.
 void deleteNodeProperty(java.lang.String path, org.alfresco.service.namespace.QName name)
          Delete a property.
 void deleteStoreProperty(java.lang.String store, org.alfresco.service.namespace.QName name)
          Delete a property on a store by name.
 AVMNodeDescriptor forceCopy(java.lang.String path)
          Force copy on write of a path.
 org.alfresco.util.Pair getAPath(AVMNodeDescriptor desc)
          Get a single valid path to a given node.
 java.util.Set getAspects(AVMNodeDescriptor desc)
          Get all the aspects from a node descriptor.
 java.util.Set getAspects(int version, java.lang.String path)
          Get all the aspects on an AVM node.
 AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left, AVMNodeDescriptor right)
          Get the common ancestor of two nodes if one exists.
 org.alfresco.service.cmr.repository.ContentData getContentDataForRead(AVMNodeDescriptor desc)
          Get ContentData using only a node descriptor.
 org.alfresco.service.cmr.repository.ContentData getContentDataForRead(int version, java.lang.String path)
          Get the ContentData for a node.
 org.alfresco.service.cmr.repository.ContentData getContentDataForWrite(java.lang.String path)
          Get the Content data for writing.
 org.alfresco.service.cmr.repository.ContentReader getContentReader(int version, java.lang.String path)
          Get a content reader from a file node.
 org.alfresco.service.cmr.repository.ContentWriter getContentWriter(java.lang.String path, boolean update)
          Get a ContentWriter to a file node.
 java.util.List getDeleted(int version, java.lang.String path)
          Get the names of nodes that have been deleted in a directory.
 java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir)
          Get a directory listing from a node descriptor.
 java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir, boolean includeDeleted)
          Get a directory listing from a node descriptor, with the option of seeing deleted nodes.
 java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir, java.lang.String childPattern)
          Get a non-recursive directory listing of a directory node identified by a node descriptor.
 java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir, java.lang.String childNamePattern, boolean includeDeleted)
           
 java.util.SortedMap getDirectoryListing(int version, java.lang.String path)
          Get a directory listing.
 java.util.SortedMap getDirectoryListing(int version, java.lang.String path, boolean includeDeleted)
          Get a listing of a Folder by name, with the option of seeing Deleted Nodes.
 AVMNodeDescriptor[] getDirectoryListingArray(AVMNodeDescriptor dir, boolean includeDeleted)
          Get a directory listing as an Array of node descriptors.
 AVMNodeDescriptor[] getDirectoryListingArray(int version, java.lang.String path, boolean includeDeleted)
          Get a directory listing as an Array of AVMNodeDescriptors.
 java.util.SortedMap getDirectoryListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
          Get a listing of all the directly contained children of a directory.
 java.util.SortedMap getDirectoryListingDirect(int version, java.lang.String path)
          Get the listing of nodes contained directly in a directory.
 java.util.SortedMap getDirectoryListingDirect(int version, java.lang.String path, boolean includeDeleted)
          Get the listing of nodes contained directly in a directory.
 java.io.InputStream getFileInputStream(AVMNodeDescriptor desc)
          Get an InputStream from a descriptor.
 java.io.InputStream getFileInputStream(int version, java.lang.String path)
          Get an InputStream from a file.
 java.io.OutputStream getFileOutputStream(java.lang.String path)
          Get an output stream to a file.
 java.util.List getHeadPaths(AVMNodeDescriptor desc)
          Get all paths that a given node has that are in the head version.
 java.util.List getHistory(AVMNodeDescriptor desc, int count)
          Get the history of a node.
 java.lang.String getIndirectionPath(int version, java.lang.String path)
          Get the indirection path of a layered node.
 int getLatestSnapshotID(java.lang.String storeName)
          Get the latest snapshot id of a store.
 LayeringDescriptor getLayeringInfo(int version, java.lang.String path)
          Get layering information about a path.
 int getNextVersionID(java.lang.String repName)
          Get the Latest Version ID for an AVMStore.
 java.util.Map getNodeProperties(AVMNodeDescriptor desc)
          Get all the properties associated with a node identified by a descriptor.
 java.util.Map getNodeProperties(int version, java.lang.String path)
          Get all the properties associated with a node.
 PropertyValue getNodeProperty(int version, java.lang.String path, org.alfresco.service.namespace.QName name)
          Get a property of a node by QName.
 java.util.List getPaths(AVMNodeDescriptor desc)
          Get a list of all paths that a given node has.
 java.util.List getPathsInStoreHead(AVMNodeDescriptor desc, java.lang.String store)
          Get all paths to a node starting at the HEAD version of a store.
 java.util.List getPathsInStoreVersion(AVMNodeDescriptor desc, java.lang.String store, int version)
          Get all paths to a given node in a single store in a single non-head version.
 AVMStoreDescriptor getStore(java.lang.String name)
          Get a reposotory.
 java.util.Map getStoreProperties(java.lang.String store)
          Get all the properties associated with a store.
 PropertyValue getStoreProperty(java.lang.String store, org.alfresco.service.namespace.QName name)
          Get a property from a store.
 AVMNodeDescriptor getStoreRoot(int version, java.lang.String name)
          Get a descriptor for the specified AVMStore root.
 java.util.List getStores()
          Get a list of all AVMStores.
 java.util.List getStoreVersions(java.lang.String name)
          Get the extant version ids for an AVMStore.
 java.util.List getStoreVersions(java.lang.String name, java.util.Date from, java.util.Date to)
          Get version IDs by creation date.
 java.util.List getStoreVersionsBetween(java.lang.String name, int startVersion, int endVersion)
          Get all versions from an including startVersion up to but NOT including endVersion
 java.util.List getStoreVersionsFrom(java.lang.String name, int version)
          Get all versions from the last down to and including the one specified Returned in descending version id.
 java.util.List getStoreVersionsTo(java.lang.String name, int version)
          Get all versions from the first up to and including the one specified Returned in ascending version id order.
 AVMStoreDescriptor getSystemStore()
          Get (and create if necessary) the system store.
 boolean hasAspect(int version, java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Does a node have a particular aspect.
 void link(java.lang.String parentPath, java.lang.String name, AVMNodeDescriptor toLink)
          This inserts a node into a parent directly.
 AVMNodeDescriptor lookup(AVMNodeDescriptor dir, java.lang.String name)
          Lookup a node descriptor from a directory node descriptor.
 AVMNodeDescriptor lookup(AVMNodeDescriptor dir, java.lang.String name, boolean includeDeleted)
          Lookup a node from a directory node, with the option of seeing Deleted Nodes.
 AVMNodeDescriptor lookup(int version, java.lang.String path)
          Look up information about a node.
 AVMNodeDescriptor lookup(int version, java.lang.String path, boolean includeDeleted)
          Lookup a node by version ids and path, with the option of seeing Deleted Nodes.
 void makePrimary(java.lang.String path)
          Make the indicated directory a primary indirection.
 void makeTransparent(java.lang.String dirPath, java.lang.String name)
          Make name in dirPath transparent to what was underneath it.
 void purgeStore(java.lang.String name)
          Purge an AVMStore.
 void purgeVersion(int version, java.lang.String name)
          Purge a particular version from a repository.
 java.util.Map queryStorePropertyKey(java.lang.String store, org.alfresco.service.namespace.QName keyPattern)
          Queries a given store for properties with keys that match a given pattern.
 java.util.Map queryStoresPropertyKeys(org.alfresco.service.namespace.QName keyPattern)
          Queries all AVM stores for properties with keys that matcha given pattern.
 void removeAspect(java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Remove an aspect and its properties from a node.
 void removeNode(java.lang.String path)
          Remove a node by full path.
 void removeNode(java.lang.String parent, java.lang.String name)
          Remove a node.
 void rename(java.lang.String srcParent, java.lang.String srcName, java.lang.String dstParent, java.lang.String dstName)
          Rename a node.
 void renameStore(java.lang.String sourceName, java.lang.String destName)
          Rename a store.
 void retargetLayeredDirectory(java.lang.String path, java.lang.String target)
          Change what a layered directory points to.
 void revert(java.lang.String path, AVMNodeDescriptor toRevertTo)
          Revert a head path to a given version.
 void setAvmRepository(AVMRepository avmRepository)
          Set the repository reference.
 void setContentData(java.lang.String path, org.alfresco.service.cmr.repository.ContentData data)
          Set the content data on a file.
 void setEncoding(java.lang.String path, java.lang.String encoding)
          Set the encoding.
 void setGuid(java.lang.String path, java.lang.String guid)
          Set the GUID on a node.
 void setMetaDataFrom(java.lang.String path, AVMNodeDescriptor from)
          Set all metadata on a node from another node.
 void setMimeType(java.lang.String path, java.lang.String mimeType)
          Set the mime type.
 void setNodeProperties(java.lang.String path, java.util.Map properties)
          Set a collection of properties on a node.
 void setNodeProperty(java.lang.String path, org.alfresco.service.namespace.QName name, PropertyValue value)
          Set a property on a node.
 void setOpacity(java.lang.String path, boolean opacity)
          Set the opacity of a layered directory.
 void setStoreProperties(java.lang.String store, java.util.Map props)
          Set a group of properties on a store.
 void setStoreProperty(java.lang.String store, org.alfresco.service.namespace.QName name, PropertyValue value)
          Set a property on a store.
 void uncover(java.lang.String dirPath, java.lang.String name)
          Uncover a deleted name in a layered directory.
 void updateLink(java.lang.String parentPath, java.lang.String name, AVMNodeDescriptor toLink)
          This replaces a node into a parent directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM

public static final java.lang.String SYSTEM
See Also:
Constant Field Values
Constructor Detail

AVMServiceImpl

public AVMServiceImpl()
Basic constructor for the service.

Method Detail

setAvmRepository

public void setAvmRepository(AVMRepository avmRepository)
Set the repository reference. For Spring.

Parameters:
avmRepository - The repository reference.

getFileInputStream

public java.io.InputStream getFileInputStream(int version,
                                              java.lang.String path)
Get an InputStream from a file.

Specified by:
getFileInputStream in interface AVMService
Parameters:
version - The version to look under.
path - The absolute path.
Returns:
An InputStream
Throws:
AVMNotFoundException - When the path is invalid.

getFileInputStream

public java.io.InputStream getFileInputStream(AVMNodeDescriptor desc)
Get an InputStream from a descriptor.

Specified by:
getFileInputStream in interface AVMService
Parameters:
desc - The descriptor.
Returns:
An InputStream.
Throws:
AVMNotFoundException

getFileOutputStream

public java.io.OutputStream getFileOutputStream(java.lang.String path)
Get an output stream to a file. Triggers versioning.

Specified by:
getFileOutputStream in interface AVMService
Parameters:
path - The absolute path to the file.

getContentReader

public org.alfresco.service.cmr.repository.ContentReader getContentReader(int version,
                                                                          java.lang.String path)
Get a content reader from a file node.

Specified by:
getContentReader in interface AVMService
Parameters:
version - The version of the file.
path - The path to the file.
Returns:
A ContentReader.

getContentWriter

public org.alfresco.service.cmr.repository.ContentWriter getContentWriter(java.lang.String path,
                                                                          boolean update)
Get a ContentWriter to a file node.

Specified by:
getContentWriter in interface AVMService
Parameters:
path - The path to the file.
update - true if the property must be updated atomically when the content write stream is closed (attaches a listener to the stream); false if the client code will perform the updates itself.
Returns:
A ContentWriter.

getDirectoryListing

public java.util.SortedMap getDirectoryListing(int version,
                                               java.lang.String path)
Get a directory listing.

Specified by:
getDirectoryListing in interface AVMService
Parameters:
version - The version id to lookup.
path - The path to lookup.
Returns:
A Map of names to descriptors.

getDirectoryListing

public java.util.SortedMap getDirectoryListing(int version,
                                               java.lang.String path,
                                               boolean includeDeleted)
Get a listing of a Folder by name, with the option of seeing Deleted Nodes.

Specified by:
getDirectoryListing in interface AVMService
Parameters:
version - The version id to look in.
path - The simple absolute path to the file node.
includeDeleted - Whether to see Deleted Nodes.
Returns:
A Map of names to descriptors.
Throws:
AVMNotFoundException - If path is not found.
AVMWrongTypeException - If path contains a non-terminal component that is not a directory, or if path is not pointing at a directory.

getDirectoryListingArray

public AVMNodeDescriptor[] getDirectoryListingArray(int version,
                                                    java.lang.String path,
                                                    boolean includeDeleted)
Get a directory listing as an Array of AVMNodeDescriptors.

Specified by:
getDirectoryListingArray in interface AVMService
Parameters:
version - The version to look under.
path - The path to the directory to be listed.
includeDeleted - Whether to include ghosts.
Returns:
An array of AVMNodeDescriptors.

getDirectoryListingArray

public AVMNodeDescriptor[] getDirectoryListingArray(AVMNodeDescriptor dir,
                                                    boolean includeDeleted)
Get a directory listing as an Array of node descriptors.

Specified by:
getDirectoryListingArray in interface AVMService
Parameters:
dir - The descriptor pointing at the directory to list.
includeDeleted - Whether to show ghosts.
Returns:
An array of AVMNodeDescriptors.

getDirectoryListingDirect

public java.util.SortedMap getDirectoryListingDirect(AVMNodeDescriptor dir,
                                                     boolean includeDeleted)
Get a listing of all the directly contained children of a directory.

Specified by:
getDirectoryListingDirect in interface AVMService
Parameters:
dir - The directory descriptor.
includeDeleted - Whether to include deleted children.
Returns:
A Map of Strings to descriptors.

getDirectoryListingDirect

public java.util.SortedMap getDirectoryListingDirect(int version,
                                                     java.lang.String path)
Get the listing of nodes contained directly in a directory. This is the same as getDirectoryListing for PlainDirectories, but returns only those that are directly contained in a layered directory.

Specified by:
getDirectoryListingDirect in interface AVMService
Parameters:
version - The version to look up.
path - The full path to get listing for.
Returns:
A Map of names to descriptors.
Throws:
AVMNotFoundException - If path does not exist.
AVMWrongTypeException - If path contains any non-directory elements.

getDirectoryListingDirect

public java.util.SortedMap getDirectoryListingDirect(int version,
                                                     java.lang.String path,
                                                     boolean includeDeleted)
Get the listing of nodes contained directly in a directory. This is the same as getDirectoryListing for PlainDirectories, but returns only those that are directly contained in a layered directory. This has the option of seeing Deleted Nodes.

Specified by:
getDirectoryListingDirect in interface AVMService
Parameters:
version - The version to look up.
path - The full path to get listing for.
includeDeleted - Whether to see Deleted Nodes.
Returns:
A Map of names to descriptors.
Throws:
AVMNotFoundException - If path does not exist.
AVMWrongTypeException - If path contains any non-directory elements.

getDirectoryListing

public java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir)
Get a directory listing from a node descriptor.

Specified by:
getDirectoryListing in interface AVMService
Parameters:
dir - The directory node descriptor.
Returns:
A Map of names to node descriptors.

getDirectoryListing

public java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir,
                                               java.lang.String childPattern)
Description copied from interface: AVMService
Get a non-recursive directory listing of a directory node identified by a node descriptor. Only return children matching the given pattern. '*' match any number of characters - equivalent to SQL '%' '?' match a single character - equivalent to SQL '_' '\' escape - valid sequences "\\", "\*" and "\?"

Specified by:
getDirectoryListing in interface AVMService
Parameters:
dir - The directory node descriptor.
Returns:
A sorted Map of names to node descriptors.

getDirectoryListing

public java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir,
                                               java.lang.String childNamePattern,
                                               boolean includeDeleted)

getDirectoryListing

public java.util.SortedMap getDirectoryListing(AVMNodeDescriptor dir,
                                               boolean includeDeleted)
Get a directory listing from a node descriptor, with the option of seeing deleted nodes.

Specified by:
getDirectoryListing in interface AVMService
Parameters:
dir - The directory node descriptor.
includeDeleted - Whether to see Deleted Nodes.
Returns:
A Map of names to node descriptors.
Throws:
AVMNotFoundException - If the descriptor is stale.
AVMWrongTypeException - If the descriptor does not point at a directory.

getDeleted

public java.util.List getDeleted(int version,
                                 java.lang.String path)
Get the names of nodes that have been deleted in a directory.

Specified by:
getDeleted in interface AVMService
Parameters:
version - The version to look under.
path - The path of the directory.
Returns:
A List of names.
Throws:
AVMNotFoundException - If path does not exist.
AVMWrongTypeException - If path contains any elements that are not directories.

createFile

public java.io.OutputStream createFile(java.lang.String path,
                                       java.lang.String name)
Create a new file. The file must not exist.

Specified by:
createFile in interface AVMService
Parameters:
path - The path to the containing directory.
name - The name of the file.
Returns:
An output stream to the file.

createFile

public void createFile(java.lang.String path,
                       java.lang.String name,
                       java.io.InputStream in)
Create a file with content specified by the InputStream. Guaranteed to be created atomically.

Specified by:
createFile in interface AVMService
Parameters:
path - The path to the containing directory.
name - The name to give the file.
in - An InputStream containing data for file.

createFile

public void createFile(java.lang.String path,
                       java.lang.String name,
                       java.io.InputStream in,
                       java.util.List aspects,
                       java.util.Map properties)
Description copied from interface: AVMService
Create a new "plain" (non-layered) file with aspects and properties. Guarantees that the entire contents of the input stream will be loaded atomically. The directory identified by path must already exist.

Specified by:
createFile in interface AVMService
Parameters:
path - The path of the directory containing the created file.
name - The name of the new file
in - An input stream with data for the file.
properties - A map of properties to give the file.

createDirectory

public void createDirectory(java.lang.String path,
                            java.lang.String name)
Create a directory. The directory must not exist.

Specified by:
createDirectory in interface AVMService
Parameters:
path - The path to the containing directory.
name - The name of the new directory.

createDirectory

public void createDirectory(java.lang.String path,
                            java.lang.String name,
                            java.util.List aspects,
                            java.util.Map properties)
Description copied from interface: AVMService
Create a new directory with aspects and properties. If path is within a layer, the new directory will be a layered directory; otherwise, the new directory will be a plain directory.

Specified by:
createDirectory in interface AVMService
Parameters:
path - The simple absolute path to the parent.
name - The name to give the directory.
aspects - A list of aspects to add.
properties - A Map of properties to add.

createLayeredFile

public void createLayeredFile(java.lang.String srcPath,
                              java.lang.String parent,
                              java.lang.String name)
Create a new layered file. It must not exist.

Specified by:
createLayeredFile in interface AVMService
Parameters:
srcPath - The src path. Ie the target for the layering.
parent - The path to the parent directory.
name - The name to give the new file.

createLayeredDirectory

public void createLayeredDirectory(java.lang.String srcPath,
                                   java.lang.String parent,
                                   java.lang.String name)
Create a new layered directory. It must not exist.

Specified by:
createLayeredDirectory in interface AVMService
Parameters:
srcPath - The src path. Ie the target for layering.
parent - The path to the parent directory.
name - The name for the new directory.

createStore

public void createStore(java.lang.String name)
Create an AVMStore with the given name (it must not exist).

Specified by:
createStore in interface AVMService
Parameters:
name - The name to give the AVMStore.

createStore

public void createStore(java.lang.String name,
                        java.util.Map props)
Create an AVMStore with the given name (it must not exist) and set store properties.

Specified by:
createStore in interface AVMService
Parameters:
name - The name to give the AVMStore.
props - A Map of the properties to set.

createBranch

public void createBranch(int version,
                         java.lang.String srcPath,
                         java.lang.String dstPath,
                         java.lang.String name)
Create a branch.

Specified by:
createBranch in interface AVMService
Parameters:
version - The version to branch from.
srcPath - The path to the thing to branch from.
dstPath - The path to the destination containing directory.
name - The name of the new branch.

removeNode

public void removeNode(java.lang.String parent,
                       java.lang.String name)
Remove a node. Beware, the node can be a directory and this acts recursively.

Specified by:
removeNode in interface AVMService
Parameters:
parent - The path to the parent.
name - The name of the node to remove.

removeNode

public void removeNode(java.lang.String path)
Remove a node by full path.

Specified by:
removeNode in interface AVMService
Parameters:
path - The full path to the node.

rename

public void rename(java.lang.String srcParent,
                   java.lang.String srcName,
                   java.lang.String dstParent,
                   java.lang.String dstName)
Rename a node.

Specified by:
rename in interface AVMService
Parameters:
srcParent - The path to the source parent.
srcName - The name of the source node.
dstParent - The path to the destination parent.
dstName - The name to give the renamed node.

uncover

public void uncover(java.lang.String dirPath,
                    java.lang.String name)
Uncover a deleted name in a layered directory.

Specified by:
uncover in interface AVMService
Parameters:
dirPath - The path to the layered directory.
name - The name to uncover.

makeTransparent

public void makeTransparent(java.lang.String dirPath,
                            java.lang.String name)
Make name in dirPath transparent to what was underneath it. That is, this removes the offending node from its layered directory parent's direct ownership.

Specified by:
makeTransparent in interface AVMService
Parameters:
dirPath - The path to the layered directory.
name - The name of the item to flatten.

getNextVersionID

public int getNextVersionID(java.lang.String repName)
Get the Latest Version ID for an AVMStore.

Specified by:
getNextVersionID in interface AVMService
Parameters:
repName - The name of the AVMStore.
Returns:
The Latest Version ID.

getLatestSnapshotID

public int getLatestSnapshotID(java.lang.String storeName)
Get the latest snapshot id of a store.

Specified by:
getLatestSnapshotID in interface AVMService
Parameters:
storeName - The store name.
Returns:
The id of the latest extant version of the store.
Throws:
AVMNotFoundException - If storeName does not exist.

createSnapshot

public java.util.Map createSnapshot(java.lang.String store,
                                    java.lang.String tag,
                                    java.lang.String description)
Description copied from interface: AVMService
Snapshot the given AVMStore. When files have been modified since the previous snapshot, a new snapshot version is created; otherwise, no extra snapshot is actually taken.

When no snapshot is actually taken, but either 'tag' or 'store' are non-null, they will override the value for the last snapshot (i.e.: the old values will be discarded); however, if both 'tag' and 'description' are null then invoking createSnapshot when no files have been modified becomes a true no-op.

Specified by:
createSnapshot in interface AVMService
Parameters:
store - The name of the AVMStore to snapshot.
tag - The short description.
description - The thick description.
Returns:
A Map of all implicitly or explicitly snapshotted stores to last version id.

lookup

public AVMNodeDescriptor lookup(int version,
                                java.lang.String path)
Look up information about a node.

Specified by:
lookup in interface AVMService
Parameters:
version - The version to look up.
path - The path to look up.
Returns:
A Descriptor.

lookup

public AVMNodeDescriptor lookup(int version,
                                java.lang.String path,
                                boolean includeDeleted)
Lookup a node by version ids and path, with the option of seeing Deleted Nodes.

Specified by:
lookup in interface AVMService
Parameters:
version - The version id to look under.
path - The simple absolute path to the parent directory.
includeDeleted - Whether to see Deleted Nodes.
Returns:
An AVMNodeDescriptor.
Throws:
AVMNotFoundException - If path does not exist or if version does not exist.
AVMWrongTypeException - If path contains a non-terminal element that is not a directory.

lookup

public AVMNodeDescriptor lookup(AVMNodeDescriptor dir,
                                java.lang.String name)
Lookup a node descriptor from a directory node descriptor.

Specified by:
lookup in interface AVMService
Parameters:
dir - The node descriptor of the directory.
name - The name to lookup.
Returns:
The node descriptor of the child.

lookup

public AVMNodeDescriptor lookup(AVMNodeDescriptor dir,
                                java.lang.String name,
                                boolean includeDeleted)
Lookup a node from a directory node, with the option of seeing Deleted Nodes.

Specified by:
lookup in interface AVMService
Parameters:
dir - The descriptor for the directory node.
name - The name to lookup.
includeDeleted - Whether to see Deleted Nodes.
Returns:
The descriptor for the child.
Throws:
AVMNotFoundException - If name does not exist or if dir is dangling.
AVMWrongTypeException - If dir does not refer to a directory.

getPaths

public java.util.List getPaths(AVMNodeDescriptor desc)
Get a list of all paths that a given node has.

Specified by:
getPaths in interface AVMService
Parameters:
desc - The node descriptor to get paths for.
Returns:
A List of version, path Pairs.

getAPath

public org.alfresco.util.Pair getAPath(AVMNodeDescriptor desc)
Description copied from interface: AVMService
Get a single valid path to a given node.

Specified by:
getAPath in interface AVMService
Parameters:
desc - The descriptor of the node to which a version and path will be fetched.
Returns:
version and path.

getHeadPaths

public java.util.List getHeadPaths(AVMNodeDescriptor desc)
Get all paths that a given node has that are in the head version.

Specified by:
getHeadPaths in interface AVMService
Parameters:
desc - The node descriptor to get paths for.
Returns:
A List of version, path Pairs.

getPathsInStoreHead

public java.util.List getPathsInStoreHead(AVMNodeDescriptor desc,
                                          java.lang.String store)
Get all paths to a node starting at the HEAD version of a store.

Specified by:
getPathsInStoreHead in interface AVMService
Parameters:
desc - The node descriptor.
store - The store.
Returns:
A List of all paths meeting the criteria.

getPathsInStoreVersion

public java.util.List getPathsInStoreVersion(AVMNodeDescriptor desc,
                                             java.lang.String store,
                                             int version)
Description copied from interface: AVMService
Get all paths to a given node in a single store in a single non-head version.

Specified by:
getPathsInStoreVersion in interface AVMService
Parameters:
desc - The node descriptor.
store - The name of the store.
version - The version.
Returns:
A List of AVM paths.

purgeStore

public void purgeStore(java.lang.String name)
Purge an AVMStore. Permanently delete everything that is only referenced in that AVMStore.

Specified by:
purgeStore in interface AVMService
Parameters:
name - The name of the AVMStore to purge.

purgeVersion

public void purgeVersion(int version,
                         java.lang.String name)
Purge a particular version from a repository.

Specified by:
purgeVersion in interface AVMService
Parameters:
version - The id of the version to purge.
name - The name of the repository.

getIndirectionPath

public java.lang.String getIndirectionPath(int version,
                                           java.lang.String path)
Get the indirection path of a layered node.

Specified by:
getIndirectionPath in interface AVMService
Parameters:
version - The version to lookup.
path - The path to lookup.
Returns:
The indirection path (target) of the layered node.

getStoreVersions

public java.util.List getStoreVersions(java.lang.String name)
Get the extant version ids for an AVMStore.

Specified by:
getStoreVersions in interface AVMService
Parameters:
name - The name of the AVMStore.
Returns:
A List of VersionDescriptors.

getStoreVersions

public java.util.List getStoreVersions(java.lang.String name,
                                       java.util.Date from,
                                       java.util.Date to)
Get version IDs by creation date. From or to may be null but not both.

Specified by:
getStoreVersions in interface AVMService
Parameters:
name - The name of the AVMStore to search.
from - The earliest versions to return.
to - The latest versions to return.
Returns:
The Set of matching version IDs.

retargetLayeredDirectory

public void retargetLayeredDirectory(java.lang.String path,
                                     java.lang.String target)
Change what a layered directory points to.

Specified by:
retargetLayeredDirectory in interface AVMService
Parameters:
path - The path to the layered directory.
target - The new indirection target of the layered directory

makePrimary

public void makePrimary(java.lang.String path)
Make the indicated directory a primary indirection.

Specified by:
makePrimary in interface AVMService
Parameters:
path - The absolute path.

getStores

public java.util.List getStores()
Get a list of all AVMStores.

Specified by:
getStores in interface AVMService
Returns:
The AVMStores.

getStore

public AVMStoreDescriptor getStore(java.lang.String name)
Get a reposotory.

Specified by:
getStore in interface AVMService
Parameters:
name - The name of the AVMStore to get.
Returns:
The AVMStore.

getSystemStore

public AVMStoreDescriptor getSystemStore()
Get (and create if necessary) the system store. This store houses things like workflow packages.

Specified by:
getSystemStore in interface AVMService
Returns:
The descriptor.

getStoreRoot

public AVMNodeDescriptor getStoreRoot(int version,
                                      java.lang.String name)
Get a descriptor for the specified AVMStore root.

Specified by:
getStoreRoot in interface AVMService
Parameters:
version - The version to get.
name - The name of the AVMStore.
Returns:
The root descriptor.

getHistory

public java.util.List getHistory(AVMNodeDescriptor desc,
                                 int count)
Get the history of a node.

Specified by:
getHistory in interface AVMService
Parameters:
desc - The node to get history from.
count - The number of ancestors to fallow back. -1 means all.
Returns:
A List of ancestors most recent first.

setOpacity

public void setOpacity(java.lang.String path,
                       boolean opacity)
Set the opacity of a layered directory. An opaque layer hides what its indirection points to.

Specified by:
setOpacity in interface AVMService
Parameters:
path - The path to the layered directory.
opacity - True is opaque false is not.

getLayeringInfo

public LayeringDescriptor getLayeringInfo(int version,
                                          java.lang.String path)
Get layering information about a path.

Specified by:
getLayeringInfo in interface AVMService
Parameters:
version - The version to look under.
path - The full AVM path.
Returns:
A LayeringDescriptor.

getCommonAncestor

public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
                                           AVMNodeDescriptor right)
Get the common ancestor of two nodes if one exists.

Specified by:
getCommonAncestor in interface AVMService
Parameters:
left - The first node.
right - The second node.
Returns:
The common ancestor. There are four possible results. Null means that there is no common ancestor. Left returned means that left is strictly an ancestor of right. Right returned means that right is strictly an ancestor of left. Any other non null return is the common ancestor and indicates that left and right are in conflict.

setNodeProperty

public void setNodeProperty(java.lang.String path,
                            org.alfresco.service.namespace.QName name,
                            PropertyValue value)
Set a property on a node.

Specified by:
setNodeProperty in interface AVMService
Parameters:
path - The path to the node to set the property on.
name - The QName of the property.
value - The property to set.

setNodeProperties

public void setNodeProperties(java.lang.String path,
                              java.util.Map properties)
Set a collection of properties on a node.

Specified by:
setNodeProperties in interface AVMService
Parameters:
path - The path to the node.
properties - The Map of properties to set.

getNodeProperty

public PropertyValue getNodeProperty(int version,
                                     java.lang.String path,
                                     org.alfresco.service.namespace.QName name)
Get a property of a node by QName.

Specified by:
getNodeProperty in interface AVMService
Parameters:
version - The version to look under.
path - The path to the node.
name - The QName.
Returns:
The PropertyValue or null if it doesn't exist.

getNodeProperties

public java.util.Map getNodeProperties(int version,
                                       java.lang.String path)
Get all the properties associated with a node.

Specified by:
getNodeProperties in interface AVMService
Parameters:
version - The version to look under.
path - The path to the node.
Returns:
A List of AVMNodeProperties.

getNodeProperties

public java.util.Map getNodeProperties(AVMNodeDescriptor desc)
Description copied from interface: AVMService
Get all the properties associated with a node identified by a descriptor.

Specified by:
getNodeProperties in interface AVMService
Parameters:
desc - The node descriptor
Returns:
A Map of the properties.

deleteNodeProperty

public void deleteNodeProperty(java.lang.String path,
                               org.alfresco.service.namespace.QName name)
Delete a property.

Specified by:
deleteNodeProperty in interface AVMService
Parameters:
path - The path to the node.
name - The QName of the property to delete.

deleteNodeProperties

public void deleteNodeProperties(java.lang.String path)
Delete all the properties attached to an AVM node.

Specified by:
deleteNodeProperties in interface AVMService
Parameters:
path - The path to the node.

setStoreProperty

public void setStoreProperty(java.lang.String store,
                             org.alfresco.service.namespace.QName name,
                             PropertyValue value)
Set a property on a store. If the property exists it will be overwritten.

Specified by:
setStoreProperty in interface AVMService
Parameters:
store - The store to set the property on.
name - The name of the property.
value - The value of the property.

setStoreProperties

public void setStoreProperties(java.lang.String store,
                               java.util.Map props)
Set a group of properties on a store. Existing properties will be overwritten.

Specified by:
setStoreProperties in interface AVMService
Parameters:
store - The name of the store.
props - A Map of the properties to set.

getStoreProperty

public PropertyValue getStoreProperty(java.lang.String store,
                                      org.alfresco.service.namespace.QName name)
Get a property from a store.

Specified by:
getStoreProperty in interface AVMService
Parameters:
store - The name of the store.
name - The name of the property.
Returns:
A PropertyValue or null if non-existent.

queryStorePropertyKey

public java.util.Map queryStorePropertyKey(java.lang.String store,
                                           org.alfresco.service.namespace.QName keyPattern)
Queries a given store for properties with keys that match a given pattern.

Specified by:
queryStorePropertyKey in interface AVMService
Parameters:
store - The name of the store.
keyPattern - The sql 'like' pattern, inserted into a QName.
Returns:
A Map of the matching key value pairs.

queryStoresPropertyKeys

public java.util.Map queryStoresPropertyKeys(org.alfresco.service.namespace.QName keyPattern)
Queries all AVM stores for properties with keys that matcha given pattern.

Specified by:
queryStoresPropertyKeys in interface AVMService
Parameters:
keyPattern - The sql 'like' pattern, inserted into a QName.
Returns:
A List of Pairs of Store name, Map.Entry.

getStoreProperties

public java.util.Map getStoreProperties(java.lang.String store)
Get all the properties associated with a store.

Specified by:
getStoreProperties in interface AVMService
Parameters:
store - The name of the store.
Returns:
A Map of the stores properties.

deleteStoreProperty

public void deleteStoreProperty(java.lang.String store,
                                org.alfresco.service.namespace.QName name)
Delete a property on a store by name.

Specified by:
deleteStoreProperty in interface AVMService
Parameters:
store - The name of the store.
name - The name of the property to delete.

getContentDataForRead

public org.alfresco.service.cmr.repository.ContentData getContentDataForRead(int version,
                                                                             java.lang.String path)
Get the ContentData for a node. Only applies to a file.

Specified by:
getContentDataForRead in interface AVMService
Parameters:
version - The version to look under.
path - The path to the node.
Returns:
The ContentData object.

getContentDataForRead

public org.alfresco.service.cmr.repository.ContentData getContentDataForRead(AVMNodeDescriptor desc)
Description copied from interface: AVMService
Get ContentData using only a node descriptor.

Specified by:
getContentDataForRead in interface AVMService
Parameters:
desc - The node descriptor.
Returns:
The ContentData

getContentDataForWrite

public org.alfresco.service.cmr.repository.ContentData getContentDataForWrite(java.lang.String path)
Get the Content data for writing.

Specified by:
getContentDataForWrite in interface AVMService
Parameters:
path - The path to the node.
Returns:
The ContentData object.

setContentData

public void setContentData(java.lang.String path,
                           org.alfresco.service.cmr.repository.ContentData data)
Set the content data on a file.

Specified by:
setContentData in interface AVMService
Parameters:
path - The path to the file.
data - The ContentData to set.
Throws:
AVMNotFoundException - If path does not exist.
AVMWrongTypeException - If path does not point to a file.

setMetaDataFrom

public void setMetaDataFrom(java.lang.String path,
                            AVMNodeDescriptor from)
Set all metadata on a node from another node. Aspects, properties, ACLs.

Specified by:
setMetaDataFrom in interface AVMService
Parameters:
path - The path to the node to set.
from - The descriptor for the node to get metadata from.

addAspect

public void addAspect(java.lang.String path,
                      org.alfresco.service.namespace.QName aspectName)
Add an aspect to an AVM node.

Specified by:
addAspect in interface AVMService
Parameters:
path - The path to the node.
aspectName - The QName of the aspect.
Throws:
AVMNotFoundException - If path does not exist.
AVMExistsException - If the aspect already exists.

getAspects

public java.util.Set getAspects(int version,
                                java.lang.String path)
Get all the aspects on an AVM node.

Specified by:
getAspects in interface AVMService
Parameters:
version - The version to look under.
path - The path to the node.
Returns:
A List of the QNames of the aspects.

getAspects

public java.util.Set getAspects(AVMNodeDescriptor desc)
Description copied from interface: AVMService
Get all the aspects from a node descriptor.

Specified by:
getAspects in interface AVMService
Parameters:
desc - The node descriptor.
Returns:
The Set of Aspects.

removeAspect

public void removeAspect(java.lang.String path,
                         org.alfresco.service.namespace.QName aspectName)
Remove an aspect and its properties from a node.

Specified by:
removeAspect in interface AVMService
Parameters:
path - The path to the node.
aspectName - The name of the aspect.

hasAspect

public boolean hasAspect(int version,
                         java.lang.String path,
                         org.alfresco.service.namespace.QName aspectName)
Does a node have a particular aspect.

Specified by:
hasAspect in interface AVMService
Parameters:
version - The version to look under.
path - The path to the node.
aspectName - The aspect name to check.
Returns:
Whether the given node has the given aspect.

link

public void link(java.lang.String parentPath,
                 java.lang.String name,
                 AVMNodeDescriptor toLink)
This inserts a node into a parent directly.

Specified by:
link in interface AVMService
Parameters:
parentPath - The path to the parent directory.
name - The name to give the node.
toLink - A descriptor for the node to insert.

updateLink

public void updateLink(java.lang.String parentPath,
                       java.lang.String name,
                       AVMNodeDescriptor toLink)
This replaces a node into a parent directly.

Specified by:
updateLink in interface AVMService
Parameters:
parentPath - The path to the parent directory.
name - The name to give the node.
toLink - A descriptor for the node to insert.

forceCopy

public AVMNodeDescriptor forceCopy(java.lang.String path)
Force copy on write of a path.

Specified by:
forceCopy in interface AVMService
Parameters:
path - The path to force.

copy

public void copy(int srcVersion,
                 java.lang.String srcPath,
                 java.lang.String dstPath,
                 java.lang.String name)
Copy (possibly recursively) the source into the destination directory.

Specified by:
copy in interface AVMService
Parameters:
srcVersion - The version of the source.
srcPath - The path to the source.
dstPath - The destination directory.
name - The name to give the copy.

renameStore

public void renameStore(java.lang.String sourceName,
                        java.lang.String destName)
Rename a store.

Specified by:
renameStore in interface AVMService
Parameters:
sourceName - The original name.
destName - The new name.
Throws:
AVMNotFoundException
AVMExistsException

revert

public void revert(java.lang.String path,
                   AVMNodeDescriptor toRevertTo)
Revert a head path to a given version. This works by cloning the version to revert to, and then linking that new version into head. The reverted version will have the previous head version as ancestor.

Specified by:
revert in interface AVMService
Parameters:
path - The path to the node to revert.
toRevertTo - The descriptor of the version to revert to.
Throws:
AVMNotFoundException

setGuid

public void setGuid(java.lang.String path,
                    java.lang.String guid)
Description copied from interface: AVMService
Set the GUID on a node. The GUID of a node uniquely identifies the state of a node, i.e. its content, metadata, and aspects.

Specified by:
setGuid in interface AVMService
Parameters:
path - The path to the node.
guid - The GUID to set.

setEncoding

public void setEncoding(java.lang.String path,
                        java.lang.String encoding)
Description copied from interface: AVMService
Set the encoding.

Specified by:
setEncoding in interface AVMService
Parameters:
path - The path of the file.
encoding - The encoding.

setMimeType

public void setMimeType(java.lang.String path,
                        java.lang.String mimeType)
Description copied from interface: AVMService
Set the mime type.

Specified by:
setMimeType in interface AVMService
Parameters:
path - The path of the file.
mimeType - The mime type.

getStoreVersionsTo

public java.util.List getStoreVersionsTo(java.lang.String name,
                                         int version)
Description copied from interface: AVMService
Get all versions from the first up to and including the one specified Returned in ascending version id order.

Specified by:
getStoreVersionsTo in interface AVMService
Returns:
list of version descriptors

getStoreVersionsFrom

public java.util.List getStoreVersionsFrom(java.lang.String name,
                                           int version)
Description copied from interface: AVMService
Get all versions from the last down to and including the one specified Returned in descending version id.

Specified by:
getStoreVersionsFrom in interface AVMService
Returns:
list of version descriptors

getStoreVersionsBetween

public java.util.List getStoreVersionsBetween(java.lang.String name,
                                              int startVersion,
                                              int endVersion)
Description copied from interface: AVMService
Get all versions from an including startVersion up to but NOT including endVersion

Specified by:
getStoreVersionsBetween in interface AVMService
Returns:
list of version descriptors


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.