org.alfresco.repo.avm
Class LayeredDirectoryNodeImpl

java.lang.Object
  extended by org.alfresco.repo.avm.AVMNodeImpl
      extended by org.alfresco.repo.avm.DirectoryNodeImpl
          extended by org.alfresco.repo.avm.LayeredDirectoryNodeImpl
All Implemented Interfaces:
AVMNode, DirectoryNode, Layered, LayeredDirectoryNode

public class LayeredDirectoryNodeImpl
extends DirectoryNodeImpl
implements LayeredDirectoryNode

A layered directory node. A layered directory node points at an underlying directory, which may or may not exist. The visible contents of a layered directory node is the contents of the underlying node pointed at plus those nodes added to or modified in the layered directory node minus those nodes which have been deleted in the layered directory node.


Field Summary
 
Fields inherited from class org.alfresco.repo.avm.AVMNodeImpl
DEBUG
 
Constructor Summary
LayeredDirectoryNodeImpl()
          Default constructor.
LayeredDirectoryNodeImpl(DirectoryNode dir, AVMStore store, org.alfresco.repo.avm.Lookup srcLookup, java.lang.String name, java.lang.Long inheritedAcl, ACLCopyMode mode)
          Create a new layered directory based on a directory we are being named from that is in not in the layer of the source lookup.
LayeredDirectoryNodeImpl(LayeredDirectoryNode other, AVMStore repos, org.alfresco.repo.avm.Lookup lookup, boolean copyAll, java.lang.Long parentAcl, ACLCopyMode mode)
          Kind of copy constructor, sort of.
LayeredDirectoryNodeImpl(PlainDirectoryNode other, AVMStore store, org.alfresco.repo.avm.Lookup lPath, boolean copyContents, java.lang.Long parentAcl, ACLCopyMode mode)
          Construct one from a PlainDirectoryNode.
LayeredDirectoryNodeImpl(java.lang.String indirection, AVMStore store, AVMNode toCopy, java.lang.Long parentAcl, ACLCopyMode mode)
          Make a new one from a specified indirection path.
 
