org.alfresco.repo.avm
Class AVMRepository

java.lang.Object
  extended by org.alfresco.repo.avm.AVMRepository

public class AVMRepository
extends java.lang.Object

This or AVMStore are the implementors of the operations specified by AVMService.


Constructor Summary
AVMRepository()
          Create a new one.
 
Method Summary
 void addAspect(java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Add an aspect to an AVM Node.
 boolean can(AVMStore store, AVMNode node, java.lang.String permission, boolean isDirectlyContained)
          Evaluate permission on a node.
 boolean can(java.lang.String storeName, int version, java.lang.String path, java.lang.String permission)
           
 void createAVMStore(java.lang.String name)
          Create a new AVMStore.
 void createAVMStore(java.lang.String name, java.util.Map props)
           
 void createBranch(int version, java.lang.String srcPath, java.lang.String dstPath, java.lang.String name)
          Create a new branch.
 org.alfresco.service.cmr.repository.ContentWriter createContentWriter(java.lang.String path, boolean update)
          Get a ContentWriter to a file node.
 AVMNodeDescriptor createDirectory(AVMNodeDescriptor parent, java.lang.String name)
          Create a new directory.
 void createDirectory(java.lang.String path, java.lang.String name, java.util.List aspects, java.util.Map properties)
          Create a new directory.
 java.io.OutputStream createFile(java.lang.String path, java.lang.String name)
          Create a file.
 void createFile(java.lang.String path, java.lang.String name, java.io.File data, java.util.List aspects, java.util.Map properties)
          Create a file with the given File as content.
 void createLayeredDirectory(java.lang.String srcPath, java.lang.String dstPath, java.lang.String name)
          Create a new layered directory.
 void createLayeredFile(java.lang.String srcPath, java.lang.String dstPath, java.lang.String name)
          Create a new layered file.
 java.util.Map createSnapshot(java.lang.String storeName, java.lang.String tag, java.lang.String description)
          Create a snapshot of a single AVMStore.
 void deleteNodeProperties(java.lang.String path)
          Delete all properties on a node.
 void deleteNodeProperty(java.lang.String path, org.alfresco.service.namespace.QName name)
          Delete a single property from a node.
 void deleteStoreProperty(java.lang.String store, org.alfresco.service.namespace.QName name)
          Delete a property from a store.
 void flatten(java.lang.String path, java.lang.String name)
          Remove name without leaving behind a deleted node.
 AVMNodeDescriptor forceCopy(java.lang.String path)
          Force a copy on write.
 Acl getACL(int version, java.lang.String path)
          Get the ACL on a node.
 org.alfresco.util.Pair getAPath(AVMNodeDescriptor desc)
          Get a single valid path for a node.
 java.util.Set getAspects(AVMNodeDescriptor desc)
           
 java.util.Set getAspects(int version, java.lang.String path)
          Get all the aspects on an AVM node.
 AVMStoreDescriptor getAVMStore(java.lang.String name)
          Get a descriptor for an AVMStore.
 AVMNodeDescriptor getAVMStoreRoot(int version, java.lang.String name)
          Get a descriptor for an AVMStore root.
 java.util.List getAVMStores()
          Get descriptors of all AVMStores.
 java.util.List getAVMStoreVersions(java.lang.String name)
          Get all version for a given AVMStore.
 java.util.List getAVMStoreVersions(java.lang.String name, java.util.Date from, java.util.Date to)
          Get the set of versions between (inclusive) of the given dates.
 java.util.List getAVMStoreVersionsBetween(java.lang.String name, int startVersion, int endVersion)
           
 java.util.List getAVMStoreVersionsFrom(java.lang.String name, int version)
           
 java.util.List getAVMStoreVersionsTo(java.lang.String name, int version)
           
 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)
           
 org.alfresco.service.cmr.repository.ContentData getContentDataForRead(int version, java.lang.String path)
          Get the ContentData for a file.
 org.alfresco.service.cmr.repository.ContentData getContentDataForWrite(java.lang.String path)
          Get the ContentData for a file for writing.
 org.alfresco.service.cmr.repository.ContentReader getContentReader(int version, java.lang.String path)
          Get a content reader from a file node.
 java.util.List getDeleted(int version, java.lang.String path)
          Get the names of deleted nodes in a directory.
 java.util.List getHeadPaths(AVMNodeDescriptor desc)
          Get all paths for a node reachable by HEAD.
 java.util.List getHistory(AVMNodeDescriptor desc, int count)
          Get the history chain for a node.
 java.lang.String getIndirectionPath(int version, java.lang.String path)
          Get the indirection path for a layered node.
 java.io.InputStream getInputStream(AVMNodeDescriptor desc)
           
 java.io.InputStream getInputStream(int version, java.lang.String path)
          Get an input stream from a file.
