mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Renamed a few things. What used to be SuperRepository (kind of meaning free name
wasn't it) is now AVMRepository. What used to be Repository is now AVMStore as it more closely matches what is meant by a store in Alfresco. Many adjustments in ancillary class names, references, and comments followed. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,9 +31,9 @@ public class AVMContext
|
||||
public AVMNodeDAO fAVMNodeDAO;
|
||||
|
||||
/**
|
||||
* The Repository DAO.
|
||||
* The AVMStore DAO.
|
||||
*/
|
||||
public RepositoryDAO fRepositoryDAO;
|
||||
public AVMStoreDAO fAVMStoreDAO;
|
||||
|
||||
/**
|
||||
* The VersionRootDAO.
|
||||
@@ -66,9 +66,9 @@ public class AVMContext
|
||||
public DeletedChildDAO fDeletedChildDAO;
|
||||
|
||||
/**
|
||||
* The NewInRepositoryDAO
|
||||
* The NewInAVMStoreDAO
|
||||
*/
|
||||
public NewInRepositoryDAO fNewInRepositoryDAO;
|
||||
public NewInAVMStoreDAO fNewInAVMStoreDAO;
|
||||
|
||||
/**
|
||||
* @param nodeDAO the fAVMNodeDAO to set
|
||||
@@ -119,11 +119,11 @@ public class AVMContext
|
||||
}
|
||||
|
||||
/**
|
||||
* @param repositoryDAO the fRepositoryDAO to set
|
||||
* @param aVMStore the fAVMStoreDAO to set
|
||||
*/
|
||||
public void setRepositoryDAO(RepositoryDAO repositoryDAO)
|
||||
public void setAvmStoreDAO(AVMStoreDAO aVMStoreDAO)
|
||||
{
|
||||
fRepositoryDAO = repositoryDAO;
|
||||
fAVMStoreDAO = aVMStoreDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,10 +143,10 @@ public class AVMContext
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newInRepositoryDAO The DAO to set.
|
||||
* @param newInAVMStoreDAO The DAO to set.
|
||||
*/
|
||||
public void setNewInRepositoryDAO(NewInRepositoryDAO newInRepositoryDAO)
|
||||
public void setNewInAVMStoreDAO(NewInAVMStoreDAO newInAVMStoreDAO)
|
||||
{
|
||||
fNewInRepositoryDAO = newInRepositoryDAO;
|
||||
fNewInAVMStoreDAO = newInAVMStoreDAO;
|
||||
}
|
||||
}
|
||||
|
@@ -38,13 +38,13 @@ public class AVMCrawlTest extends AVMServiceTestBase
|
||||
int n = 2; // Number of Threads.
|
||||
int m = 4; // How many multiples of content to start with.
|
||||
long runTime = 1200000; // Ten minutes
|
||||
fService.purgeRepository("main");
|
||||
fService.purgeAVMStore("main");
|
||||
fReaper.setInactiveBaseSleep(60000);
|
||||
BulkLoader loader = new BulkLoader();
|
||||
loader.setAvmService(fService);
|
||||
for (int i = 0; i < m; i++)
|
||||
{
|
||||
fService.createRepository("d" + i);
|
||||
fService.createAVMStore("d" + i);
|
||||
loader.recursiveLoad("source", "d" + i + ":/");
|
||||
fService.createSnapshot("d" + i);
|
||||
}
|
||||
|
@@ -112,9 +112,9 @@ class AVMCrawler implements Runnable
|
||||
{
|
||||
try
|
||||
{
|
||||
List<RepositoryDescriptor> reps = fService.getRepositories();
|
||||
List<AVMStoreDescriptor> reps = fService.getAVMStores();
|
||||
fOpCount++;
|
||||
RepositoryDescriptor repDesc = reps.get(fRandom.nextInt(reps.size()));
|
||||
AVMStoreDescriptor repDesc = reps.get(fRandom.nextInt(reps.size()));
|
||||
Map<String, AVMNodeDescriptor> rootListing = fService.getDirectoryListing(-1, repDesc.getName() + ":/");
|
||||
fOpCount++;
|
||||
// Get all the directories in the root.
|
||||
|
@@ -161,8 +161,8 @@ public class AVMInterpreter
|
||||
}
|
||||
else if (command[0].equals("lsrep"))
|
||||
{
|
||||
List<RepositoryDescriptor> repos = fService.getRepositories();
|
||||
for (RepositoryDescriptor repo : repos)
|
||||
List<AVMStoreDescriptor> repos = fService.getAVMStores();
|
||||
for (AVMStoreDescriptor repo : repos)
|
||||
{
|
||||
out.println(repo);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class AVMInterpreter
|
||||
{
|
||||
return "Syntax Error.";
|
||||
}
|
||||
List<VersionDescriptor> listing = fService.getRepositoryVersions(command[1]);
|
||||
List<VersionDescriptor> listing = fService.getAVMStoreVersions(command[1]);
|
||||
for (VersionDescriptor desc : listing)
|
||||
{
|
||||
out.println(desc);
|
||||
@@ -185,7 +185,7 @@ public class AVMInterpreter
|
||||
{
|
||||
return "Syntax Error.";
|
||||
}
|
||||
fService.createRepository(command[1]);
|
||||
fService.createAVMStore(command[1]);
|
||||
}
|
||||
else if (command[0].equals("load"))
|
||||
{
|
||||
@@ -307,7 +307,7 @@ public class AVMInterpreter
|
||||
{
|
||||
return "Syntax Error.";
|
||||
}
|
||||
fService.purgeRepository(command[1]);
|
||||
fService.purgeAVMStore(command[1]);
|
||||
}
|
||||
else if (command[0].equals("rmver"))
|
||||
{
|
||||
|
@@ -114,13 +114,13 @@ public interface AVMNode
|
||||
public String toString(Lookup lPath);
|
||||
|
||||
/**
|
||||
* Set whether this node to be a root of a Repository.
|
||||
* Set whether this node to be a root of a AVMStore
|
||||
* @param isRoot
|
||||
*/
|
||||
public void setIsRoot(boolean isRoot);
|
||||
|
||||
/**
|
||||
* Get whether this node is a root of a Repository.
|
||||
* Get whether this node is a root of a AVMStore.
|
||||
* @return Whether this node is a root.
|
||||
*/
|
||||
public boolean getIsRoot();
|
||||
|
@@ -44,11 +44,11 @@ public interface AVMNodeDAO
|
||||
|
||||
/**
|
||||
* Get the root of a particular version.
|
||||
* @param rep The repository we're querying.
|
||||
* @param store The store we're querying.
|
||||
* @param version The version.
|
||||
* @return The VersionRoot or null.
|
||||
*/
|
||||
public DirectoryNode getRepositoryRoot(Repository rep, int version);
|
||||
public DirectoryNode getAVMStoreRoot(AVMStore store, int version);
|
||||
|
||||
/**
|
||||
* Update a node that has been dirtied.
|
||||
@@ -77,13 +77,6 @@ public interface AVMNodeDAO
|
||||
*/
|
||||
public List<AVMNode> getOrphans(int batchSize);
|
||||
|
||||
/**
|
||||
* Get all nodes that have the given repository as their owning repository.
|
||||
* @param rep The Repository.
|
||||
* @return An Iterator over the matching nodes.
|
||||
*/
|
||||
public Iterator<AVMNode> getByRepository(Repository rep);
|
||||
|
||||
/**
|
||||
* Inappropriate hack to get Hibernate to play nice.
|
||||
*/
|
||||
|
@@ -60,10 +60,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
/**
|
||||
* Constructor used when creating a new concrete subclass instance.
|
||||
* @param id The object id.
|
||||
* @param repo The Repository that owns this.
|
||||
* @param store The AVMStore that owns this.
|
||||
*/
|
||||
protected AVMNodeImpl(long id,
|
||||
Repository repo)
|
||||
AVMStore store)
|
||||
{
|
||||
fID = id;
|
||||
fVersionID = -1;
|
||||
@@ -216,7 +216,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
public boolean getIsNew()
|
||||
{
|
||||
return AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(this) != null;
|
||||
return AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(this) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,16 +27,16 @@ import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* This or Repository are
|
||||
* This or AVMStore are
|
||||
* the implementors of the operations specified by AVMService.
|
||||
* @author britt
|
||||
*/
|
||||
class SuperRepository
|
||||
class AVMRepository
|
||||
{
|
||||
/**
|
||||
* The single instance of SuperRepository.
|
||||
* The single instance of AVMRepository.
|
||||
*/
|
||||
private static SuperRepository fgInstance;
|
||||
private static AVMRepository fgInstance;
|
||||
|
||||
/**
|
||||
* The current lookup count.
|
||||
@@ -70,7 +70,7 @@ class SuperRepository
|
||||
* @param layerIssuer
|
||||
* @param storage
|
||||
*/
|
||||
public SuperRepository(Issuer nodeIssuer,
|
||||
public AVMRepository(Issuer nodeIssuer,
|
||||
Issuer contentIssuer,
|
||||
Issuer layerIssuer,
|
||||
String storage)
|
||||
@@ -92,7 +92,7 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
return rep.createFile(pathParts[1], name);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
rep.createFile(pathParts[1], name, data);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
rep.createDirectory(pathParts[1], name);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class SuperRepository
|
||||
}
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(dstPath);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.createLayeredDirectory(srcPath, pathParts[1], name);
|
||||
}
|
||||
@@ -154,20 +154,20 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(dstPath);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
rep.createLayeredFile(srcPath, pathParts[1], name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new repository.
|
||||
* @param name The name to give the new repository.
|
||||
* Create a new AVMStore.
|
||||
* @param name The name to give the new AVMStore.
|
||||
*/
|
||||
public void createRepository(String name)
|
||||
public void createAVMStore(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
getRepositoryByName(name, false);
|
||||
throw new AVMExistsException("Repository exists: " + name);
|
||||
getAVMStoreByName(name, false);
|
||||
throw new AVMExistsException("AVMStore exists: " + name);
|
||||
}
|
||||
catch (AVMNotFoundException anf)
|
||||
{
|
||||
@@ -175,10 +175,10 @@ class SuperRepository
|
||||
}
|
||||
// Newing up the object causes it to be written to the db.
|
||||
@SuppressWarnings("unused")
|
||||
Repository rep = new RepositoryImpl(this, name);
|
||||
// Special handling for repository creation.
|
||||
NewInRepository newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(rep.getRoot());
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newInRep);
|
||||
AVMStore rep = new AVMStoreImpl(this, name);
|
||||
// Special handling for AVMStore creation.
|
||||
NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(rep.getRoot());
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,12 +197,12 @@ class SuperRepository
|
||||
// Lookup the src node.
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(srcPath);
|
||||
Repository srcRepo = getRepositoryByName(pathParts[0], false);
|
||||
AVMStore srcRepo = getAVMStoreByName(pathParts[0], false);
|
||||
Lookup sPath = srcRepo.lookup(version, pathParts[1], false);
|
||||
// Lookup the destination directory.
|
||||
fLookupCount.set(1);
|
||||
pathParts = SplitPath(dstPath);
|
||||
Repository dstRepo = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore dstRepo = getAVMStoreByName(pathParts[0], true);
|
||||
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
DirectoryNode dirNode = (DirectoryNode)dPath.getCurrentNode();
|
||||
AVMNode srcNode = sPath.getCurrentNode();
|
||||
@@ -243,7 +243,7 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
return rep.getOutputStream(pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore rep = getAVMStoreByName(pathParts[0], true);
|
||||
return rep.getRandomAccess(version, pathParts[1], access);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ class SuperRepository
|
||||
}
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(srcPath);
|
||||
Repository srcRepo = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore srcRepo = getAVMStoreByName(pathParts[0], true);
|
||||
Lookup sPath = srcRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
DirectoryNode srcDir = (DirectoryNode)sPath.getCurrentNode();
|
||||
AVMNode srcNode = srcDir.lookupChild(sPath, srcName, -1, true);
|
||||
@@ -289,7 +289,7 @@ class SuperRepository
|
||||
}
|
||||
fLookupCount.set(1);
|
||||
pathParts = SplitPath(dstPath);
|
||||
Repository dstRepo = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore dstRepo = getAVMStoreByName(pathParts[0], true);
|
||||
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
DirectoryNode dstDir = (DirectoryNode)dPath.getCurrentNode();
|
||||
AVMNode dstNode = dstDir.lookupChild(dPath, dstName, -1, true);
|
||||
@@ -392,35 +392,35 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(dirPath);
|
||||
Repository repo = getRepositoryByName(pathParts[0], true);
|
||||
AVMStore repo = getAVMStoreByName(pathParts[0], true);
|
||||
repo.uncover(pathParts[1], name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Snapshot the given repositories.
|
||||
* @param repositories The list of repository name to snapshot.
|
||||
* @return A List of version ids for each newly snapshotted repository.
|
||||
* @param repositories The list of AVMStore name to snapshot.
|
||||
* @return A List of version ids for each newly snapshotted AVMStore.
|
||||
*/
|
||||
public List<Integer> createSnapshot(List<String> repositories)
|
||||
{
|
||||
List<Integer> result = new ArrayList<Integer>();
|
||||
for (String repName : repositories)
|
||||
{
|
||||
Repository repo = getRepositoryByName(repName, true);
|
||||
AVMStore repo = getAVMStoreByName(repName, true);
|
||||
result.add(repo.createSnapshot());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a snapshot of a single repository.
|
||||
* @param repository The name of the repository.
|
||||
* Create a snapshot of a single AVMStore.
|
||||
* @param store The name of the repository.
|
||||
* @return The version id of the newly snapshotted repository.
|
||||
*/
|
||||
public int createSnapshot(String repository)
|
||||
public int createSnapshot(String storeName)
|
||||
{
|
||||
Repository repo = getRepositoryByName(repository, true);
|
||||
return repo.createSnapshot();
|
||||
AVMStore store = getAVMStoreByName(storeName, true);
|
||||
return store.createSnapshot();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -432,46 +432,46 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], true);
|
||||
repo.removeNode(pathParts[1], name);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], true);
|
||||
store.removeNode(pathParts[1], name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rid of all content that lives only in the given repository.
|
||||
* Also removes the repository.
|
||||
* @param name The name of the repository to purge.
|
||||
* Get rid of all content that lives only in the given AVMStore.
|
||||
* Also removes the AVMStore.
|
||||
* @param name The name of the AVMStore to purge.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void purgeRepository(String name)
|
||||
public void purgeAVMStore(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, true);
|
||||
AVMNode root = rep.getRoot();
|
||||
AVMStore store = getAVMStoreByName(name, true);
|
||||
AVMNode root = store.getRoot();
|
||||
root.setIsRoot(false);
|
||||
VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO;
|
||||
List<VersionRoot> vRoots = vrDAO.getAllInRepository(rep);
|
||||
List<VersionRoot> vRoots = vrDAO.getAllInAVMStore(store);
|
||||
for (VersionRoot vr : vRoots)
|
||||
{
|
||||
AVMNode node = vr.getRoot();
|
||||
node.setIsRoot(false);
|
||||
vrDAO.delete(vr);
|
||||
}
|
||||
List<NewInRepository> newGuys = AVMContext.fgInstance.fNewInRepositoryDAO.getByRepository(rep);
|
||||
for (NewInRepository newGuy : newGuys)
|
||||
List<NewInAVMStore> newGuys = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(store);
|
||||
for (NewInAVMStore newGuy : newGuys)
|
||||
{
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newGuy);
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
|
||||
}
|
||||
AVMContext.fgInstance.fRepositoryDAO.delete(rep);
|
||||
AVMContext.fgInstance.fAVMStoreDAO.delete(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all content specific to a repository and version.
|
||||
* @param name The name of the repository.
|
||||
* Remove all content specific to a AVMRepository and version.
|
||||
* @param name The name of the AVMStore.
|
||||
* @param version The version to purge.
|
||||
*/
|
||||
public void purgeVersion(String name, int version)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, true);
|
||||
rep.purgeVersion(version);
|
||||
AVMStore store = getAVMStoreByName(name, true);
|
||||
store.purgeVersion(version);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,8 +484,8 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], false);
|
||||
return repo.getInputStream(version, pathParts[1]);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], false);
|
||||
return store.getInputStream(version, pathParts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -520,8 +520,8 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], false);
|
||||
return repo.getListing(version, pathParts[1]);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], false);
|
||||
return store.getListing(version, pathParts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -543,55 +543,55 @@ class SuperRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of all repositories.
|
||||
* @return A list of names.
|
||||
* Get descriptors of all AVMStores.
|
||||
* @return A list of all descriptors.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<RepositoryDescriptor> getRepositories()
|
||||
public List<AVMStoreDescriptor> getAVMStores()
|
||||
{
|
||||
List<Repository> l = AVMContext.fgInstance.fRepositoryDAO.getAll();
|
||||
List<RepositoryDescriptor> result = new ArrayList<RepositoryDescriptor>();
|
||||
for (Repository rep : l)
|
||||
List<AVMStore> l = AVMContext.fgInstance.fAVMStoreDAO.getAll();
|
||||
List<AVMStoreDescriptor> result = new ArrayList<AVMStoreDescriptor>();
|
||||
for (AVMStore store : l)
|
||||
{
|
||||
result.add(rep.getDescriptor());
|
||||
result.add(store.getDescriptor());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a descriptor for a repository.
|
||||
* Get a descriptor for an AVMStore.
|
||||
* @param name The name to get.
|
||||
* @return The descriptor.
|
||||
*/
|
||||
public RepositoryDescriptor getRepository(String name)
|
||||
public AVMStoreDescriptor getAVMStore(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
return rep.getDescriptor();
|
||||
AVMStore store = getAVMStoreByName(name, false);
|
||||
return store.getDescriptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all version for a given repository.
|
||||
* @param name The name of the repository.
|
||||
* Get all version for a given AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A Set will all the version ids.
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name)
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
return rep.getVersions();
|
||||
AVMStore store = getAVMStoreByName(name, false);
|
||||
return store.getVersions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of versions between (inclusive) of the given dates.
|
||||
* From or to may be null but not both.
|
||||
* @param name The name of the repository.
|
||||
* @param name The name of the AVMRepository.
|
||||
* @param from The earliest date.
|
||||
* @param to The latest date.
|
||||
* @return The Set of version IDs.
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name, Date from, Date to)
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name, Date from, Date to)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
return rep.getVersions(from, to);
|
||||
AVMStore store = getAVMStoreByName(name, false);
|
||||
return store.getVersions(from, to);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,51 +631,51 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], false);
|
||||
return rep.getIndirectionPath(version, pathParts[1]);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], false);
|
||||
return store.getIndirectionPath(version, pathParts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next version id for the given repository.
|
||||
* @param name The name of the repository.
|
||||
* Get the next version id for the given AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return The next version id.
|
||||
*/
|
||||
public int getLatestVersionID(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
return rep.getNextVersionID();
|
||||
AVMStore store = getAVMStoreByName(name, false);
|
||||
return store.getNextVersionID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a repository by name.
|
||||
* @param name The name of the repository.
|
||||
* Get an AVMStore by name.
|
||||
* @param name The name of the AVMStore.
|
||||
* @param write Whether this is called for a write operation.
|
||||
* @return The Repository.
|
||||
* @return The AVMStore.
|
||||
*/
|
||||
private Repository getRepositoryByName(String name, boolean write)
|
||||
private AVMStore getAVMStoreByName(String name, boolean write)
|
||||
{
|
||||
Repository rep = AVMContext.fgInstance.fRepositoryDAO.getByName(name);
|
||||
if (rep == null)
|
||||
AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByName(name);
|
||||
if (store == null)
|
||||
{
|
||||
throw new AVMNotFoundException("Repository not found: " + name);
|
||||
throw new AVMNotFoundException("AVMStore not found: " + name);
|
||||
}
|
||||
return rep;
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a descriptor for a repository root.
|
||||
* Get a descriptor for an AVMStore root.
|
||||
* @param version The version to get.
|
||||
* @param name The name of the repository.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return The descriptor for the root.
|
||||
*/
|
||||
public AVMNodeDescriptor getRepositoryRoot(int version, String name)
|
||||
public AVMNodeDescriptor getAVMStoreRoot(int version, String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
if (rep == null)
|
||||
AVMStore store = getAVMStoreByName(name, false);
|
||||
if (store == null)
|
||||
{
|
||||
throw new AVMNotFoundException("Not found: " + name);
|
||||
}
|
||||
return rep.getRoot(version);
|
||||
return store.getRoot(version);
|
||||
}
|
||||
|
||||
// TODO Fix this awful mess regarding cycle detection.
|
||||
@@ -701,8 +701,8 @@ class SuperRepository
|
||||
throw new AVMCycleException("Cycle in lookup.");
|
||||
}
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], false);
|
||||
Lookup result = rep.lookup(version, pathParts[1], false);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], false);
|
||||
Lookup result = store.lookup(version, pathParts[1], false);
|
||||
if (count == null)
|
||||
{
|
||||
fLookupCount.set(null);
|
||||
@@ -747,8 +747,8 @@ class SuperRepository
|
||||
throw new AVMCycleException("Cycle in lookup.");
|
||||
}
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], false);
|
||||
return rep.lookupDirectory(version, pathParts[1], false);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], false);
|
||||
return store.lookupDirectory(version, pathParts[1], false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -783,8 +783,8 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
rep.makePrimary(pathParts[1]);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], true);
|
||||
store.makePrimary(pathParts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -796,8 +796,8 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
rep.retargetLayeredDirectory(pathParts[1], target);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], true);
|
||||
store.retargetLayeredDirectory(pathParts[1], target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -840,18 +840,18 @@ class SuperRepository
|
||||
{
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
rep.setOpacity(pathParts[1], opacity);
|
||||
AVMStore store = getAVMStoreByName(pathParts[0], true);
|
||||
store.setOpacity(pathParts[1], opacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RepositoryDescriptor for a Repository.
|
||||
* @param name The name of the Repository.
|
||||
* Get the AVMStoreDescriptor for an AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return The descriptor.
|
||||
*/
|
||||
public RepositoryDescriptor getRepositoryDescriptor(String name)
|
||||
public AVMStoreDescriptor getAVMStoreDescriptor(String name)
|
||||
{
|
||||
return getRepositoryByName(name, false).getDescriptor();
|
||||
return getAVMStoreByName(name, false).getDescriptor();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -901,10 +901,10 @@ class SuperRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the single instance of SuperRepository.
|
||||
* Get the single instance of AVMRepository.
|
||||
* @return The single instance.
|
||||
*/
|
||||
public static SuperRepository GetInstance()
|
||||
public static AVMRepository GetInstance()
|
||||
{
|
||||
return fgInstance;
|
||||
}
|
@@ -29,7 +29,7 @@ import java.util.SortedMap;
|
||||
* Versioning Model. It specifies methods that are close in functionality to the underlying
|
||||
* implementation, and is intended as both a first class Alfresco service and an
|
||||
* aid in creating new implementations of existing services.
|
||||
* Paths are of the form repositoryname:/foo/bar/baz
|
||||
* Paths are of the form storename:/foo/bar/baz
|
||||
* @author britt
|
||||
*/
|
||||
public interface AVMService
|
||||
@@ -126,11 +126,11 @@ public interface AVMService
|
||||
public void retargetLayeredDirectory(String path, String target);
|
||||
|
||||
/**
|
||||
* Create a new Repository. All Repositories are top level in a hierarchical
|
||||
* Create a new AVMStore. All AVMStores are top level in a hierarchical
|
||||
* sense.
|
||||
* @param name The name to give the virtual repository.
|
||||
* @param name The name to give the AVMStore.
|
||||
*/
|
||||
public void createRepository(String name);
|
||||
public void createAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Create a branch from a given version and path.
|
||||
@@ -168,64 +168,64 @@ public interface AVMService
|
||||
public void uncover(String dirPath, String name);
|
||||
|
||||
/**
|
||||
* Get the latest version id of the repository.
|
||||
* @param repName The name of the repository.
|
||||
* @return The latest version id of the repository.
|
||||
* Get the latest version id of the AVMStore.
|
||||
* @param storeName The name of the AVMStore.
|
||||
* @return The latest version id of the AVMStore.
|
||||
*/
|
||||
public int getLatestVersionID(String repName);
|
||||
public int getLatestVersionID(String storeName);
|
||||
|
||||
/**
|
||||
* Snapshot the given repositories. When this is called everything that has been added,
|
||||
* Snapshot the given AVMStores. When this is called everything that has been added,
|
||||
* deleted, or modified since the last time this function was called, is marked
|
||||
* as needing to be copied, so that further modifications will trigger copy on write
|
||||
* semantics.
|
||||
* @param repositories The names of the repositories to snapshot.
|
||||
* @param stores The names of the AVMStores to snapshot.
|
||||
*/
|
||||
public List<Integer> createSnapshot(List<String> repositories);
|
||||
|
||||
/**
|
||||
* Snapshot the given repository.
|
||||
* @param repository The name of the repository to snapshot.
|
||||
* Snapshot the given AVMStore.
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
*/
|
||||
public int createSnapshot(String repository);
|
||||
public int createSnapshot(String store);
|
||||
|
||||
/**
|
||||
* Get the set of versions in a Repository
|
||||
* @param name The name of the Repository.
|
||||
* Get the set of versions in an AVMStore
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A Set of version IDs
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name);
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name);
|
||||
|
||||
/**
|
||||
* Get Repository version IDs by creation date. Either from or
|
||||
* Get AVMStore version descriptors by creation date. Either from or
|
||||
* to can be null but not both.
|
||||
* @param name The name of the repository.
|
||||
* @param name The name of the AVMStore.
|
||||
* @param from Earliest date of version to include.
|
||||
* @param to Latest date of version to include.
|
||||
* @return The Set of version IDs that match.
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name, Date from, Date to);
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name, Date from, Date to);
|
||||
|
||||
/**
|
||||
* Get the descriptors of all repositories.
|
||||
* @return A List of all repositories.
|
||||
* Get the descriptors of all AVMStores.
|
||||
* @return A List of all AVMStores.
|
||||
*/
|
||||
public List<RepositoryDescriptor> getRepositories();
|
||||
public List<AVMStoreDescriptor> getAVMStores();
|
||||
|
||||
/**
|
||||
* Get a descriptor for a repository.
|
||||
* @param name The repository's name.
|
||||
* Get a descriptor for an AVMStore.
|
||||
* @param name The AVMStore's name.
|
||||
* @return A Descriptor.
|
||||
*/
|
||||
public RepositoryDescriptor getRepository(String name);
|
||||
public AVMStoreDescriptor getAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Get the specified root of a repository.
|
||||
* Get the specified root of an AVMStore.
|
||||
* @param version The version to look up.
|
||||
* @param name The name of the repository.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A descriptor for the specified root.
|
||||
*/
|
||||
public AVMNodeDescriptor getRepositoryRoot(int version, String name);
|
||||
public AVMNodeDescriptor getAVMStoreRoot(int version, String name);
|
||||
|
||||
/**
|
||||
* Lookup a node by version ids and path.
|
||||
@@ -252,16 +252,16 @@ public interface AVMService
|
||||
public String getIndirectionPath(int version, String path);
|
||||
|
||||
/**
|
||||
* Purge a repository. This is a complete wipe of a Repository.
|
||||
* @param name The name of the Repository.
|
||||
* Purge an AVMStore. This is a complete wipe of an AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
*/
|
||||
public void purgeRepository(String name);
|
||||
public void purgeAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Purge a version from a repository. Deletes everything that lives in
|
||||
* Purge a version from an AVMStore. Deletes everything that lives in
|
||||
* the given version only.
|
||||
* @param version The version to purge.
|
||||
* @param name The name of the Repository from which to purge it.
|
||||
* @param name The name of the AVMStore from which to purge it.
|
||||
*/
|
||||
public void purgeVersion(int version, String name);
|
||||
|
||||
|
@@ -27,7 +27,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.alfresco.repo.avm.SuperRepository;
|
||||
import org.alfresco.repo.avm.AVMRepository;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
@@ -44,9 +44,9 @@ public class AVMServiceImpl implements AVMService
|
||||
private RetryingTransaction fTransaction;
|
||||
|
||||
/**
|
||||
* The SuperRepository for each service thread.
|
||||
* The AVMRepository for each service thread.
|
||||
*/
|
||||
private SuperRepository fSuperRepository;
|
||||
private AVMRepository fAVMRepository;
|
||||
|
||||
/**
|
||||
* The storage directory.
|
||||
@@ -102,11 +102,11 @@ public class AVMServiceImpl implements AVMService
|
||||
fLayerIssuer = new Issuer(val == null ? 0L : val + 1L);
|
||||
}
|
||||
}, false);
|
||||
fSuperRepository = new SuperRepository(fNodeIssuer,
|
||||
fAVMRepository = new AVMRepository(fNodeIssuer,
|
||||
fContentIssuer,
|
||||
fLayerIssuer,
|
||||
fStorage);
|
||||
fgLogger.info("Initialized AVMService and SuperRepository");
|
||||
fgLogger.info("Initialized AVMService and AVMRepository");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -117,8 +117,8 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
File storageDir = new File(fStorage);
|
||||
storageDir.mkdirs();
|
||||
createRepository("main");
|
||||
fgLogger.info("Created new main repository");
|
||||
createAVMStore("main");
|
||||
fgLogger.info("Created new main AVMStore");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether we should create an initial repository.
|
||||
* Set whether we should create an initial AVMStore.
|
||||
* @param initialize
|
||||
*/
|
||||
public void setInitialize(boolean initialize)
|
||||
@@ -168,7 +168,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
in = fSuperRepository.getInputStream(version, path);
|
||||
in = fAVMRepository.getInputStream(version, path);
|
||||
}
|
||||
};
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -193,7 +193,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
in = fSuperRepository.getInputStream(desc);
|
||||
in = fAVMRepository.getInputStream(desc);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -216,7 +216,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
out = fSuperRepository.getOutputStream(path);
|
||||
out = fAVMRepository.getOutputStream(path);
|
||||
}
|
||||
};
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -243,7 +243,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
file = fSuperRepository.getRandomAccess(version, path, access);
|
||||
file = fAVMRepository.getRandomAccess(version, path, access);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -269,7 +269,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
listing = fSuperRepository.getListing(version, path);
|
||||
listing = fAVMRepository.getListing(version, path);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -294,7 +294,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
listing = fSuperRepository.getListing(dir);
|
||||
listing = fAVMRepository.getListing(dir);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -320,7 +320,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
out = fSuperRepository.createFile(path, name);
|
||||
out = fAVMRepository.createFile(path, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -365,7 +365,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createFile(path, name, temp);
|
||||
fAVMRepository.createFile(path, name, temp);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -394,7 +394,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createDirectory(path, name);
|
||||
fAVMRepository.createDirectory(path, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -417,7 +417,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createLayeredFile(srcPath, parent, name);
|
||||
fAVMRepository.createLayeredFile(srcPath, parent, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -440,7 +440,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createLayeredDirectory(srcPath, parent, name);
|
||||
fAVMRepository.createLayeredDirectory(srcPath, parent, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -448,10 +448,10 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a repository with the given name. It must not exist.
|
||||
* @param name The name to give the repository.
|
||||
* Create an AVMStore with the given name. It must not exist.
|
||||
* @param name The name to give the AVMStore.
|
||||
*/
|
||||
public void createRepository(final String name)
|
||||
public void createAVMStore(final String name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
@@ -461,7 +461,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createRepository(name);
|
||||
fAVMRepository.createAVMStore(name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -486,7 +486,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.createBranch(version, srcPath, dstPath, name);
|
||||
fAVMRepository.createBranch(version, srcPath, dstPath, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -509,7 +509,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.remove(parent, name);
|
||||
fAVMRepository.remove(parent, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -534,7 +534,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.rename(srcParent, srcName, dstParent, dstName);
|
||||
fAVMRepository.rename(srcParent, srcName, dstParent, dstName);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -556,7 +556,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.uncover(dirPath, name);
|
||||
fAVMRepository.uncover(dirPath, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -564,8 +564,8 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Latest Version ID for a repository.
|
||||
* @param repName The name of the repository.
|
||||
* Get the Latest Version ID for an AVMStore.
|
||||
* @param repName The name of the AVMStore.
|
||||
* @return The Latest Version ID.
|
||||
*/
|
||||
public int getLatestVersionID(final String repName)
|
||||
@@ -580,7 +580,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
latestVersionID = fSuperRepository.getLatestVersionID(repName);
|
||||
latestVersionID = fAVMRepository.getLatestVersionID(repName);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -589,15 +589,15 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Create snapshots of a group of repositories.
|
||||
* @param repositories A List of repository name.
|
||||
* Create snapshots of a group of AVMStores.
|
||||
* @param stores A List of AVMStore names.
|
||||
* @return A List of the new version ids.
|
||||
*/
|
||||
public List<Integer> createSnapshot(final List<String> repositories)
|
||||
public List<Integer> createSnapshot(final List<String> stores)
|
||||
{
|
||||
if (repositories == null)
|
||||
if (stores == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Repositories is null.");
|
||||
throw new AVMBadArgumentException("Stores is null.");
|
||||
}
|
||||
class TxnCallback implements RetryingTransactionCallback
|
||||
{
|
||||
@@ -605,7 +605,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
versionIDs = fSuperRepository.createSnapshot(repositories);
|
||||
versionIDs = fAVMRepository.createSnapshot(stores);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -614,15 +614,15 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Snapshot a repository.
|
||||
* @param repository The name of the repository.
|
||||
* Snapshot an AVMRepository.
|
||||
* @param store The name of the AVMStore.
|
||||
* @return The id of the new version.
|
||||
*/
|
||||
public int createSnapshot(final String repository)
|
||||
public int createSnapshot(final String store)
|
||||
{
|
||||
if (repository == null)
|
||||
if (store == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Repository is null.");
|
||||
throw new AVMBadArgumentException("Store is null.");
|
||||
}
|
||||
class TxnCallback implements RetryingTransactionCallback
|
||||
{
|
||||
@@ -630,7 +630,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
versionID = fSuperRepository.createSnapshot(repository);
|
||||
versionID = fAVMRepository.createSnapshot(store);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -656,7 +656,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
Lookup lookup = fSuperRepository.lookup(version, path);
|
||||
Lookup lookup = fAVMRepository.lookup(version, path);
|
||||
descriptor = lookup.getCurrentNode().getDescriptor(lookup);
|
||||
}
|
||||
}
|
||||
@@ -683,7 +683,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
child = fSuperRepository.lookup(dir, name);
|
||||
child = fAVMRepository.lookup(dir, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -692,11 +692,11 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge a repository. Permanently delete everything that
|
||||
* is only referenced in that repository.
|
||||
* @param name The name of the repository to purge.
|
||||
* Purge an AVMStore. Permanently delete everything that
|
||||
* is only referenced in that AVMStore.
|
||||
* @param name The name of the AVMStore to purge.
|
||||
*/
|
||||
public void purgeRepository(final String name)
|
||||
public void purgeAVMStore(final String name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
@@ -706,7 +706,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.purgeRepository(name);
|
||||
fAVMRepository.purgeAVMStore(name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -728,7 +728,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.purgeVersion(name, version);
|
||||
fAVMRepository.purgeVersion(name, version);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -753,7 +753,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
indirectionPath = fSuperRepository.getIndirectionPath(version, path);
|
||||
indirectionPath = fAVMRepository.getIndirectionPath(version, path);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -762,11 +762,11 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extant version ids for a repository.
|
||||
* @param name The name of the repository.
|
||||
* Get the extant version ids for an AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A List of VersionDescriptors.
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(final String name)
|
||||
public List<VersionDescriptor> getAVMStoreVersions(final String name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
@@ -778,7 +778,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
versions = fSuperRepository.getRepositoryVersions(name);
|
||||
versions = fAVMRepository.getAVMStoreVersions(name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -789,12 +789,12 @@ public class AVMServiceImpl implements AVMService
|
||||
/**
|
||||
* Get version IDs by creation date. From or to may be null but not
|
||||
* both.
|
||||
* @param name The name of the repository to search.
|
||||
* @param name The name of the AVMStore to search.
|
||||
* @param from The earliest versions to return.
|
||||
* @param to The latest versions to return.
|
||||
* @return The Set of matching version IDs.
|
||||
*/
|
||||
public List<VersionDescriptor> getRepositoryVersions(final String name, final Date from, final Date to)
|
||||
public List<VersionDescriptor> getAVMStoreVersions(final String name, final Date from, final Date to)
|
||||
{
|
||||
if (name == null || (from == null && to == null))
|
||||
{
|
||||
@@ -806,7 +806,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
versions = fSuperRepository.getRepositoryVersions(name, from, to);
|
||||
versions = fAVMRepository.getAVMStoreVersions(name, from, to);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -828,7 +828,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.retargetLayeredDirectory(path, target);
|
||||
fAVMRepository.retargetLayeredDirectory(path, target);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -849,7 +849,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.makePrimary(path);
|
||||
fAVMRepository.makePrimary(path);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -857,18 +857,18 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all Repositories.
|
||||
* @return The repositories.
|
||||
* Get a list of all AVMStores.
|
||||
* @return The AVMStores.
|
||||
*/
|
||||
public List<RepositoryDescriptor> getRepositories()
|
||||
public List<AVMStoreDescriptor> getAVMStores()
|
||||
{
|
||||
class TxnCallback implements RetryingTransactionCallback
|
||||
{
|
||||
public List<RepositoryDescriptor> reps;
|
||||
public List<AVMStoreDescriptor> reps;
|
||||
|
||||
public void perform()
|
||||
{
|
||||
reps = fSuperRepository.getRepositories();
|
||||
reps = fAVMRepository.getAVMStores();
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -878,18 +878,18 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
/**
|
||||
* Get a reposotory.
|
||||
* @param name The name of the repository to get.
|
||||
* @return The repositories.
|
||||
* @param name The name of the AVMStore to get.
|
||||
* @return The AVMStore.
|
||||
*/
|
||||
public RepositoryDescriptor getRepository(final String name)
|
||||
public AVMStoreDescriptor getAVMStore(final String name)
|
||||
{
|
||||
class TxnCallback implements RetryingTransactionCallback
|
||||
{
|
||||
public RepositoryDescriptor desc;
|
||||
public AVMStoreDescriptor desc;
|
||||
|
||||
public void perform()
|
||||
{
|
||||
desc = fSuperRepository.getRepository(name);
|
||||
desc = fAVMRepository.getAVMStore(name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -898,12 +898,12 @@ public class AVMServiceImpl implements AVMService
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a descriptor for the specified repository root.
|
||||
* Get a descriptor for the specified AVMStore root.
|
||||
* @param version The version to get.
|
||||
* @param name The name of the repository.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return The root descriptor.
|
||||
*/
|
||||
public AVMNodeDescriptor getRepositoryRoot(final int version, final String name)
|
||||
public AVMNodeDescriptor getAVMStoreRoot(final int version, final String name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
@@ -915,7 +915,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
root = fSuperRepository.getRepositoryRoot(version, name);
|
||||
root = fAVMRepository.getAVMStoreRoot(version, name);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -941,7 +941,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
history = fSuperRepository.getHistory(desc, count);
|
||||
history = fAVMRepository.getHistory(desc, count);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -965,7 +965,7 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
fSuperRepository.setOpacity(path, opacity);
|
||||
fAVMRepository.setOpacity(path, opacity);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
@@ -995,7 +995,7 @@ public class AVMServiceImpl implements AVMService
|
||||
|
||||
public void perform()
|
||||
{
|
||||
ancestor = fSuperRepository.getCommonAncestor(left, right);
|
||||
ancestor = fAVMRepository.getCommonAncestor(left, right);
|
||||
}
|
||||
}
|
||||
TxnCallback doit = new TxnCallback();
|
||||
|
@@ -689,7 +689,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
out.println("This is testfile2");
|
||||
out.close();
|
||||
fService.createSnapshot("main");
|
||||
List<VersionDescriptor> versions = fService.getRepositoryVersions("main");
|
||||
List<VersionDescriptor> versions = fService.getAVMStoreVersions("main");
|
||||
for (VersionDescriptor version : versions)
|
||||
{
|
||||
System.out.println("V:" + version.getVersionID());
|
||||
@@ -722,7 +722,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
setupBasicTree();
|
||||
fService.createBranch(-1, "main:/a", "main:/d/e", "abranch");
|
||||
fService.createSnapshot("main");
|
||||
List<VersionDescriptor> versions = fService.getRepositoryVersions("main");
|
||||
List<VersionDescriptor> versions = fService.getAVMStoreVersions("main");
|
||||
for (VersionDescriptor version : versions)
|
||||
{
|
||||
System.out.println("V:" + version.getVersionID());
|
||||
@@ -866,15 +866,15 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test branching from one repository to another.
|
||||
* Test branching from one AVMStore to another.
|
||||
*/
|
||||
public void testBranchAcross()
|
||||
{
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
fService.createRepository("second");
|
||||
List<RepositoryDescriptor> repos = fService.getRepositories();
|
||||
fService.createAVMStore("second");
|
||||
List<AVMStoreDescriptor> repos = fService.getAVMStores();
|
||||
assertEquals(2, repos.size());
|
||||
System.out.println(repos.get(0));
|
||||
System.out.println(repos.get(1));
|
||||
@@ -905,14 +905,14 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating a layer across repositories.
|
||||
* Test creating a layer across AVMStores.
|
||||
*/
|
||||
public void testLayerAcross()
|
||||
{
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
fService.createRepository("second");
|
||||
fService.createAVMStore("second");
|
||||
fService.createLayeredDirectory("main:/", "second:/", "main");
|
||||
fService.createSnapshot("second");
|
||||
System.out.println(recursiveList("second", -1, true));
|
||||
@@ -935,7 +935,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
line = reader.readLine();
|
||||
reader.close();
|
||||
assertEquals("I am main:/a/b/c/foo", line);
|
||||
fService.purgeRepository("second");
|
||||
fService.purgeAVMStore("second");
|
||||
fService.purgeVersion(1, "main");
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -946,14 +946,14 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test rename across repositories.
|
||||
* Test rename across AVMStores.
|
||||
*/
|
||||
public void testRenameAcross()
|
||||
{
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
fService.createRepository("second");
|
||||
fService.createAVMStore("second");
|
||||
fService.rename("main:/a/b", "c", "second:/", "cmoved");
|
||||
ArrayList<String> toSnapshot = new ArrayList<String>();
|
||||
toSnapshot.add("main");
|
||||
@@ -1823,7 +1823,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
AVMNodeDescriptor desc = fService.getRepositoryRoot(-1, "main");
|
||||
AVMNodeDescriptor desc = fService.getAVMStoreRoot(-1, "main");
|
||||
assertNotNull(desc);
|
||||
System.out.println(desc.toString());
|
||||
AVMNodeDescriptor child = fService.lookup(desc, "a");
|
||||
@@ -1859,9 +1859,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
loader.recursiveLoad("source/java/org/alfresco/repo/audit", "main:/");
|
||||
times.add(System.currentTimeMillis());
|
||||
assertEquals(3, fService.createSnapshot("main"));
|
||||
assertEquals(1, fService.getRepositoryVersions("main", null, new Date(times.get(0))).size());
|
||||
assertEquals(3, fService.getRepositoryVersions("main", new Date(times.get(0)), null).size());
|
||||
assertEquals(2, fService.getRepositoryVersions("main", new Date(times.get(1)),
|
||||
assertEquals(1, fService.getAVMStoreVersions("main", null, new Date(times.get(0))).size());
|
||||
assertEquals(3, fService.getAVMStoreVersions("main", new Date(times.get(0)), null).size());
|
||||
assertEquals(2, fService.getAVMStoreVersions("main", new Date(times.get(1)),
|
||||
new Date(System.currentTimeMillis())).size());
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1872,17 +1872,17 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test repository functions.
|
||||
* Test AVMStore functions.
|
||||
*/
|
||||
public void testRepository()
|
||||
public void testAVMStore()
|
||||
{
|
||||
try
|
||||
{
|
||||
// First check that we get the right error when we try to create a
|
||||
// repository that exists.
|
||||
// First check that we get the right error when we try to create an
|
||||
// AVMStore that exists.
|
||||
try
|
||||
{
|
||||
fService.createRepository("main");
|
||||
fService.createAVMStore("main");
|
||||
fail();
|
||||
}
|
||||
catch (AVMExistsException ae)
|
||||
@@ -1890,7 +1890,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
// Do nothing.
|
||||
}
|
||||
// Now make sure getRepository() works.
|
||||
RepositoryDescriptor desc = fService.getRepository("main");
|
||||
AVMStoreDescriptor desc = fService.getAVMStore("main");
|
||||
assertNotNull(desc);
|
||||
System.out.println(desc);
|
||||
}
|
||||
|
@@ -94,8 +94,8 @@ public class AVMServiceTestBase extends TestCase
|
||||
|
||||
|
||||
/**
|
||||
* Helper to write a recursive listing of a repository at a given version.
|
||||
* @param repoName The name of the repository.
|
||||
* Helper to write a recursive listing of an AVMStore at a given version.
|
||||
* @param repoName The name of the AVMStore.
|
||||
* @param version The version to look under.
|
||||
*/
|
||||
protected String recursiveList(String repoName, int version, boolean followLinks)
|
||||
|
@@ -25,27 +25,27 @@ import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* The repository interface. Methods for filesystem like, versioning,
|
||||
* The store interface. Methods for filesystem like, versioning,
|
||||
* and layering operations.
|
||||
* @author britt
|
||||
*/
|
||||
public interface Repository
|
||||
public interface AVMStore
|
||||
{
|
||||
/**
|
||||
* This returns the next version in this repository that will be snapshotted.
|
||||
* This returns the next version in this store that will be snapshotted.
|
||||
* @return The next version to be snapshotted.
|
||||
*/
|
||||
public int getNextVersionID();
|
||||
|
||||
/**
|
||||
* Set a new root for this repository.
|
||||
* Set a new root for this store.
|
||||
* @param root The root to set.
|
||||
*/
|
||||
public void setNewRoot(DirectoryNode root);
|
||||
|
||||
/**
|
||||
* Snapshots this repository. This sets all nodes in the
|
||||
* the repository to the should be copied state, and creates
|
||||
* Snapshots this store. This sets all nodes in the
|
||||
* the store to the should be copied state, and creates
|
||||
* a new version root.
|
||||
* @return The version id of the newly created snapshot.
|
||||
*/
|
||||
@@ -142,7 +142,7 @@ public interface Repository
|
||||
// provide methods for getting versions by date range, n most
|
||||
// recent etc.
|
||||
/**
|
||||
* Get all the version for this repository.
|
||||
* Get all the version for this AVMStore.
|
||||
* @return A Set of all versions.
|
||||
*/
|
||||
public List<VersionDescriptor> getVersions();
|
||||
@@ -157,10 +157,10 @@ public interface Repository
|
||||
public List<VersionDescriptor> getVersions(Date from, Date to);
|
||||
|
||||
/**
|
||||
* Get the super repository.
|
||||
* @return The SuperRepository.
|
||||
* Get the AVMRepository.
|
||||
* @return The AVMRepository.
|
||||
*/
|
||||
public SuperRepository getSuperRepository();
|
||||
public AVMRepository getAVMRepository();
|
||||
|
||||
/**
|
||||
* Lookup a node.
|
||||
@@ -190,7 +190,7 @@ public interface Repository
|
||||
|
||||
/**
|
||||
* Make the indicated directory a primary indirection.
|
||||
* @param path The Repository relative path.
|
||||
* @param path The AVMRepository relative path.
|
||||
*/
|
||||
public void makePrimary(String path);
|
||||
|
||||
@@ -202,7 +202,7 @@ public interface Repository
|
||||
public void retargetLayeredDirectory(String path, String target);
|
||||
|
||||
/**
|
||||
* Get the root directory of this Repository.
|
||||
* Get the root directory of this AVMStore.
|
||||
* @return The root directory.
|
||||
*/
|
||||
public DirectoryNode getRoot();
|
||||
@@ -215,7 +215,7 @@ public interface Repository
|
||||
public AVMNodeDescriptor getRoot(int version);
|
||||
|
||||
/**
|
||||
* Get the name of this repository.
|
||||
* Get the name of this store.
|
||||
* @return The name.
|
||||
*/
|
||||
public String getName();
|
||||
@@ -254,7 +254,7 @@ public interface Repository
|
||||
* Get the descriptor for this.
|
||||
* @return The descriptor.
|
||||
*/
|
||||
public RepositoryDescriptor getDescriptor();
|
||||
public AVMStoreDescriptor getDescriptor();
|
||||
|
||||
/**
|
||||
* Set the opacity of a layered directory. An opaque directory hides
|
@@ -23,36 +23,36 @@ import java.util.List;
|
||||
* DAO for Repositories.
|
||||
* @author britt
|
||||
*/
|
||||
public interface RepositoryDAO
|
||||
public interface AVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Save a repository, never before saved.
|
||||
* @param rep The repository
|
||||
* Save an AVMStore, never before saved.
|
||||
* @param store The AVMStore
|
||||
*/
|
||||
public void save(Repository rep);
|
||||
public void save(AVMStore store);
|
||||
|
||||
/**
|
||||
* Delete the given Repository.
|
||||
* @param rep The Repository.
|
||||
* Delete the given AVMStore.
|
||||
* @param store The AVMStore.
|
||||
*/
|
||||
public void delete(Repository rep);
|
||||
public void delete(AVMStore store);
|
||||
|
||||
/**
|
||||
* Get all repositories.
|
||||
* @return A List of all the Repositories.
|
||||
* Get all AVMStores.
|
||||
* @return A List of all the AVMStores.
|
||||
*/
|
||||
public List<Repository> getAll();
|
||||
public List<AVMStore> getAll();
|
||||
|
||||
/**
|
||||
* Get a repository by name.
|
||||
* @param name The name of the repository.
|
||||
* @return The repository or null if not found.
|
||||
* Get an AVMStore by name.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return The AVMStore or null if not found.
|
||||
*/
|
||||
public Repository getByName(String name);
|
||||
public AVMStore getByName(String name);
|
||||
|
||||
/**
|
||||
* Update the given Repository record.
|
||||
* @param rep The dirty Repository.
|
||||
* Update the given AVMStore record.
|
||||
* @param rep The dirty AVMStore.
|
||||
*/
|
||||
public void update(Repository rep);
|
||||
public void update(AVMStore rep);
|
||||
}
|
@@ -20,10 +20,10 @@ package org.alfresco.repo.avm;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* A value class for Data about a repository.
|
||||
* A value class for Data about an AVMStore.
|
||||
* @author britt
|
||||
*/
|
||||
public class RepositoryDescriptor
|
||||
public class AVMStoreDescriptor
|
||||
{
|
||||
/**
|
||||
* The name.
|
||||
@@ -40,7 +40,7 @@ public class RepositoryDescriptor
|
||||
*/
|
||||
private long fCreateDate;
|
||||
|
||||
public RepositoryDescriptor(String name,
|
||||
public AVMStoreDescriptor(String name,
|
||||
String creator,
|
||||
long createDate)
|
||||
{
|
@@ -35,12 +35,12 @@ import java.util.TreeMap;
|
||||
* operation.
|
||||
* @author britt
|
||||
*/
|
||||
public class RepositoryImpl implements Repository, Serializable
|
||||
public class AVMStoreImpl implements AVMStore, Serializable
|
||||
{
|
||||
static final long serialVersionUID = -1485972568675732904L;
|
||||
|
||||
/**
|
||||
* The name of this repository.
|
||||
* The name of this AVMStore.
|
||||
*/
|
||||
private String fName;
|
||||
|
||||
@@ -60,9 +60,9 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
private long fVers;
|
||||
|
||||
/**
|
||||
* The super repository.
|
||||
* The AVMRepository.
|
||||
*/
|
||||
transient private SuperRepository fSuper;
|
||||
transient private AVMRepository fAVMRepository;
|
||||
|
||||
/**
|
||||
* The creator.
|
||||
@@ -77,26 +77,26 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected RepositoryImpl()
|
||||
protected AVMStoreImpl()
|
||||
{
|
||||
fSuper = SuperRepository.GetInstance();
|
||||
fAVMRepository = AVMRepository.GetInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a brand new repository.
|
||||
* @param superRepo The SuperRepository.
|
||||
* @param name The name of the Repository.
|
||||
* Make a brand new AVMStore.
|
||||
* @param repo The AVMRepository.
|
||||
* @param name The name of the AVMStore.
|
||||
*/
|
||||
public RepositoryImpl(SuperRepository superRepo, String name)
|
||||
public AVMStoreImpl(AVMRepository repo, String name)
|
||||
{
|
||||
// Make ourselves up and save.
|
||||
fSuper = superRepo;
|
||||
fAVMRepository = repo;
|
||||
fName = name;
|
||||
fNextVersionID = 0;
|
||||
fRoot = null;
|
||||
fCreator = "britt";
|
||||
fCreateDate = System.currentTimeMillis();
|
||||
AVMContext.fgInstance.fRepositoryDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMStoreDAO.save(this);
|
||||
// Make up the initial version record and save.
|
||||
long time = System.currentTimeMillis();
|
||||
fRoot = new PlainDirectoryNodeImpl(this);
|
||||
@@ -122,7 +122,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Snapshot this repository. This creates a new version record.
|
||||
* Snapshot this store. This creates a new version record.
|
||||
* @return The version id of the new snapshot.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -134,10 +134,10 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
throw new AVMExistsException("Already snapshotted.");
|
||||
}
|
||||
// Clear out the new nodes.
|
||||
List<NewInRepository> newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByRepository(this);
|
||||
for (NewInRepository newGuy : newInRep)
|
||||
List<NewInAVMStore> newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(this);
|
||||
for (NewInAVMStore newGuy : newInRep)
|
||||
{
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newGuy);
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
|
||||
}
|
||||
// Make up a new version record.
|
||||
VersionRoot versionRoot = new VersionRootImpl(this,
|
||||
@@ -210,7 +210,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
else
|
||||
{
|
||||
// Otherwise we issue a brand new layer id.
|
||||
newDir.setLayerID(fSuper.issueLayerID());
|
||||
newDir.setLayerID(fAVMRepository.issueLayerID());
|
||||
}
|
||||
dir.putChild(name, newDir);
|
||||
dir.updateModTime();
|
||||
@@ -415,13 +415,13 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
// provide methods for getting versions by date range, n most
|
||||
// recent etc.
|
||||
/**
|
||||
* Get the set of all extant versions for this Repository.
|
||||
* Get the set of all extant versions for this AVMStore.
|
||||
* @return A Set of version ids.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionDescriptor> getVersions()
|
||||
{
|
||||
List<VersionRoot> versions = AVMContext.fgInstance.fVersionRootDAO.getAllInRepository(this);
|
||||
List<VersionRoot> versions = AVMContext.fgInstance.fVersionRootDAO.getAllInAVMStore(this);
|
||||
List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
|
||||
for (VersionRoot vr : versions)
|
||||
{
|
||||
@@ -460,12 +460,12 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SuperRepository.
|
||||
* @return The SuperRepository
|
||||
* Get the AVMRepository.
|
||||
* @return The AVMRepository
|
||||
*/
|
||||
public SuperRepository getSuperRepository()
|
||||
public AVMRepository getAVMRepository()
|
||||
{
|
||||
return fSuper;
|
||||
return fAVMRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,7 +498,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = AVMContext.fgInstance.fAVMNodeDAO.getRepositoryRoot(this, version);
|
||||
dir = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
|
||||
}
|
||||
// Add an entry for the root.
|
||||
result.add(dir, "", write);
|
||||
@@ -549,7 +549,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
else
|
||||
{
|
||||
root = AVMContext.fgInstance.fAVMNodeDAO.getRepositoryRoot(this, version);
|
||||
root = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
|
||||
}
|
||||
return root.getDescriptor("main:", "", null);
|
||||
}
|
||||
@@ -631,7 +631,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this repository. Hibernate.
|
||||
* Set the name of this AVMStore. Hibernate.
|
||||
* @param name
|
||||
*/
|
||||
protected void setName(String name)
|
||||
@@ -640,7 +640,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this Repository.
|
||||
* Get the name of this AVMStore.
|
||||
* @return The name.
|
||||
*/
|
||||
public String getName()
|
||||
@@ -714,11 +714,11 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Repository))
|
||||
if (!(obj instanceof AVMStore))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return fName.equals(((Repository)obj).getName());
|
||||
return fName.equals(((AVMStore)obj).getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -757,7 +757,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
// TODO More hibernate goofiness to compensate for: fSuper.getSession().flush();
|
||||
vRoot = AVMContext.fgInstance.fVersionRootDAO.getMaxVersion(this);
|
||||
fRoot = vRoot.getRoot();
|
||||
AVMContext.fgInstance.fRepositoryDAO.update(this);
|
||||
AVMContext.fgInstance.fAVMStoreDAO.update(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,11 +799,11 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
|
||||
/**
|
||||
* Get the descriptor for this.
|
||||
* @return A RepositoryDescriptor
|
||||
* @return An AVMStoreDescriptor
|
||||
*/
|
||||
public RepositoryDescriptor getDescriptor()
|
||||
public AVMStoreDescriptor getDescriptor()
|
||||
{
|
||||
return new RepositoryDescriptor(fName, fCreator, fCreateDate);
|
||||
return new AVMStoreDescriptor(fName, fCreator, fCreateDate);
|
||||
}
|
||||
|
||||
/**
|
@@ -474,7 +474,7 @@ class AVMTester implements Runnable
|
||||
fAllPaths.add("main:/");
|
||||
fAllDirectories.add("main:/");
|
||||
Set<Long> visited = new HashSet<Long>();
|
||||
AVMNodeDescriptor root = fService.getRepositoryRoot(-1, "main");
|
||||
AVMNodeDescriptor root = fService.getAVMStoreRoot(-1, "main");
|
||||
recursiveRefresh(root, visited);
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
|
||||
* @param id
|
||||
* @param repo
|
||||
*/
|
||||
protected DirectoryNodeImpl(long id, Repository repo)
|
||||
protected DirectoryNodeImpl(long id, AVMStore repo)
|
||||
{
|
||||
super(id, repo);
|
||||
}
|
||||
|
@@ -286,7 +286,7 @@ class FileContentImpl implements FileContent, Serializable
|
||||
(fID & 0xff0000) >> 16,
|
||||
(fID & 0xff00) >> 8);
|
||||
String dir = form.toString();
|
||||
fPath = SuperRepository.GetInstance().getStorageRoot() + dir;
|
||||
fPath = AVMRepository.GetInstance().getStorageRoot() + dir;
|
||||
fName = fPath + "/" + name;
|
||||
}
|
||||
|
||||
|
@@ -33,10 +33,10 @@ abstract class FileNodeImpl extends AVMNodeImpl implements FileNode
|
||||
/**
|
||||
* Pass through constructor.
|
||||
* @param id The newly assigned object id.
|
||||
* @param repo The repository we belong to.
|
||||
* @param store The AVMStore we belong to.
|
||||
*/
|
||||
public FileNodeImpl(long id, Repository repo)
|
||||
public FileNodeImpl(long id, AVMStore store)
|
||||
{
|
||||
super(id, repo);
|
||||
super(id, store);
|
||||
}
|
||||
}
|
||||
|
@@ -65,30 +65,30 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
/**
|
||||
* Make a new one from a specified indirection path.
|
||||
* @param indirection The indirection path to set.
|
||||
* @param repos The repository that owns this node.
|
||||
* @param store The store that owns this node.
|
||||
*/
|
||||
public LayeredDirectoryNodeImpl(String indirection, Repository repos)
|
||||
public LayeredDirectoryNodeImpl(String indirection, AVMStore store)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fLayerID = -1;
|
||||
fIndirection = indirection;
|
||||
fPrimaryIndirection = true;
|
||||
fOpacity = false;
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Kind of copy constructor, sort of.
|
||||
* @param other The LayeredDirectoryNode we are copied from.
|
||||
* @param repos The Repository object we use.
|
||||
* @param repos The AVMStore object we use.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public LayeredDirectoryNodeImpl(LayeredDirectoryNode other,
|
||||
Repository repos)
|
||||
AVMStore repos)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(repos.getAVMRepository().issueID(), repos);
|
||||
fIndirection = other.getUnderlying();
|
||||
fPrimaryIndirection = other.getPrimaryIndirection();
|
||||
fLayerID = -1;
|
||||
@@ -108,23 +108,23 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
AVMContext.fgInstance.fDeletedChildDAO.save(newDel);
|
||||
}
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(repos, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct one from a PlainDirectoryNode. Called when a COW is performed in a layered
|
||||
* context.
|
||||
* @param other The PlainDirectoryNode.
|
||||
* @param repos The Repository we should belong to.
|
||||
* @param store The AVMStore we should belong to.
|
||||
* @param lPath The Lookup object.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public LayeredDirectoryNodeImpl(PlainDirectoryNode other,
|
||||
Repository repos,
|
||||
AVMStore store,
|
||||
Lookup lPath,
|
||||
boolean copyContents)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fIndirection = null;
|
||||
fPrimaryIndirection = false;
|
||||
fLayerID = -1;
|
||||
@@ -141,30 +141,30 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
}
|
||||
}
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new layered directory based on a directory we are being named from
|
||||
* that is in not in the layer of the source lookup.
|
||||
* @param dir The directory
|
||||
* @param repo The repository
|
||||
* @param store The store
|
||||
* @param srcLookup The source lookup.
|
||||
* @param name The name of the target.
|
||||
*/
|
||||
public LayeredDirectoryNodeImpl(DirectoryNode dir,
|
||||
Repository repo,
|
||||
AVMStore store,
|
||||
Lookup srcLookup,
|
||||
String name)
|
||||
{
|
||||
super(repo.getSuperRepository().issueID(), repo);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fIndirection = srcLookup.getIndirectionPath() + "/" + name;
|
||||
fPrimaryIndirection = true;
|
||||
fLayerID = -1;
|
||||
fOpacity = false;
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repo, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,8 +238,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
*/
|
||||
public AVMNode copy(Lookup lPath)
|
||||
{
|
||||
// Capture the repository.
|
||||
Repository repo = lPath.getRepository();
|
||||
// Capture the store.
|
||||
AVMStore store = lPath.getAVMStore();
|
||||
LayeredDirectoryNodeImpl newMe = null;
|
||||
if (!lPath.isInThisLayer())
|
||||
{
|
||||
@@ -247,7 +247,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
// layer. The following creates a node that will inherit its
|
||||
// indirection from its parent.
|
||||
newMe = new LayeredDirectoryNodeImpl((String)null,
|
||||
repo);
|
||||
store);
|
||||
newMe.setPrimaryIndirection(false);
|
||||
newMe.setLayerID(lPath.getTopLayer().getLayerID());
|
||||
}
|
||||
@@ -255,7 +255,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
// A simple copy is made.
|
||||
newMe = new LayeredDirectoryNodeImpl(this,
|
||||
repo);
|
||||
store);
|
||||
newMe.setLayerID(getLayerID());
|
||||
}
|
||||
newMe.setAncestor(this);
|
||||
@@ -315,7 +315,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
try
|
||||
{
|
||||
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
|
||||
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
|
||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||
baseListing = dir.getListing(lookup);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
try
|
||||
{
|
||||
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, dir.getIndirection());
|
||||
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, dir.getIndirection());
|
||||
DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode();
|
||||
Map<String, AVMNode> listing = dirNode.getListing(lookup);
|
||||
for (String name : listing.keySet())
|
||||
@@ -427,7 +427,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
// Not here so check our indirection.
|
||||
try
|
||||
{
|
||||
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
|
||||
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
|
||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||
return dir.lookupChild(lookup, name, -1, false);
|
||||
}
|
||||
@@ -471,7 +471,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
}
|
||||
try
|
||||
{
|
||||
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, mine.getIndirection());
|
||||
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, mine.getIndirection());
|
||||
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
|
||||
AVMNode child = dir.lookupChild(lookup, name, -1, false);
|
||||
if (child == null)
|
||||
|
@@ -41,29 +41,29 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
||||
* Basically a copy constructor. Used when a branch is created
|
||||
* from a layered file.
|
||||
* @param other The file to make a copy of.
|
||||
* @param repo The repository that contains us.
|
||||
* @param store The store that contains us.
|
||||
*/
|
||||
public LayeredFileNodeImpl(LayeredFileNode other, Repository repo)
|
||||
public LayeredFileNodeImpl(LayeredFileNode other, AVMStore store)
|
||||
{
|
||||
super(repo.getSuperRepository().issueID(), repo);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fIndirection = other.getIndirection();
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repo, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a brand new layered file node.
|
||||
* @param indirection The thing we point to.
|
||||
* @param repo The repository we belong to.
|
||||
* @param store The store we belong to.
|
||||
*/
|
||||
public LayeredFileNodeImpl(String indirection, Repository repo)
|
||||
public LayeredFileNodeImpl(String indirection, AVMStore store)
|
||||
{
|
||||
super(repo.getSuperRepository().issueID(), repo);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fIndirection = indirection;
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repo, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
||||
public AVMNode copy(Lookup lPath)
|
||||
{
|
||||
// LayeredFileNodes are always copied.
|
||||
Lookup lookup = SuperRepository.GetInstance().lookup(-1, fIndirection);
|
||||
Lookup lookup = AVMRepository.GetInstance().lookup(-1, fIndirection);
|
||||
AVMNode indirect = lookup.getCurrentNode();
|
||||
if (indirect.getType() != AVMNodeType.LAYERED_FILE &&
|
||||
indirect.getType() != AVMNodeType.PLAIN_FILE)
|
||||
@@ -83,7 +83,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
||||
// This is a mildly dirty trick. We use getContentForRead so as not to startle
|
||||
// the ultimate destination content into copying itself prematurely.
|
||||
FileContent content = ((FileNode)indirect).getContentForRead();
|
||||
PlainFileNodeImpl newMe = new PlainFileNodeImpl(content, lPath.getRepository(), getBasicAttributes());
|
||||
PlainFileNodeImpl newMe = new PlainFileNodeImpl(content, lPath.getAVMStore(), getBasicAttributes());
|
||||
newMe.setAncestor(this);
|
||||
return newMe;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
||||
*/
|
||||
public FileContent getContentForRead()
|
||||
{
|
||||
Lookup lookup = SuperRepository.GetInstance().lookup(-1, fIndirection);
|
||||
Lookup lookup = AVMRepository.GetInstance().lookup(-1, fIndirection);
|
||||
AVMNode node = lookup.getCurrentNode();
|
||||
if (node.getType() != AVMNodeType.LAYERED_FILE &&
|
||||
node.getType() != AVMNodeType.PLAIN_FILE)
|
||||
|
@@ -29,14 +29,14 @@ import java.util.List;
|
||||
class Lookup
|
||||
{
|
||||
/**
|
||||
* The Repository.
|
||||
* The AVMStore.
|
||||
*/
|
||||
private RepositoryImpl fRepository;
|
||||
private AVMStore fAVMStore;
|
||||
|
||||
/**
|
||||
* The name of the Repository.
|
||||
* The name of the AVMStore.
|
||||
*/
|
||||
private String fRepName;
|
||||
private String fStoreName;
|
||||
|
||||
/**
|
||||
* The components that make up this path.
|
||||
@@ -81,13 +81,13 @@ class Lookup
|
||||
|
||||
/**
|
||||
* Create a new one.
|
||||
* @param repository The Repository that's being looked in.
|
||||
* @param repName The name of that Repsository.
|
||||
* @param store The AVMStore that's being looked in.
|
||||
* @param storeName The name of that AVMStore.
|
||||
*/
|
||||
public Lookup(RepositoryImpl repository, String repName)
|
||||
public Lookup(AVMStore store, String storeName)
|
||||
{
|
||||
fRepository = repository;
|
||||
fRepName = repName;
|
||||
fAVMStore = store;
|
||||
fStoreName = storeName;
|
||||
fComponents = new ArrayList<LookupComponent>();
|
||||
fLayeredYet = false;
|
||||
fTopLayer = null;
|
||||
@@ -178,14 +178,13 @@ class Lookup
|
||||
if (fNeedsCopying)
|
||||
{
|
||||
node = node.copy(this);
|
||||
node.setVersionID(fRepository.getNextVersionID());
|
||||
node.setVersionID(fAVMStore.getNextVersionID());
|
||||
fComponents.get(fPosition).setNode(node);
|
||||
if (fPosition == 0)
|
||||
{
|
||||
// Inform the repository of a new root.
|
||||
fRepository.setNewRoot((DirectoryNode)node);
|
||||
AVMContext.fgInstance.fRepositoryDAO.update(fRepository);
|
||||
// TODO More Hibernate weirdness to figure out: SuperRepository.GetInstance().getSession().flush();
|
||||
// Inform the store of a new root.
|
||||
fAVMStore.setNewRoot((DirectoryNode)node);
|
||||
AVMContext.fgInstance.fAVMStoreDAO.update(fAVMStore);
|
||||
return;
|
||||
}
|
||||
// Not the root. Check if we are the top layer and insert this into it's parent.
|
||||
@@ -302,12 +301,12 @@ class Lookup
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the repository that this path is in.
|
||||
* @return The repository.
|
||||
* Get the store that this path is in.
|
||||
* @return The store.
|
||||
*/
|
||||
public Repository getRepository()
|
||||
public AVMStore getAVMStore()
|
||||
{
|
||||
return fRepository;
|
||||
return fAVMStore;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,10 +317,10 @@ class Lookup
|
||||
{
|
||||
if (fComponents.size() == 1)
|
||||
{
|
||||
return fRepName + ":/";
|
||||
return fStoreName + ":/";
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(fRepName);
|
||||
builder.append(fStoreName);
|
||||
builder.append(':');
|
||||
int count = fComponents.size();
|
||||
for (int i = 1; i < count; i++)
|
||||
|
@@ -18,16 +18,16 @@
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
/**
|
||||
* Eensy-weensy interface for tracking nodes that are new in a repository.
|
||||
* Eensy-weensy interface for tracking nodes that are new in a store.
|
||||
* @author britt
|
||||
*/
|
||||
public interface NewInRepository
|
||||
public interface NewInAVMStore
|
||||
{
|
||||
/**
|
||||
* Get the Repository part.
|
||||
* @return The Repository
|
||||
* Get the AVMStore part.
|
||||
* @return The AVMStore
|
||||
*/
|
||||
public Repository getRepository();
|
||||
public AVMStore getAvmStore();
|
||||
|
||||
/**
|
||||
* Get the node part.
|
@@ -20,34 +20,34 @@ package org.alfresco.repo.avm;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DAO for NewInRepository markers.
|
||||
* DAO for NewInAVMStore markers.
|
||||
* @author britt
|
||||
*/
|
||||
public interface NewInRepositoryDAO
|
||||
public interface NewInAVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Save one.
|
||||
* @param newEntry The item to save.
|
||||
*/
|
||||
public void save(NewInRepository newEntry);
|
||||
public void save(NewInAVMStore newEntry);
|
||||
|
||||
/**
|
||||
* Get one by Node.
|
||||
* @param node The node to lookup with.
|
||||
* @return The Entry or null if not found.
|
||||
*/
|
||||
public NewInRepository getByNode(AVMNode node);
|
||||
public NewInAVMStore getByNode(AVMNode node);
|
||||
|
||||
/**
|
||||
* Get all that are in the given repository.
|
||||
* @param repository The Repository.
|
||||
* @return A List of NewInRepositorys.
|
||||
* Get all that are in the given store.
|
||||
* @param store The AVMStore.
|
||||
* @return A List of NewInAVMStores.
|
||||
*/
|
||||
public List<NewInRepository> getByRepository(Repository repository);
|
||||
public List<NewInAVMStore> getByAVMStore(AVMStore store);
|
||||
|
||||
/**
|
||||
* Delete the given entry.
|
||||
* @param newEntry The entry to delete.
|
||||
*/
|
||||
public void delete(NewInRepository newEntry);
|
||||
public void delete(NewInAVMStore newEntry);
|
||||
}
|
@@ -20,17 +20,17 @@ package org.alfresco.repo.avm;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* A record of a node that is new and in which repository it resides.
|
||||
* A record of a node that is new and in which store it resides.
|
||||
* @author britt
|
||||
*/
|
||||
public class NewInRepositoryImpl implements NewInRepository, Serializable
|
||||
public class NewInAVMStoreImpl implements NewInAVMStore, Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1905996612150732182L;
|
||||
|
||||
/**
|
||||
* The Repository.
|
||||
* The AVMStore.
|
||||
*/
|
||||
private Repository fRepository;
|
||||
private AVMStore fAVMStore;
|
||||
|
||||
/**
|
||||
* The Node.
|
||||
@@ -40,18 +40,18 @@ public class NewInRepositoryImpl implements NewInRepository, Serializable
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public NewInRepositoryImpl()
|
||||
public NewInAVMStoreImpl()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new one.
|
||||
* @param repository The repository.
|
||||
* @param store The store.
|
||||
* @param node The AVMNode that is new.
|
||||
*/
|
||||
public NewInRepositoryImpl(Repository repository, AVMNode node)
|
||||
public NewInAVMStoreImpl(AVMStore store, AVMNode node)
|
||||
{
|
||||
fRepository = repository;
|
||||
fAVMStore = store;
|
||||
fNode = node;
|
||||
}
|
||||
|
||||
@@ -72,19 +72,19 @@ public class NewInRepositoryImpl implements NewInRepository, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fRepository
|
||||
* @return the store
|
||||
*/
|
||||
public Repository getRepository()
|
||||
public AVMStore getAvmStore()
|
||||
{
|
||||
return fRepository;
|
||||
return fAVMStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param repository the fRepository to set
|
||||
* @param store the AVMStore to set
|
||||
*/
|
||||
public void setRepository(Repository repository)
|
||||
public void setAvmStore(AVMStore store)
|
||||
{
|
||||
fRepository = repository;
|
||||
fAVMStore = store;
|
||||
}
|
||||
}
|
||||
|
@@ -233,10 +233,10 @@ public class OrphanReaper implements Runnable
|
||||
link.getMto().setMergedFrom(ancestor);
|
||||
AVMContext.fgInstance.fMergeLinkDAO.delete(link);
|
||||
}
|
||||
NewInRepository newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(node);
|
||||
NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(node);
|
||||
if (newInRep != null)
|
||||
{
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newInRep);
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
|
||||
}
|
||||
// TODO What to do about such Hibernate wackiness: session.flush();
|
||||
// TODO More of the same: node = AVMNodeUnwrapper.Unwrap(node);
|
||||
|
@@ -32,14 +32,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
|
||||
/**
|
||||
* Make up a new directory with nothing in it.
|
||||
* @param repo
|
||||
* @param store
|
||||
*/
|
||||
public PlainDirectoryNodeImpl(Repository repo)
|
||||
public PlainDirectoryNodeImpl(AVMStore store)
|
||||
{
|
||||
super(repo.getSuperRepository().issueID(), repo);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repo, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,13 +52,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
/**
|
||||
* Copy like constructor.
|
||||
* @param other The other directory.
|
||||
* @param repos The Repository Object that will own us.
|
||||
* @param repos The AVMStore Object that will own us.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public PlainDirectoryNodeImpl(PlainDirectoryNode other,
|
||||
Repository repos)
|
||||
AVMStore store)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
||||
}
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,13 +209,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
// Subtlety warning: This distinguishes the case of a
|
||||
// Directory that was branched into the layer and one
|
||||
// that is indirectly seen in this layer.
|
||||
newMe = new LayeredDirectoryNodeImpl(this, lPath.getRepository(), lPath,
|
||||
newMe = new LayeredDirectoryNodeImpl(this, lPath.getAVMStore(), lPath,
|
||||
lPath.isInThisLayer());
|
||||
((LayeredDirectoryNodeImpl)newMe).setLayerID(lPath.getTopLayer().getLayerID());
|
||||
}
|
||||
else
|
||||
{
|
||||
newMe = new PlainDirectoryNodeImpl(this, lPath.getRepository());
|
||||
newMe = new PlainDirectoryNodeImpl(this, lPath.getAVMStore());
|
||||
}
|
||||
newMe.setAncestor(this);
|
||||
return newMe;
|
||||
|
@@ -41,64 +41,64 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
||||
}
|
||||
|
||||
/**
|
||||
* Make one from just a repository.
|
||||
* Make one from just an AVMStore.
|
||||
* This is the constructor used when a brand new plain file is being made.
|
||||
* @param repos A Repository.
|
||||
* @param store An AVMStore.
|
||||
*/
|
||||
public PlainFileNodeImpl(Repository repos)
|
||||
public PlainFileNodeImpl(AVMStore store)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
fContent = new FileContentImpl(SuperRepository.GetInstance().issueContentID());
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fContent = new FileContentImpl(AVMRepository.GetInstance().issueContentID());
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new plain file with given content.
|
||||
* @param repos The repository.
|
||||
* @param store The store.
|
||||
* @param content The content to set.
|
||||
*/
|
||||
public PlainFileNodeImpl(Repository repos, File content)
|
||||
public PlainFileNodeImpl(AVMStore store, File content)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
fContent = new FileContentImpl(SuperRepository.GetInstance().issueContentID(), content);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fContent = new FileContentImpl(AVMRepository.GetInstance().issueContentID(), content);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy on write constructor.
|
||||
* @param other The node we are being copied from.
|
||||
* @param repos The Repository.
|
||||
* @param store The AVMStore.
|
||||
*/
|
||||
public PlainFileNodeImpl(PlainFileNode other,
|
||||
Repository repos)
|
||||
AVMStore store)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fContent = other.getContent();
|
||||
fContent.setRefCount(fContent.getRefCount() + 1);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that takes a FileContent to share.
|
||||
* @param content The FileContent to share.
|
||||
* @param repos The Repository.
|
||||
* @param store The AVMStore.
|
||||
*/
|
||||
public PlainFileNodeImpl(FileContent content,
|
||||
Repository repos,
|
||||
AVMStore store,
|
||||
BasicAttributes oAttrs)
|
||||
{
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
super(store.getAVMRepository().issueID(), store);
|
||||
fContent = content;
|
||||
fContent.setRefCount(fContent.getRefCount() + 1);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this));
|
||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
||||
*/
|
||||
public AVMNode copy(Lookup lPath)
|
||||
{
|
||||
PlainFileNodeImpl newMe = new PlainFileNodeImpl(this, lPath.getRepository());
|
||||
PlainFileNodeImpl newMe = new PlainFileNodeImpl(this, lPath.getAVMStore());
|
||||
newMe.setAncestor(this);
|
||||
return newMe;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
||||
{
|
||||
if (fContent.getRefCount() > 1)
|
||||
{
|
||||
fContent = new FileContentImpl(fContent, SuperRepository.GetInstance().issueContentID());
|
||||
fContent = new FileContentImpl(fContent, AVMRepository.GetInstance().issueContentID());
|
||||
}
|
||||
return fContent;
|
||||
}
|
||||
|
@@ -100,9 +100,9 @@ public class PurgeTest extends AVMServiceTestBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test purging an entire repository.
|
||||
* Test purging an entire store.
|
||||
*/
|
||||
public void testPurgeRepository()
|
||||
public void testPurgeStore()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public class PurgeTest extends AVMServiceTestBase
|
||||
fService.removeNode("main:/layer/java/org/alfresco", "repo");
|
||||
fService.createFile("main:/layer/java/org/alfresco", "goofy").close();
|
||||
fService.createSnapshot("main");
|
||||
fService.purgeRepository("main");
|
||||
fService.purgeAVMStore("main");
|
||||
fReaper.activate();
|
||||
while (fReaper.isActive())
|
||||
{
|
||||
|
@@ -26,9 +26,9 @@ import java.util.Date;
|
||||
public class VersionDescriptor
|
||||
{
|
||||
/**
|
||||
* The name of the repository this version belongs to.
|
||||
* The name of the store this version belongs to.
|
||||
*/
|
||||
private String fRepositoryName;
|
||||
private String fAVMStoreName;
|
||||
|
||||
/**
|
||||
* The version id.
|
||||
@@ -47,29 +47,29 @@ public class VersionDescriptor
|
||||
|
||||
/**
|
||||
* New one up.
|
||||
* @param repName The repository name.
|
||||
* @param storeName The store name.
|
||||
* @param versionID The version id.
|
||||
* @param creator The creator.
|
||||
* @param createDate The create date.
|
||||
*/
|
||||
public VersionDescriptor(String repName,
|
||||
public VersionDescriptor(String storeName,
|
||||
int versionID,
|
||||
String creator,
|
||||
long createDate)
|
||||
{
|
||||
fRepositoryName = repName;
|
||||
fAVMStoreName = storeName;
|
||||
fVersionID = versionID;
|
||||
fCreator = creator;
|
||||
fCreateDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the repository name.
|
||||
* @return The repository name.
|
||||
* Get the store name.
|
||||
* @return The store name.
|
||||
*/
|
||||
public String getRepositoryName()
|
||||
public String getAVMStoreName()
|
||||
{
|
||||
return fRepositoryName;
|
||||
return fAVMStoreName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ public class VersionDescriptor
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[");
|
||||
builder.append(fRepositoryName);
|
||||
builder.append(fAVMStoreName);
|
||||
builder.append(":");
|
||||
builder.append("" + fVersionID);
|
||||
builder.append(":");
|
||||
|
@@ -53,14 +53,14 @@ public interface VersionRoot
|
||||
public void setId(long id);
|
||||
|
||||
/**
|
||||
* @return the repository
|
||||
* @return the AVMStore
|
||||
*/
|
||||
public Repository getRepository();
|
||||
public AVMStore getAvmStore();
|
||||
|
||||
/**
|
||||
* @param repository the repository to set
|
||||
* @param store the store to set
|
||||
*/
|
||||
public void setRepository(Repository repository);
|
||||
public void setAvmStore(AVMStore store);
|
||||
|
||||
/**
|
||||
* @return the root
|
||||
|
@@ -39,33 +39,33 @@ public interface VersionRootDAO
|
||||
public void delete(VersionRoot vr);
|
||||
|
||||
/**
|
||||
* Get all the version roots in a given repository.
|
||||
* @param rep The repository.
|
||||
* Get all the version roots in a given store.
|
||||
* @param store The store.
|
||||
* @return A List of VersionRoots. In id order.
|
||||
*/
|
||||
public List<VersionRoot> getAllInRepository(Repository rep);
|
||||
public List<VersionRoot> getAllInAVMStore(AVMStore store);
|
||||
|
||||
/**
|
||||
* Get the VersionRoot corresponding to the given id.
|
||||
* @param rep The repository
|
||||
* @param store The store
|
||||
* @param id The version id.
|
||||
* @return The VersionRoot or null if not found.
|
||||
*/
|
||||
public VersionRoot getByVersionID(Repository rep, int id);
|
||||
public VersionRoot getByVersionID(AVMStore store, int id);
|
||||
|
||||
/**
|
||||
* Get the version of a repository by dates.
|
||||
* @param rep The repository.
|
||||
* Get the version of a store by dates.
|
||||
* @param store The store.
|
||||
* @param from The starting date. May be null but not with to null also.
|
||||
* @param to The ending date. May be null but not with from null also.
|
||||
* @return A List of VersionRoots.
|
||||
*/
|
||||
public List<VersionRoot> getByDates(Repository rep, Date from, Date to);
|
||||
public List<VersionRoot> getByDates(AVMStore store, Date from, Date to);
|
||||
|
||||
/**
|
||||
* Get the highest numbered version in a repository.
|
||||
* @param rep The repository.
|
||||
* Get the highest numbered version in a store.
|
||||
* @param stor The store.
|
||||
* @return The highest numbered version.
|
||||
*/
|
||||
public VersionRoot getMaxVersion(Repository rep);
|
||||
public VersionRoot getMaxVersion(AVMStore store);
|
||||
}
|
||||
|
@@ -49,9 +49,9 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
private String fCreator;
|
||||
|
||||
/**
|
||||
* The Repository.
|
||||
* The AVMStore.
|
||||
*/
|
||||
private Repository fRepository;
|
||||
private AVMStore fAVMStore;
|
||||
|
||||
/**
|
||||
* The root node.
|
||||
@@ -67,19 +67,19 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
|
||||
/**
|
||||
* Rich constructor.
|
||||
* @param repository
|
||||
* @param store
|
||||
* @param root
|
||||
* @param versionID
|
||||
* @param createDate
|
||||
* @param creator
|
||||
*/
|
||||
public VersionRootImpl(Repository repository,
|
||||
DirectoryNode root,
|
||||
int versionID,
|
||||
long createDate,
|
||||
String creator)
|
||||
public VersionRootImpl(AVMStore store,
|
||||
DirectoryNode root,
|
||||
int versionID,
|
||||
long createDate,
|
||||
String creator)
|
||||
{
|
||||
fRepository = repository;
|
||||
fAVMStore = store;
|
||||
fRoot = root;
|
||||
fVersionID = versionID;
|
||||
fCreateDate = createDate;
|
||||
@@ -116,14 +116,14 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
fID = id;
|
||||
}
|
||||
|
||||
public Repository getRepository()
|
||||
public AVMStore getAvmStore()
|
||||
{
|
||||
return fRepository;
|
||||
return fAVMStore;
|
||||
}
|
||||
|
||||
public void setRepository(Repository repository)
|
||||
public void setAvmStore(AVMStore store)
|
||||
{
|
||||
fRepository = repository;
|
||||
fAVMStore = store;
|
||||
}
|
||||
|
||||
public DirectoryNode getRoot()
|
||||
@@ -155,7 +155,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Check equality. Based on Repository equality and version id equality.
|
||||
* Check equality. Based on AVMStore equality and version id equality.
|
||||
* @param obj
|
||||
* @return Equality.
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
return false;
|
||||
}
|
||||
VersionRoot other = (VersionRoot)obj;
|
||||
return fRepository.equals(other.getRepository())
|
||||
return fAVMStore.equals(other.getAvmStore())
|
||||
&& fVersionID == other.getVersionID();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return fRepository.hashCode() + fVersionID;
|
||||
return fAVMStore.hashCode() + fVersionID;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -99,12 +99,12 @@
|
||||
<property name="refCount" column="ref_count" type="int"
|
||||
not-null="true"/>
|
||||
</class>
|
||||
<!-- A Repository is the what we used to call a virtual repository.
|
||||
Each Repository has it's own branch ids and layer ids but shares node ids
|
||||
<!-- A store is the what we used to call a virtual repository.
|
||||
Each store has it's own branch ids and layer ids but shares node ids
|
||||
with other repositories. The physical repository is structured this way
|
||||
for better scaling. -->
|
||||
<class table="repositories" name="RepositoryImpl"
|
||||
proxy="Repository" optimistic-lock="version">
|
||||
<class table="avm_repositories" name="AVMStoreImpl"
|
||||
proxy="AVMStore" optimistic-lock="version">
|
||||
<cache usage="read-write"/>
|
||||
<id name="name" column="name" type="string"/>
|
||||
<version name="vers" column="vers" type="long"/>
|
||||
@@ -112,7 +112,7 @@
|
||||
column="next_version_id" not-null="true"/>
|
||||
<property type="string" name="creator" column="creator" not-null="true"/>
|
||||
<property type="long" name="createDate" column="create_date" not-null="true"/>
|
||||
<!-- Every Repository has a root directory that is the current root directory. -->
|
||||
<!-- Every AVMStore has a root directory that is the current root directory. -->
|
||||
<!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
|
||||
<many-to-one name="root" class="DirectoryNodeImpl"
|
||||
column="current_root_id" unique="true" cascade="save-update">
|
||||
@@ -131,8 +131,8 @@
|
||||
<property name="creator" type="string" column="creator"
|
||||
not-null="true">
|
||||
</property>
|
||||
<many-to-one name="repository" column="repository_id"
|
||||
class="RepositoryImpl" not-null="true">
|
||||
<many-to-one name="avmStore" column="avm_store_id"
|
||||
class="AVMStoreImpl" not-null="true">
|
||||
</many-to-one>
|
||||
<many-to-one name="root" class="DirectoryNodeImpl"
|
||||
column="root_id" not-null="true">
|
||||
@@ -171,9 +171,9 @@
|
||||
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
|
||||
</composite-id>
|
||||
</class>
|
||||
<class name="NewInRepositoryImpl" proxy="NewInRepository" table="new_in_repository_nodes">
|
||||
<class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
|
||||
<composite-id>
|
||||
<key-many-to-one name="repository" class="RepositoryImpl" column="repository_id"/>
|
||||
<key-many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
|
||||
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
|
||||
</composite-id>
|
||||
</class>
|
||||
@@ -204,10 +204,10 @@
|
||||
where ce.parent = :parent
|
||||
]]>
|
||||
</query>
|
||||
<query name="AVMNode.ByNewInRepo">
|
||||
<query name="AVMNode.ByNewInAVMStore">
|
||||
<![CDATA[
|
||||
from NewInRepositoryImpl nie
|
||||
where nie.repository = :rep
|
||||
from NewInAVMStoreImpl nie
|
||||
where nie.avmStore = :store
|
||||
]]>
|
||||
</query>
|
||||
<query name="AVMNode.GetDescendents">
|
||||
@@ -241,14 +241,14 @@
|
||||
select v.root
|
||||
from VersionRootImpl v
|
||||
where
|
||||
v.repository = :rep and v.versionID = :version
|
||||
v.avmStore = :store and v.versionID = :version
|
||||
]]>
|
||||
</query>
|
||||
<query name="VersionRoot.VersionByID">
|
||||
<![CDATA[
|
||||
from VersionRootImpl v
|
||||
where
|
||||
v.repository = :rep and v.versionID = :version
|
||||
v.avmStore = :store and v.versionID = :version
|
||||
]]>
|
||||
</query>
|
||||
<query name="DeletedChild.ByNameParent">
|
||||
|
@@ -25,7 +25,7 @@ import org.alfresco.repo.avm.AVMNodeDAO;
|
||||
import org.alfresco.repo.avm.AVMNodeImpl;
|
||||
import org.alfresco.repo.avm.AVMNodeUnwrapper;
|
||||
import org.alfresco.repo.avm.DirectoryNode;
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
@@ -81,15 +81,15 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
|
||||
/**
|
||||
* Get the root of a particular version.
|
||||
* @param rep The repository we're querying.
|
||||
* @param store The store we're querying.
|
||||
* @param version The version.
|
||||
* @return The VersionRoot or null.
|
||||
*/
|
||||
public DirectoryNode getRepositoryRoot(Repository rep, int version)
|
||||
public DirectoryNode getAVMStoreRoot(AVMStore store, int version)
|
||||
{
|
||||
Query query =
|
||||
getSession().getNamedQuery("VersionRoot.GetVersionRoot");
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
query.setInteger("version", version);
|
||||
AVMNode root = (AVMNode)query.uniqueResult();
|
||||
if (root == null)
|
||||
@@ -136,19 +136,6 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
return (List<AVMNode>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all nodes that have the given repository as their owning repository.
|
||||
* @param rep The Repository.
|
||||
* @return An Iterator over the matching nodes.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AVMNode> getByRepository(Repository rep)
|
||||
{
|
||||
Query query = getSession().createQuery("from AVMNodeImpl an where an.repository = :rep");
|
||||
query.setEntity("rep", rep);
|
||||
return (Iterator<AVMNode>)query.iterate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inappropriate hack to get Hibernate to play nice.
|
||||
*/
|
||||
|
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.alfresco.repo.avm.AVMStoreDAO;
|
||||
import org.alfresco.repo.avm.AVMStoreImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* The Hibernate version for AVMStoreDAO
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMStoreDAOHibernate extends HibernateDaoSupport implements
|
||||
AVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Do nothing constructor.
|
||||
*/
|
||||
public AVMStoreDAOHibernate()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a store, never before saved.
|
||||
* @param store The store
|
||||
*/
|
||||
public void save(AVMStore store)
|
||||
{
|
||||
getSession().save(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given AVMStore.
|
||||
* @param store The AVMStore.
|
||||
*/
|
||||
public void delete(AVMStore store)
|
||||
{
|
||||
getSession().delete(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all stores.
|
||||
* @return A List of all the AVMStores.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<AVMStore> getAll()
|
||||
{
|
||||
Query query = getSession().createQuery("from AVMStoreImpl r");
|
||||
return (List<AVMStore>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a store by name.
|
||||
* @param name The name of the store.
|
||||
* @return The store or null if not found.
|
||||
*/
|
||||
public AVMStore getByName(String name)
|
||||
{
|
||||
return (AVMStore)getSession().get(AVMStoreImpl.class, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given AVMStore record.
|
||||
* @param store The dirty AVMStore.
|
||||
*/
|
||||
public void update(AVMStore store)
|
||||
{
|
||||
// No op in Hibernate.
|
||||
}
|
||||
}
|
@@ -20,24 +20,24 @@ package org.alfresco.repo.avm.hibernate;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNode;
|
||||
import org.alfresco.repo.avm.NewInRepository;
|
||||
import org.alfresco.repo.avm.NewInRepositoryDAO;
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.NewInAVMStore;
|
||||
import org.alfresco.repo.avm.NewInAVMStoreDAO;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of NewInRepository DAO.
|
||||
* Hibernate implementation of NewInAVMStore DAO.
|
||||
* @author britt
|
||||
*/
|
||||
public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
NewInRepositoryDAO
|
||||
public class NewInAVMStoreDAOHibernate extends HibernateDaoSupport implements
|
||||
NewInAVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Save one.
|
||||
* @param newEntry The item to save.
|
||||
*/
|
||||
public void save(NewInRepository newEntry)
|
||||
public void save(NewInAVMStore newEntry)
|
||||
{
|
||||
getSession().save(newEntry);
|
||||
}
|
||||
@@ -47,31 +47,31 @@ public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
* @param node The node to lookup with.
|
||||
* @return The Entry or null if not found.
|
||||
*/
|
||||
public NewInRepository getByNode(AVMNode node)
|
||||
public NewInAVMStore getByNode(AVMNode node)
|
||||
{
|
||||
Query query = getSession().createQuery("from NewInRepositoryImpl nie where nie.node = :node");
|
||||
Query query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.node = :node");
|
||||
query.setEntity("node", node);
|
||||
return (NewInRepository)query.uniqueResult();
|
||||
return (NewInAVMStore)query.uniqueResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all that are in the given repository.
|
||||
* @param repository The Repository.
|
||||
* @return A List of NewInRepositorys.
|
||||
* Get all that are in the given store.
|
||||
* @param store The AVMStore.
|
||||
* @return A List of NewInAVMStores.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<NewInRepository> getByRepository(Repository repository)
|
||||
public List<NewInAVMStore> getByAVMStore(AVMStore store)
|
||||
{
|
||||
Query query = getSession().createQuery("from NewInRepositoryImpl nie where nie.repository = :rep");
|
||||
query.setEntity("rep", repository);
|
||||
return (List<NewInRepository>)query.list();
|
||||
Query query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.avmStore = :store");
|
||||
query.setEntity("store", store);
|
||||
return (List<NewInAVMStore>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given entry.
|
||||
* @param newEntry The entry to delete.
|
||||
*/
|
||||
public void delete(NewInRepository newEntry)
|
||||
public void delete(NewInAVMStore newEntry)
|
||||
{
|
||||
getSession().delete(newEntry);
|
||||
}
|
@@ -1,90 +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 java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.RepositoryDAO;
|
||||
import org.alfresco.repo.avm.RepositoryImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* The Hibernate version for RepositoryDAO
|
||||
* @author britt
|
||||
*/
|
||||
public class RepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
RepositoryDAO
|
||||
{
|
||||
/**
|
||||
* Do nothing constructor.
|
||||
*/
|
||||
public RepositoryDAOHibernate()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a repository, never before saved.
|
||||
* @param rep The repository
|
||||
*/
|
||||
public void save(Repository rep)
|
||||
{
|
||||
getSession().save(rep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given Repository.
|
||||
* @param rep The Repository.
|
||||
*/
|
||||
public void delete(Repository rep)
|
||||
{
|
||||
getSession().delete(rep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all repositories.
|
||||
* @return A List of all the Repositories.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Repository> getAll()
|
||||
{
|
||||
Query query = getSession().createQuery("from RepositoryImpl r");
|
||||
return (List<Repository>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a repository by name.
|
||||
* @param name The name of the repository.
|
||||
* @return The repository or null if not found.
|
||||
*/
|
||||
public Repository getByName(String name)
|
||||
{
|
||||
return (Repository)getSession().get(RepositoryImpl.class, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given Repository record.
|
||||
* @param rep The dirty Repository.
|
||||
*/
|
||||
public void update(Repository rep)
|
||||
{
|
||||
// No op in Hibernate.
|
||||
}
|
||||
}
|
@@ -20,7 +20,7 @@ package org.alfresco.repo.avm.hibernate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.alfresco.repo.avm.VersionRoot;
|
||||
import org.alfresco.repo.avm.VersionRootDAO;
|
||||
import org.hibernate.Query;
|
||||
@@ -61,73 +61,70 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the version roots in a given repository.
|
||||
* @param rep The repository.
|
||||
* Get all the version roots in a given store.
|
||||
* @param store The store.
|
||||
* @return A List of VersionRoots. In id order.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionRoot> getAllInRepository(Repository rep)
|
||||
public List<VersionRoot> getAllInAVMStore(AVMStore store)
|
||||
{
|
||||
Query query = getSession().createQuery("from VersionRootImpl v where v.repository = :rep order by v.versionID");
|
||||
query.setEntity("rep", rep);
|
||||
Query query = getSession().createQuery("from VersionRootImpl v where v.avmStore = :store order by v.versionID");
|
||||
query.setEntity("store", store);
|
||||
return (List<VersionRoot>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of a repository by dates.
|
||||
* @param rep The repository.
|
||||
* Get the version of a store by dates.
|
||||
* @param store The store.
|
||||
* @param from The starting date. May be null but not with to null also.
|
||||
* @param to The ending date. May be null but not with from null also.
|
||||
* @return A List of VersionRoots.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionRoot> getByDates(Repository rep, Date from, Date to)
|
||||
public List<VersionRoot> getByDates(AVMStore store, Date from, Date to)
|
||||
{
|
||||
Query query;
|
||||
if (from == null)
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr where vr.createDate <= :to " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("to", to.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
else if (to == null)
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr " +
|
||||
"where vr.createDate >= :from " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("from", from.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
else
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr "+
|
||||
"where vr.createDate between :from and :to " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("from", from.getTime());
|
||||
query.setLong("to", to.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
return (List<VersionRoot>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VersionRoot corresponding to the given id.
|
||||
* @param rep The repository
|
||||
* @param store The store
|
||||
* @param id The version id.
|
||||
* @return The VersionRoot or null if not found.
|
||||
*/
|
||||
public VersionRoot getByVersionID(Repository rep, int id)
|
||||
public VersionRoot getByVersionID(AVMStore store, int id)
|
||||
{
|
||||
Query query = getSession().getNamedQuery("VersionRoot.VersionByID");
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
query.setInteger("version", id);
|
||||
return (VersionRoot)query.uniqueResult();
|
||||
}
|
||||
@@ -137,7 +134,7 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
|
||||
* @param rep The repository.
|
||||
* @return The highest numbered version.
|
||||
*/
|
||||
public VersionRoot getMaxVersion(Repository rep)
|
||||
public VersionRoot getMaxVersion(AVMStore rep)
|
||||
{
|
||||
Query query = getSession().createQuery("from VersionRootImpl vr " +
|
||||
"where vr.versionID = " +
|
||||
|
Reference in New Issue
Block a user