Method Summary
 AVMNode copy(org.alfresco.repo.avm.Lookup lPath)
          Copy on write logic.
 void flatten(java.lang.String name)
          Remove name without leaving behind a deleted node.
 java.util.List getDeletedNames()
          Get the names of nodes deleted in this directory.
 AVMNodeDescriptor getDescriptor(org.alfresco.repo.avm.Lookup lPath)
          Get the descriptor for this node.
 AVMNodeDescriptor getDescriptor(org.alfresco.repo.avm.Lookup lPath, java.lang.String name)
          Get the descriptor for this node.
 AVMNodeDescriptor getDescriptor(java.lang.String parentPath, java.lang.String name, java.lang.String parentIndirection, int parentIndirectionVersion)
          Get a descriptor for this.
 java.lang.String getIndirection()
          Get the indirection path.
 java.lang.Integer getIndirectionVersion()
          Get the indirection version.
 long getLayerID()
          Get the layer id.
 java.util.SortedMap getListing(AVMNodeDescriptor dir, boolean includeDeleted)
          Get a listing from a directory node descriptor.
 java.util.SortedMap getListing(AVMNodeDescriptor dir, java.lang.String childNamePattern, boolean includeDeleted)
          Get a listing from a directory node descriptor.
 java.util.Map getListing(org.alfresco.repo.avm.Lookup lPath, boolean includeDeleted)
          Get a listing of the virtual contents of this directory.
 java.util.Map getListing(org.alfresco.repo.avm.Lookup lPath, java.lang.String childNamePattern, boolean includeDeleted)
          Get a listing of the virtual contents of this directory.
 java.util.SortedMap getListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
          Get the direct contents of this directory.
 java.util.Map getListingDirect(org.alfresco.repo.avm.Lookup lPath, boolean includeDeleted)
          Get a listing of the nodes directly contained by a directory.
 boolean getOpacity()
          Get the opacity of this.
 boolean getPrimaryIndirection()
          Is this a primary indirection node.
 int getType()
          Get the type of this node.
 java.lang.String getUnderlying(org.alfresco.repo.avm.Lookup lPath)
          Get the underlying path in the Lookup's context.
 int getUnderlyingVersion(org.alfresco.repo.avm.Lookup lPath)
          Get the underlying version in the lookup path context.
 void link(org.alfresco.repo.avm.Lookup lPath, java.lang.String name, AVMNodeDescriptor toLink)
          Link a node with the given id into this directory.
 AVMNodeDescriptor lookupChild(AVMNodeDescriptor mine, java.lang.String name, boolean includeDeleted)
          Lookup a child using a node descriptor as context.
 org.alfresco.util.Pair lookupChildEntry(org.alfresco.repo.avm.Lookup lPath, java.lang.String name, boolean includeDeleted)
          Lookup a child entry by name.
 void putChild(java.lang.String name, AVMNode node)
          Insert a child node without COW.
 void rawSetPrimary(org.alfresco.repo.avm.Lookup lPath, java.lang.String path)
          Set the primary indirection.
 void removeChild(org.alfresco.repo.avm.Lookup lPath, java.lang.String name)
          Directly remove a child.
 void retarget(org.alfresco.repo.avm.Lookup lPath, java.lang.String target)
          Make this point at a new target.
 void setAclAndInherit(LayeredDirectoryNode layeredDirectory, DbAccessControlList acl, java.lang.String name)
           
 void setIndirection(java.lang.String indirection)
          Set the indirection.
 void setIndirectionVersion(java.lang.Integer version)
          Set the indirection version for this layered node.
 void setIsRoot(boolean isRoot)
          Does nothing because LayeredDirectoryNodes can't be roots.
 void setLayerID(long id)
          Set the layer id.
 void setOpacity(boolean opacity)
          Set the opacity of this, ie, whether it blocks things normally seen through its indirection.
 void setPrimaryIndirection(boolean has)
          Set the primary indirection state of this.
 java.lang.String toString(org.alfresco.repo.avm.Lookup lPath)
          For diagnostics.
 void turnPrimary(org.alfresco.repo.avm.Lookup lPath)
          Make this node become a primary indirection.
 void uncover(org.alfresco.repo.avm.Lookup lPath, java.lang.String name)
          Let anything behind name in this become visible.
 
Methods inherited from class org.alfresco.repo.avm.DirectoryNodeImpl
directlyContains, link, lookupChild
 
Methods inherited from class org.alfresco.repo.avm.AVMNodeImpl
addAspect, addProperties, changeAncestor, checkReadOnly, copyACLs, copyAspects, copyCreationAndOwnerBasicAttributes, copyMetaDataFrom, copyProperties, deleteProperties, deleteProperty, equals, getAcl, getAncestor, getAspects, getBasicAttributes, getGuid, getId, getIsNew, getIsRoot, getMergedFrom, getProperties, getProperty, getStoreNew, getVers, getVersionID, hashCode, removeAspect, setAcl, setAncestor, setAspects, setBasicAttributes, setGuid, setId, setMergedFrom, setProperties, setProperty, setStoreNew, setVers, setVersionID, toString, updateModTime
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.alfresco.repo.avm.DirectoryNode
directlyContains, link, lookupChild
 
Methods inherited from interface org.alfresco.repo.avm.AVMNode
addAspect, addProperties, changeAncestor, copyMetaDataFrom, deleteProperties, deleteProperty, getAcl, getAncestor, getAspects, getBasicAttributes, getGuid, getId, getIsNew, getIsRoot, getMergedFrom, getProperties, getProperty, getStoreNew, getVersionID, removeAspect, setAcl, setAncestor, setGuid, setMergedFrom, setProperties, setProperty, setStoreNew, setVersionID, updateModTime
 
Methods inherited from interface org.alfresco.repo.avm.AVMNode
addAspect, addProperties, changeAncestor, copyMetaDataFrom, deleteProperties, deleteProperty, getAcl, getAncestor, getAspects, getBasicAttributes, getGuid, getId, getIsNew, getIsRoot, getMergedFrom, getProperties, getProperty, getStoreNew, getVersionID, removeAspect, setAcl, setAncestor, setGuid, setMergedFrom, setProperties, setProperty, setStoreNew, setVersionID, updateModTime
 