static AVMRepository GetInstance()
          Get the single instance of AVMRepository.
 int getLatestSnapshotID(java.lang.String name)
          Get the latest extant snapshotted version id.
 int getLatestVersionID(java.lang.String name)
          Get the next version id for the given AVMStore.
 LayeringDescriptor getLayeringInfo(int version, java.lang.String path)
          Get information about layering of a path.
 java.util.SortedMap getListing(AVMNodeDescriptor dir, boolean includeDeleted)
          Get a directory listing from a directory node descriptor.
 java.util.SortedMap getListing(AVMNodeDescriptor dir, java.lang.String childNamePattern, boolean includeDeleted)
          Get a directory listing from a directory node descriptor fo children that match the given pattern
 java.util.SortedMap getListing(int version, java.lang.String path, boolean includeDeleted)
          Get a listing of a directory.
 java.util.SortedMap getListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
          Get the list of nodes directly contained in a directory.
 java.util.SortedMap getListingDirect(int version, java.lang.String path, boolean includeDeleted)
          Get the list of nodes directly contained in a directory.
 java.util.Map getNodeProperties(AVMNodeDescriptor desc)
           
 java.util.Map getNodeProperties(int version, java.lang.String path)
          Get a Map of all the properties of a node.
 PropertyValue getNodeProperty(int version, java.lang.String path, org.alfresco.service.namespace.QName name)
          Get a property by name for a node.
 java.io.OutputStream getOutputStream(java.lang.String path)
          Get an output stream to a file.
 java.util.List getPaths(AVMNodeDescriptor desc)
          Get all the paths to a particular node.
 java.util.List getPathsInStoreHead(AVMNodeDescriptor desc, java.lang.String store)
          Get all paths in a particular store in the head version for a particular node.
 java.util.List getPathsInStoreVersion(AVMNodeDescriptor desc, java.lang.String store, int version)
           
 Acl getStoreAcl(java.lang.String storeName)
          Get the ACL on a store.
 java.util.Map getStoreProperties(java.lang.String store)
          Get all the properties for a store.
 PropertyValue getStoreProperty(java.lang.String store, org.alfresco.service.namespace.QName name)
          Get a property from a store.
 java.util.List getVersionPaths(VersionRoot version, AVMNode node)
          Gets all the pass from to the given node starting from the give version root.
 boolean hasAspect(int version, java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Does a node have a particular aspect.
 void link(AVMNodeDescriptor parent, java.lang.String name, AVMNodeDescriptor child)
          This is the danger version of link.
 void link(java.lang.String parentPath, java.lang.String name, AVMNodeDescriptor toLink)
          Link a node into a directory, directly.
 AVMNodeDescriptor lookup(AVMNodeDescriptor dir, java.lang.String name, boolean includeDeleted)
          Lookup a descriptor from a directory descriptor.
 org.alfresco.repo.avm.Lookup lookup(int version, java.lang.String path, boolean includeDeleted)
          Lookup a node.
 org.alfresco.repo.avm.Lookup lookupDirectory(int version, java.lang.String path)
          Lookup a directory specifically.
 void makePrimary(java.lang.String path)
          Make a directory into a primary indirection.
 void purgeAVMStore(java.lang.String name)
          Get rid of all content that lives only in the given AVMStore.
 void purgeVersion(java.lang.String name, int version)
          Remove all content specific to a AVMRepository and version.
 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 match a given pattern.
 void remove(java.lang.String path, java.lang.String name)
          Remove a node and everything underneath it.
 void removeAspect(java.lang.String path, org.alfresco.service.namespace.QName aspectName)
          Remove an aspect and all associated properties from a node.
 void rename(java.lang.String srcPath, java.lang.String srcName, java.lang.String dstPath, 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 at.
 void revert(java.lang.String path, java.lang.String name, AVMNodeDescriptor toRevertTo)
          Revert a head path to a given version.
 void setACL(java.lang.String path, Acl acl)
          Set the ACL on a node.
 void setAvmNodeDAO(AVMNodeDAO dao)
           
 void setAvmStoreDAO(AVMStoreDAO dao)
           
 void setAvmStorePropertyDAO(AVMStorePropertyDAO dao)
           
 void setChildEntryDAO(ChildEntryDAO dao)
           
 void setContentData(java.lang.String path, org.alfresco.service.cmr.repository.ContentData data)
          Set the ContentData on a file.
 void setContentStore(ContentStore store)
          Set the ContentService.
 void setCreateStoreTxnListener(CreateStoreTxnListener listener)
           
 void setCreateVersionTxnListener(CreateVersionTxnListener listener)
           
 void setEncoding(java.lang.String path, java.lang.String encoding)
          Set the encoding on a node.
 void setGuid(java.lang.String path, java.lang.String guid)
          Set the GUID on a node.
 void setLookupCache(LookupCache cache)
          Set the Lookup Cache instance.
 void setMetaDataFrom(java.lang.String path, AVMNodeDescriptor from)
           
 void setMimeType(java.lang.String path, java.lang.String mimeType)
          Set the mime type on a node.
 void setNodeProperties(java.lang.String path, java.util.Map properties)
          Set a collection of properties at once.
 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 setPermissionService(org.alfresco.service.cmr.security.PermissionService service)
           
 void setPurgeStoreTxnListener(PurgeStoreTxnListener listener)
           
 void setPurgeVersionTxnListener(PurgeVersionTxnListener listener)
           
 void setStoreAcl(java.lang.String storeName, Acl acl)
          Set the acl on a store.
 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 setVersionLayeredNodeEntryDAO(VersionLayeredNodeEntryDAO dao)
           
 void setVersionRootDAO(VersionRootDAO dao)
           
 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)
          Update a link, directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AVMRepository

public AVMRepository()
Create a new one.

Method Detail

setContentStore

public void setContentStore(ContentStore store)
Set the ContentService.


setLookupCache

public void setLookupCache(LookupCache cache)
Set the Lookup Cache instance.

Parameters:
cache - The instance to set.

setCreateStoreTxnListener

public void setCreateStoreTxnListener(CreateStoreTxnListener listener)

setPurgeStoreTxnListener

public void setPurgeStoreTxnListener(PurgeStoreTxnListener listener)

setCreateVersionTxnListener

public void setCreateVersionTxnListener(CreateVersionTxnListener listener)

setPurgeVersionTxnListener

public void setPurgeVersionTxnListener(PurgeVersionTxnListener listener)

setAvmStoreDAO

public void setAvmStoreDAO(AVMStoreDAO dao)

setAvmNodeDAO

public void setAvmNodeDAO(AVMNodeDAO dao)

setVersionRootDAO

public void setVersionRootDAO(VersionRootDAO dao)

setVersionLayeredNodeEntryDAO

public void setVersionLayeredNodeEntryDAO(VersionLayeredNodeEntryDAO dao)

setAvmStorePropertyDAO

public void setAvmStorePropertyDAO(AVMStorePropertyDAO dao)

setChildEntryDAO

public void setChildEntryDAO(ChildEntryDAO dao)

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService service)

