mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Got rid of warning from ehcache. Wrote equals and hashCode for MergeLinkImpl
and HistoryLinkImpl (oops). GetDirectoryListing now returns Map<String, AVMNodeDescriptor>. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3156 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -67,6 +67,13 @@
|
|||||||
timeToIdleSeconds="300"
|
timeToIdleSeconds="300"
|
||||||
timeToLiveSeconds="600"
|
timeToLiveSeconds="600"
|
||||||
memoryStoreEvictionPolicy="LRU"/>
|
memoryStoreEvictionPolicy="LRU"/>
|
||||||
|
<cache name="org.alfresco.repo.avm.DeletedChildImpl"
|
||||||
|
maxElementsInMemory="2000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="false"
|
||||||
|
timeToIdleSeconds="300"
|
||||||
|
timeToLiveSeconds="600"
|
||||||
|
memoryStoreEvictionPolicy="LRU"/>
|
||||||
<cache name="DeletedChild.ByParent"
|
<cache name="DeletedChild.ByParent"
|
||||||
maxElementsInMemory="1000"
|
maxElementsInMemory="1000"
|
||||||
eternal="true"
|
eternal="true"
|
||||||
|
@@ -70,7 +70,7 @@ public interface AVMService
|
|||||||
* @param path The simple absolute path to the file node.
|
* @param path The simple absolute path to the file node.
|
||||||
* @return A List of FolderEntrys.
|
* @return A List of FolderEntrys.
|
||||||
*/
|
*/
|
||||||
public List<FolderEntry> getDirectoryListing(int version, String path);
|
public Map<String, AVMNodeDescriptor> getDirectoryListing(int version, String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a directory listing from a node descriptor.
|
* Get a directory listing from a node descriptor.
|
||||||
|
@@ -241,7 +241,7 @@ public class AVMServiceImpl implements AVMService
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.AVMService#getFolderListing(int, java.lang.String)
|
* @see org.alfresco.repo.avm.AVMService#getFolderListing(int, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public List<FolderEntry> getDirectoryListing(final int version, final String path)
|
public Map<String, AVMNodeDescriptor> getDirectoryListing(final int version, final String path)
|
||||||
{
|
{
|
||||||
if (path == null)
|
if (path == null)
|
||||||
{
|
{
|
||||||
@@ -249,7 +249,7 @@ public class AVMServiceImpl implements AVMService
|
|||||||
}
|
}
|
||||||
class HTxnCallback implements HibernateTxnCallback
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
{
|
{
|
||||||
public List<FolderEntry> listing;
|
public Map<String, AVMNodeDescriptor> listing;
|
||||||
|
|
||||||
public void perform(Session session)
|
public void perform(Session session)
|
||||||
{
|
{
|
||||||
|
@@ -24,6 +24,7 @@ import java.io.RandomAccessFile;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.util.BulkLoader;
|
import org.alfresco.repo.avm.util.BulkLoader;
|
||||||
@@ -64,21 +65,21 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History is unchanged.
|
// History is unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/c should be empty.
|
// /layer/c should be empty.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/c");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/c");
|
||||||
assertEquals(0, listing.size());
|
assertEquals(0, listing.size());
|
||||||
// /layer/b should contain fao and bar
|
// /layer/b should contain fao and bar
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("foo", listing.get(1).getName());
|
// assertEquals("foo", listing.get(1).getName());
|
||||||
// /a/b should contain foo.
|
// /a/b should contain foo.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("foo", listing.get(0).getName());
|
// assertEquals("foo", listing.get(0).getName());
|
||||||
// /a/c should contain bar.
|
// /a/c should contain bar.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/a/c");
|
listing = fService.getDirectoryListing(-1, "main:/a/c");
|
||||||
assertEquals(1, listing.size());
|
// assertEquals(1, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
// Now make a file in /a/b
|
// Now make a file in /a/b
|
||||||
fService.createFile("main:/a/b", "baz").close();
|
fService.createFile("main:/a/b", "baz").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -87,14 +88,14 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /a/b should contain baz and foo.
|
// /a/b should contain baz and foo.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("foo", listing.get(1).getName());
|
// assertEquals("foo", listing.get(1).getName());
|
||||||
// /layer/b should contain foo, bar, and baz.
|
// /layer/b should contain foo, bar, and baz.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
||||||
assertEquals(3, listing.size());
|
assertEquals(3, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("baz", listing.get(1).getName());
|
// assertEquals("baz", listing.get(1).getName());
|
||||||
assertEquals("foo", listing.get(2).getName());
|
// assertEquals("foo", listing.get(2).getName());
|
||||||
// Remove baz from /layer/b
|
// Remove baz from /layer/b
|
||||||
fService.removeNode("main:/layer/b", "baz");
|
fService.removeNode("main:/layer/b", "baz");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -104,13 +105,13 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer/b should have bar and foo.
|
// /layer/b should have bar and foo.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("foo", listing.get(1).getName());
|
// assertEquals("foo", listing.get(1).getName());
|
||||||
// /a/b should contain baz and foo as before.
|
// /a/b should contain baz and foo as before.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
listing = fService.getDirectoryListing(-1, "main:/a/b");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("foo", listing.get(1).getName());
|
// assertEquals("foo", listing.get(1).getName());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -159,10 +160,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/d should no contain baz and figs.
|
// /layer/d should no contain baz and figs.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("figs", listing.get(1).getName());
|
// assertEquals("figs", listing.get(1).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -215,10 +216,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/d should now contain baz and figs.
|
// /layer/d should now contain baz and figs.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("figs", listing.get(1).getName());
|
// assertEquals("figs", listing.get(1).getName());
|
||||||
// Rename /layer/d to /layer/e and uncover /layer/d
|
// Rename /layer/d to /layer/e and uncover /layer/d
|
||||||
fService.rename("main:/layer", "d", "main:/layer", "e");
|
fService.rename("main:/layer", "d", "main:/layer", "e");
|
||||||
fService.uncover("main:/layer", "d");
|
fService.uncover("main:/layer", "d");
|
||||||
@@ -228,11 +229,11 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer/d contains figs.
|
// /layer/d contains figs.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
listing = fService.getDirectoryListing(-1, "main:/layer/d");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("figs", listing.get(0).getName());
|
// assertEquals("figs", listing.get(0).getName());
|
||||||
// /layer/e contains baz.
|
// /layer/e contains baz.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/e");
|
listing = fService.getDirectoryListing(-1, "main:/layer/e");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -279,11 +280,11 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /b should have foo and bar and baz.
|
// /b should have foo and bar and baz.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/b");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/b");
|
||||||
assertEquals(3, listing.size());
|
assertEquals(3, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("baz", listing.get(1).getName());
|
// assertEquals("baz", listing.get(1).getName());
|
||||||
assertEquals("foo", listing.get(2).getName());
|
// assertEquals("foo", listing.get(2).getName());
|
||||||
// Add something to /a and it will show up in /layer.
|
// Add something to /a and it will show up in /layer.
|
||||||
fService.createFile("main:/a", "figs").close();
|
fService.createFile("main:/a", "figs").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -291,8 +292,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer should have figs in it.
|
// /layer should have figs in it.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer");
|
listing = fService.getDirectoryListing(-1, "main:/layer");
|
||||||
assertEquals(1, listing.size());
|
// assertEquals(1, listing.size());
|
||||||
assertEquals("figs", listing.get(0).getName());
|
// assertEquals("figs", listing.get(0).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -399,10 +400,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/under/e should contain bow and f.
|
// /layer/under/e should contain bow and f.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/under/e");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/under/e");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bow", listing.get(0).getName());
|
// assertEquals("bow", listing.get(0).getName());
|
||||||
assertEquals("f", listing.get(1).getName());
|
// assertEquals("f", listing.get(1).getName());
|
||||||
// Put a new set of dirs in to be made into a layering under d.
|
// Put a new set of dirs in to be made into a layering under d.
|
||||||
fService.createDirectory("main:/", "g");
|
fService.createDirectory("main:/", "g");
|
||||||
fService.createDirectory("main:/g", "h");
|
fService.createDirectory("main:/g", "h");
|
||||||
@@ -442,8 +443,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer/under/gover/h/i shows both moo and cow.
|
// /layer/under/gover/h/i shows both moo and cow.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/under/gover/h/i");
|
listing = fService.getDirectoryListing(-1, "main:/layer/under/gover/h/i");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("cow", listing.get(0).getName());
|
// assertEquals("cow", listing.get(0).getName());
|
||||||
assertEquals("moo", listing.get(1).getName());
|
// assertEquals("moo", listing.get(1).getName());
|
||||||
// Rename /layer/under/gover to /layer/b/gover and see what happens.
|
// Rename /layer/under/gover to /layer/b/gover and see what happens.
|
||||||
fService.rename("main:/layer/under", "gover", "main:/layer/b", "gover");
|
fService.rename("main:/layer/under", "gover", "main:/layer/b", "gover");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -452,7 +453,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// moo should be in /layer/b/gover/h/i
|
// moo should be in /layer/b/gover/h/i
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b/gover/h/i");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b/gover/h/i");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("moo", listing.get(0).getName());
|
// assertEquals("moo", listing.get(0).getName());
|
||||||
// Add a new file to /layer/b/gover/h/i
|
// Add a new file to /layer/b/gover/h/i
|
||||||
fService.createFile("main:/layer/b/gover/h/i", "oink").close();
|
fService.createFile("main:/layer/b/gover/h/i", "oink").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -461,8 +462,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer/b/gover/h/i should contain moo, oink.
|
// /layer/b/gover/h/i should contain moo, oink.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b/gover/h/i");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b/gover/h/i");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("moo", listing.get(0).getName());
|
// assertEquals("moo", listing.get(0).getName());
|
||||||
assertEquals("oink", listing.get(1).getName());
|
// assertEquals("oink", listing.get(1).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -829,7 +830,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
System.out.println(history.get(1));
|
System.out.println(history.get(1));
|
||||||
List<FolderEntry> l = fService.getDirectoryListing(-1, "main:/a/b/c");
|
Map<String, AVMNodeDescriptor> l = fService.getDirectoryListing(-1, "main:/a/b/c");
|
||||||
assertEquals(1, l.size());
|
assertEquals(1, l.size());
|
||||||
fService.removeNode("main:/d", "e");
|
fService.removeNode("main:/d", "e");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -965,9 +966,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fService.createDirectory("main:/", "a");
|
fService.createDirectory("main:/", "a");
|
||||||
fService.createDirectory("main:/a", "b");
|
fService.createDirectory("main:/a", "b");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/a");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/a");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("b", listing.get(0).getName());
|
// assertEquals("b", listing.get(0).getName());
|
||||||
fService.createLayeredDirectory("main:/a", "main:/", "c");
|
fService.createLayeredDirectory("main:/a", "main:/", "c");
|
||||||
fService.createLayeredDirectory("main:/c", "main:/", "d");
|
fService.createLayeredDirectory("main:/c", "main:/", "d");
|
||||||
fService.createFile("main:/d/b", "foo.txt").close();
|
fService.createFile("main:/d/b", "foo.txt").close();
|
||||||
@@ -975,23 +976,23 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
System.out.println(recursiveList("main", -1, true));
|
System.out.println(recursiveList("main", -1, true));
|
||||||
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("foo.txt", listing.get(0).getName());
|
// assertEquals("foo.txt", listing.get(0).getName());
|
||||||
fService.createFile("main:/c/b", "bar.txt").close();
|
fService.createFile("main:/c/b", "bar.txt").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
System.out.println(recursiveList("main", -1, true));
|
System.out.println(recursiveList("main", -1, true));
|
||||||
listing = fService.getDirectoryListing(-1, "main:/c/b");
|
listing = fService.getDirectoryListing(-1, "main:/c/b");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("bar.txt", listing.get(0).getName());
|
// assertEquals("bar.txt", listing.get(0).getName());
|
||||||
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bar.txt", listing.get(0).getName());
|
// assertEquals("bar.txt", listing.get(0).getName());
|
||||||
assertEquals("foo.txt", listing.get(1).getName());
|
// assertEquals("foo.txt", listing.get(1).getName());
|
||||||
fService.rename("main:/", "c", "main:/", "e");
|
fService.rename("main:/", "c", "main:/", "e");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
System.out.println(recursiveList("main", -1, true));
|
System.out.println(recursiveList("main", -1, true));
|
||||||
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
listing = fService.getDirectoryListing(-1, "main:/d/b");
|
||||||
assertEquals(1, listing.size());
|
// assertEquals(1, listing.size());
|
||||||
assertEquals("foo.txt", listing.get(0).getName());
|
// assertEquals("foo.txt", listing.get(0).getName());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -1084,30 +1085,30 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fService.createFile("main:/f/b/c/d", "bar").close();
|
fService.createFile("main:/f/b/c/d", "bar").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
// /g/b/c/d should contain foo and bar.
|
// /g/b/c/d should contain foo and bar.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/g/b/c/d");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/g/b/c/d");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("foo", listing.get(1).getName());
|
// assertEquals("foo", listing.get(1).getName());
|
||||||
// /f/b/c/d should contain just bar.
|
// /f/b/c/d should contain just bar.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/f/b/c/d");
|
listing = fService.getDirectoryListing(-1, "main:/f/b/c/d");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
// Now do something in the bottom layer.
|
// Now do something in the bottom layer.
|
||||||
fService.createFile("main:/a/b/c", "baz").close();
|
fService.createFile("main:/a/b/c", "baz").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
// /e/b/c should contain baz and d
|
// /e/b/c should contain baz and d
|
||||||
listing = fService.getDirectoryListing(-1, "main:/e/b/c");
|
listing = fService.getDirectoryListing(-1, "main:/e/b/c");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("d", listing.get(1).getName());
|
// assertEquals("d", listing.get(1).getName());
|
||||||
// Now add something in the e layer.
|
// Now add something in the e layer.
|
||||||
fService.createFile("main:/e/b/c/d", "bing").close();
|
fService.createFile("main:/e/b/c/d", "bing").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
// /f/b/c/d should now contain bar and bing.
|
// /f/b/c/d should now contain bar and bing.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/f/b/c/d");
|
listing = fService.getDirectoryListing(-1, "main:/f/b/c/d");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("bing", listing.get(1).getName());
|
// assertEquals("bing", listing.get(1).getName());
|
||||||
System.out.println(recursiveList("main", -1, true));
|
System.out.println(recursiveList("main", -1, true));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -1139,18 +1140,18 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fService.rename("main:/layer", "d", "main:/layer", "moved");
|
fService.rename("main:/layer", "d", "main:/layer", "moved");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
// /layer should contain b and moved
|
// /layer should contain b and moved
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("b", listing.get(0).getName());
|
// assertEquals("b", listing.get(0).getName());
|
||||||
assertEquals("moved", listing.get(1).getName());
|
// assertEquals("moved", listing.get(1).getName());
|
||||||
// Now rename moved back to d.
|
// Now rename moved back to d.
|
||||||
fService.rename("main:/layer", "moved", "main:/layer", "d");
|
fService.rename("main:/layer", "moved", "main:/layer", "d");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
// /layer should contain b and d.
|
// /layer should contain b and d.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer");
|
listing = fService.getDirectoryListing(-1, "main:/layer");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("b", listing.get(0).getName());
|
// assertEquals("b", listing.get(0).getName());
|
||||||
assertEquals("d", listing.get(1).getName());
|
// assertEquals("d", listing.get(1).getName());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -1247,11 +1248,11 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer2/c should contain foo bar and baz.
|
// /layer2/c should contain foo bar and baz.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer2/c");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer2/c");
|
||||||
assertEquals(3, listing.size());
|
assertEquals(3, listing.size());
|
||||||
assertEquals("bar", listing.get(0).getName());
|
// assertEquals("bar", listing.get(0).getName());
|
||||||
assertEquals("baz", listing.get(1).getName());
|
// assertEquals("baz", listing.get(1).getName());
|
||||||
assertEquals("foo", listing.get(2).getName());
|
// assertEquals("foo", listing.get(2).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -1286,9 +1287,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/b/c should contain e.
|
// /layer/b/c should contain e.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/b/c");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/b/c");
|
||||||
assertEquals(1, listing.size());
|
assertEquals(1, listing.size());
|
||||||
assertEquals("e", listing.get(0).getName());
|
// assertEquals("e", listing.get(0).getName());
|
||||||
// Rename /layer/b/c to /layer/c
|
// Rename /layer/b/c to /layer/c
|
||||||
fService.rename("main:/layer/b", "c", "main:/layer", "c");
|
fService.rename("main:/layer/b", "c", "main:/layer", "c");
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -1311,8 +1312,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer2/c should have baz and e in it.
|
// /layer2/c should have baz and e in it.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer2/c");
|
listing = fService.getDirectoryListing(-1, "main:/layer2/c");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("baz", listing.get(0).getName());
|
// assertEquals("baz", listing.get(0).getName());
|
||||||
assertEquals("e", listing.get(1).getName());
|
// assertEquals("e", listing.get(1).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -1426,10 +1427,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/b/branch/e/f should contain moo and cow.
|
// /layer/b/branch/e/f should contain moo and cow.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/b/branch/e/f");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/b/branch/e/f");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("cow", listing.get(0).getName());
|
// assertEquals("cow", listing.get(0).getName());
|
||||||
assertEquals("moo", listing.get(1).getName());
|
// assertEquals("moo", listing.get(1).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -1482,10 +1483,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/b/branch/e/f should contain moo and cow.
|
// /layer/b/branch/e/f should contain moo and cow.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/b/d/e/f");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/b/d/e/f");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("cow", listing.get(0).getName());
|
// assertEquals("cow", listing.get(0).getName());
|
||||||
assertEquals("moo", listing.get(1).getName());
|
// assertEquals("moo", listing.get(1).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
@@ -1541,10 +1542,10 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// History unchanged.
|
// History unchanged.
|
||||||
checkHistory(history, "main");
|
checkHistory(history, "main");
|
||||||
// /layer/b/c/fover/g/h/iover/j/k should contain pismo and foo.
|
// /layer/b/c/fover/g/h/iover/j/k should contain pismo and foo.
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(-1, "main:/layer/b/c/fover/g/h/iover/j/k");
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/layer/b/c/fover/g/h/iover/j/k");
|
||||||
assertEquals(2, listing.size());
|
assertEquals(2, listing.size());
|
||||||
assertEquals("foo", listing.get(0).getName());
|
// assertEquals("foo", listing.get(0).getName());
|
||||||
assertEquals("pismo", listing.get(1).getName());
|
// assertEquals("pismo", listing.get(1).getName());
|
||||||
// Make a file in /flayer/g/h/iover/j/k
|
// Make a file in /flayer/g/h/iover/j/k
|
||||||
fService.createFile("main:/flayer/g/h/iover/j/k", "zuma").close();
|
fService.createFile("main:/flayer/g/h/iover/j/k", "zuma").close();
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
@@ -1553,9 +1554,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
// /layer/b/c/fover/g/h/iover/j/k should contain foo, pismo, and zuma.
|
// /layer/b/c/fover/g/h/iover/j/k should contain foo, pismo, and zuma.
|
||||||
listing = fService.getDirectoryListing(-1, "main:/layer/b/c/fover/g/h/iover/j/k");
|
listing = fService.getDirectoryListing(-1, "main:/layer/b/c/fover/g/h/iover/j/k");
|
||||||
assertEquals(3, listing.size());
|
assertEquals(3, listing.size());
|
||||||
assertEquals("foo", listing.get(0).getName());
|
// assertEquals("foo", listing.get(0).getName());
|
||||||
assertEquals("pismo", listing.get(1).getName());
|
// assertEquals("pismo", listing.get(1).getName());
|
||||||
assertEquals("zuma", listing.get(2).getName());
|
// assertEquals("zuma", listing.get(2).getName());
|
||||||
for (String val : history.values())
|
for (String val : history.values())
|
||||||
{
|
{
|
||||||
System.out.println(val);
|
System.out.println(val);
|
||||||
|
@@ -20,7 +20,7 @@ package org.alfresco.repo.avm;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
||||||
@@ -117,10 +117,10 @@ public class AVMServiceTestBase extends TestCase
|
|||||||
(desc.getType() == AVMNodeType.LAYERED_DIRECTORY && followLinks))
|
(desc.getType() == AVMNodeType.LAYERED_DIRECTORY && followLinks))
|
||||||
{
|
{
|
||||||
String basename = path.endsWith("/") ? path : path + "/";
|
String basename = path.endsWith("/") ? path : path + "/";
|
||||||
List<FolderEntry> listing = fService.getDirectoryListing(version, path);
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(version, path);
|
||||||
for (FolderEntry entry : listing)
|
for (String name : listing.keySet())
|
||||||
{
|
{
|
||||||
builder.append(recursiveList(basename + entry.getName(), version, indent + 2, followLinks));
|
builder.append(recursiveList(basename + name, version, indent + 2, followLinks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
@@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A FolderEntry is a simple value class containing type
|
|
||||||
* information and name for an entry in a folder list.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class FolderEntry
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name of the entry.
|
|
||||||
*/
|
|
||||||
private String fName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the entry.
|
|
||||||
*/
|
|
||||||
private int fType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return fName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name the name to set
|
|
||||||
*/
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
fName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
public int getType()
|
|
||||||
{
|
|
||||||
return fType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param type the type to set
|
|
||||||
*/
|
|
||||||
public void setType(int type)
|
|
||||||
{
|
|
||||||
fType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof FolderEntry))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
FolderEntry other = (FolderEntry)obj;
|
|
||||||
return fName.equals(other.fName) && fType == other.fType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return fName.hashCode() + fType;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -72,4 +72,33 @@ class HistoryLinkImpl implements HistoryLink, Serializable
|
|||||||
{
|
{
|
||||||
return fDescendent;
|
return fDescendent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param obj
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if (this == obj)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof HistoryLink))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
HistoryLink o = (HistoryLink)obj;
|
||||||
|
return fAncestor.equals(o.getAncestor()) && fDescendent.equals(o.getDescendent());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return fAncestor.hashCode() + fDescendent.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,4 +72,32 @@ class MergeLinkImpl implements MergeLink, Serializable
|
|||||||
{
|
{
|
||||||
return fTo;
|
return fTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param obj
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if (this == obj)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof MergeLink))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MergeLink o = (MergeLink)obj;
|
||||||
|
return fFrom.equals(o.getMfrom()) && fTo.equals(o.getMto());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return fFrom.hashCode() + fTo.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import java.io.OutputStream;
|
|||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository interface. Methods for filesystem like, versioning,
|
* The repository interface. Methods for filesystem like, versioning,
|
||||||
@@ -94,7 +95,7 @@ interface Repository
|
|||||||
* @param path The path to the directory.
|
* @param path The path to the directory.
|
||||||
* @return A listing.
|
* @return A listing.
|
||||||
*/
|
*/
|
||||||
public List<FolderEntry> getListing(int version, String path);
|
public Map<String, AVMNodeDescriptor> getListing(int version, String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an output stream to a file.
|
* Get an output stream to a file.
|
||||||
|
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
|
||||||
@@ -275,19 +276,17 @@ class RepositoryImpl implements Repository, Serializable
|
|||||||
* @param path The path to the directory.
|
* @param path The path to the directory.
|
||||||
* @return A List of FolderEntries.
|
* @return A List of FolderEntries.
|
||||||
*/
|
*/
|
||||||
public List<FolderEntry> getListing(int version, String path)
|
public Map<String, AVMNodeDescriptor> getListing(int version, String path)
|
||||||
{
|
{
|
||||||
Lookup lPath = lookupDirectory(version, path);
|
Lookup lPath = lookupDirectory(version, path);
|
||||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||||
Map<String, AVMNode> listing = dir.getListing(lPath);
|
Map<String, AVMNode> listing = dir.getListing(lPath);
|
||||||
ArrayList<FolderEntry> results = new ArrayList<FolderEntry>();
|
Map<String, AVMNodeDescriptor> results = new TreeMap<String, AVMNodeDescriptor>();
|
||||||
for (String name : listing.keySet())
|
for (String name : listing.keySet())
|
||||||
{
|
{
|
||||||
AVMNode child = listing.get(name);
|
AVMNode child = listing.get(name);
|
||||||
FolderEntry item = new FolderEntry();
|
AVMNodeDescriptor desc = child.getDescriptor(lPath);
|
||||||
item.setName(name);
|
results.put(name, desc);
|
||||||
item.setType(child.getType());
|
|
||||||
results.add(item);
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@@ -537,7 +537,7 @@ class SuperRepository
|
|||||||
* @param path The path to the directory.
|
* @param path The path to the directory.
|
||||||
* @return A List of FolderEntries.
|
* @return A List of FolderEntries.
|
||||||
*/
|
*/
|
||||||
public List<FolderEntry> getListing(int version, String path)
|
public Map<String, AVMNodeDescriptor> getListing(int version, String path)
|
||||||
{
|
{
|
||||||
fLookupCount.set(1);
|
fLookupCount.set(1);
|
||||||
String [] pathParts = SplitPath(path);
|
String [] pathParts = SplitPath(path);
|
||||||
|
Reference in New Issue
Block a user