Constructor Detail

LayeredDirectoryNodeImpl

public LayeredDirectoryNodeImpl()
Default constructor.


LayeredDirectoryNodeImpl

public LayeredDirectoryNodeImpl(java.lang.String indirection,
                                AVMStore store,
                                AVMNode toCopy,
                                java.lang.Long parentAcl,
                                ACLCopyMode mode)
Make a new one from a specified indirection path.

Parameters:
indirection - The indirection path to set.
store - The store that owns this node.

LayeredDirectoryNodeImpl

public LayeredDirectoryNodeImpl(LayeredDirectoryNode other,
                                AVMStore repos,
                                org.alfresco.repo.avm.Lookup lookup,
                                boolean copyAll,
                                java.lang.Long parentAcl,
                                ACLCopyMode mode)
Kind of copy constructor, sort of.

Parameters:
other - The LayeredDirectoryNode we are copied from.
repos - The AVMStore object we use.

LayeredDirectoryNodeImpl

public LayeredDirectoryNodeImpl(PlainDirectoryNode other,
                                AVMStore store,
                                org.alfresco.repo.avm.Lookup lPath,
                                boolean copyContents,
                                java.lang.Long parentAcl,
                                ACLCopyMode mode)
Construct one from a PlainDirectoryNode. Called when a COW is performed in a layered context.

Parameters:
other - The PlainDirectoryNode.
store - The AVMStore we should belong to.
lPath - The Lookup object.

LayeredDirectoryNodeImpl

public LayeredDirectoryNodeImpl(DirectoryNode dir,
                                AVMStore store,
                                org.alfresco.repo.avm.Lookup srcLookup,
                                java.lang.String name,
                                java.lang.Long inheritedAcl,
                                ACLCopyMode mode)
Create a new layered directory based on a directory we are being named from that is in not in the layer of the source lookup.

Parameters:
dir - The directory
store - The store
srcLookup - The source lookup.
name - The name of the target.
Method Detail

getPrimaryIndirection

public boolean getPrimaryIndirection()
Is this a primary indirection node.

Specified by:
getPrimaryIndirection in interface LayeredDirectoryNode
Returns:
Whether this is a primary indirection.

setPrimaryIndirection

public void setPrimaryIndirection(boolean has)
Set the primary indirection state of this.

Specified by:
setPrimaryIndirection in interface LayeredDirectoryNode
Parameters:
has - Whether this is a primary indirection node.

getIndirection

public java.lang.String getIndirection()
Get the indirection path.

Specified by:
getIndirection in interface Layered
Returns:
The indirection path.

getUnderlying

public java.lang.String getUnderlying(org.alfresco.repo.avm.Lookup lPath)
Get the underlying path in the Lookup's context.

Specified by:
getUnderlying in interface Layered
Parameters:
lPath - The Lookup.
Returns:
The underlying path.

getUnderlyingVersion

public int getUnderlyingVersion(org.alfresco.repo.avm.Lookup lPath)
Get the underlying version in the lookup path context.

Specified by:
getUnderlyingVersion in interface Layered
Parameters:
lPath - The Lookup.
Returns:
The effective underlying version.

getLayerID

public long getLayerID()
Get the layer id.

Specified by:
getLayerID in interface LayeredDirectoryNode
Returns:
The layer id.

setLayerID

public void setLayerID(long id)
Set the layer id.

Specified by:
setLayerID in interface LayeredDirectoryNode
Parameters:
id - The id to set.

copy

public AVMNode copy(org.alfresco.repo.avm.Lookup lPath)
Copy on write logic.

Specified by:
copy in interface AVMNode
Parameters:
lPath -
Returns:
The copy or null.

putChild

public void putChild(java.lang.String name,
                     AVMNode node)
Insert a child node without COW.