createFile

public java.io.OutputStream createFile(java.lang.String path,
                                       java.lang.String name)
Create a file.

Parameters:
path - The path to the containing directory.
name - The name for the new file.

createFile

public void createFile(java.lang.String path,
                       java.lang.String name,
                       java.io.File data,
                       java.util.List aspects,
                       java.util.Map properties)
Create a file with the given File as content.

Parameters:
path - The path to the containing directory.
name - The name to give the file.
data - The file contents.

createDirectory

public void createDirectory(java.lang.String path,
                            java.lang.String name,
                            java.util.List aspects,
                            java.util.Map properties)
Create a new directory.

Parameters:
path - The path to the containing directory.
name - The name to give the directory.

createDirectory

public AVMNodeDescriptor createDirectory(AVMNodeDescriptor parent,
                                         java.lang.String name)
Create a new directory. This assumes that the parent is already copied and therefore should only be used with great care.

Parameters:
parent - The parent node.
name - The name of the new directory.
Returns:
A descriptor for the newly created directory.

createLayeredDirectory

public void createLayeredDirectory(java.lang.String srcPath,
                                   java.lang.String dstPath,
                                   java.lang.String name)
Create a new layered directory.

Parameters:
srcPath - The target indirection for the new layered directory.
dstPath - The path to the containing directory.
name - The name for the new directory.

