mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Retyped a counter so had to muck with many beans. Forced creation of layered directories
to work. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2930 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -105,7 +105,7 @@ public abstract class AVMNode
|
|||||||
* Set the version number.
|
* Set the version number.
|
||||||
* @param version The version number to set.
|
* @param version The version number to set.
|
||||||
*/
|
*/
|
||||||
public void setVersion(long version)
|
public void setVersion(int version)
|
||||||
{
|
{
|
||||||
fData.setVersionID(version);
|
fData.setVersionID(version);
|
||||||
}
|
}
|
||||||
@@ -212,15 +212,6 @@ public abstract class AVMNode
|
|||||||
fData.setRepository(repo.getDataBean());
|
fData.setRepository(repo.getDataBean());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Repository we 'belong' to.
|
|
||||||
* @return The Repository.
|
|
||||||
*/
|
|
||||||
public Repository getRepository()
|
|
||||||
{
|
|
||||||
return RepositoryFactory.GetInstance().createFromBean(fData.getRepository());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data bean in this node.
|
* Get the data bean in this node.
|
||||||
* @return The data bean.
|
* @return The data bean.
|
||||||
@@ -242,5 +233,11 @@ public abstract class AVMNode
|
|||||||
/**
|
/**
|
||||||
* Get the type of this node.
|
* Get the type of this node.
|
||||||
*/
|
*/
|
||||||
public abstract AVMNodeType getType();
|
public abstract int getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a debugging string representation.
|
||||||
|
* @param lPath The Lookup.
|
||||||
|
*/
|
||||||
|
public abstract String toString(Lookup lPath);
|
||||||
}
|
}
|
||||||
|
@@ -41,8 +41,11 @@ public class AVMNodeFactory
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (bean instanceof HibernateProxy)
|
||||||
|
{
|
||||||
HibernateProxy proxy = (HibernateProxy)bean;
|
HibernateProxy proxy = (HibernateProxy)bean;
|
||||||
bean = (AVMNodeBean)proxy.getHibernateLazyInitializer().getImplementation();
|
bean = (AVMNodeBean)proxy.getHibernateLazyInitializer().getImplementation();
|
||||||
|
}
|
||||||
if (bean instanceof PlainFileNodeBean)
|
if (bean instanceof PlainFileNodeBean)
|
||||||
{
|
{
|
||||||
return new PlainFileNode((PlainFileNodeBean)bean);
|
return new PlainFileNode((PlainFileNodeBean)bean);
|
||||||
|
@@ -21,10 +21,10 @@ package org.alfresco.repo.avm;
|
|||||||
* This defines the different types of FolderEntrys.
|
* This defines the different types of FolderEntrys.
|
||||||
* @author britt
|
* @author britt
|
||||||
*/
|
*/
|
||||||
public enum AVMNodeType
|
public interface AVMNodeType
|
||||||
{
|
{
|
||||||
PLAIN_FILE,
|
public static final int PLAIN_FILE = 0;
|
||||||
LAYERED_FILE,
|
public static final int LAYERED_FILE = 1;
|
||||||
PLAIN_DIRECTORY,
|
public static final int PLAIN_DIRECTORY = 2;
|
||||||
LAYERED_DIRECTORY
|
public static final int LAYERED_DIRECTORY = 3;
|
||||||
}
|
}
|
||||||
|
@@ -149,22 +149,26 @@ public interface AVMService
|
|||||||
*/
|
*/
|
||||||
public void createSnapshot(List<String> repositories);
|
public void createSnapshot(List<String> repositories);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Snapshot the given repository.
|
||||||
|
* @param repository The name of the repository to snapshot.
|
||||||
|
*/
|
||||||
|
public void createSnapshot(String repository);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the set of version IDs in a Repository
|
* Get the set of version IDs in a Repository
|
||||||
* @param name The name of the Repository.
|
* @param name The name of the Repository.
|
||||||
* @return A Set of version IDs
|
* @return A Set of version IDs
|
||||||
*/
|
*/
|
||||||
public Set<Long> getRepositoryVersions(String name);
|
public Set<Integer> getRepositoryVersions(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup a node by version ids and path. Note that an AVMNode is essentially
|
* Lookup a node by version ids and path.
|
||||||
* informational only. There is very little you can do to an AVMNode in the absence
|
|
||||||
* of path information.
|
|
||||||
* @param version The version id to look under.
|
* @param version The version id to look under.
|
||||||
* @param path The simple absolute path to the parent directory.
|
* @param path The simple absolute path to the parent directory.
|
||||||
* @return An AVMNode.
|
* @return A Lookup object.
|
||||||
*/
|
*/
|
||||||
public AVMNode lookup(int version, String path);
|
public Lookup lookup(int version, String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the indirection path for a layered file or directory.
|
* Get the indirection path for a layered file or directory.
|
||||||
|
@@ -17,7 +17,10 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.avm;
|
package org.alfresco.repo.avm;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
||||||
import org.alfresco.repo.avm.impl.AVMServiceImpl;
|
import org.alfresco.repo.avm.impl.AVMServiceImpl;
|
||||||
@@ -76,10 +79,8 @@ public class AVMServiceTest extends TestCase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
fService.createDirectory("main:/", "testdir");
|
fService.createDirectory("main:/", "testdir");
|
||||||
ArrayList<String> toSnapshot = new ArrayList<String>();
|
fService.createSnapshot("main");
|
||||||
toSnapshot.add("main");
|
AVMNode node = fService.lookup(-1, "main:/").getCurrentNode();
|
||||||
fService.createSnapshot(toSnapshot);
|
|
||||||
AVMNode node = fService.lookup(-1, "main:/");
|
|
||||||
assertTrue(node instanceof PlainDirectoryNode);
|
assertTrue(node instanceof PlainDirectoryNode);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -99,9 +100,20 @@ public class AVMServiceTest extends TestCase
|
|||||||
testCreateDirectory();
|
testCreateDirectory();
|
||||||
fService.createFile("main:testdir", "testfile");
|
fService.createFile("main:testdir", "testfile");
|
||||||
fService.createFile("main:/", "testfile2");
|
fService.createFile("main:/", "testfile2");
|
||||||
ArrayList<String> toSnapshot = new ArrayList<String>();
|
fService.createSnapshot("main");
|
||||||
toSnapshot.add("main");
|
PrintStream out = new PrintStream(fService.getFileOutputStream("main:testdir/testfile"));
|
||||||
fService.createSnapshot(toSnapshot);
|
out.println("This is testdir/testfile");
|
||||||
|
out.close();
|
||||||
|
out = new PrintStream(fService.getFileOutputStream("main:testfile2"));
|
||||||
|
out.println("This is testfile2");
|
||||||
|
out.close();
|
||||||
|
fService.createSnapshot("main");
|
||||||
|
Set<Integer> versions = fService.getRepositoryVersions("main");
|
||||||
|
for (Integer version : versions)
|
||||||
|
{
|
||||||
|
System.out.println("V:" + version);
|
||||||
|
System.out.println(recursiveList("main", version));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -109,4 +121,118 @@ public class AVMServiceTest extends TestCase
|
|||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test creating a branch.
|
||||||
|
*/
|
||||||
|
public void testCreateBranch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
setupBasicTree();
|
||||||
|
fService.createBranch(-1, "main:a", "main:d/e", "abranch");
|
||||||
|
fService.createSnapshot("main");
|
||||||
|
Set<Integer> versions = fService.getRepositoryVersions("main");
|
||||||
|
for (Integer version : versions)
|
||||||
|
{
|
||||||
|
System.out.println("V:" + version);
|
||||||
|
System.out.println(recursiveList("main", version));
|
||||||
|
}
|
||||||
|
List<FolderEntry> original = fService.getDirectoryListing(-1, "main:a");
|
||||||
|
List<FolderEntry> branch = fService.getDirectoryListing(-1, "main:d/e/abranch");
|
||||||
|
assertEquals(original, branch);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test creating a layer.
|
||||||
|
*/
|
||||||
|
public void testCreateLayer()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
setupBasicTree();
|
||||||
|
fService.createLayeredDirectory("main:a", "main:d/e", "alayer");
|
||||||
|
fService.createSnapshot("main");
|
||||||
|
System.out.println(recursiveList("main", -1));
|
||||||
|
List<FolderEntry> original = fService.getDirectoryListing(-1, "main:a");
|
||||||
|
List<FolderEntry> layer = fService.getDirectoryListing(-1, "main:d/e/alayer");
|
||||||
|
assertEquals(original, layer);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to write a recursive listing of a repository at a given version.
|
||||||
|
* @param repoName The name of the repository.
|
||||||
|
* @param version The version to look under.
|
||||||
|
*/
|
||||||
|
private String recursiveList(String repoName, int version)
|
||||||
|
{
|
||||||
|
return recursiveList(repoName + ":/", version, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive list the given path.
|
||||||
|
* @param path The path.
|
||||||
|
* @param version The version.
|
||||||
|
* @param indent The current indent level.
|
||||||
|
*/
|
||||||
|
private String recursiveList(String path, int version, int indent)
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (int i = 0; i < indent; i++)
|
||||||
|
{
|
||||||
|
builder.append(' ');
|
||||||
|
}
|
||||||
|
builder.append(path);
|
||||||
|
builder.append(' ');
|
||||||
|
Lookup lookup = fService.lookup(version, path);
|
||||||
|
AVMNode node = lookup.getCurrentNode();
|
||||||
|
builder.append(node.toString(lookup));
|
||||||
|
builder.append('\n');
|
||||||
|
if (node instanceof DirectoryNode)
|
||||||
|
{
|
||||||
|
String basename = path.endsWith("/") ? path.substring(0, path.length() - 1) : path + "/";
|
||||||
|
List<FolderEntry> listing = fService.getDirectoryListing(version, path);
|
||||||
|
for (FolderEntry entry : listing)
|
||||||
|
{
|
||||||
|
builder.append(recursiveList(basename + entry.getName(), version, indent + 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup a basic tree.
|
||||||
|
*/
|
||||||
|
private void setupBasicTree()
|
||||||
|
{
|
||||||
|
fService.createDirectory("main:/", "a");
|
||||||
|
fService.createDirectory("main:a", "b");
|
||||||
|
fService.createDirectory("main:a/b", "c");
|
||||||
|
fService.createDirectory("main:/", "d");
|
||||||
|
fService.createDirectory("main:d", "e");
|
||||||
|
fService.createDirectory("main:d/e", "f");
|
||||||
|
fService.createFile("main:a/b/c", "foo");
|
||||||
|
PrintStream out = new PrintStream(fService.getFileOutputStream("main:a/b/c/foo"));
|
||||||
|
out.println("I am main:a/b/c/foo");
|
||||||
|
out.close();
|
||||||
|
fService.createFile("main:a/b/c", "bar");
|
||||||
|
out = new PrintStream(fService.getFileOutputStream("main:a/b/c/bar"));
|
||||||
|
out.println("I am main:a/b/c/bar");
|
||||||
|
out.close();
|
||||||
|
ArrayList<String> toSnapshot = new ArrayList<String>();
|
||||||
|
toSnapshot.add("main");
|
||||||
|
fService.createSnapshot(toSnapshot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ public abstract class FileNode extends AVMNode
|
|||||||
* @param version The version to get in.
|
* @param version The version to get in.
|
||||||
* @return A FileContent object.
|
* @return A FileContent object.
|
||||||
*/
|
*/
|
||||||
public abstract FileContent getContentForRead(int version);
|
public abstract FileContent getContentForRead(int version, Repository repo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the content object for writing. This will do COW
|
* Get the content object for writing. This will do COW
|
||||||
|
@@ -32,7 +32,7 @@ public class FolderEntry
|
|||||||
/**
|
/**
|
||||||
* The type of the entry.
|
* The type of the entry.
|
||||||
*/
|
*/
|
||||||
private AVMNodeType fType;
|
private int fType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name
|
* @return the name
|
||||||
@@ -53,7 +53,7 @@ public class FolderEntry
|
|||||||
/**
|
/**
|
||||||
* @return the type
|
* @return the type
|
||||||
*/
|
*/
|
||||||
public AVMNodeType getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
@@ -61,8 +61,35 @@ public class FolderEntry
|
|||||||
/**
|
/**
|
||||||
* @param type the type to set
|
* @param type the type to set
|
||||||
*/
|
*/
|
||||||
public void setType(AVMNodeType type)
|
public void setType(int type)
|
||||||
{
|
{
|
||||||
fType = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -78,6 +78,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
repos.getDataBean(),
|
repos.getDataBean(),
|
||||||
attrs,
|
attrs,
|
||||||
-1,
|
-1,
|
||||||
|
true,
|
||||||
indirection);
|
indirection);
|
||||||
setDataBean(fData);
|
setDataBean(fData);
|
||||||
repos.getSuperRepository().getSession().save(fData);
|
repos.getSuperRepository().getSession().save(fData);
|
||||||
@@ -108,11 +109,12 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
repos.getDataBean(),
|
repos.getDataBean(),
|
||||||
attrs,
|
attrs,
|
||||||
-1,
|
-1,
|
||||||
|
thatBean.getPrimaryIndirection(),
|
||||||
other.getUnderlying());
|
other.getUnderlying());
|
||||||
setDataBean(fData);
|
setDataBean(fData);
|
||||||
fData.setAdded(thatBean.getAdded());
|
fData.setAdded(thatBean.getAdded());
|
||||||
fData.setDeleted(thatBean.getDeleted());
|
fData.setDeleted(thatBean.getDeleted());
|
||||||
fData.setPrimaryIndirection(thatBean.getPrimaryIndirection());
|
// fData.setPrimaryIndirection(thatBean.getPrimaryIndirection());
|
||||||
repos.getSuperRepository().getSession().save(fData);
|
repos.getSuperRepository().getSession().save(fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,11 +142,12 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
repos.getDataBean(),
|
repos.getDataBean(),
|
||||||
attrs,
|
attrs,
|
||||||
-1,
|
-1,
|
||||||
|
false,
|
||||||
null);
|
null);
|
||||||
setDataBean(fData);
|
setDataBean(fData);
|
||||||
// TODO Is this right? I don't think so.
|
// TODO Is this right? I don't think so.
|
||||||
// fData.setAdded(other.getListing(lPath, -1));
|
// fData.setAdded(other.getListing(lPath, -1));
|
||||||
fData.setPrimaryIndirection(false);
|
// fData.setPrimaryIndirection(false);
|
||||||
repos.getSuperRepository().getSession().save(fData);
|
repos.getSuperRepository().getSession().save(fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,9 +181,9 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
repo.getDataBean(),
|
repo.getDataBean(),
|
||||||
attrs,
|
attrs,
|
||||||
-1,
|
-1,
|
||||||
|
true,
|
||||||
srcLookup.getIndirectionPath() + "/" + name);
|
srcLookup.getIndirectionPath() + "/" + name);
|
||||||
setDataBean(fData);
|
setDataBean(fData);
|
||||||
fData.setPrimaryIndirection(true);
|
|
||||||
repo.getSuperRepository().getSession().save(fData);
|
repo.getSuperRepository().getSession().save(fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +255,6 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
{
|
{
|
||||||
LayeredDirectoryNode dir = (LayeredDirectoryNode)parent;
|
LayeredDirectoryNode dir = (LayeredDirectoryNode)parent;
|
||||||
setLayerID(dir.getLayerID());
|
setLayerID(dir.getLayerID());
|
||||||
setRepository(parent.getRepository());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +326,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Lookup lookup = getRepository().getSuperRepository().lookupDirectory(-1, getUnderlying(lPath));
|
Lookup lookup = lPath.getRepository().getSuperRepository().lookupDirectory(-1, getUnderlying(lPath));
|
||||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||||
if (dir.lookupChild(lookup, name, -1) != null)
|
if (dir.lookupChild(lookup, name, -1) != null)
|
||||||
{
|
{
|
||||||
@@ -339,7 +341,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
|
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
|
||||||
toModify.putChild(name, child);
|
toModify.putChild(name, child);
|
||||||
child.setParent(toModify);
|
child.setParent(toModify);
|
||||||
child.setRepository(toModify.getRepository());
|
child.setRepository(lPath.getRepository());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +361,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
Map<String, DirectoryEntry> baseListing = null;
|
Map<String, DirectoryEntry> baseListing = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Lookup lookup = getRepository().getSuperRepository().lookupDirectory(version, getUnderlying(lPath));
|
Lookup lookup = lPath.getRepository().getSuperRepository().lookupDirectory(version, getUnderlying(lPath));
|
||||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||||
baseListing = dir.getListing(lookup, version);
|
baseListing = dir.getListing(lookup, version);
|
||||||
}
|
}
|
||||||
@@ -396,7 +398,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
AVMNode child = null;
|
AVMNode child = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Lookup lookup = getRepository().getSuperRepository().lookupDirectory(version, getUnderlying(lPath));
|
Lookup lookup = lPath.getRepository().getSuperRepository().lookupDirectory(version, getUnderlying(lPath));
|
||||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||||
child = dir.lookupChild(lookup, name, version);
|
child = dir.lookupChild(lookup, name, version);
|
||||||
}
|
}
|
||||||
@@ -446,7 +448,7 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Lookup lookup = getRepository().getSuperRepository().lookupDirectory(-1, getUnderlying(lPath));
|
Lookup lookup = lPath.getRepository().getSuperRepository().lookupDirectory(-1, getUnderlying(lPath));
|
||||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||||
if (dir.lookupChild(lookup, name, -1) == null)
|
if (dir.lookupChild(lookup, name, -1) == null)
|
||||||
{
|
{
|
||||||
@@ -467,8 +469,16 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.AVMNode#getType()
|
* @see org.alfresco.repo.avm.AVMNode#getType()
|
||||||
*/
|
*/
|
||||||
public AVMNodeType getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return AVMNodeType.LAYERED_DIRECTORY;
|
return AVMNodeType.LAYERED_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString(Lookup lPath)
|
||||||
|
{
|
||||||
|
return "[LD:" + fData.getId() + ":" + getUnderlying(lPath) + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
fData =
|
fData =
|
||||||
new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1,
|
||||||
-1L,
|
-1L,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@@ -98,7 +98,7 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
fData =
|
fData =
|
||||||
new LayeredFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
new LayeredFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1,
|
||||||
-1L,
|
-1L,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@@ -125,7 +125,7 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
fData = new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
fData = new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1,
|
||||||
-1L,
|
-1L,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@@ -143,10 +143,6 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
*/
|
*/
|
||||||
public void handlePostCopy(DirectoryNode parent)
|
public void handlePostCopy(DirectoryNode parent)
|
||||||
{
|
{
|
||||||
if (parent != null)
|
|
||||||
{
|
|
||||||
setRepository(parent.getRepository());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +154,7 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
// LayeredFileNodes are always copied.
|
// LayeredFileNodes are always copied.
|
||||||
// TODO This is busted. Need to set the PlainFileNode contents
|
// TODO This is busted. Need to set the PlainFileNode contents
|
||||||
// to share with underlying file node.
|
// to share with underlying file node.
|
||||||
PlainFileNode newMe = new PlainFileNode(getRepository());
|
PlainFileNode newMe = new PlainFileNode(lPath.getRepository());
|
||||||
newMe.setAncestor(this);
|
newMe.setAncestor(this);
|
||||||
return newMe;
|
return newMe;
|
||||||
}
|
}
|
||||||
@@ -167,7 +163,7 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
* Get the type of this node.
|
* Get the type of this node.
|
||||||
* @return The type.
|
* @return The type.
|
||||||
*/
|
*/
|
||||||
public AVMNodeType getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return AVMNodeType.LAYERED_FILE;
|
return AVMNodeType.LAYERED_FILE;
|
||||||
}
|
}
|
||||||
@@ -176,16 +172,16 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
* Get the content of the specified version.
|
* Get the content of the specified version.
|
||||||
* @return A FileContent object.
|
* @return A FileContent object.
|
||||||
*/
|
*/
|
||||||
public FileContent getContentForRead(int version)
|
public FileContent getContentForRead(int version, Repository repo)
|
||||||
{
|
{
|
||||||
Lookup lookup = getRepository().getSuperRepository().lookup(version, fData.getIndirection());
|
Lookup lookup = repo.getSuperRepository().lookup(version, fData.getIndirection());
|
||||||
AVMNode node = lookup.getCurrentNode();
|
AVMNode node = lookup.getCurrentNode();
|
||||||
if (!(node instanceof FileNode))
|
if (!(node instanceof FileNode))
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Missing Link.");
|
throw new AlfrescoRuntimeException("Missing Link.");
|
||||||
}
|
}
|
||||||
FileNode file = (FileNode)node;
|
FileNode file = (FileNode)node;
|
||||||
return file.getContentForRead(version);
|
return file.getContentForRead(version, repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,4 +200,12 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
{
|
{
|
||||||
return fData.getIndirection();
|
return fData.getIndirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString(Lookup lPath)
|
||||||
|
{
|
||||||
|
return "[LF:" + fData.getId() + ":" + fData.getIndirection() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -277,7 +277,9 @@ public class Lookup
|
|||||||
*/
|
*/
|
||||||
public String getCurrentIndirection()
|
public String getCurrentIndirection()
|
||||||
{
|
{
|
||||||
return fComponents.get(fPosition).getIndirection();
|
String value = fComponents.get(fPosition).getIndirection();
|
||||||
|
System.err.println(value);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -216,10 +216,6 @@ public class PlainDirectoryNode extends DirectoryNode
|
|||||||
*/
|
*/
|
||||||
public void handlePostCopy(DirectoryNode parent)
|
public void handlePostCopy(DirectoryNode parent)
|
||||||
{
|
{
|
||||||
if (parent != null)
|
|
||||||
{
|
|
||||||
setRepository(parent.getRepository());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,8 +251,17 @@ public class PlainDirectoryNode extends DirectoryNode
|
|||||||
* Get the type of this node.
|
* Get the type of this node.
|
||||||
* @return The type of this node.
|
* @return The type of this node.
|
||||||
*/
|
*/
|
||||||
public AVMNodeType getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return AVMNodeType.PLAIN_DIRECTORY;
|
return AVMNodeType.PLAIN_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMNode#toString(org.alfresco.repo.avm.Lookup)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString(Lookup lPath)
|
||||||
|
{
|
||||||
|
return "[PD:" + fData.getId() + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -104,19 +104,6 @@ public class PlainFileNode extends FileNode
|
|||||||
setDataBean(fData);
|
setDataBean(fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO I believe this is unnecessary (bhp)
|
|
||||||
/**
|
|
||||||
* Handle setting repository after a COW.
|
|
||||||
* @param parent The possibly new parent directory.
|
|
||||||
*/
|
|
||||||
public void handlePostCopy(DirectoryNode parent)
|
|
||||||
{
|
|
||||||
if (parent != null)
|
|
||||||
{
|
|
||||||
setRepository(parent.getRepository());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy on write logic.
|
* Copy on write logic.
|
||||||
* @param lPath The lookup path.
|
* @param lPath The lookup path.
|
||||||
@@ -127,7 +114,7 @@ public class PlainFileNode extends FileNode
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PlainFileNode newMe = new PlainFileNode(this, getRepository());
|
PlainFileNode newMe = new PlainFileNode(this, lPath.getRepository());
|
||||||
newMe.setAncestor(this);
|
newMe.setAncestor(this);
|
||||||
newMe.setBranchID(lPath.getHighestBranch());
|
newMe.setBranchID(lPath.getHighestBranch());
|
||||||
return newMe;
|
return newMe;
|
||||||
@@ -137,7 +124,7 @@ public class PlainFileNode extends FileNode
|
|||||||
* Get the type of this node.
|
* Get the type of this node.
|
||||||
* @return The type.
|
* @return The type.
|
||||||
*/
|
*/
|
||||||
public AVMNodeType getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return AVMNodeType.PLAIN_FILE;
|
return AVMNodeType.PLAIN_FILE;
|
||||||
}
|
}
|
||||||
@@ -145,7 +132,7 @@ public class PlainFileNode extends FileNode
|
|||||||
/**
|
/**
|
||||||
* Get content for reading.
|
* Get content for reading.
|
||||||
*/
|
*/
|
||||||
public FileContent getContentForRead(int version)
|
public FileContent getContentForRead(int version, Repository repo)
|
||||||
{
|
{
|
||||||
return new FileContent(fData.getContent());
|
return new FileContent(fData.getContent());
|
||||||
}
|
}
|
||||||
@@ -164,4 +151,21 @@ public class PlainFileNode extends FileNode
|
|||||||
}
|
}
|
||||||
return fc;
|
return fc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMNode#toString(org.alfresco.repo.avm.Lookup)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString(Lookup lPath)
|
||||||
|
{
|
||||||
|
return "[PF:" + fData.getId() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMNode#handlePostCopy(org.alfresco.repo.avm.DirectoryNode)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void handlePostCopy(DirectoryNode parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ public interface Repository
|
|||||||
* Get the latest version id.
|
* Get the latest version id.
|
||||||
* @return The latest version.
|
* @return The latest version.
|
||||||
*/
|
*/
|
||||||
public long getLatestVersion();
|
public int getLatestVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform this Repository that the root node is new.
|
* Inform this Repository that the root node is new.
|
||||||
@@ -131,7 +131,7 @@ public interface Repository
|
|||||||
* Get the version ids that this Repository has.
|
* Get the version ids that this Repository has.
|
||||||
* @return A Set of Version IDs.
|
* @return A Set of Version IDs.
|
||||||
*/
|
*/
|
||||||
public Set<Long> getVersions();
|
public Set<Integer> getVersions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data bean.
|
* Get the data bean.
|
||||||
|
@@ -114,6 +114,12 @@ public interface SuperRepository
|
|||||||
*/
|
*/
|
||||||
public void createSnapshot(List<String> repositories);
|
public void createSnapshot(List<String> repositories);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a snapshot of a single repository.
|
||||||
|
* @param repository The name of the repsository.
|
||||||
|
*/
|
||||||
|
public void createSnapshot(String repository);
|
||||||
|
|
||||||
// Different flavors of deletions.
|
// Different flavors of deletions.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -165,7 +171,7 @@ public interface SuperRepository
|
|||||||
* @param name The name of the repository.
|
* @param name The name of the repository.
|
||||||
* @return A Set of IDs.
|
* @return A Set of IDs.
|
||||||
*/
|
*/
|
||||||
public Set<Long> getRepositoryVersions(String name);
|
public Set<Integer> getRepositoryVersions(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Issue a unique identifier for a new node.
|
* Issue a unique identifier for a new node.
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
won't cause violations in the db during saves. -->
|
won't cause violations in the db during saves. -->
|
||||||
<many-to-one name="repository" column="repository"
|
<many-to-one name="repository" column="repository"
|
||||||
class="RepositoryBeanImpl" cascade="save-update"/>
|
class="RepositoryBeanImpl" cascade="save-update"/>
|
||||||
<property name="versionID" type="long" column="version_id"
|
<property name="versionID" type="int" column="version_id"
|
||||||
not-null="true"/>
|
not-null="true"/>
|
||||||
<!-- The branch id is always 0 for nodes that are not part of
|
<!-- The branch id is always 0 for nodes that are not part of
|
||||||
a branch. -->
|
a branch. -->
|
||||||
@@ -80,8 +80,8 @@
|
|||||||
<!-- A DirectoryEntry is a (node)type AVMNode reference pair.
|
<!-- A DirectoryEntry is a (node)type AVMNode reference pair.
|
||||||
Should probably convert type into an integer code. -->
|
Should probably convert type into an integer code. -->
|
||||||
<composite-element class="DirectoryEntry">
|
<composite-element class="DirectoryEntry">
|
||||||
<property name="type" column="type_name"
|
<property name="type" column="type_code"
|
||||||
type="string" length="30" not-null="true" />
|
type="int" not-null="true" />
|
||||||
<many-to-one name="child"
|
<many-to-one name="child"
|
||||||
class="AVMNodeBeanImpl" cascade="save-update"
|
class="AVMNodeBeanImpl" cascade="save-update"
|
||||||
not-null="true">
|
not-null="true">
|
||||||
@@ -106,14 +106,14 @@
|
|||||||
this probably wants to be in the base class. -->
|
this probably wants to be in the base class. -->
|
||||||
<property name="isRoot" column="is_root" type="boolean" />
|
<property name="isRoot" column="is_root" type="boolean" />
|
||||||
<!-- A map of names to DirectoryEntries. In the AVM world, it makes sense
|
<!-- A map of names to DirectoryEntries. In the AVM world, it makes sense
|
||||||
that nodes don't know there own names, only there containers do. -->
|
that nodes don't know there own names, only their containers do. -->
|
||||||
<map name="children" cascade="all">
|
<map name="children" cascade="all">
|
||||||
<key column="directory_id" />
|
<key column="directory_id" />
|
||||||
<map-key type="string" column="name" />
|
<map-key type="string" column="name" />
|
||||||
<composite-element
|
<composite-element
|
||||||
class="org.alfresco.repo.avm.hibernate.DirectoryEntry">
|
class="org.alfresco.repo.avm.hibernate.DirectoryEntry">
|
||||||
<property name="type" type="string"
|
<property name="type" type="int"
|
||||||
not-null="true" length="30" column="type_name" />
|
not-null="true" column="type_code" />
|
||||||
<many-to-one name="child"
|
<many-to-one name="child"
|
||||||
class="org.alfresco.repo.avm.hibernate.AVMNodeBeanImpl"
|
class="org.alfresco.repo.avm.hibernate.AVMNodeBeanImpl"
|
||||||
not-null="true" cascade="save-update">
|
not-null="true" cascade="save-update">
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
<cache usage="read-write" />
|
<cache usage="read-write" />
|
||||||
<id name="name" column="name" type="string"/>
|
<id name="name" column="name" type="string"/>
|
||||||
<version name="vers" column="vers" type="long"/>
|
<version name="vers" column="vers" type="long"/>
|
||||||
<property type="long" name="nextVersionID"
|
<property type="int" name="nextVersionID"
|
||||||
column="next_version_id" not-null="true"/>
|
column="next_version_id" not-null="true"/>
|
||||||
<!-- Every Repository has a root directory that is the current root directory. -->
|
<!-- Every Repository has a root directory that is the current root directory. -->
|
||||||
<!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
|
<!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
of versioned root directories. -->
|
of versioned root directories. -->
|
||||||
<map name="roots" table="repository_roots">
|
<map name="roots" table="repository_roots">
|
||||||
<key column="repository_id"/>
|
<key column="repository_id"/>
|
||||||
<map-key type="long" column="version_id"/>
|
<map-key type="int" column="version_id"/>
|
||||||
<many-to-many class="DirectoryNodeBeanImpl"
|
<many-to-many class="DirectoryNodeBeanImpl"
|
||||||
column="directory_id"/>
|
column="directory_id"/>
|
||||||
</map>
|
</map>
|
||||||
|
@@ -39,13 +39,13 @@ public interface AVMNodeBean
|
|||||||
* Set the version id.
|
* Set the version id.
|
||||||
* @param id The version id of the node.
|
* @param id The version id of the node.
|
||||||
*/
|
*/
|
||||||
public void setVersionID(long id);
|
public void setVersionID(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version id of this node.
|
* Get the version id of this node.
|
||||||
* @return The version id.
|
* @return The version id.
|
||||||
*/
|
*/
|
||||||
public long getVersionID();
|
public int getVersionID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the parent of this node. This is only a canonical parent,
|
* Set the parent of this node. This is only a canonical parent,
|
||||||
|
@@ -31,7 +31,7 @@ public class AVMNodeBeanImpl implements AVMNodeBean
|
|||||||
/**
|
/**
|
||||||
* The Version ID
|
* The Version ID
|
||||||
*/
|
*/
|
||||||
private long fVersionID;
|
private int fVersionID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Branch ID
|
* The Branch ID
|
||||||
@@ -91,7 +91,7 @@ public class AVMNodeBeanImpl implements AVMNodeBean
|
|||||||
* @param repository The repository.
|
* @param repository The repository.
|
||||||
*/
|
*/
|
||||||
public AVMNodeBeanImpl(long id,
|
public AVMNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
@@ -155,7 +155,7 @@ public class AVMNodeBeanImpl implements AVMNodeBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setVersionID(int)
|
* @see org.alfresco.proto.avm.AVMNode#setVersionID(int)
|
||||||
*/
|
*/
|
||||||
public void setVersionID(long id)
|
public void setVersionID(int id)
|
||||||
{
|
{
|
||||||
fVersionID = id;
|
fVersionID = id;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ public class AVMNodeBeanImpl implements AVMNodeBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getVersionID()
|
* @see org.alfresco.proto.avm.AVMNode#getVersionID()
|
||||||
*/
|
*/
|
||||||
public long getVersionID()
|
public int getVersionID()
|
||||||
{
|
{
|
||||||
return fVersionID;
|
return fVersionID;
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ public class DirectoryEntry
|
|||||||
/**
|
/**
|
||||||
* The type of entry a node is.
|
* The type of entry a node is.
|
||||||
*/
|
*/
|
||||||
private AVMNodeType fType;
|
private int fType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the actual child Node.
|
* This is the actual child Node.
|
||||||
@@ -47,30 +47,12 @@ public class DirectoryEntry
|
|||||||
* @param type The type.
|
* @param type The type.
|
||||||
* @param child The child node.
|
* @param child The child node.
|
||||||
*/
|
*/
|
||||||
public DirectoryEntry(AVMNodeType type, AVMNodeBean child)
|
public DirectoryEntry(int type, AVMNodeBean child)
|
||||||
{
|
{
|
||||||
fType = type;
|
fType = type;
|
||||||
fChild = child;
|
fChild = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the entry type.
|
|
||||||
* @param type The type to set.
|
|
||||||
*/
|
|
||||||
public void setEntryType(AVMNodeType type)
|
|
||||||
{
|
|
||||||
fType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the entry type.
|
|
||||||
* @return The type.
|
|
||||||
*/
|
|
||||||
public AVMNodeType getEntryType()
|
|
||||||
{
|
|
||||||
return fType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the child.
|
* Set the child.
|
||||||
* @param child The child to set.
|
* @param child The child to set.
|
||||||
@@ -91,19 +73,19 @@ public class DirectoryEntry
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the type by name.
|
* Set the type by name.
|
||||||
* @param name The name of the type.
|
* @param type The type.
|
||||||
*/
|
*/
|
||||||
public void setType(String name)
|
public void setType(int type)
|
||||||
{
|
{
|
||||||
fType = Enum.valueOf(AVMNodeType.class, name);
|
fType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type name.
|
* Get the type.
|
||||||
*/
|
*/
|
||||||
public String getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return fType.name();
|
return fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -138,6 +120,6 @@ public class DirectoryEntry
|
|||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "[" + fType.name() + "] " + fChild.getId();
|
return "[" + fType + "] " + fChild.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ public class DirectoryNodeBeanImpl extends AVMNodeBeanImpl implements DirectoryN
|
|||||||
* @param parent The parent.
|
* @param parent The parent.
|
||||||
*/
|
*/
|
||||||
public DirectoryNodeBeanImpl(long id,
|
public DirectoryNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
|
@@ -42,7 +42,7 @@ public class FileNodeBeanImpl extends AVMNodeBeanImpl implements FileNodeBean
|
|||||||
* @param parent The parent.
|
* @param parent The parent.
|
||||||
*/
|
*/
|
||||||
public FileNodeBeanImpl(long id,
|
public FileNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
|
@@ -72,10 +72,11 @@ public class LayeredDirectoryNodeBeanImpl extends DirectoryNodeBeanImpl implemen
|
|||||||
* @param mergedFrom The node that merged into us.
|
* @param mergedFrom The node that merged into us.
|
||||||
* @param parent The parent node.
|
* @param parent The parent node.
|
||||||
* @param layerID The layer id of this node.
|
* @param layerID The layer id of this node.
|
||||||
|
* @param primary Whether this is a primary indirection node.
|
||||||
* @param indirection The indirection pointer of this.
|
* @param indirection The indirection pointer of this.
|
||||||
*/
|
*/
|
||||||
public LayeredDirectoryNodeBeanImpl(long id,
|
public LayeredDirectoryNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
@@ -83,10 +84,12 @@ public class LayeredDirectoryNodeBeanImpl extends DirectoryNodeBeanImpl implemen
|
|||||||
RepositoryBean repository,
|
RepositoryBean repository,
|
||||||
BasicAttributesBean attrs,
|
BasicAttributesBean attrs,
|
||||||
long layerID,
|
long layerID,
|
||||||
|
boolean primary,
|
||||||
String indirection)
|
String indirection)
|
||||||
{
|
{
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
||||||
fLayerID = layerID;
|
fLayerID = layerID;
|
||||||
|
fPrimaryIndirection = primary;
|
||||||
fIndirection = indirection;
|
fIndirection = indirection;
|
||||||
fAdded = new HashMap<String, DirectoryEntry>();
|
fAdded = new HashMap<String, DirectoryEntry>();
|
||||||
fDeleted = new HashSet<String>();
|
fDeleted = new HashSet<String>();
|
||||||
|
@@ -48,7 +48,7 @@ public class LayeredFileNodeBeanImpl extends FileNodeBeanImpl implements
|
|||||||
* @param indirection The indirection pointer.
|
* @param indirection The indirection pointer.
|
||||||
*/
|
*/
|
||||||
public LayeredFileNodeBeanImpl(long id,
|
public LayeredFileNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
|
@@ -55,7 +55,7 @@ public class PlainDirectoryNodeBeanImpl extends DirectoryNodeBeanImpl implements
|
|||||||
* @param isRoot Whether this is a root node.
|
* @param isRoot Whether this is a root node.
|
||||||
*/
|
*/
|
||||||
public PlainDirectoryNodeBeanImpl(long id,
|
public PlainDirectoryNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
|
@@ -48,7 +48,7 @@ public class PlainFileNodeBeanImpl extends FileNodeBeanImpl implements PlainFile
|
|||||||
* @param content The content object.
|
* @param content The content object.
|
||||||
*/
|
*/
|
||||||
public PlainFileNodeBeanImpl(long id,
|
public PlainFileNodeBeanImpl(long id,
|
||||||
long versionID,
|
int versionID,
|
||||||
long branchID,
|
long branchID,
|
||||||
AVMNodeBean ancestor,
|
AVMNodeBean ancestor,
|
||||||
AVMNodeBean mergedFrom,
|
AVMNodeBean mergedFrom,
|
||||||
|
@@ -55,25 +55,25 @@ public interface RepositoryBean
|
|||||||
* Set the roots map.
|
* Set the roots map.
|
||||||
* @param roots The Map of version ids to roots.
|
* @param roots The Map of version ids to roots.
|
||||||
*/
|
*/
|
||||||
public void setRoots(Map<Long, DirectoryNodeBean> roots);
|
public void setRoots(Map<Integer, DirectoryNodeBean> roots);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the roots map.
|
* Get the roots map.
|
||||||
* @return The roots map.
|
* @return The roots map.
|
||||||
*/
|
*/
|
||||||
public Map<Long, DirectoryNodeBean> getRoots();
|
public Map<Integer, DirectoryNodeBean> getRoots();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the next version id.
|
* Set the next version id.
|
||||||
* @param nextVersionID The value to set.
|
* @param nextVersionID The value to set.
|
||||||
*/
|
*/
|
||||||
public void setNextVersionID(long nextVersionID);
|
public void setNextVersionID(int nextVersionID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next version id.
|
* Get the next version id.
|
||||||
* @return The next version id.
|
* @return The next version id.
|
||||||
*/
|
*/
|
||||||
public long getNextVersionID();
|
public int getNextVersionID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the new nodes.
|
* Set the new nodes.
|
||||||
|
@@ -41,12 +41,12 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
/**
|
/**
|
||||||
* The root directories for all versions.
|
* The root directories for all versions.
|
||||||
*/
|
*/
|
||||||
private Map<Long, DirectoryNodeBean> fRoots;
|
private Map<Integer, DirectoryNodeBean> fRoots;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The next version id.
|
* The next version id.
|
||||||
*/
|
*/
|
||||||
private long fNextVersionID;
|
private int fNextVersionID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nodes that are new since the last end operation.
|
* The nodes that are new since the last end operation.
|
||||||
@@ -76,7 +76,7 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
fName = name;
|
fName = name;
|
||||||
fNextVersionID = 0;
|
fNextVersionID = 0;
|
||||||
fRoot = root;
|
fRoot = root;
|
||||||
fRoots = new HashMap<Long, DirectoryNodeBean>();
|
fRoots = new HashMap<Integer, DirectoryNodeBean>();
|
||||||
fNewNodes = new HashSet<AVMNodeBean>();
|
fNewNodes = new HashSet<AVMNodeBean>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.Repository#setRoots(java.util.Map)
|
* @see org.alfresco.proto.avm.Repository#setRoots(java.util.Map)
|
||||||
*/
|
*/
|
||||||
public void setRoots(Map<Long, DirectoryNodeBean> roots)
|
public void setRoots(Map<Integer, DirectoryNodeBean> roots)
|
||||||
{
|
{
|
||||||
fRoots = roots;
|
fRoots = roots;
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.Repository#getRoots()
|
* @see org.alfresco.proto.avm.Repository#getRoots()
|
||||||
*/
|
*/
|
||||||
public Map<Long, DirectoryNodeBean> getRoots()
|
public Map<Integer, DirectoryNodeBean> getRoots()
|
||||||
{
|
{
|
||||||
return fRoots;
|
return fRoots;
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.Repository#setNextVersionID(int)
|
* @see org.alfresco.proto.avm.Repository#setNextVersionID(int)
|
||||||
*/
|
*/
|
||||||
public void setNextVersionID(long nextVersionID)
|
public void setNextVersionID(int nextVersionID)
|
||||||
{
|
{
|
||||||
fNextVersionID = nextVersionID;
|
fNextVersionID = nextVersionID;
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ public class RepositoryBeanImpl implements RepositoryBean
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.proto.avm.Repository#getNextVersionID()
|
* @see org.alfresco.proto.avm.Repository#getNextVersionID()
|
||||||
*/
|
*/
|
||||||
public long getNextVersionID()
|
public int getNextVersionID()
|
||||||
{
|
{
|
||||||
return fNextVersionID;
|
return fNextVersionID;
|
||||||
}
|
}
|
||||||
|
@@ -1,233 +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.hibernate;
|
|
||||||
|
|
||||||
import org.alfresco.repo.avm.AVMNodeType;
|
|
||||||
import org.alfresco.repo.avm.hibernate.ContentBean;
|
|
||||||
import org.alfresco.repo.avm.hibernate.ContentBeanImpl;
|
|
||||||
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
|
||||||
import org.alfresco.repo.avm.hibernate.HibernateTxn;
|
|
||||||
import org.alfresco.repo.avm.hibernate.HibernateTxnCallback;
|
|
||||||
import org.alfresco.repo.avm.hibernate.Issuer;
|
|
||||||
import org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBean;
|
|
||||||
import org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBeanImpl;
|
|
||||||
import org.alfresco.repo.avm.hibernate.PlainFileNodeBean;
|
|
||||||
import org.alfresco.repo.avm.hibernate.PlainFileNodeBeanImpl;
|
|
||||||
import org.alfresco.repo.avm.hibernate.RepositoryBean;
|
|
||||||
import org.alfresco.repo.avm.hibernate.RepositoryBeanImpl;
|
|
||||||
import org.hibernate.Query;
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.SessionFactory;
|
|
||||||
import org.hibernate.cfg.Configuration;
|
|
||||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
public class TestPopulate extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The SessionFactory.
|
|
||||||
*/
|
|
||||||
private SessionFactory fSessionFactory;
|
|
||||||
|
|
||||||
public TestPopulate(String name)
|
|
||||||
{
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setUp() throws Exception
|
|
||||||
{
|
|
||||||
fSessionFactory = HibernateHelper.GetSessionFactory();
|
|
||||||
Configuration cfg = HibernateHelper.GetConfiguration();
|
|
||||||
SchemaExport se = new SchemaExport(cfg);
|
|
||||||
se.drop(false, true);
|
|
||||||
se.create(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void tearDown() throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add some data to persistent store.
|
|
||||||
*/
|
|
||||||
public void testPopulate()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HibernateTxn hTxn = new HibernateTxn(fSessionFactory);
|
|
||||||
boolean result = hTxn.perform(
|
|
||||||
new HibernateTxnCallback()
|
|
||||||
{
|
|
||||||
public void perform(Session session)
|
|
||||||
{
|
|
||||||
// Set up issuers.
|
|
||||||
Issuer nodeIssuer = new Issuer("node", 0, session);
|
|
||||||
new Issuer("content", 0, session);
|
|
||||||
new Issuer("repository", 0, session);
|
|
||||||
// Make the initial root directory.
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
BasicAttributesBean attrs = new BasicAttributesBeanImpl("britt",
|
|
||||||
"britt",
|
|
||||||
"britt",
|
|
||||||
time,
|
|
||||||
time,
|
|
||||||
time);
|
|
||||||
session.save(attrs);
|
|
||||||
PlainDirectoryNodeBean root =
|
|
||||||
new PlainDirectoryNodeBeanImpl(nodeIssuer.issue(),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
attrs,
|
|
||||||
true);
|
|
||||||
// Make a new repository.
|
|
||||||
RepositoryBean rep =
|
|
||||||
new RepositoryBeanImpl("main", root);
|
|
||||||
root.setRepository(rep);
|
|
||||||
session.save(rep);
|
|
||||||
rep.getRoots().put(rep.getNextVersionID(), root);
|
|
||||||
rep.setNextVersionID(rep.getNextVersionID() + 1);
|
|
||||||
root.setIsNew(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
assertTrue(result);
|
|
||||||
System.out.println("--------------------------------------------");
|
|
||||||
result = hTxn.perform(
|
|
||||||
new HibernateTxnCallback()
|
|
||||||
{
|
|
||||||
public void perform(Session session)
|
|
||||||
{
|
|
||||||
// Now read some things back, and modify some stuff.
|
|
||||||
Issuer nodeIssuer = (Issuer)session.get(Issuer.class, "node");
|
|
||||||
Issuer contentIssuer = (Issuer)session.get(Issuer.class, "content");
|
|
||||||
RepositoryBean rep = (RepositoryBean)session.get(RepositoryBeanImpl.class, "main");
|
|
||||||
long version = rep.getNextVersionID();
|
|
||||||
rep.setNextVersionID(version + 1);
|
|
||||||
assertTrue(rep != null);
|
|
||||||
PlainDirectoryNodeBean root = (PlainDirectoryNodeBean)rep.getRoot();
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
BasicAttributesBean attrs = new BasicAttributesBeanImpl("britt",
|
|
||||||
"britt",
|
|
||||||
"britt",
|
|
||||||
time,
|
|
||||||
time,
|
|
||||||
time);
|
|
||||||
session.save(attrs);
|
|
||||||
PlainDirectoryNodeBean newRoot = new PlainDirectoryNodeBeanImpl(nodeIssuer.issue(),
|
|
||||||
version,
|
|
||||||
0L,
|
|
||||||
root,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
rep,
|
|
||||||
attrs,
|
|
||||||
true);
|
|
||||||
ContentBean content = new ContentBeanImpl(contentIssuer.issue());
|
|
||||||
attrs = new BasicAttributesBeanImpl(attrs);
|
|
||||||
session.save(attrs);
|
|
||||||
PlainFileNodeBean file = new PlainFileNodeBeanImpl(nodeIssuer.issue(),
|
|
||||||
version,
|
|
||||||
0L,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
newRoot,
|
|
||||||
rep,
|
|
||||||
attrs,
|
|
||||||
content);
|
|
||||||
content.setRefCount(content.getRefCount() + 1);
|
|
||||||
newRoot.getChildren().put("foo", new DirectoryEntry(AVMNodeType.PLAIN_FILE, file));
|
|
||||||
session.save(content);
|
|
||||||
session.save(newRoot);
|
|
||||||
content = new ContentBeanImpl(contentIssuer.issue());
|
|
||||||
content.setRefCount(content.getRefCount() + 1);
|
|
||||||
file.setIsNew(false);
|
|
||||||
attrs = new BasicAttributesBeanImpl(attrs);
|
|
||||||
session.save(attrs);
|
|
||||||
file = new PlainFileNodeBeanImpl(nodeIssuer.issue(),
|
|
||||||
version,
|
|
||||||
0L,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
newRoot,
|
|
||||||
rep,
|
|
||||||
attrs,
|
|
||||||
content);
|
|
||||||
session.save(content);
|
|
||||||
file.setIsNew(false);
|
|
||||||
newRoot.getChildren().put("bar", new DirectoryEntry(AVMNodeType.PLAIN_FILE, file));
|
|
||||||
rep.setRoot(newRoot);
|
|
||||||
rep.getRoots().put(version, newRoot);
|
|
||||||
newRoot.setIsNew(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
assertTrue(result);
|
|
||||||
System.out.println("-----------------------------------------------");
|
|
||||||
result = hTxn.perform(
|
|
||||||
new HibernateTxnCallback()
|
|
||||||
{
|
|
||||||
public void perform(Session session)
|
|
||||||
{
|
|
||||||
Query query = session.createQuery("from RepositoryBeanImpl r where r.name = :name");
|
|
||||||
query.setString("name", "main");
|
|
||||||
RepositoryBean rep = (RepositoryBean)query.uniqueResult();
|
|
||||||
PlainDirectoryNodeBean root = (PlainDirectoryNodeBean)rep.getRoot();
|
|
||||||
assertEquals(2, root.getChildren().size());
|
|
||||||
for (String name : root.getChildren().keySet())
|
|
||||||
{
|
|
||||||
System.out.println(name);
|
|
||||||
}
|
|
||||||
for (DirectoryEntry entry : root.getChildren().values())
|
|
||||||
{
|
|
||||||
assertEquals(AVMNodeType.PLAIN_FILE, entry.getEntryType());
|
|
||||||
}
|
|
||||||
assertEquals("britt", root.getBasicAttributes().getCreator());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
assertTrue(result);
|
|
||||||
System.out.println("----------------------------------------------");
|
|
||||||
// Just check cascading deletes for the children of a directory.
|
|
||||||
result = hTxn.perform(
|
|
||||||
new HibernateTxnCallback()
|
|
||||||
{
|
|
||||||
public void perform(Session session)
|
|
||||||
{
|
|
||||||
RepositoryBean rep = (RepositoryBean)session.get(RepositoryBeanImpl.class, "main");
|
|
||||||
PlainDirectoryNodeBean root = (PlainDirectoryNodeBean)rep.getRoot();
|
|
||||||
PlainDirectoryNodeBean prev = (PlainDirectoryNodeBean)root.getAncestor();
|
|
||||||
rep.getRoots().remove(rep.getRoot().getId());
|
|
||||||
rep.setRoot(prev);
|
|
||||||
for (String name : root.getChildren().keySet())
|
|
||||||
{
|
|
||||||
AVMNodeBean child = root.getChildren().get(name).getChild();
|
|
||||||
child.setParent(null);
|
|
||||||
}
|
|
||||||
session.delete(root);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
assertTrue(result);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
fail();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -22,7 +22,6 @@ import java.io.OutputStream;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.AVMNode;
|
|
||||||
import org.alfresco.repo.avm.AVMService;
|
import org.alfresco.repo.avm.AVMService;
|
||||||
import org.alfresco.repo.avm.FolderEntry;
|
import org.alfresco.repo.avm.FolderEntry;
|
||||||
import org.alfresco.repo.avm.Lookup;
|
import org.alfresco.repo.avm.Lookup;
|
||||||
@@ -363,10 +362,27 @@ public class AVMServiceImpl implements AVMService
|
|||||||
fTransaction.perform(doit);
|
fTransaction.perform(doit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMService#createSnapshot(java.lang.String)
|
||||||
|
*/
|
||||||
|
public void createSnapshot(final String repository)
|
||||||
|
{
|
||||||
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
|
{
|
||||||
|
public void perform(Session session)
|
||||||
|
{
|
||||||
|
fSuperRepository.set(new SuperRepositoryImpl(session, fStorage));
|
||||||
|
fSuperRepository.get().createSnapshot(repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HTxnCallback doit = new HTxnCallback();
|
||||||
|
fTransaction.perform(doit);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.AVMService#lookup(int, java.lang.String)
|
* @see org.alfresco.repo.avm.AVMService#lookup(int, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public AVMNode lookup(final int version, final String path)
|
public Lookup lookup(final int version, final String path)
|
||||||
{
|
{
|
||||||
class HTxnCallback implements HibernateTxnCallback
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
{
|
{
|
||||||
@@ -380,7 +396,7 @@ public class AVMServiceImpl implements AVMService
|
|||||||
}
|
}
|
||||||
HTxnCallback doit = new HTxnCallback();
|
HTxnCallback doit = new HTxnCallback();
|
||||||
fTransaction.perform(doit);
|
fTransaction.perform(doit);
|
||||||
return doit.lookup.getCurrentNode();
|
return doit.lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -440,11 +456,11 @@ public class AVMServiceImpl implements AVMService
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.AVMService#getRepositoryVersions(java.lang.String)
|
* @see org.alfresco.repo.avm.AVMService#getRepositoryVersions(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Set<Long> getRepositoryVersions(final String name)
|
public Set<Integer> getRepositoryVersions(final String name)
|
||||||
{
|
{
|
||||||
class HTxnCallback implements HibernateTxnCallback
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
{
|
{
|
||||||
public Set<Long> versions;
|
public Set<Integer> versions;
|
||||||
|
|
||||||
public void perform(Session session)
|
public void perform(Session session)
|
||||||
{
|
{
|
||||||
|
@@ -122,7 +122,7 @@ public class RepositoryImpl implements Repository
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.Repository#getLatestVersion()
|
* @see org.alfresco.repo.avm.Repository#getLatestVersion()
|
||||||
*/
|
*/
|
||||||
public long getLatestVersion()
|
public int getLatestVersion()
|
||||||
{
|
{
|
||||||
return fData.getNextVersionID();
|
return fData.getNextVersionID();
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ public class RepositoryImpl implements Repository
|
|||||||
throw new AlfrescoRuntimeException("Not a file: " + path + " r " + version);
|
throw new AlfrescoRuntimeException("Not a file: " + path + " r " + version);
|
||||||
}
|
}
|
||||||
FileNode file = (FileNode)node;
|
FileNode file = (FileNode)node;
|
||||||
FileContent content = file.getContentForRead(version);
|
FileContent content = file.getContentForRead(version, this);
|
||||||
return content.getInputStream(fSuper);
|
return content.getInputStream(fSuper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ public class RepositoryImpl implements Repository
|
|||||||
{
|
{
|
||||||
FolderEntry item = new FolderEntry();
|
FolderEntry item = new FolderEntry();
|
||||||
item.setName(name);
|
item.setName(name);
|
||||||
item.setType(listing.get(name).getEntryType());
|
item.setType(listing.get(name).getType());
|
||||||
results.add(item);
|
results.add(item);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -376,7 +376,7 @@ public class RepositoryImpl implements Repository
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.Repository#getVersions()
|
* @see org.alfresco.repo.avm.Repository#getVersions()
|
||||||
*/
|
*/
|
||||||
public Set<Long> getVersions()
|
public Set<Integer> getVersions()
|
||||||
{
|
{
|
||||||
return fData.getRoots().keySet();
|
return fData.getRoots().keySet();
|
||||||
}
|
}
|
||||||
|
@@ -335,6 +335,15 @@ public class SuperRepositoryImpl implements SuperRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.SuperRepository#createSnapshot(java.lang.String)
|
||||||
|
*/
|
||||||
|
public void createSnapshot(String repository)
|
||||||
|
{
|
||||||
|
Repository repo = getRepositoryByName(repository);
|
||||||
|
repo.createSnapshot();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.SuperRepository#remove(java.lang.String, java.lang.String)
|
* @see org.alfresco.repo.avm.SuperRepository#remove(java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -394,7 +403,7 @@ public class SuperRepositoryImpl implements SuperRepository
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.SuperRepository#getRepositoryVersions(java.lang.String)
|
* @see org.alfresco.repo.avm.SuperRepository#getRepositoryVersions(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Set<Long> getRepositoryVersions(String name)
|
public Set<Integer> getRepositoryVersions(String name)
|
||||||
{
|
{
|
||||||
Repository rep = getRepositoryByName(name);
|
Repository rep = getRepositoryByName(name);
|
||||||
return rep.getVersions();
|
return rep.getVersions();
|
||||||
|
Reference in New Issue
Block a user