Specified by:
putChild in interface DirectoryNode
Parameters:
name - The name to give the child.
node - The child.

getListing

public java.util.Map getListing(org.alfresco.repo.avm.Lookup lPath,
                                boolean includeDeleted)
Get a listing of the virtual contents of this directory.

Specified by:
getListing in interface DirectoryNode
Parameters:
lPath - The Lookup.
Returns:
A Map from names to nodes. This is a sorted Map.

getListing

public java.util.Map getListing(org.alfresco.repo.avm.Lookup lPath,
                                java.lang.String childNamePattern,
                                boolean includeDeleted)
Get a listing of the virtual contents of this directory.

Specified by:
getListing in interface DirectoryNode
Parameters:
lPath - The Lookup.
Returns:
A Map from names to nodes. This is a sorted Map.

getListingDirect

public java.util.Map getListingDirect(org.alfresco.repo.avm.Lookup lPath,
                                      boolean includeDeleted)
Get a listing of the nodes directly contained by a directory.

Specified by:
getListingDirect in interface DirectoryNode
Parameters:
lPath - The Lookup to this directory.
Returns:
A Map of names to nodes.

getListingDirect

public java.util.SortedMap getListingDirect(AVMNodeDescriptor dir,
                                            boolean includeDeleted)
Get the direct contents of this directory.

Specified by:
getListingDirect in interface DirectoryNode
Parameters:
dir - The descriptor that describes us.
includeDeleted - Whether to inlude deleted nodes.
Returns:
A Map of Strings to descriptors.

getListing

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

Specified by:
getListing in interface DirectoryNode
Parameters:
dir - The directory node descriptor.
includeDeleted - Should DeletedNodes be shown.
Returns:
A Map of names to node descriptors.

getListing

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

Specified by:
getListing in interface DirectoryNode
Parameters:
dir - The directory node descriptor.
childNamePattern - Pattern to match for child names - may be null
includeDeleted - Should DeletedNodes be shown.
Returns:
A Map of names to node descriptors.

getDeletedNames

public java.util.List getDeletedNames()
Get the names of nodes deleted in this directory.

Specified by:
getDeletedNames in interface DirectoryNode
Returns:
A List of names.

lookupChildEntry

public org.alfresco.util.Pair lookupChildEntry(org.alfresco.repo.avm.Lookup lPath,
                                               java.lang.String name,
                                               boolean includeDeleted)
Lookup a child entry by name.

Specified by:
lookupChildEntry in interface DirectoryNode
Parameters:
lPath - The Lookup.
name - The name we are looking.
version - The version in which we are looking.
write - Whether this lookup is occurring in a write context.
Returns:
The child entry or null if not found.

lookupChild

public AVMNodeDescriptor lookupChild(AVMNodeDescriptor mine,
                                     java.lang.String name,
                                     boolean includeDeleted)
Lookup a child using a node descriptor as context.

Specified by:
lookupChild in interface DirectoryNode
Parameters:
mine - The node descriptor for this,
name - The name to lookup,
Returns:
The node descriptor.

removeChild

public void removeChild(org.alfresco.repo.avm.Lookup lPath,
                        java.lang.String name)
Directly remove a child. Do not COW. Do not pass go etc.

Specified by:
removeChild in interface DirectoryNode
Parameters:
lPath - The lookup that arrived at this.
name - The name of the child to remove.

getType

public int getType()
Get the type of this node.

Specified by:
getType in interface AVMNode
Returns:
The type of this node.

toString

public java.lang.String toString(org.alfresco.repo.avm.Lookup lPath)
For diagnostics. Get a String representation.

Specified by:
toString in interface AVMNode
Parameters:
lPath - The Lookup.
Returns:
A String representation.

rawSetPrimary

public void rawSetPrimary(org.alfresco.repo.avm.Lookup lPath,
                          java.lang.String path)
Set the primary indirection. No COW. Cascade resetting of acls also does not COW

Specified by:
rawSetPrimary in interface LayeredDirectoryNode
Parameters:
path - The indirection path.

setAclAndInherit