createLayeredFile

public void createLayeredFile(java.lang.String srcPath,
                              java.lang.String dstPath,
                              java.lang.String name)
Create a new layered file.

Parameters:
srcPath - The target indirection for the new layered file.
dstPath - The path to the containing directory.
name - The name of the new layered file.

createAVMStore

public void createAVMStore(java.lang.String name)
Create a new AVMStore.

Parameters:
name - The name to give the new AVMStore.

createAVMStore

public void createAVMStore(java.lang.String name,
                           java.util.Map props)

createBranch

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

Parameters:
version - The version to branch off.
srcPath - The path to make a branch from.
dstPath - The containing directory.
name - The name of the new branch.

getOutputStream

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

Parameters:
path - The full path to the file.
Returns:
An OutputStream.

getContentReader

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

Parameters:
version - The version of the file.
path - The path to the file.
Returns:
A ContentReader.

createContentWriter

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

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.

rename

public void rename(java.lang.String srcPath,
                   java.lang.String srcName,
                   java.lang.String dstPath,
                   java.lang.String dstName)
Rename a node.

Parameters:
srcPath - Source containing directory.
srcName - Source name.
dstPath - Destination containing directory.
dstName - Destination name.

uncover

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

Parameters:
dirPath - The path to the layered directory.
name - The name to uncover.

createSnapshot

public java.util.Map createSnapshot(java.lang.String storeName,
                                    java.lang.String tag,
                                    java.lang.String description)
Create a snapshot of a single AVMStore.

Parameters:
store - The name of the repository.
tag - The short description.
description - The thick description.
Returns:
The version id of the newly snapshotted repository.

remove

public void remove(java.lang.String path,
                   java.lang.String name)
Remove a node and everything underneath it.

Parameters:
path - The path to the containing directory.
name - The name of the node to remove.

purgeAVMStore

public void purgeAVMStore(java.lang.String name)
Get rid of all content that lives only in the given AVMStore. Also removes the AVMStore.

Parameters:
name - The name of the AVMStore to purge.

purgeVersion

public void purgeVersion(java.lang.String name,
                         int version)
Remove all content specific to a AVMRepository and version.

Parameters:
name - The name of the AVMStore.
version - The version to purge.

getInputStream

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

Parameters:
version - The version to look under.
path - The path to the file.
Returns:
An InputStream.

getInputStream

public java.io.InputStream getInputStream(AVMNodeDescriptor desc)

getListing

public java.util.SortedMap getListing(int version,
                                      java.lang.String path,
                                      boolean includeDeleted)
Get a listing of a directory.

Parameters:
version - The version to look under.
path - The path to the directory.
includeDeleted - Whether to see DeletedNodes.
Returns:
A List of FolderEntries.

