mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Reworks AVMService.getIndirection() to return the indirection path for a plain node
in a layered context. Modified AVMHostConfig to use this method. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3903 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -63,6 +63,30 @@ import org.alfresco.util.GUID;
|
|||||||
*/
|
*/
|
||||||
public class AVMServiceTest extends AVMServiceTestBase
|
public class AVMServiceTest extends AVMServiceTestBase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Test getIndirection.
|
||||||
|
*/
|
||||||
|
public void testGetIndirection()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
setupBasicTree();
|
||||||
|
fService.createAVMStore("layer");
|
||||||
|
fService.createLayeredDirectory("main:/a", "layer:/", "layer");
|
||||||
|
assertEquals("main:/a", fService.getIndirectionPath(-1, "layer:/layer"));
|
||||||
|
assertEquals("main:/a/b", fService.getIndirectionPath(-1, "layer:/layer/b"));
|
||||||
|
assertEquals("main:/a/b/c", fService.getIndirectionPath(-1, "layer:/layer/b/c"));
|
||||||
|
assertEquals("main:/a/b/c/foo", fService.getIndirectionPath(-1, "layer:/layer/b/c/foo"));
|
||||||
|
fService.createLayeredDirectory("main:/d", "layer:/layer/b", "dlayer");
|
||||||
|
assertEquals("main:/d", fService.getIndirectionPath(-1, "layer:/layer/b/dlayer"));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the promote action.
|
* Test the promote action.
|
||||||
*/
|
*/
|
||||||
|
@@ -692,16 +692,22 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Path not found.");
|
throw new AVMNotFoundException("Path not found.");
|
||||||
}
|
}
|
||||||
|
if (!lPath.isLayered())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
AVMNode node = lPath.getCurrentNode();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
if (node.getType() == AVMNodeType.LAYERED_DIRECTORY)
|
if (node.getType() == AVMNodeType.LAYERED_DIRECTORY)
|
||||||
{
|
{
|
||||||
return ((LayeredDirectoryNode)node).getUnderlying(lPath);
|
LayeredDirectoryNode dir = (LayeredDirectoryNode)node;
|
||||||
|
return dir.getUnderlying(lPath);
|
||||||
}
|
}
|
||||||
if (node.getType() == AVMNodeType.LAYERED_FILE)
|
else if (node.getType() == AVMNodeType.LAYERED_FILE)
|
||||||
{
|
{
|
||||||
return ((LayeredFileNode)node).getUnderlying(lPath);
|
LayeredFileNode file = (LayeredFileNode)node;
|
||||||
|
return file.getUnderlying(lPath);
|
||||||
}
|
}
|
||||||
throw new AVMWrongTypeException("Not a layered node: " + path);
|
return lPath.getIndirectionPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -104,6 +104,7 @@ class Lookup
|
|||||||
fFinalStore = store;
|
fFinalStore = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO This is badly in need of cleanup.
|
||||||
/**
|
/**
|
||||||
* Add a new node to the lookup.
|
* Add a new node to the lookup.
|
||||||
* @param node The node to add.
|
* @param node The node to add.
|
||||||
@@ -135,6 +136,13 @@ class Lookup
|
|||||||
comp.setIndirection(computeIndirection(name));
|
comp.setIndirection(computeIndirection(name));
|
||||||
}
|
}
|
||||||
fLayeredYet = true;
|
fLayeredYet = true;
|
||||||
|
// Record the first layer seen.
|
||||||
|
if (fTopLayer == null)
|
||||||
|
{
|
||||||
|
fTopLayer = oNode;
|
||||||
|
fTopLayerIndex = fPosition + 1;
|
||||||
|
}
|
||||||
|
fLowestLayerIndex = fPosition + 1;
|
||||||
}
|
}
|
||||||
fComponents.add(comp);
|
fComponents.add(comp);
|
||||||
fPosition++;
|
fPosition++;
|
||||||
|
@@ -408,10 +408,10 @@ public interface AVMService
|
|||||||
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted);
|
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the indirection path for a layered file or directory.
|
* Get the indirection path for a node in a layered context.
|
||||||
* @param version The version number to get.
|
* @param version The version number to get.
|
||||||
* @param path The path to the node of interest.
|
* @param path The path to the node of interest.
|
||||||
* @return The indirection path.
|
* @return The indirection path, or null if the path is not in a layered context.
|
||||||
* @throws AVMNotFoundException If <code>path</code> does not exist or
|
* @throws AVMNotFoundException If <code>path</code> does not exist or
|
||||||
* if <code>version</code> does not exist.
|
* if <code>version</code> does not exist.
|
||||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||||
|
Reference in New Issue
Block a user