public void setAclAndInherit(LayeredDirectoryNode layeredDirectory,
                             DbAccessControlList acl,
                             java.lang.String name)
Specified by:
setAclAndInherit in interface LayeredDirectoryNode

turnPrimary

public void turnPrimary(org.alfresco.repo.avm.Lookup lPath)
Make this node become a primary indirection. COW.

Specified by:
turnPrimary in interface DirectoryNode
Specified by:
turnPrimary in interface LayeredDirectoryNode
Parameters:
lPath - The Lookup.

retarget

public void retarget(org.alfresco.repo.avm.Lookup lPath,
                     java.lang.String target)
Make this point at a new target.

Specified by:
retarget in interface DirectoryNode
Specified by:
retarget in interface LayeredDirectoryNode
Parameters:
lPath - The Lookup.
target - The target path.

uncover

public void uncover(org.alfresco.repo.avm.Lookup lPath,
                    java.lang.String name)
Let anything behind name in this become visible.

Specified by:
uncover in interface LayeredDirectoryNode
Parameters:
lPath - The Lookup.
name - The name to uncover.

getDescriptor

public AVMNodeDescriptor getDescriptor(org.alfresco.repo.avm.Lookup lPath,
                                       java.lang.String name)
Get the descriptor for this node.

Specified by:
getDescriptor in interface AVMNode
Parameters:
lPath - The Lookup.
name - The name of this in the current context.
Returns:
A descriptor.

getDescriptor

public AVMNodeDescriptor getDescriptor(org.alfresco.repo.avm.Lookup lPath)
Get the descriptor for this node.

Specified by:
getDescriptor in interface AVMNode
Parameters:
lPath - The Lookup.
Returns:
A descriptor.

getDescriptor

public AVMNodeDescriptor getDescriptor(java.lang.String parentPath,
                                       java.lang.String name,
                                       java.lang.String parentIndirection,
                                       int parentIndirectionVersion)
Get a descriptor for this.

Specified by:
getDescriptor in interface AVMNode
Parameters:
parentPath - The parent path.
name - The name this was looked up with.
parentIndirection - The indirection of the parent.
parentIndirectionVersion - The indirection version of the parent.
Returns:
The descriptor.

setIndirection

public void setIndirection(java.lang.String indirection)
Set the indirection.

Specified by:
setIndirection in interface LayeredDirectoryNode
Parameters:
indirection -

setIsRoot

public void setIsRoot(boolean isRoot)
Does nothing because LayeredDirectoryNodes can't be roots.

Specified by:
setIsRoot in interface AVMNode
Specified by:
setIsRoot in interface DirectoryNode
Overrides:
setIsRoot in class AVMNodeImpl
Parameters:
isRoot -

getOpacity

public boolean getOpacity()
Get the opacity of this.

Specified by:
getOpacity in interface LayeredDirectoryNode
Returns:
The opacity.

setOpacity

public void setOpacity(boolean opacity)
Set the opacity of this, ie, whether it blocks things normally seen through its indirection.

Specified by:
setOpacity in interface LayeredDirectoryNode
Parameters:
opacity -

link

public void link(org.alfresco.repo.avm.Lookup lPath,
                 java.lang.String name,
                 AVMNodeDescriptor toLink)
Link a node with the given id into this directory.

Specified by:
link in interface DirectoryNode
Parameters:
lPath - The Lookup for this.
name - The name to give the node.
toLink - The node to link in.

flatten

public void flatten(java.lang.String name)
Remove name without leaving behind a deleted node.

Specified by:
flatten in interface LayeredDirectoryNode
Parameters:
name - The name of the child to flatten.

setIndirectionVersion

public void setIndirectionVersion(java.lang.Integer version)
Description copied from interface: Layered
Set the indirection version for this layered node.

Specified by:
setIndirectionVersion in interface Layered
Parameters:
version - The indirection version to set.

getIndirectionVersion

public java.lang.Integer getIndirectionVersion()
Get the indirection version.

Specified by:
getIndirectionVersion in interface LayeredDirectoryNode
Returns:
The indirection version.


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