getListingDirect

public java.util.SortedMap getListingDirect(int version,
                                            java.lang.String path,
                                            boolean includeDeleted)
Get the list of nodes directly contained in a directory.

Parameters:
version - The version to look under.
path - The path to the directory to list.
Returns:
A Map of names to descriptors.

getListingDirect

public java.util.SortedMap getListingDirect(AVMNodeDescriptor dir,
                                            boolean includeDeleted)
Get the list of nodes directly contained in a directory.

Parameters:
dir - The descriptor to the directory node.
includeDeleted - Whether to include deleted children.
Returns:
A Map of names to descriptors.

getListing

public java.util.SortedMap getListing(AVMNodeDescriptor dir,
                                      boolean includeDeleted)
Get a directory listing from a directory node descriptor.

Parameters:
dir - The directory node descriptor.
Returns:
A SortedMap listing.

getListing

public java.util.SortedMap getListing(AVMNodeDescriptor dir,
                                      java.lang.String childNamePattern,
                                      boolean includeDeleted)
Get a directory listing from a directory node descriptor fo children that match the given pattern

Parameters:
dir - The directory node descriptor.
Returns:
A SortedMap listing.

getDeleted

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

Parameters:
version - The version to look under.
path - The path to the directory.
Returns:
A List of names.

getAVMStores

public java.util.List getAVMStores()
Get descriptors of all AVMStores.

Returns:
A list of all descriptors.

getAVMStore

public AVMStoreDescriptor getAVMStore(java.lang.String name)
Get a descriptor for an AVMStore.

Parameters:
name - The name to get.
Returns:
The descriptor.

getAVMStoreVersions

public java.util.List getAVMStoreVersions(java.lang.String name)
Get all version for a given AVMStore.

Parameters:
name - The name of the AVMStore.
Returns:
A Set will all the version ids.

getAVMStoreVersions

public java.util.List getAVMStoreVersions(java.lang.String name,
                                          java.util.Date from,
                                          java.util.Date to)
Get the set of versions between (inclusive) of the given dates. From or to may be null but not both.

Parameters:
name - The name of the AVMRepository.
from - The earliest date.
to - The latest date.
Returns:
The Set of version IDs.

getIndirectionPath

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

Parameters:
version - The version to look under.
path - The path to the node.
Returns:
The indirection path.

getLatestVersionID

public int getLatestVersionID(java.lang.String name)
Get the next version id for the given AVMStore.

Parameters:
name - The name of the AVMStore.
Returns:
The next version id.

getLatestSnapshotID

public int getLatestSnapshotID(java.lang.String name)
Get the latest extant snapshotted version id.

Parameters:
name - The store name.

getAVMStoreRoot

public AVMNodeDescriptor getAVMStoreRoot(int version,
                                         java.lang.String name)
Get a descriptor for an AVMStore root.

Parameters:
version - The version to get.
name - The name of the AVMStore.
Returns:
The descriptor for the root.

lookup

public org.alfresco.repo.avm.Lookup lookup(int version,
                                           java.lang.String path,
                                           boolean includeDeleted)
Lookup a node.

Parameters:
version - The version to look under.
path - The path to lookup.
includeDeleted - Whether to see DeletedNodes.
Returns:
A lookup object.

lookup

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

Parameters:
dir - The directory descriptor.
name - The name of the child to lookup.
Returns:
The child's descriptor.

getPaths

public java.util.List getPaths(AVMNodeDescriptor desc)
Get all the paths to a particular node.

Parameters:
desc - The node descriptor.
Returns:
The list of version, paths.

getAPath

public org.alfresco.util.Pair getAPath(AVMNodeDescriptor desc)
Get a single valid path for a node.

Parameters:
desc - The node descriptor.
Returns:
A version, path

getHeadPaths

public java.util.List getHeadPaths(AVMNodeDescriptor desc)
Get all paths for a node reachable by HEAD.

Parameters:
desc - The node descriptor.
Returns:
A List of all the version, path Pairs that match.

getVersionPaths

public java.util.List getVersionPaths(VersionRoot version,
                                      AVMNode node)
Gets all the pass from to the given node starting from the give version root.

Parameters:
version - The version root.
node - The node to get the paths of.
Returns:
A list of all paths in the given version to the node.

getPathsInStoreHead

public java.util.List getPathsInStoreHead(AVMNodeDescriptor desc,
                                          java.lang.String store)
Get all paths in a particular store in the head version for a particular node.

Parameters:
desc - The node descriptor.
store - The name of the store.
Returns:
All matching paths.

getLayeringInfo

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

Parameters:
version - The version to look under.
path - The full avm path.
Returns:
A LayeringDescriptor.

lookupDirectory

public org.alfresco.repo.avm.Lookup lookupDirectory(int version,
                                                    java.lang.String path)
Lookup a directory specifically.

Parameters:
version - The version to look under.
path - The path to lookup.
Returns:
A lookup object.

makePrimary

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

Parameters:
path - The full path.

retargetLayeredDirectory

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

Parameters:
path - The full path to the layered directory.
target - The new target path.

getHistory

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

Parameters:
desc - The node to get history of.
count - The maximum number of ancestors to traverse. Negative means all.
Returns:
A List of ancestors.

setOpacity

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

Parameters:
path - The path to the layered directory.
opacity - True is opaque; false is not.

setNodeProperty

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

Parameters:
path - The path to the node.
name - The name of the property.
value - The value of the property.

setNodeProperties

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

Parameters:
path - The path to the node.
properties - The Map of QNames to PropertyValues.

getNodeProperty

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

Parameters:
version - The version to look under.
path - The path to the node.
name - The name of the property.
Returns:
The PropertyValue or null if it does not exist.

getNodeProperties

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

Parameters:
version - The version to look under.
path - The path to the node.
Returns:
A Map of QNames to PropertyValues.

deleteNodeProperty

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

Parameters:
path - The path to the node.
name - The name of the property.

deleteNodeProperties

public void deleteNodeProperties(java.lang.String path)
Delete all properties on a node.

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. Overwrites if property exists.

Parameters:
store - The AVMStore.
name - The QName.
value - The PropertyValue to set.

setStoreProperties

public void setStoreProperties(java.lang.String store,
                               java.util.Map props)
Set a group of properties on a store. Overwrites any properties that exist.

Parameters:
store - The AVMStore.
props - The properties to set.

getStoreProperty

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

Parameters:
store - The name of the store.
name - The property
Returns:
The property value 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.

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 match a given pattern.

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 for a store.

Parameters:
store - The name of the Store.
Returns:
A Map of all the properties.

deleteStoreProperty

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

Parameters:
store - The name of the store.
name - The name of the property.

getCommonAncestor

public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
                                           AVMNodeDescriptor right)
Get the common ancestor of two nodes if one exists. Unfortunately this is a quadratic problem, taking time proportional to the product of the lengths of the left and right history chains.

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.

getContentDataForRead

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

Parameters:
version - The version to look under.
path - The path to the file.
Returns:
The ContentData for the file.

getContentDataForWrite

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

Parameters:
path - The path to the file.
Returns:
The ContentData object.

setContentData

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

Parameters:
path - The path to the file.
data - The content data to set.

GetInstance

public static AVMRepository GetInstance()
Get the single instance of AVMRepository.

Returns:
The single instance.

setMetaDataFrom

public void setMetaDataFrom(java.lang.String path,
                            AVMNodeDescriptor from)

addAspect

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

Parameters:
path - The path to the node.
aspectName - The name of the aspect.

getAspects

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

Parameters:
version - The version to look under.
path - The path to the node.
Returns:
A List of the QNames of the Aspects.

removeAspect

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

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.

Parameters:
version - The version to look under.
path - The path to the node.
aspectName - The name of the aspect.
Returns:
Whether the node has the aspect.

setACL

public void setACL(java.lang.String path,
                   Acl acl)
Set the ACL on a node.

Parameters:
path - The path to the node.
acl - The ACL to set.

getACL

public Acl getACL(int version,
                  java.lang.String path)
Get the ACL on a node.

Parameters:
version - The version to look under.
path - The path to the node.
Returns:
The ACL.

link

public void link(java.lang.String parentPath,
                 java.lang.String name,
                 AVMNodeDescriptor toLink)
Link a node into a directory, directly.

Parameters:
parentPath - The path to the parent.
name - The name to give the node.
toLink - The node to link.

updateLink

public void updateLink(java.lang.String parentPath,
                       java.lang.String name,
                       AVMNodeDescriptor toLink)
Update a link, directly.

Parameters:
parentPath - The path to the parent.
name - The name to give the node.
toLink - The node to link.

link

public void link(AVMNodeDescriptor parent,
                 java.lang.String name,
                 AVMNodeDescriptor child)
This is the danger version of link. It must be called on a copied and unsnapshotted directory. It blithely inserts a child without checking if a child exists with a conflicting name.

Parameters:
parent - The parent directory.
name - The name to give the child.
child - The child to link in.

flatten

public void flatten(java.lang.String path,
                    java.lang.String name)
Remove name without leaving behind a deleted node. Dangerous if used unwisely.

Parameters:
path - The path to the layered directory.
name - The name of the child.

forceCopy

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

Parameters:
path - The path to force.

renameStore

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

Parameters:
sourceName - The original name.
destName - The new name.
Throws:
AVMNotFoundException
AVMExistsException

revert

public void revert(java.lang.String path,
                   java.lang.String name,
                   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.

Parameters:
path - The path to the parent directory.
name - The name of the node.
toRevertTo - The descriptor of the version to revert to.

setGuid

public void setGuid(java.lang.String path,
                    java.lang.String guid)
Set the GUID on a node.

Parameters:
path -
guid -

setEncoding

public void setEncoding(java.lang.String path,
                        java.lang.String encoding)
Set the encoding on a node.

Parameters:
path -
encoding -

setMimeType

public void setMimeType(java.lang.String path,
                        java.lang.String mimeType)
Set the mime type on a node.

Parameters:
path -
encoding -

getPathsInStoreVersion

public java.util.List getPathsInStoreVersion(AVMNodeDescriptor desc,
                                             java.lang.String store,
                                             int version)

getNodeProperties

public java.util.Map getNodeProperties(AVMNodeDescriptor desc)

getContentDataForRead

public org.alfresco.service.cmr.repository.ContentData getContentDataForRead(AVMNodeDescriptor desc)

getAspects

public java.util.Set getAspects(AVMNodeDescriptor desc)

can

public boolean can(AVMStore store,
                   AVMNode node,
                   java.lang.String permission,
                   boolean isDirectlyContained)
Evaluate permission on a node. I've got a bad feeling about this...

Parameters:
store -
node -
permission -
Returns:

can

public boolean can(java.lang.String storeName,
                   int version,
                   java.lang.String path,
                   java.lang.String permission)

setStoreAcl

public void setStoreAcl(java.lang.String storeName,
                        Acl acl)
Set the acl on a store.

Parameters:
storeName -
acl -

getStoreAcl

public Acl getStoreAcl(java.lang.String storeName)
Get the ACL on a store.

Parameters:
storeName -
Returns:

getAVMStoreVersionsTo

public java.util.List getAVMStoreVersionsTo(java.lang.String name,
                                            int version)
Parameters:
name -
version -
Returns:

getAVMStoreVersionsFrom

public java.util.List getAVMStoreVersionsFrom(java.lang.String name,
                                              int version)
Parameters:
name -
version -
Returns:

getAVMStoreVersionsBetween

public java.util.List getAVMStoreVersionsBetween(java.lang.String name,
                                                 int startVersion,
                                                 int endVersion)
Parameters:
name -
startVersion -
endVersion -
Returns:


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