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:
Britt Park
2006-07-16 18:19:59 +00:00
parent 1510998f69
commit 60cdda3f13
42 changed files with 656 additions and 680 deletions

View File

@@ -104,7 +104,7 @@
</property> </property>
</bean> </bean>
<bean id="repositoryDAO" class="org.alfresco.repo.avm.hibernate.RepositoryDAOHibernate"> <bean id="avmStoreDAO" class="org.alfresco.repo.avm.hibernate.AVMStoreDAOHibernate">
<property name="sessionFactory"> <property name="sessionFactory">
<ref bean="sessionFactory"/> <ref bean="sessionFactory"/>
</property> </property>
@@ -146,7 +146,7 @@
</property> </property>
</bean> </bean>
<bean id="newInRepositoryDAO" class="org.alfresco.repo.avm.hibernate.NewInRepositoryDAOHibernate"> <bean id="newInAVMStoreDAO" class="org.alfresco.repo.avm.hibernate.NewInAVMStoreDAOHibernate">
<property name="sessionFactory"> <property name="sessionFactory">
<ref bean="sessionFactory"/> <ref bean="sessionFactory"/>
</property> </property>
@@ -159,8 +159,8 @@
<property name="nodeDAO"> <property name="nodeDAO">
<ref bean="nodeDAO"/> <ref bean="nodeDAO"/>
</property> </property>
<property name="repositoryDAO"> <property name="avmStoreDAO">
<ref bean="repositoryDAO"/> <ref bean="avmStoreDAO"/>
</property> </property>
<property name="versionRootDAO"> <property name="versionRootDAO">
<ref bean="versionRootDAO"/> <ref bean="versionRootDAO"/>
@@ -180,8 +180,8 @@
<property name="deletedChildDAO"> <property name="deletedChildDAO">
<ref bean="deletedChildDAO"/> <ref bean="deletedChildDAO"/>
</property> </property>
<property name="newInRepositoryDAO"> <property name="newInAVMStoreDAO">
<ref bean="newInRepositoryDAO"/> <ref bean="newInAVMStoreDAO"/>
</property> </property>
</bean> </bean>

View File

@@ -76,7 +76,7 @@
</property> </property>
</bean> </bean>
<bean id="repositoryDAO" class="org.alfresco.repo.avm.hibernate.RepositoryDAOHibernate"> <bean id="avmStoreDAO" class="org.alfresco.repo.avm.hibernate.AVMStoreDAOHibernate">
<property name="sessionFactory"> <property name="sessionFactory">
<ref bean="sessionFactory"/> <ref bean="sessionFactory"/>
</property> </property>
@@ -118,7 +118,7 @@
</property> </property>
</bean> </bean>
<bean id="newInRepositoryDAO" class="org.alfresco.repo.avm.hibernate.NewInRepositoryDAOHibernate"> <bean id="newInAVMStoreDAO" class="org.alfresco.repo.avm.hibernate.NewInAVMStoreDAOHibernate">
<property name="sessionFactory"> <property name="sessionFactory">
<ref bean="sessionFactory"/> <ref bean="sessionFactory"/>
</property> </property>
@@ -131,8 +131,8 @@
<property name="nodeDAO"> <property name="nodeDAO">
<ref bean="nodeDAO"/> <ref bean="nodeDAO"/>
</property> </property>
<property name="repositoryDAO"> <property name="avmStoreDAO">
<ref bean="repositoryDAO"/> <ref bean="avmStoreDAO"/>
</property> </property>
<property name="versionRootDAO"> <property name="versionRootDAO">
<ref bean="versionRootDAO"/> <ref bean="versionRootDAO"/>
@@ -152,8 +152,8 @@
<property name="deletedChildDAO"> <property name="deletedChildDAO">
<ref bean="deletedChildDAO"/> <ref bean="deletedChildDAO"/>
</property> </property>
<property name="newInRepositoryDAO"> <property name="newInAVMStoreDAO">
<ref bean="newInRepositoryDAO"/> <ref bean="newInAVMStoreDAO"/>
</property> </property>
</bean> </bean>

View File

@@ -31,9 +31,9 @@ public class AVMContext
public AVMNodeDAO fAVMNodeDAO; public AVMNodeDAO fAVMNodeDAO;
/** /**
* The Repository DAO. * The AVMStore DAO.
*/ */
public RepositoryDAO fRepositoryDAO; public AVMStoreDAO fAVMStoreDAO;
/** /**
* The VersionRootDAO. * The VersionRootDAO.
@@ -66,9 +66,9 @@ public class AVMContext
public DeletedChildDAO fDeletedChildDAO; public DeletedChildDAO fDeletedChildDAO;
/** /**
* The NewInRepositoryDAO * The NewInAVMStoreDAO
*/ */
public NewInRepositoryDAO fNewInRepositoryDAO; public NewInAVMStoreDAO fNewInAVMStoreDAO;
/** /**
* @param nodeDAO the fAVMNodeDAO to set * @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;
} }
} }

View File

@@ -38,13 +38,13 @@ public class AVMCrawlTest extends AVMServiceTestBase
int n = 2; // Number of Threads. int n = 2; // Number of Threads.
int m = 4; // How many multiples of content to start with. int m = 4; // How many multiples of content to start with.
long runTime = 1200000; // Ten minutes long runTime = 1200000; // Ten minutes
fService.purgeRepository("main"); fService.purgeAVMStore("main");
fReaper.setInactiveBaseSleep(60000); fReaper.setInactiveBaseSleep(60000);
BulkLoader loader = new BulkLoader(); BulkLoader loader = new BulkLoader();
loader.setAvmService(fService); loader.setAvmService(fService);
for (int i = 0; i < m; i++) for (int i = 0; i < m; i++)
{ {
fService.createRepository("d" + i); fService.createAVMStore("d" + i);
loader.recursiveLoad("source", "d" + i + ":/"); loader.recursiveLoad("source", "d" + i + ":/");
fService.createSnapshot("d" + i); fService.createSnapshot("d" + i);
} }

View File

@@ -112,9 +112,9 @@ class AVMCrawler implements Runnable
{ {
try try
{ {
List<RepositoryDescriptor> reps = fService.getRepositories(); List<AVMStoreDescriptor> reps = fService.getAVMStores();
fOpCount++; 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() + ":/"); Map<String, AVMNodeDescriptor> rootListing = fService.getDirectoryListing(-1, repDesc.getName() + ":/");
fOpCount++; fOpCount++;
// Get all the directories in the root. // Get all the directories in the root.

View File

@@ -161,8 +161,8 @@ public class AVMInterpreter
} }
else if (command[0].equals("lsrep")) else if (command[0].equals("lsrep"))
{ {
List<RepositoryDescriptor> repos = fService.getRepositories(); List<AVMStoreDescriptor> repos = fService.getAVMStores();
for (RepositoryDescriptor repo : repos) for (AVMStoreDescriptor repo : repos)
{ {
out.println(repo); out.println(repo);
} }
@@ -173,7 +173,7 @@ public class AVMInterpreter
{ {
return "Syntax Error."; return "Syntax Error.";
} }
List<VersionDescriptor> listing = fService.getRepositoryVersions(command[1]); List<VersionDescriptor> listing = fService.getAVMStoreVersions(command[1]);
for (VersionDescriptor desc : listing) for (VersionDescriptor desc : listing)
{ {
out.println(desc); out.println(desc);
@@ -185,7 +185,7 @@ public class AVMInterpreter
{ {
return "Syntax Error."; return "Syntax Error.";
} }
fService.createRepository(command[1]); fService.createAVMStore(command[1]);
} }
else if (command[0].equals("load")) else if (command[0].equals("load"))
{ {
@@ -307,7 +307,7 @@ public class AVMInterpreter
{ {
return "Syntax Error."; return "Syntax Error.";
} }
fService.purgeRepository(command[1]); fService.purgeAVMStore(command[1]);
} }
else if (command[0].equals("rmver")) else if (command[0].equals("rmver"))
{ {

View File

@@ -114,13 +114,13 @@ public interface AVMNode
public String toString(Lookup lPath); 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 * @param isRoot
*/ */
public void setIsRoot(boolean 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. * @return Whether this node is a root.
*/ */
public boolean getIsRoot(); public boolean getIsRoot();

View File

@@ -44,11 +44,11 @@ public interface AVMNodeDAO
/** /**
* Get the root of a particular version. * 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. * @param version The version.
* @return The VersionRoot or null. * @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. * Update a node that has been dirtied.
@@ -77,13 +77,6 @@ public interface AVMNodeDAO
*/ */
public List<AVMNode> getOrphans(int batchSize); 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. * Inappropriate hack to get Hibernate to play nice.
*/ */

View File

@@ -60,10 +60,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
/** /**
* Constructor used when creating a new concrete subclass instance. * Constructor used when creating a new concrete subclass instance.
* @param id The object id. * @param id The object id.
* @param repo The Repository that owns this. * @param store The AVMStore that owns this.
*/ */
protected AVMNodeImpl(long id, protected AVMNodeImpl(long id,
Repository repo) AVMStore store)
{ {
fID = id; fID = id;
fVersionID = -1; fVersionID = -1;
@@ -216,7 +216,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/ */
public boolean getIsNew() public boolean getIsNew()
{ {
return AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(this) != null; return AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(this) != null;
} }
/** /**

View File

@@ -27,16 +27,16 @@ import java.util.List;
import java.util.SortedMap; import java.util.SortedMap;
/** /**
* This or Repository are * This or AVMStore are
* the implementors of the operations specified by AVMService. * the implementors of the operations specified by AVMService.
* @author britt * @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. * The current lookup count.
@@ -70,7 +70,7 @@ class SuperRepository
* @param layerIssuer * @param layerIssuer
* @param storage * @param storage
*/ */
public SuperRepository(Issuer nodeIssuer, public AVMRepository(Issuer nodeIssuer,
Issuer contentIssuer, Issuer contentIssuer,
Issuer layerIssuer, Issuer layerIssuer,
String storage) String storage)
@@ -92,7 +92,7 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
// fSession.get().lock(rep, LockMode.UPGRADE); // fSession.get().lock(rep, LockMode.UPGRADE);
return rep.createFile(pathParts[1], name); return rep.createFile(pathParts[1], name);
} }
@@ -107,7 +107,7 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
rep.createFile(pathParts[1], name, data); rep.createFile(pathParts[1], name, data);
} }
@@ -120,7 +120,7 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
rep.createDirectory(pathParts[1], name); rep.createDirectory(pathParts[1], name);
} }
@@ -139,7 +139,7 @@ class SuperRepository
} }
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(dstPath); String[] pathParts = SplitPath(dstPath);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
// fSession.get().lock(rep, LockMode.UPGRADE); // fSession.get().lock(rep, LockMode.UPGRADE);
rep.createLayeredDirectory(srcPath, pathParts[1], name); rep.createLayeredDirectory(srcPath, pathParts[1], name);
} }
@@ -154,20 +154,20 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(dstPath); String[] pathParts = SplitPath(dstPath);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
rep.createLayeredFile(srcPath, pathParts[1], name); rep.createLayeredFile(srcPath, pathParts[1], name);
} }
/** /**
* Create a new repository. * Create a new AVMStore.
* @param name The name to give the new repository. * @param name The name to give the new AVMStore.
*/ */
public void createRepository(String name) public void createAVMStore(String name)
{ {
try try
{ {
getRepositoryByName(name, false); getAVMStoreByName(name, false);
throw new AVMExistsException("Repository exists: " + name); throw new AVMExistsException("AVMStore exists: " + name);
} }
catch (AVMNotFoundException anf) catch (AVMNotFoundException anf)
{ {
@@ -175,10 +175,10 @@ class SuperRepository
} }
// Newing up the object causes it to be written to the db. // Newing up the object causes it to be written to the db.
@SuppressWarnings("unused") @SuppressWarnings("unused")
Repository rep = new RepositoryImpl(this, name); AVMStore rep = new AVMStoreImpl(this, name);
// Special handling for repository creation. // Special handling for AVMStore creation.
NewInRepository newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(rep.getRoot()); NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(rep.getRoot());
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newInRep); AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
} }
/** /**
@@ -197,12 +197,12 @@ class SuperRepository
// Lookup the src node. // Lookup the src node.
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(srcPath); 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 sPath = srcRepo.lookup(version, pathParts[1], false);
// Lookup the destination directory. // Lookup the destination directory.
fLookupCount.set(1); fLookupCount.set(1);
pathParts = SplitPath(dstPath); pathParts = SplitPath(dstPath);
Repository dstRepo = getRepositoryByName(pathParts[0], true); AVMStore dstRepo = getAVMStoreByName(pathParts[0], true);
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true); Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
DirectoryNode dirNode = (DirectoryNode)dPath.getCurrentNode(); DirectoryNode dirNode = (DirectoryNode)dPath.getCurrentNode();
AVMNode srcNode = sPath.getCurrentNode(); AVMNode srcNode = sPath.getCurrentNode();
@@ -243,7 +243,7 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
return rep.getOutputStream(pathParts[1]); return rep.getOutputStream(pathParts[1]);
} }
@@ -258,7 +258,7 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore rep = getAVMStoreByName(pathParts[0], true);
return rep.getRandomAccess(version, pathParts[1], access); return rep.getRandomAccess(version, pathParts[1], access);
} }
@@ -279,7 +279,7 @@ class SuperRepository
} }
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(srcPath); String [] pathParts = SplitPath(srcPath);
Repository srcRepo = getRepositoryByName(pathParts[0], true); AVMStore srcRepo = getAVMStoreByName(pathParts[0], true);
Lookup sPath = srcRepo.lookupDirectory(-1, pathParts[1], true); Lookup sPath = srcRepo.lookupDirectory(-1, pathParts[1], true);
DirectoryNode srcDir = (DirectoryNode)sPath.getCurrentNode(); DirectoryNode srcDir = (DirectoryNode)sPath.getCurrentNode();
AVMNode srcNode = srcDir.lookupChild(sPath, srcName, -1, true); AVMNode srcNode = srcDir.lookupChild(sPath, srcName, -1, true);
@@ -289,7 +289,7 @@ class SuperRepository
} }
fLookupCount.set(1); fLookupCount.set(1);
pathParts = SplitPath(dstPath); pathParts = SplitPath(dstPath);
Repository dstRepo = getRepositoryByName(pathParts[0], true); AVMStore dstRepo = getAVMStoreByName(pathParts[0], true);
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true); Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
DirectoryNode dstDir = (DirectoryNode)dPath.getCurrentNode(); DirectoryNode dstDir = (DirectoryNode)dPath.getCurrentNode();
AVMNode dstNode = dstDir.lookupChild(dPath, dstName, -1, true); AVMNode dstNode = dstDir.lookupChild(dPath, dstName, -1, true);
@@ -392,35 +392,35 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(dirPath); String [] pathParts = SplitPath(dirPath);
Repository repo = getRepositoryByName(pathParts[0], true); AVMStore repo = getAVMStoreByName(pathParts[0], true);
repo.uncover(pathParts[1], name); repo.uncover(pathParts[1], name);
} }
/** /**
* Snapshot the given repositories. * Snapshot the given repositories.
* @param repositories The list of repository name to snapshot. * @param repositories The list of AVMStore name to snapshot.
* @return A List of version ids for each newly snapshotted repository. * @return A List of version ids for each newly snapshotted AVMStore.
*/ */
public List<Integer> createSnapshot(List<String> repositories) public List<Integer> createSnapshot(List<String> repositories)
{ {
List<Integer> result = new ArrayList<Integer>(); List<Integer> result = new ArrayList<Integer>();
for (String repName : repositories) for (String repName : repositories)
{ {
Repository repo = getRepositoryByName(repName, true); AVMStore repo = getAVMStoreByName(repName, true);
result.add(repo.createSnapshot()); result.add(repo.createSnapshot());
} }
return result; return result;
} }
/** /**
* Create a snapshot of a single repository. * Create a snapshot of a single AVMStore.
* @param repository The name of the repository. * @param store The name of the repository.
* @return The version id of the newly snapshotted 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); AVMStore store = getAVMStoreByName(storeName, true);
return repo.createSnapshot(); return store.createSnapshot();
} }
/** /**
@@ -432,46 +432,46 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository repo = getRepositoryByName(pathParts[0], true); AVMStore store = getAVMStoreByName(pathParts[0], true);
repo.removeNode(pathParts[1], name); store.removeNode(pathParts[1], name);
} }
/** /**
* Get rid of all content that lives only in the given repository. * Get rid of all content that lives only in the given AVMStore.
* Also removes the repository. * Also removes the AVMStore.
* @param name The name of the repository to purge. * @param name The name of the AVMStore to purge.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void purgeRepository(String name) public void purgeAVMStore(String name)
{ {
Repository rep = getRepositoryByName(name, true); AVMStore store = getAVMStoreByName(name, true);
AVMNode root = rep.getRoot(); AVMNode root = store.getRoot();
root.setIsRoot(false); root.setIsRoot(false);
VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO; VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO;
List<VersionRoot> vRoots = vrDAO.getAllInRepository(rep); List<VersionRoot> vRoots = vrDAO.getAllInAVMStore(store);
for (VersionRoot vr : vRoots) for (VersionRoot vr : vRoots)
{ {
AVMNode node = vr.getRoot(); AVMNode node = vr.getRoot();
node.setIsRoot(false); node.setIsRoot(false);
vrDAO.delete(vr); vrDAO.delete(vr);
} }
List<NewInRepository> newGuys = AVMContext.fgInstance.fNewInRepositoryDAO.getByRepository(rep); List<NewInAVMStore> newGuys = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(store);
for (NewInRepository newGuy : newGuys) 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. * Remove all content specific to a AVMRepository and version.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @param version The version to purge. * @param version The version to purge.
*/ */
public void purgeVersion(String name, int version) public void purgeVersion(String name, int version)
{ {
Repository rep = getRepositoryByName(name, true); AVMStore store = getAVMStoreByName(name, true);
rep.purgeVersion(version); store.purgeVersion(version);
} }
/** /**
@@ -484,8 +484,8 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository repo = getRepositoryByName(pathParts[0], false); AVMStore store = getAVMStoreByName(pathParts[0], false);
return repo.getInputStream(version, pathParts[1]); return store.getInputStream(version, pathParts[1]);
} }
/** /**
@@ -520,8 +520,8 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository repo = getRepositoryByName(pathParts[0], false); AVMStore store = getAVMStoreByName(pathParts[0], false);
return repo.getListing(version, pathParts[1]); return store.getListing(version, pathParts[1]);
} }
/** /**
@@ -543,55 +543,55 @@ class SuperRepository
} }
/** /**
* Get the names of all repositories. * Get descriptors of all AVMStores.
* @return A list of names. * @return A list of all descriptors.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<RepositoryDescriptor> getRepositories() public List<AVMStoreDescriptor> getAVMStores()
{ {
List<Repository> l = AVMContext.fgInstance.fRepositoryDAO.getAll(); List<AVMStore> l = AVMContext.fgInstance.fAVMStoreDAO.getAll();
List<RepositoryDescriptor> result = new ArrayList<RepositoryDescriptor>(); List<AVMStoreDescriptor> result = new ArrayList<AVMStoreDescriptor>();
for (Repository rep : l) for (AVMStore store : l)
{ {
result.add(rep.getDescriptor()); result.add(store.getDescriptor());
} }
return result; return result;
} }
/** /**
* Get a descriptor for a repository. * Get a descriptor for an AVMStore.
* @param name The name to get. * @param name The name to get.
* @return The descriptor. * @return The descriptor.
*/ */
public RepositoryDescriptor getRepository(String name) public AVMStoreDescriptor getAVMStore(String name)
{ {
Repository rep = getRepositoryByName(name, false); AVMStore store = getAVMStoreByName(name, false);
return rep.getDescriptor(); return store.getDescriptor();
} }
/** /**
* Get all version for a given repository. * Get all version for a given AVMStore.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @return A Set will all the version ids. * @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); AVMStore store = getAVMStoreByName(name, false);
return rep.getVersions(); return store.getVersions();
} }
/** /**
* Get the set of versions between (inclusive) of the given dates. * Get the set of versions between (inclusive) of the given dates.
* From or to may be null but not both. * 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 from The earliest date.
* @param to The latest date. * @param to The latest date.
* @return The Set of version IDs. * @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); AVMStore store = getAVMStoreByName(name, false);
return rep.getVersions(from, to); return store.getVersions(from, to);
} }
/** /**
@@ -631,51 +631,51 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], false); AVMStore store = getAVMStoreByName(pathParts[0], false);
return rep.getIndirectionPath(version, pathParts[1]); return store.getIndirectionPath(version, pathParts[1]);
} }
/** /**
* Get the next version id for the given repository. * Get the next version id for the given AVMStore.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @return The next version id. * @return The next version id.
*/ */
public int getLatestVersionID(String name) public int getLatestVersionID(String name)
{ {
Repository rep = getRepositoryByName(name, false); AVMStore store = getAVMStoreByName(name, false);
return rep.getNextVersionID(); return store.getNextVersionID();
} }
/** /**
* Get a repository by name. * Get an AVMStore by name.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @param write Whether this is called for a write operation. * @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); AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByName(name);
if (rep == null) 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 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. * @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); AVMStore store = getAVMStoreByName(name, false);
if (rep == null) if (store == null)
{ {
throw new AVMNotFoundException("Not found: " + name); throw new AVMNotFoundException("Not found: " + name);
} }
return rep.getRoot(version); return store.getRoot(version);
} }
// TODO Fix this awful mess regarding cycle detection. // TODO Fix this awful mess regarding cycle detection.
@@ -701,8 +701,8 @@ class SuperRepository
throw new AVMCycleException("Cycle in lookup."); throw new AVMCycleException("Cycle in lookup.");
} }
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], false); AVMStore store = getAVMStoreByName(pathParts[0], false);
Lookup result = rep.lookup(version, pathParts[1], false); Lookup result = store.lookup(version, pathParts[1], false);
if (count == null) if (count == null)
{ {
fLookupCount.set(null); fLookupCount.set(null);
@@ -747,8 +747,8 @@ class SuperRepository
throw new AVMCycleException("Cycle in lookup."); throw new AVMCycleException("Cycle in lookup.");
} }
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], false); AVMStore store = getAVMStoreByName(pathParts[0], false);
return rep.lookupDirectory(version, pathParts[1], false); return store.lookupDirectory(version, pathParts[1], false);
} }
/** /**
@@ -783,8 +783,8 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore store = getAVMStoreByName(pathParts[0], true);
rep.makePrimary(pathParts[1]); store.makePrimary(pathParts[1]);
} }
/** /**
@@ -796,8 +796,8 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore store = getAVMStoreByName(pathParts[0], true);
rep.retargetLayeredDirectory(pathParts[1], target); store.retargetLayeredDirectory(pathParts[1], target);
} }
/** /**
@@ -840,18 +840,18 @@ class SuperRepository
{ {
fLookupCount.set(1); fLookupCount.set(1);
String[] pathParts = SplitPath(path); String[] pathParts = SplitPath(path);
Repository rep = getRepositoryByName(pathParts[0], true); AVMStore store = getAVMStoreByName(pathParts[0], true);
rep.setOpacity(pathParts[1], opacity); store.setOpacity(pathParts[1], opacity);
} }
/** /**
* Get the RepositoryDescriptor for a Repository. * Get the AVMStoreDescriptor for an AVMStore.
* @param name The name of the Repository. * @param name The name of the AVMStore.
* @return The descriptor. * @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. * @return The single instance.
*/ */
public static SuperRepository GetInstance() public static AVMRepository GetInstance()
{ {
return fgInstance; return fgInstance;
} }

View File

@@ -29,7 +29,7 @@ import java.util.SortedMap;
* Versioning Model. It specifies methods that are close in functionality to the underlying * 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 * implementation, and is intended as both a first class Alfresco service and an
* aid in creating new implementations of existing services. * 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 * @author britt
*/ */
public interface AVMService public interface AVMService
@@ -126,11 +126,11 @@ public interface AVMService
public void retargetLayeredDirectory(String path, String target); 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. * 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. * Create a branch from a given version and path.
@@ -168,64 +168,64 @@ public interface AVMService
public void uncover(String dirPath, String name); public void uncover(String dirPath, String name);
/** /**
* Get the latest version id of the repository. * Get the latest version id of the AVMStore.
* @param repName The name of the repository. * @param storeName The name of the AVMStore.
* @return The latest version id of the repository. * @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 * 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 * as needing to be copied, so that further modifications will trigger copy on write
* semantics. * 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); public List<Integer> createSnapshot(List<String> repositories);
/** /**
* Snapshot the given repository. * Snapshot the given AVMStore.
* @param repository The name of the repository to snapshot. * @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 * Get the set of versions in an AVMStore
* @param name The name of the Repository. * @param name The name of the AVMStore.
* @return A Set of version IDs * @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. * 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 from Earliest date of version to include.
* @param to Latest date of version to include. * @param to Latest date of version to include.
* @return The Set of version IDs that match. * @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. * Get the descriptors of all AVMStores.
* @return A List of all repositories. * @return A List of all AVMStores.
*/ */
public List<RepositoryDescriptor> getRepositories(); public List<AVMStoreDescriptor> getAVMStores();
/** /**
* Get a descriptor for a repository. * Get a descriptor for an AVMStore.
* @param name The repository's name. * @param name The AVMStore's name.
* @return A Descriptor. * @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 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. * @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. * Lookup a node by version ids and path.
@@ -252,16 +252,16 @@ public interface AVMService
public String getIndirectionPath(int version, String path); public String getIndirectionPath(int version, String path);
/** /**
* Purge a repository. This is a complete wipe of a Repository. * Purge an AVMStore. This is a complete wipe of an AVMStore.
* @param name The name of the Repository. * @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. * the given version only.
* @param version The version to purge. * @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); public void purgeVersion(int version, String name);

View File

@@ -27,7 +27,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.SortedMap; import java.util.SortedMap;
import org.alfresco.repo.avm.SuperRepository; import org.alfresco.repo.avm.AVMRepository;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@@ -44,9 +44,9 @@ public class AVMServiceImpl implements AVMService
private RetryingTransaction fTransaction; private RetryingTransaction fTransaction;
/** /**
* The SuperRepository for each service thread. * The AVMRepository for each service thread.
*/ */
private SuperRepository fSuperRepository; private AVMRepository fAVMRepository;
/** /**
* The storage directory. * The storage directory.
@@ -102,11 +102,11 @@ public class AVMServiceImpl implements AVMService
fLayerIssuer = new Issuer(val == null ? 0L : val + 1L); fLayerIssuer = new Issuer(val == null ? 0L : val + 1L);
} }
}, false); }, false);
fSuperRepository = new SuperRepository(fNodeIssuer, fAVMRepository = new AVMRepository(fNodeIssuer,
fContentIssuer, fContentIssuer,
fLayerIssuer, fLayerIssuer,
fStorage); fStorage);
fgLogger.info("Initialized AVMService and SuperRepository"); fgLogger.info("Initialized AVMService and AVMRepository");
} }
catch (Exception e) catch (Exception e)
{ {
@@ -117,8 +117,8 @@ public class AVMServiceImpl implements AVMService
{ {
File storageDir = new File(fStorage); File storageDir = new File(fStorage);
storageDir.mkdirs(); storageDir.mkdirs();
createRepository("main"); createAVMStore("main");
fgLogger.info("Created new main repository"); 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 * @param initialize
*/ */
public void setInitialize(boolean initialize) public void setInitialize(boolean initialize)
@@ -168,7 +168,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
in = fSuperRepository.getInputStream(version, path); in = fAVMRepository.getInputStream(version, path);
} }
}; };
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -193,7 +193,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
in = fSuperRepository.getInputStream(desc); in = fAVMRepository.getInputStream(desc);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -216,7 +216,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
out = fSuperRepository.getOutputStream(path); out = fAVMRepository.getOutputStream(path);
} }
}; };
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -243,7 +243,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
file = fSuperRepository.getRandomAccess(version, path, access); file = fAVMRepository.getRandomAccess(version, path, access);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -269,7 +269,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
listing = fSuperRepository.getListing(version, path); listing = fAVMRepository.getListing(version, path);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -294,7 +294,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
listing = fSuperRepository.getListing(dir); listing = fAVMRepository.getListing(dir);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -320,7 +320,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
out = fSuperRepository.createFile(path, name); out = fAVMRepository.createFile(path, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -365,7 +365,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createFile(path, name, temp); fAVMRepository.createFile(path, name, temp);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -394,7 +394,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createDirectory(path, name); fAVMRepository.createDirectory(path, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -417,7 +417,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createLayeredFile(srcPath, parent, name); fAVMRepository.createLayeredFile(srcPath, parent, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -440,7 +440,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createLayeredDirectory(srcPath, parent, name); fAVMRepository.createLayeredDirectory(srcPath, parent, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -448,10 +448,10 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Create a repository with the given name. It must not exist. * Create an AVMStore with the given name. It must not exist.
* @param name The name to give the repository. * @param name The name to give the AVMStore.
*/ */
public void createRepository(final String name) public void createAVMStore(final String name)
{ {
if (name == null) if (name == null)
{ {
@@ -461,7 +461,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createRepository(name); fAVMRepository.createAVMStore(name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -486,7 +486,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.createBranch(version, srcPath, dstPath, name); fAVMRepository.createBranch(version, srcPath, dstPath, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -509,7 +509,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.remove(parent, name); fAVMRepository.remove(parent, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -534,7 +534,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.rename(srcParent, srcName, dstParent, dstName); fAVMRepository.rename(srcParent, srcName, dstParent, dstName);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -556,7 +556,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.uncover(dirPath, name); fAVMRepository.uncover(dirPath, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -564,8 +564,8 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Get the Latest Version ID for a repository. * Get the Latest Version ID for an AVMStore.
* @param repName The name of the repository. * @param repName The name of the AVMStore.
* @return The Latest Version ID. * @return The Latest Version ID.
*/ */
public int getLatestVersionID(final String repName) public int getLatestVersionID(final String repName)
@@ -580,7 +580,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
latestVersionID = fSuperRepository.getLatestVersionID(repName); latestVersionID = fAVMRepository.getLatestVersionID(repName);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -589,15 +589,15 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Create snapshots of a group of repositories. * Create snapshots of a group of AVMStores.
* @param repositories A List of repository name. * @param stores A List of AVMStore names.
* @return A List of the new version ids. * @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 class TxnCallback implements RetryingTransactionCallback
{ {
@@ -605,7 +605,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
versionIDs = fSuperRepository.createSnapshot(repositories); versionIDs = fAVMRepository.createSnapshot(stores);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -614,15 +614,15 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Snapshot a repository. * Snapshot an AVMRepository.
* @param repository The name of the repository. * @param store The name of the AVMStore.
* @return The id of the new version. * @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 class TxnCallback implements RetryingTransactionCallback
{ {
@@ -630,7 +630,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
versionID = fSuperRepository.createSnapshot(repository); versionID = fAVMRepository.createSnapshot(store);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -656,7 +656,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
Lookup lookup = fSuperRepository.lookup(version, path); Lookup lookup = fAVMRepository.lookup(version, path);
descriptor = lookup.getCurrentNode().getDescriptor(lookup); descriptor = lookup.getCurrentNode().getDescriptor(lookup);
} }
} }
@@ -683,7 +683,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
child = fSuperRepository.lookup(dir, name); child = fAVMRepository.lookup(dir, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -692,11 +692,11 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Purge a repository. Permanently delete everything that * Purge an AVMStore. Permanently delete everything that
* is only referenced in that repository. * is only referenced in that AVMStore.
* @param name The name of the repository to purge. * @param name The name of the AVMStore to purge.
*/ */
public void purgeRepository(final String name) public void purgeAVMStore(final String name)
{ {
if (name == null) if (name == null)
{ {
@@ -706,7 +706,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.purgeRepository(name); fAVMRepository.purgeAVMStore(name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -728,7 +728,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.purgeVersion(name, version); fAVMRepository.purgeVersion(name, version);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -753,7 +753,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
indirectionPath = fSuperRepository.getIndirectionPath(version, path); indirectionPath = fAVMRepository.getIndirectionPath(version, path);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -762,11 +762,11 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Get the extant version ids for a repository. * Get the extant version ids for an AVMStore.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @return A List of VersionDescriptors. * @return A List of VersionDescriptors.
*/ */
public List<VersionDescriptor> getRepositoryVersions(final String name) public List<VersionDescriptor> getAVMStoreVersions(final String name)
{ {
if (name == null) if (name == null)
{ {
@@ -778,7 +778,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
versions = fSuperRepository.getRepositoryVersions(name); versions = fAVMRepository.getAVMStoreVersions(name);
} }
} }
TxnCallback doit = new TxnCallback(); 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 * Get version IDs by creation date. From or to may be null but not
* both. * 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 from The earliest versions to return.
* @param to The latest versions to return. * @param to The latest versions to return.
* @return The Set of matching version IDs. * @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)) if (name == null || (from == null && to == null))
{ {
@@ -806,7 +806,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
versions = fSuperRepository.getRepositoryVersions(name, from, to); versions = fAVMRepository.getAVMStoreVersions(name, from, to);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -828,7 +828,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.retargetLayeredDirectory(path, target); fAVMRepository.retargetLayeredDirectory(path, target);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -849,7 +849,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.makePrimary(path); fAVMRepository.makePrimary(path);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -857,18 +857,18 @@ public class AVMServiceImpl implements AVMService
} }
/** /**
* Get a list of all Repositories. * Get a list of all AVMStores.
* @return The repositories. * @return The AVMStores.
*/ */
public List<RepositoryDescriptor> getRepositories() public List<AVMStoreDescriptor> getAVMStores()
{ {
class TxnCallback implements RetryingTransactionCallback class TxnCallback implements RetryingTransactionCallback
{ {
public List<RepositoryDescriptor> reps; public List<AVMStoreDescriptor> reps;
public void perform() public void perform()
{ {
reps = fSuperRepository.getRepositories(); reps = fAVMRepository.getAVMStores();
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -878,18 +878,18 @@ public class AVMServiceImpl implements AVMService
/** /**
* Get a reposotory. * Get a reposotory.
* @param name The name of the repository to get. * @param name The name of the AVMStore to get.
* @return The repositories. * @return The AVMStore.
*/ */
public RepositoryDescriptor getRepository(final String name) public AVMStoreDescriptor getAVMStore(final String name)
{ {
class TxnCallback implements RetryingTransactionCallback class TxnCallback implements RetryingTransactionCallback
{ {
public RepositoryDescriptor desc; public AVMStoreDescriptor desc;
public void perform() public void perform()
{ {
desc = fSuperRepository.getRepository(name); desc = fAVMRepository.getAVMStore(name);
} }
} }
TxnCallback doit = new TxnCallback(); 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 version The version to get.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @return The root descriptor. * @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) if (name == null)
{ {
@@ -915,7 +915,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
root = fSuperRepository.getRepositoryRoot(version, name); root = fAVMRepository.getAVMStoreRoot(version, name);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -941,7 +941,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
history = fSuperRepository.getHistory(desc, count); history = fAVMRepository.getHistory(desc, count);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -965,7 +965,7 @@ public class AVMServiceImpl implements AVMService
{ {
public void perform() public void perform()
{ {
fSuperRepository.setOpacity(path, opacity); fAVMRepository.setOpacity(path, opacity);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();
@@ -995,7 +995,7 @@ public class AVMServiceImpl implements AVMService
public void perform() public void perform()
{ {
ancestor = fSuperRepository.getCommonAncestor(left, right); ancestor = fAVMRepository.getCommonAncestor(left, right);
} }
} }
TxnCallback doit = new TxnCallback(); TxnCallback doit = new TxnCallback();

View File

@@ -689,7 +689,7 @@ public class AVMServiceTest extends AVMServiceTestBase
out.println("This is testfile2"); out.println("This is testfile2");
out.close(); out.close();
fService.createSnapshot("main"); fService.createSnapshot("main");
List<VersionDescriptor> versions = fService.getRepositoryVersions("main"); List<VersionDescriptor> versions = fService.getAVMStoreVersions("main");
for (VersionDescriptor version : versions) for (VersionDescriptor version : versions)
{ {
System.out.println("V:" + version.getVersionID()); System.out.println("V:" + version.getVersionID());
@@ -722,7 +722,7 @@ public class AVMServiceTest extends AVMServiceTestBase
setupBasicTree(); setupBasicTree();
fService.createBranch(-1, "main:/a", "main:/d/e", "abranch"); fService.createBranch(-1, "main:/a", "main:/d/e", "abranch");
fService.createSnapshot("main"); fService.createSnapshot("main");
List<VersionDescriptor> versions = fService.getRepositoryVersions("main"); List<VersionDescriptor> versions = fService.getAVMStoreVersions("main");
for (VersionDescriptor version : versions) for (VersionDescriptor version : versions)
{ {
System.out.println("V:" + version.getVersionID()); 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() public void testBranchAcross()
{ {
try try
{ {
setupBasicTree(); setupBasicTree();
fService.createRepository("second"); fService.createAVMStore("second");
List<RepositoryDescriptor> repos = fService.getRepositories(); List<AVMStoreDescriptor> repos = fService.getAVMStores();
assertEquals(2, repos.size()); assertEquals(2, repos.size());
System.out.println(repos.get(0)); System.out.println(repos.get(0));
System.out.println(repos.get(1)); 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() public void testLayerAcross()
{ {
try try
{ {
setupBasicTree(); setupBasicTree();
fService.createRepository("second"); fService.createAVMStore("second");
fService.createLayeredDirectory("main:/", "second:/", "main"); fService.createLayeredDirectory("main:/", "second:/", "main");
fService.createSnapshot("second"); fService.createSnapshot("second");
System.out.println(recursiveList("second", -1, true)); System.out.println(recursiveList("second", -1, true));
@@ -935,7 +935,7 @@ public class AVMServiceTest extends AVMServiceTestBase
line = reader.readLine(); line = reader.readLine();
reader.close(); reader.close();
assertEquals("I am main:/a/b/c/foo", line); assertEquals("I am main:/a/b/c/foo", line);
fService.purgeRepository("second"); fService.purgeAVMStore("second");
fService.purgeVersion(1, "main"); fService.purgeVersion(1, "main");
} }
catch (Exception e) catch (Exception e)
@@ -946,14 +946,14 @@ public class AVMServiceTest extends AVMServiceTestBase
} }
/** /**
* Test rename across repositories. * Test rename across AVMStores.
*/ */
public void testRenameAcross() public void testRenameAcross()
{ {
try try
{ {
setupBasicTree(); setupBasicTree();
fService.createRepository("second"); fService.createAVMStore("second");
fService.rename("main:/a/b", "c", "second:/", "cmoved"); fService.rename("main:/a/b", "c", "second:/", "cmoved");
ArrayList<String> toSnapshot = new ArrayList<String>(); ArrayList<String> toSnapshot = new ArrayList<String>();
toSnapshot.add("main"); toSnapshot.add("main");
@@ -1823,7 +1823,7 @@ public class AVMServiceTest extends AVMServiceTestBase
try try
{ {
setupBasicTree(); setupBasicTree();
AVMNodeDescriptor desc = fService.getRepositoryRoot(-1, "main"); AVMNodeDescriptor desc = fService.getAVMStoreRoot(-1, "main");
assertNotNull(desc); assertNotNull(desc);
System.out.println(desc.toString()); System.out.println(desc.toString());
AVMNodeDescriptor child = fService.lookup(desc, "a"); AVMNodeDescriptor child = fService.lookup(desc, "a");
@@ -1859,9 +1859,9 @@ public class AVMServiceTest extends AVMServiceTestBase
loader.recursiveLoad("source/java/org/alfresco/repo/audit", "main:/"); loader.recursiveLoad("source/java/org/alfresco/repo/audit", "main:/");
times.add(System.currentTimeMillis()); times.add(System.currentTimeMillis());
assertEquals(3, fService.createSnapshot("main")); assertEquals(3, fService.createSnapshot("main"));
assertEquals(1, fService.getRepositoryVersions("main", null, new Date(times.get(0))).size()); assertEquals(1, fService.getAVMStoreVersions("main", null, new Date(times.get(0))).size());
assertEquals(3, fService.getRepositoryVersions("main", new Date(times.get(0)), null).size()); assertEquals(3, fService.getAVMStoreVersions("main", new Date(times.get(0)), null).size());
assertEquals(2, fService.getRepositoryVersions("main", new Date(times.get(1)), assertEquals(2, fService.getAVMStoreVersions("main", new Date(times.get(1)),
new Date(System.currentTimeMillis())).size()); new Date(System.currentTimeMillis())).size());
} }
catch (Exception e) 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 try
{ {
// First check that we get the right error when we try to create a // First check that we get the right error when we try to create an
// repository that exists. // AVMStore that exists.
try try
{ {
fService.createRepository("main"); fService.createAVMStore("main");
fail(); fail();
} }
catch (AVMExistsException ae) catch (AVMExistsException ae)
@@ -1890,7 +1890,7 @@ public class AVMServiceTest extends AVMServiceTestBase
// Do nothing. // Do nothing.
} }
// Now make sure getRepository() works. // Now make sure getRepository() works.
RepositoryDescriptor desc = fService.getRepository("main"); AVMStoreDescriptor desc = fService.getAVMStore("main");
assertNotNull(desc); assertNotNull(desc);
System.out.println(desc); System.out.println(desc);
} }

View File

@@ -94,8 +94,8 @@ public class AVMServiceTestBase extends TestCase
/** /**
* Helper to write a recursive listing of a repository at a given version. * Helper to write a recursive listing of an AVMStore at a given version.
* @param repoName The name of the repository. * @param repoName The name of the AVMStore.
* @param version The version to look under. * @param version The version to look under.
*/ */
protected String recursiveList(String repoName, int version, boolean followLinks) protected String recursiveList(String repoName, int version, boolean followLinks)

View File

@@ -25,27 +25,27 @@ import java.util.List;
import java.util.SortedMap; import java.util.SortedMap;
/** /**
* The repository interface. Methods for filesystem like, versioning, * The store interface. Methods for filesystem like, versioning,
* and layering operations. * and layering operations.
* @author britt * @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. * @return The next version to be snapshotted.
*/ */
public int getNextVersionID(); public int getNextVersionID();
/** /**
* Set a new root for this repository. * Set a new root for this store.
* @param root The root to set. * @param root The root to set.
*/ */
public void setNewRoot(DirectoryNode root); public void setNewRoot(DirectoryNode root);
/** /**
* Snapshots this repository. This sets all nodes in the * Snapshots this store. This sets all nodes in the
* the repository to the should be copied state, and creates * the store to the should be copied state, and creates
* a new version root. * a new version root.
* @return The version id of the newly created snapshot. * @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 // provide methods for getting versions by date range, n most
// recent etc. // recent etc.
/** /**
* Get all the version for this repository. * Get all the version for this AVMStore.
* @return A Set of all versions. * @return A Set of all versions.
*/ */
public List<VersionDescriptor> getVersions(); public List<VersionDescriptor> getVersions();
@@ -157,10 +157,10 @@ public interface Repository
public List<VersionDescriptor> getVersions(Date from, Date to); public List<VersionDescriptor> getVersions(Date from, Date to);
/** /**
* Get the super repository. * Get the AVMRepository.
* @return The SuperRepository. * @return The AVMRepository.
*/ */
public SuperRepository getSuperRepository(); public AVMRepository getAVMRepository();
/** /**
* Lookup a node. * Lookup a node.
@@ -190,7 +190,7 @@ public interface Repository
/** /**
* Make the indicated directory a primary indirection. * Make the indicated directory a primary indirection.
* @param path The Repository relative path. * @param path The AVMRepository relative path.
*/ */
public void makePrimary(String path); public void makePrimary(String path);
@@ -202,7 +202,7 @@ public interface Repository
public void retargetLayeredDirectory(String path, String target); 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. * @return The root directory.
*/ */
public DirectoryNode getRoot(); public DirectoryNode getRoot();
@@ -215,7 +215,7 @@ public interface Repository
public AVMNodeDescriptor getRoot(int version); public AVMNodeDescriptor getRoot(int version);
/** /**
* Get the name of this repository. * Get the name of this store.
* @return The name. * @return The name.
*/ */
public String getName(); public String getName();
@@ -254,7 +254,7 @@ public interface Repository
* Get the descriptor for this. * Get the descriptor for this.
* @return The descriptor. * @return The descriptor.
*/ */
public RepositoryDescriptor getDescriptor(); public AVMStoreDescriptor getDescriptor();
/** /**
* Set the opacity of a layered directory. An opaque directory hides * Set the opacity of a layered directory. An opaque directory hides

View File

@@ -23,36 +23,36 @@ import java.util.List;
* DAO for Repositories. * DAO for Repositories.
* @author britt * @author britt
*/ */
public interface RepositoryDAO public interface AVMStoreDAO
{ {
/** /**
* Save a repository, never before saved. * Save an AVMStore, never before saved.
* @param rep The repository * @param store The AVMStore
*/ */
public void save(Repository rep); public void save(AVMStore store);
/** /**
* Delete the given Repository. * Delete the given AVMStore.
* @param rep The Repository. * @param store The AVMStore.
*/ */
public void delete(Repository rep); public void delete(AVMStore store);
/** /**
* Get all repositories. * Get all AVMStores.
* @return A List of all the Repositories. * @return A List of all the AVMStores.
*/ */
public List<Repository> getAll(); public List<AVMStore> getAll();
/** /**
* Get a repository by name. * Get an AVMStore by name.
* @param name The name of the repository. * @param name The name of the AVMStore.
* @return The repository or null if not found. * @return The AVMStore or null if not found.
*/ */
public Repository getByName(String name); public AVMStore getByName(String name);
/** /**
* Update the given Repository record. * Update the given AVMStore record.
* @param rep The dirty Repository. * @param rep The dirty AVMStore.
*/ */
public void update(Repository rep); public void update(AVMStore rep);
} }

View File

@@ -20,10 +20,10 @@ package org.alfresco.repo.avm;
import java.util.Date; import java.util.Date;
/** /**
* A value class for Data about a repository. * A value class for Data about an AVMStore.
* @author britt * @author britt
*/ */
public class RepositoryDescriptor public class AVMStoreDescriptor
{ {
/** /**
* The name. * The name.
@@ -40,7 +40,7 @@ public class RepositoryDescriptor
*/ */
private long fCreateDate; private long fCreateDate;
public RepositoryDescriptor(String name, public AVMStoreDescriptor(String name,
String creator, String creator,
long createDate) long createDate)
{ {

View File

@@ -35,12 +35,12 @@ import java.util.TreeMap;
* operation. * operation.
* @author britt * @author britt
*/ */
public class RepositoryImpl implements Repository, Serializable public class AVMStoreImpl implements AVMStore, Serializable
{ {
static final long serialVersionUID = -1485972568675732904L; static final long serialVersionUID = -1485972568675732904L;
/** /**
* The name of this repository. * The name of this AVMStore.
*/ */
private String fName; private String fName;
@@ -60,9 +60,9 @@ public class RepositoryImpl implements Repository, Serializable
private long fVers; private long fVers;
/** /**
* The super repository. * The AVMRepository.
*/ */
transient private SuperRepository fSuper; transient private AVMRepository fAVMRepository;
/** /**
* The creator. * The creator.
@@ -77,26 +77,26 @@ public class RepositoryImpl implements Repository, Serializable
/** /**
* Default constructor. * Default constructor.
*/ */
protected RepositoryImpl() protected AVMStoreImpl()
{ {
fSuper = SuperRepository.GetInstance(); fAVMRepository = AVMRepository.GetInstance();
} }
/** /**
* Make a brand new repository. * Make a brand new AVMStore.
* @param superRepo The SuperRepository. * @param repo The AVMRepository.
* @param name The name of the Repository. * @param name The name of the AVMStore.
*/ */
public RepositoryImpl(SuperRepository superRepo, String name) public AVMStoreImpl(AVMRepository repo, String name)
{ {
// Make ourselves up and save. // Make ourselves up and save.
fSuper = superRepo; fAVMRepository = repo;
fName = name; fName = name;
fNextVersionID = 0; fNextVersionID = 0;
fRoot = null; fRoot = null;
fCreator = "britt"; fCreator = "britt";
fCreateDate = System.currentTimeMillis(); fCreateDate = System.currentTimeMillis();
AVMContext.fgInstance.fRepositoryDAO.save(this); AVMContext.fgInstance.fAVMStoreDAO.save(this);
// Make up the initial version record and save. // Make up the initial version record and save.
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
fRoot = new PlainDirectoryNodeImpl(this); 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. * @return The version id of the new snapshot.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -134,10 +134,10 @@ public class RepositoryImpl implements Repository, Serializable
throw new AVMExistsException("Already snapshotted."); throw new AVMExistsException("Already snapshotted.");
} }
// Clear out the new nodes. // Clear out the new nodes.
List<NewInRepository> newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByRepository(this); List<NewInAVMStore> newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(this);
for (NewInRepository newGuy : newInRep) for (NewInAVMStore newGuy : newInRep)
{ {
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newGuy); AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
} }
// Make up a new version record. // Make up a new version record.
VersionRoot versionRoot = new VersionRootImpl(this, VersionRoot versionRoot = new VersionRootImpl(this,
@@ -210,7 +210,7 @@ public class RepositoryImpl implements Repository, Serializable
else else
{ {
// Otherwise we issue a brand new layer id. // Otherwise we issue a brand new layer id.
newDir.setLayerID(fSuper.issueLayerID()); newDir.setLayerID(fAVMRepository.issueLayerID());
} }
dir.putChild(name, newDir); dir.putChild(name, newDir);
dir.updateModTime(); dir.updateModTime();
@@ -415,13 +415,13 @@ public class RepositoryImpl implements Repository, Serializable
// provide methods for getting versions by date range, n most // provide methods for getting versions by date range, n most
// recent etc. // 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. * @return A Set of version ids.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<VersionDescriptor> getVersions() 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>(); List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
for (VersionRoot vr : versions) for (VersionRoot vr : versions)
{ {
@@ -460,12 +460,12 @@ public class RepositoryImpl implements Repository, Serializable
} }
/** /**
* Get the SuperRepository. * Get the AVMRepository.
* @return The SuperRepository * @return The AVMRepository
*/ */
public SuperRepository getSuperRepository() public AVMRepository getAVMRepository()
{ {
return fSuper; return fAVMRepository;
} }
/** /**
@@ -498,7 +498,7 @@ public class RepositoryImpl implements Repository, Serializable
} }
else else
{ {
dir = AVMContext.fgInstance.fAVMNodeDAO.getRepositoryRoot(this, version); dir = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
} }
// Add an entry for the root. // Add an entry for the root.
result.add(dir, "", write); result.add(dir, "", write);
@@ -549,7 +549,7 @@ public class RepositoryImpl implements Repository, Serializable
} }
else else
{ {
root = AVMContext.fgInstance.fAVMNodeDAO.getRepositoryRoot(this, version); root = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
} }
return root.getDescriptor("main:", "", null); 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 * @param name
*/ */
protected void setName(String 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. * @return The name.
*/ */
public String getName() public String getName()
@@ -714,11 +714,11 @@ public class RepositoryImpl implements Repository, Serializable
{ {
return true; return true;
} }
if (!(obj instanceof Repository)) if (!(obj instanceof AVMStore))
{ {
return false; 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(); // TODO More hibernate goofiness to compensate for: fSuper.getSession().flush();
vRoot = AVMContext.fgInstance.fVersionRootDAO.getMaxVersion(this); vRoot = AVMContext.fgInstance.fVersionRootDAO.getMaxVersion(this);
fRoot = vRoot.getRoot(); 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. * 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);
} }
/** /**

View File

@@ -474,7 +474,7 @@ class AVMTester implements Runnable
fAllPaths.add("main:/"); fAllPaths.add("main:/");
fAllDirectories.add("main:/"); fAllDirectories.add("main:/");
Set<Long> visited = new HashSet<Long>(); Set<Long> visited = new HashSet<Long>();
AVMNodeDescriptor root = fService.getRepositoryRoot(-1, "main"); AVMNodeDescriptor root = fService.getAVMStoreRoot(-1, "main");
recursiveRefresh(root, visited); recursiveRefresh(root, visited);
} }

View File

@@ -36,7 +36,7 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
* @param id * @param id
* @param repo * @param repo
*/ */
protected DirectoryNodeImpl(long id, Repository repo) protected DirectoryNodeImpl(long id, AVMStore repo)
{ {
super(id, repo); super(id, repo);
} }

View File

@@ -286,7 +286,7 @@ class FileContentImpl implements FileContent, Serializable
(fID & 0xff0000) >> 16, (fID & 0xff0000) >> 16,
(fID & 0xff00) >> 8); (fID & 0xff00) >> 8);
String dir = form.toString(); String dir = form.toString();
fPath = SuperRepository.GetInstance().getStorageRoot() + dir; fPath = AVMRepository.GetInstance().getStorageRoot() + dir;
fName = fPath + "/" + name; fName = fPath + "/" + name;
} }

View File

@@ -33,10 +33,10 @@ abstract class FileNodeImpl extends AVMNodeImpl implements FileNode
/** /**
* Pass through constructor. * Pass through constructor.
* @param id The newly assigned object id. * @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);
} }
} }

View File

@@ -65,30 +65,30 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/** /**
* Make a new one from a specified indirection path. * Make a new one from a specified indirection path.
* @param indirection The indirection path to set. * @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; fLayerID = -1;
fIndirection = indirection; fIndirection = indirection;
fPrimaryIndirection = true; fPrimaryIndirection = true;
fOpacity = false; fOpacity = false;
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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. * Kind of copy constructor, sort of.
* @param other The LayeredDirectoryNode we are copied from. * @param other The LayeredDirectoryNode we are copied from.
* @param repos The Repository object we use. * @param repos The AVMStore object we use.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public LayeredDirectoryNodeImpl(LayeredDirectoryNode other, public LayeredDirectoryNodeImpl(LayeredDirectoryNode other,
Repository repos) AVMStore repos)
{ {
super(repos.getSuperRepository().issueID(), repos); super(repos.getAVMRepository().issueID(), repos);
fIndirection = other.getUnderlying(); fIndirection = other.getUnderlying();
fPrimaryIndirection = other.getPrimaryIndirection(); fPrimaryIndirection = other.getPrimaryIndirection();
fLayerID = -1; fLayerID = -1;
@@ -108,23 +108,23 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
AVMContext.fgInstance.fDeletedChildDAO.save(newDel); AVMContext.fgInstance.fDeletedChildDAO.save(newDel);
} }
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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 * Construct one from a PlainDirectoryNode. Called when a COW is performed in a layered
* context. * context.
* @param other The PlainDirectoryNode. * @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. * @param lPath The Lookup object.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public LayeredDirectoryNodeImpl(PlainDirectoryNode other, public LayeredDirectoryNodeImpl(PlainDirectoryNode other,
Repository repos, AVMStore store,
Lookup lPath, Lookup lPath,
boolean copyContents) boolean copyContents)
{ {
super(repos.getSuperRepository().issueID(), repos); super(store.getAVMRepository().issueID(), store);
fIndirection = null; fIndirection = null;
fPrimaryIndirection = false; fPrimaryIndirection = false;
fLayerID = -1; fLayerID = -1;
@@ -141,30 +141,30 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
} }
} }
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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 * 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. * that is in not in the layer of the source lookup.
* @param dir The directory * @param dir The directory
* @param repo The repository * @param store The store
* @param srcLookup The source lookup. * @param srcLookup The source lookup.
* @param name The name of the target. * @param name The name of the target.
*/ */
public LayeredDirectoryNodeImpl(DirectoryNode dir, public LayeredDirectoryNodeImpl(DirectoryNode dir,
Repository repo, AVMStore store,
Lookup srcLookup, Lookup srcLookup,
String name) String name)
{ {
super(repo.getSuperRepository().issueID(), repo); super(store.getAVMRepository().issueID(), store);
fIndirection = srcLookup.getIndirectionPath() + "/" + name; fIndirection = srcLookup.getIndirectionPath() + "/" + name;
fPrimaryIndirection = true; fPrimaryIndirection = true;
fLayerID = -1; fLayerID = -1;
fOpacity = false; fOpacity = false;
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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) public AVMNode copy(Lookup lPath)
{ {
// Capture the repository. // Capture the store.
Repository repo = lPath.getRepository(); AVMStore store = lPath.getAVMStore();
LayeredDirectoryNodeImpl newMe = null; LayeredDirectoryNodeImpl newMe = null;
if (!lPath.isInThisLayer()) if (!lPath.isInThisLayer())
{ {
@@ -247,7 +247,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
// layer. The following creates a node that will inherit its // layer. The following creates a node that will inherit its
// indirection from its parent. // indirection from its parent.
newMe = new LayeredDirectoryNodeImpl((String)null, newMe = new LayeredDirectoryNodeImpl((String)null,
repo); store);
newMe.setPrimaryIndirection(false); newMe.setPrimaryIndirection(false);
newMe.setLayerID(lPath.getTopLayer().getLayerID()); newMe.setLayerID(lPath.getTopLayer().getLayerID());
} }
@@ -255,7 +255,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{ {
// A simple copy is made. // A simple copy is made.
newMe = new LayeredDirectoryNodeImpl(this, newMe = new LayeredDirectoryNodeImpl(this,
repo); store);
newMe.setLayerID(getLayerID()); newMe.setLayerID(getLayerID());
} }
newMe.setAncestor(this); newMe.setAncestor(this);
@@ -315,7 +315,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{ {
try try
{ {
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath)); Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
baseListing = dir.getListing(lookup); baseListing = dir.getListing(lookup);
} }
@@ -363,7 +363,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{ {
try try
{ {
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, dir.getIndirection()); Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, dir.getIndirection());
DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode();
Map<String, AVMNode> listing = dirNode.getListing(lookup); Map<String, AVMNode> listing = dirNode.getListing(lookup);
for (String name : listing.keySet()) for (String name : listing.keySet())
@@ -427,7 +427,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
// Not here so check our indirection. // Not here so check our indirection.
try try
{ {
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath)); Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, getUnderlying(lPath));
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
return dir.lookupChild(lookup, name, -1, false); return dir.lookupChild(lookup, name, -1, false);
} }
@@ -471,7 +471,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
} }
try try
{ {
Lookup lookup = SuperRepository.GetInstance().lookupDirectory(-1, mine.getIndirection()); Lookup lookup = AVMRepository.GetInstance().lookupDirectory(-1, mine.getIndirection());
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
AVMNode child = dir.lookupChild(lookup, name, -1, false); AVMNode child = dir.lookupChild(lookup, name, -1, false);
if (child == null) if (child == null)

View File

@@ -41,29 +41,29 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
* Basically a copy constructor. Used when a branch is created * Basically a copy constructor. Used when a branch is created
* from a layered file. * from a layered file.
* @param other The file to make a copy of. * @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(); fIndirection = other.getIndirection();
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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. * Make a brand new layered file node.
* @param indirection The thing we point to. * @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; fIndirection = indirection;
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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) public AVMNode copy(Lookup lPath)
{ {
// LayeredFileNodes are always copied. // LayeredFileNodes are always copied.
Lookup lookup = SuperRepository.GetInstance().lookup(-1, fIndirection); Lookup lookup = AVMRepository.GetInstance().lookup(-1, fIndirection);
AVMNode indirect = lookup.getCurrentNode(); AVMNode indirect = lookup.getCurrentNode();
if (indirect.getType() != AVMNodeType.LAYERED_FILE && if (indirect.getType() != AVMNodeType.LAYERED_FILE &&
indirect.getType() != AVMNodeType.PLAIN_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 // This is a mildly dirty trick. We use getContentForRead so as not to startle
// the ultimate destination content into copying itself prematurely. // the ultimate destination content into copying itself prematurely.
FileContent content = ((FileNode)indirect).getContentForRead(); FileContent content = ((FileNode)indirect).getContentForRead();
PlainFileNodeImpl newMe = new PlainFileNodeImpl(content, lPath.getRepository(), getBasicAttributes()); PlainFileNodeImpl newMe = new PlainFileNodeImpl(content, lPath.getAVMStore(), getBasicAttributes());
newMe.setAncestor(this); newMe.setAncestor(this);
return newMe; return newMe;
} }
@@ -103,7 +103,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
*/ */
public FileContent getContentForRead() public FileContent getContentForRead()
{ {
Lookup lookup = SuperRepository.GetInstance().lookup(-1, fIndirection); Lookup lookup = AVMRepository.GetInstance().lookup(-1, fIndirection);
AVMNode node = lookup.getCurrentNode(); AVMNode node = lookup.getCurrentNode();
if (node.getType() != AVMNodeType.LAYERED_FILE && if (node.getType() != AVMNodeType.LAYERED_FILE &&
node.getType() != AVMNodeType.PLAIN_FILE) node.getType() != AVMNodeType.PLAIN_FILE)

View File

@@ -29,14 +29,14 @@ import java.util.List;
class Lookup 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. * The components that make up this path.
@@ -81,13 +81,13 @@ class Lookup
/** /**
* Create a new one. * Create a new one.
* @param repository The Repository that's being looked in. * @param store The AVMStore that's being looked in.
* @param repName The name of that Repsository. * @param storeName The name of that AVMStore.
*/ */
public Lookup(RepositoryImpl repository, String repName) public Lookup(AVMStore store, String storeName)
{ {
fRepository = repository; fAVMStore = store;
fRepName = repName; fStoreName = storeName;
fComponents = new ArrayList<LookupComponent>(); fComponents = new ArrayList<LookupComponent>();
fLayeredYet = false; fLayeredYet = false;
fTopLayer = null; fTopLayer = null;
@@ -178,14 +178,13 @@ class Lookup
if (fNeedsCopying) if (fNeedsCopying)
{ {
node = node.copy(this); node = node.copy(this);
node.setVersionID(fRepository.getNextVersionID()); node.setVersionID(fAVMStore.getNextVersionID());
fComponents.get(fPosition).setNode(node); fComponents.get(fPosition).setNode(node);
if (fPosition == 0) if (fPosition == 0)
{ {
// Inform the repository of a new root. // Inform the store of a new root.
fRepository.setNewRoot((DirectoryNode)node); fAVMStore.setNewRoot((DirectoryNode)node);
AVMContext.fgInstance.fRepositoryDAO.update(fRepository); AVMContext.fgInstance.fAVMStoreDAO.update(fAVMStore);
// TODO More Hibernate weirdness to figure out: SuperRepository.GetInstance().getSession().flush();
return; return;
} }
// Not the root. Check if we are the top layer and insert this into it's parent. // 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. * Get the store that this path is in.
* @return The repository. * @return The store.
*/ */
public Repository getRepository() public AVMStore getAVMStore()
{ {
return fRepository; return fAVMStore;
} }
/** /**
@@ -318,10 +317,10 @@ class Lookup
{ {
if (fComponents.size() == 1) if (fComponents.size() == 1)
{ {
return fRepName + ":/"; return fStoreName + ":/";
} }
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(fRepName); builder.append(fStoreName);
builder.append(':'); builder.append(':');
int count = fComponents.size(); int count = fComponents.size();
for (int i = 1; i < count; i++) for (int i = 1; i < count; i++)

View File

@@ -18,16 +18,16 @@
package org.alfresco.repo.avm; 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 * @author britt
*/ */
public interface NewInRepository public interface NewInAVMStore
{ {
/** /**
* Get the Repository part. * Get the AVMStore part.
* @return The Repository * @return The AVMStore
*/ */
public Repository getRepository(); public AVMStore getAvmStore();
/** /**
* Get the node part. * Get the node part.

View File

@@ -20,34 +20,34 @@ package org.alfresco.repo.avm;
import java.util.List; import java.util.List;
/** /**
* DAO for NewInRepository markers. * DAO for NewInAVMStore markers.
* @author britt * @author britt
*/ */
public interface NewInRepositoryDAO public interface NewInAVMStoreDAO
{ {
/** /**
* Save one. * Save one.
* @param newEntry The item to save. * @param newEntry The item to save.
*/ */
public void save(NewInRepository newEntry); public void save(NewInAVMStore newEntry);
/** /**
* Get one by Node. * Get one by Node.
* @param node The node to lookup with. * @param node The node to lookup with.
* @return The Entry or null if not found. * @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. * Get all that are in the given store.
* @param repository The Repository. * @param store The AVMStore.
* @return A List of NewInRepositorys. * @return A List of NewInAVMStores.
*/ */
public List<NewInRepository> getByRepository(Repository repository); public List<NewInAVMStore> getByAVMStore(AVMStore store);
/** /**
* Delete the given entry. * Delete the given entry.
* @param newEntry The entry to delete. * @param newEntry The entry to delete.
*/ */
public void delete(NewInRepository newEntry); public void delete(NewInAVMStore newEntry);
} }

View File

@@ -20,17 +20,17 @@ package org.alfresco.repo.avm;
import java.io.Serializable; 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 * @author britt
*/ */
public class NewInRepositoryImpl implements NewInRepository, Serializable public class NewInAVMStoreImpl implements NewInAVMStore, Serializable
{ {
private static final long serialVersionUID = 1905996612150732182L; private static final long serialVersionUID = 1905996612150732182L;
/** /**
* The Repository. * The AVMStore.
*/ */
private Repository fRepository; private AVMStore fAVMStore;
/** /**
* The Node. * The Node.
@@ -40,18 +40,18 @@ public class NewInRepositoryImpl implements NewInRepository, Serializable
/** /**
* Default constructor. * Default constructor.
*/ */
public NewInRepositoryImpl() public NewInAVMStoreImpl()
{ {
} }
/** /**
* Make a new one. * Make a new one.
* @param repository The repository. * @param store The store.
* @param node The AVMNode that is new. * @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; 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;
} }
} }

View File

@@ -233,10 +233,10 @@ public class OrphanReaper implements Runnable
link.getMto().setMergedFrom(ancestor); link.getMto().setMergedFrom(ancestor);
AVMContext.fgInstance.fMergeLinkDAO.delete(link); AVMContext.fgInstance.fMergeLinkDAO.delete(link);
} }
NewInRepository newInRep = AVMContext.fgInstance.fNewInRepositoryDAO.getByNode(node); NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(node);
if (newInRep != null) if (newInRep != null)
{ {
AVMContext.fgInstance.fNewInRepositoryDAO.delete(newInRep); AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
} }
// TODO What to do about such Hibernate wackiness: session.flush(); // TODO What to do about such Hibernate wackiness: session.flush();
// TODO More of the same: node = AVMNodeUnwrapper.Unwrap(node); // TODO More of the same: node = AVMNodeUnwrapper.Unwrap(node);

View File

@@ -32,14 +32,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
/** /**
* Make up a new directory with nothing in it. * 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.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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. * Copy like constructor.
* @param other The other directory. * @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") @SuppressWarnings("unchecked")
public PlainDirectoryNodeImpl(PlainDirectoryNode other, public PlainDirectoryNodeImpl(PlainDirectoryNode other,
Repository repos) AVMStore store)
{ {
super(repos.getSuperRepository().issueID(), repos); super(store.getAVMRepository().issueID(), store);
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other)) 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.fChildEntryDAO.save(newChild);
} }
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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 // Subtlety warning: This distinguishes the case of a
// Directory that was branched into the layer and one // Directory that was branched into the layer and one
// that is indirectly seen in this layer. // that is indirectly seen in this layer.
newMe = new LayeredDirectoryNodeImpl(this, lPath.getRepository(), lPath, newMe = new LayeredDirectoryNodeImpl(this, lPath.getAVMStore(), lPath,
lPath.isInThisLayer()); lPath.isInThisLayer());
((LayeredDirectoryNodeImpl)newMe).setLayerID(lPath.getTopLayer().getLayerID()); ((LayeredDirectoryNodeImpl)newMe).setLayerID(lPath.getTopLayer().getLayerID());
} }
else else
{ {
newMe = new PlainDirectoryNodeImpl(this, lPath.getRepository()); newMe = new PlainDirectoryNodeImpl(this, lPath.getAVMStore());
} }
newMe.setAncestor(this); newMe.setAncestor(this);
return newMe; return newMe;

View File

@@ -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. * 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); super(store.getAVMRepository().issueID(), store);
fContent = new FileContentImpl(SuperRepository.GetInstance().issueContentID()); fContent = new FileContentImpl(AVMRepository.GetInstance().issueContentID());
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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. * Create a new plain file with given content.
* @param repos The repository. * @param store The store.
* @param content The content to set. * @param content The content to set.
*/ */
public PlainFileNodeImpl(Repository repos, File content) public PlainFileNodeImpl(AVMStore store, File content)
{ {
super(repos.getSuperRepository().issueID(), repos); super(store.getAVMRepository().issueID(), store);
fContent = new FileContentImpl(SuperRepository.GetInstance().issueContentID(), content); fContent = new FileContentImpl(AVMRepository.GetInstance().issueContentID(), content);
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); AVMContext.fgInstance.fAVMNodeDAO.flush();
AVMContext.fgInstance.fNewInRepositoryDAO.save(new NewInRepositoryImpl(repos, this)); AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
} }
/** /**
* Copy on write constructor. * Copy on write constructor.
* @param other The node we are being copied from. * @param other The node we are being copied from.
* @param repos The Repository. * @param store The AVMStore.
*/ */
public PlainFileNodeImpl(PlainFileNode other, public PlainFileNodeImpl(PlainFileNode other,
Repository repos) AVMStore store)
{ {
super(repos.getSuperRepository().issueID(), repos); super(store.getAVMRepository().issueID(), store);
fContent = other.getContent(); fContent = other.getContent();
fContent.setRefCount(fContent.getRefCount() + 1); fContent.setRefCount(fContent.getRefCount() + 1);
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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. * Constructor that takes a FileContent to share.
* @param content The FileContent to share. * @param content The FileContent to share.
* @param repos The Repository. * @param store The AVMStore.
*/ */
public PlainFileNodeImpl(FileContent content, public PlainFileNodeImpl(FileContent content,
Repository repos, AVMStore store,
BasicAttributes oAttrs) BasicAttributes oAttrs)
{ {
super(repos.getSuperRepository().issueID(), repos); super(store.getAVMRepository().issueID(), store);
fContent = content; fContent = content;
fContent.setRefCount(fContent.getRefCount() + 1); fContent.setRefCount(fContent.getRefCount() + 1);
AVMContext.fgInstance.fAVMNodeDAO.save(this); AVMContext.fgInstance.fAVMNodeDAO.save(this);
AVMContext.fgInstance.fAVMNodeDAO.flush(); 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) public AVMNode copy(Lookup lPath)
{ {
PlainFileNodeImpl newMe = new PlainFileNodeImpl(this, lPath.getRepository()); PlainFileNodeImpl newMe = new PlainFileNodeImpl(this, lPath.getAVMStore());
newMe.setAncestor(this); newMe.setAncestor(this);
return newMe; return newMe;
} }
@@ -135,7 +135,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
{ {
if (fContent.getRefCount() > 1) if (fContent.getRefCount() > 1)
{ {
fContent = new FileContentImpl(fContent, SuperRepository.GetInstance().issueContentID()); fContent = new FileContentImpl(fContent, AVMRepository.GetInstance().issueContentID());
} }
return fContent; return fContent;
} }

View File

@@ -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 try
{ {
@@ -118,7 +118,7 @@ public class PurgeTest extends AVMServiceTestBase
fService.removeNode("main:/layer/java/org/alfresco", "repo"); fService.removeNode("main:/layer/java/org/alfresco", "repo");
fService.createFile("main:/layer/java/org/alfresco", "goofy").close(); fService.createFile("main:/layer/java/org/alfresco", "goofy").close();
fService.createSnapshot("main"); fService.createSnapshot("main");
fService.purgeRepository("main"); fService.purgeAVMStore("main");
fReaper.activate(); fReaper.activate();
while (fReaper.isActive()) while (fReaper.isActive())
{ {

View File

@@ -26,9 +26,9 @@ import java.util.Date;
public class VersionDescriptor 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. * The version id.
@@ -47,29 +47,29 @@ public class VersionDescriptor
/** /**
* New one up. * New one up.
* @param repName The repository name. * @param storeName The store name.
* @param versionID The version id. * @param versionID The version id.
* @param creator The creator. * @param creator The creator.
* @param createDate The create date. * @param createDate The create date.
*/ */
public VersionDescriptor(String repName, public VersionDescriptor(String storeName,
int versionID, int versionID,
String creator, String creator,
long createDate) long createDate)
{ {
fRepositoryName = repName; fAVMStoreName = storeName;
fVersionID = versionID; fVersionID = versionID;
fCreator = creator; fCreator = creator;
fCreateDate = createDate; fCreateDate = createDate;
} }
/** /**
* Get the repository name. * Get the store name.
* @return The repository 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(); StringBuilder builder = new StringBuilder();
builder.append("["); builder.append("[");
builder.append(fRepositoryName); builder.append(fAVMStoreName);
builder.append(":"); builder.append(":");
builder.append("" + fVersionID); builder.append("" + fVersionID);
builder.append(":"); builder.append(":");

View File

@@ -53,14 +53,14 @@ public interface VersionRoot
public void setId(long id); 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 * @return the root

View File

@@ -39,33 +39,33 @@ public interface VersionRootDAO
public void delete(VersionRoot vr); public void delete(VersionRoot vr);
/** /**
* Get all the version roots in a given repository. * Get all the version roots in a given store.
* @param rep The repository. * @param store The store.
* @return A List of VersionRoots. In id order. * @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. * Get the VersionRoot corresponding to the given id.
* @param rep The repository * @param store The store
* @param id The version id. * @param id The version id.
* @return The VersionRoot or null if not found. * @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. * Get the version of a store by dates.
* @param rep The repository. * @param store The store.
* @param from The starting date. May be null but not with to null also. * @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. * @param to The ending date. May be null but not with from null also.
* @return A List of VersionRoots. * @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. * Get the highest numbered version in a store.
* @param rep The repository. * @param stor The store.
* @return The highest numbered version. * @return The highest numbered version.
*/ */
public VersionRoot getMaxVersion(Repository rep); public VersionRoot getMaxVersion(AVMStore store);
} }

View File

@@ -49,9 +49,9 @@ public class VersionRootImpl implements VersionRoot, Serializable
private String fCreator; private String fCreator;
/** /**
* The Repository. * The AVMStore.
*/ */
private Repository fRepository; private AVMStore fAVMStore;
/** /**
* The root node. * The root node.
@@ -67,19 +67,19 @@ public class VersionRootImpl implements VersionRoot, Serializable
/** /**
* Rich constructor. * Rich constructor.
* @param repository * @param store
* @param root * @param root
* @param versionID * @param versionID
* @param createDate * @param createDate
* @param creator * @param creator
*/ */
public VersionRootImpl(Repository repository, public VersionRootImpl(AVMStore store,
DirectoryNode root, DirectoryNode root,
int versionID, int versionID,
long createDate, long createDate,
String creator) String creator)
{ {
fRepository = repository; fAVMStore = store;
fRoot = root; fRoot = root;
fVersionID = versionID; fVersionID = versionID;
fCreateDate = createDate; fCreateDate = createDate;
@@ -116,14 +116,14 @@ public class VersionRootImpl implements VersionRoot, Serializable
fID = id; 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() 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 * @param obj
* @return Equality. * @return Equality.
*/ */
@@ -171,7 +171,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
return false; return false;
} }
VersionRoot other = (VersionRoot)obj; VersionRoot other = (VersionRoot)obj;
return fRepository.equals(other.getRepository()) return fAVMStore.equals(other.getAvmStore())
&& fVersionID == other.getVersionID(); && fVersionID == other.getVersionID();
} }
@@ -182,7 +182,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
@Override @Override
public int hashCode() public int hashCode()
{ {
return fRepository.hashCode() + fVersionID; return fAVMStore.hashCode() + fVersionID;
} }
} }

View File

@@ -99,12 +99,12 @@
<property name="refCount" column="ref_count" type="int" <property name="refCount" column="ref_count" type="int"
not-null="true"/> not-null="true"/>
</class> </class>
<!-- A Repository is the what we used to call a virtual repository. <!-- A store 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 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 with other repositories. The physical repository is structured this way
for better scaling. --> for better scaling. -->
<class table="repositories" name="RepositoryImpl" <class table="avm_repositories" name="AVMStoreImpl"
proxy="Repository" optimistic-lock="version"> proxy="AVMStore" optimistic-lock="version">
<cache usage="read-write"/> <cache usage="read-write"/>
<id name="name" column="name" type="string"/> <id name="name" column="name" type="string"/>
<version name="vers" column="vers" type="long"/> <version name="vers" column="vers" type="long"/>
@@ -112,7 +112,7 @@
column="next_version_id" not-null="true"/> column="next_version_id" not-null="true"/>
<property type="string" name="creator" column="creator" not-null="true"/> <property type="string" name="creator" column="creator" not-null="true"/>
<property type="long" name="createDate" column="create_date" 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. --> <!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
<many-to-one name="root" class="DirectoryNodeImpl" <many-to-one name="root" class="DirectoryNodeImpl"
column="current_root_id" unique="true" cascade="save-update"> column="current_root_id" unique="true" cascade="save-update">
@@ -131,8 +131,8 @@
<property name="creator" type="string" column="creator" <property name="creator" type="string" column="creator"
not-null="true"> not-null="true">
</property> </property>
<many-to-one name="repository" column="repository_id" <many-to-one name="avmStore" column="avm_store_id"
class="RepositoryImpl" not-null="true"> class="AVMStoreImpl" not-null="true">
</many-to-one> </many-to-one>
<many-to-one name="root" class="DirectoryNodeImpl" <many-to-one name="root" class="DirectoryNodeImpl"
column="root_id" not-null="true"> column="root_id" not-null="true">
@@ -171,9 +171,9 @@
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/> <key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
</composite-id> </composite-id>
</class> </class>
<class name="NewInRepositoryImpl" proxy="NewInRepository" table="new_in_repository_nodes"> <class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
<composite-id> <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"/> <key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
</composite-id> </composite-id>
</class> </class>
@@ -204,10 +204,10 @@
where ce.parent = :parent where ce.parent = :parent
]]> ]]>
</query> </query>
<query name="AVMNode.ByNewInRepo"> <query name="AVMNode.ByNewInAVMStore">
<![CDATA[ <![CDATA[
from NewInRepositoryImpl nie from NewInAVMStoreImpl nie
where nie.repository = :rep where nie.avmStore = :store
]]> ]]>
</query> </query>
<query name="AVMNode.GetDescendents"> <query name="AVMNode.GetDescendents">
@@ -241,14 +241,14 @@
select v.root select v.root
from VersionRootImpl v from VersionRootImpl v
where where
v.repository = :rep and v.versionID = :version v.avmStore = :store and v.versionID = :version
]]> ]]>
</query> </query>
<query name="VersionRoot.VersionByID"> <query name="VersionRoot.VersionByID">
<![CDATA[ <![CDATA[
from VersionRootImpl v from VersionRootImpl v
where where
v.repository = :rep and v.versionID = :version v.avmStore = :store and v.versionID = :version
]]> ]]>
</query> </query>
<query name="DeletedChild.ByNameParent"> <query name="DeletedChild.ByNameParent">

View File

@@ -25,7 +25,7 @@ import org.alfresco.repo.avm.AVMNodeDAO;
import org.alfresco.repo.avm.AVMNodeImpl; import org.alfresco.repo.avm.AVMNodeImpl;
import org.alfresco.repo.avm.AVMNodeUnwrapper; import org.alfresco.repo.avm.AVMNodeUnwrapper;
import org.alfresco.repo.avm.DirectoryNode; import org.alfresco.repo.avm.DirectoryNode;
import org.alfresco.repo.avm.Repository; import org.alfresco.repo.avm.AVMStore;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -81,15 +81,15 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
/** /**
* Get the root of a particular version. * 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. * @param version The version.
* @return The VersionRoot or null. * @return The VersionRoot or null.
*/ */
public DirectoryNode getRepositoryRoot(Repository rep, int version) public DirectoryNode getAVMStoreRoot(AVMStore store, int version)
{ {
Query query = Query query =
getSession().getNamedQuery("VersionRoot.GetVersionRoot"); getSession().getNamedQuery("VersionRoot.GetVersionRoot");
query.setEntity("rep", rep); query.setEntity("store", store);
query.setInteger("version", version); query.setInteger("version", version);
AVMNode root = (AVMNode)query.uniqueResult(); AVMNode root = (AVMNode)query.uniqueResult();
if (root == null) if (root == null)
@@ -136,19 +136,6 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
return (List<AVMNode>)query.list(); 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. * Inappropriate hack to get Hibernate to play nice.
*/ */

View File

@@ -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.
}
}

View File

@@ -20,24 +20,24 @@ package org.alfresco.repo.avm.hibernate;
import java.util.List; import java.util.List;
import org.alfresco.repo.avm.AVMNode; import org.alfresco.repo.avm.AVMNode;
import org.alfresco.repo.avm.NewInRepository; import org.alfresco.repo.avm.NewInAVMStore;
import org.alfresco.repo.avm.NewInRepositoryDAO; import org.alfresco.repo.avm.NewInAVMStoreDAO;
import org.alfresco.repo.avm.Repository; import org.alfresco.repo.avm.AVMStore;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/** /**
* Hibernate implementation of NewInRepository DAO. * Hibernate implementation of NewInAVMStore DAO.
* @author britt * @author britt
*/ */
public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements public class NewInAVMStoreDAOHibernate extends HibernateDaoSupport implements
NewInRepositoryDAO NewInAVMStoreDAO
{ {
/** /**
* Save one. * Save one.
* @param newEntry The item to save. * @param newEntry The item to save.
*/ */
public void save(NewInRepository newEntry) public void save(NewInAVMStore newEntry)
{ {
getSession().save(newEntry); getSession().save(newEntry);
} }
@@ -47,31 +47,31 @@ public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements
* @param node The node to lookup with. * @param node The node to lookup with.
* @return The Entry or null if not found. * @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); query.setEntity("node", node);
return (NewInRepository)query.uniqueResult(); return (NewInAVMStore)query.uniqueResult();
} }
/** /**
* Get all that are in the given repository. * Get all that are in the given store.
* @param repository The Repository. * @param store The AVMStore.
* @return A List of NewInRepositorys. * @return A List of NewInAVMStores.
*/ */
@SuppressWarnings("unchecked") @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 query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.avmStore = :store");
query.setEntity("rep", repository); query.setEntity("store", store);
return (List<NewInRepository>)query.list(); return (List<NewInAVMStore>)query.list();
} }
/** /**
* Delete the given entry. * Delete the given entry.
* @param newEntry The entry to delete. * @param newEntry The entry to delete.
*/ */
public void delete(NewInRepository newEntry) public void delete(NewInAVMStore newEntry)
{ {
getSession().delete(newEntry); getSession().delete(newEntry);
} }

View File

@@ -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.
}
}

View File

@@ -20,7 +20,7 @@ package org.alfresco.repo.avm.hibernate;
import java.util.Date; import java.util.Date;
import java.util.List; 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.VersionRoot;
import org.alfresco.repo.avm.VersionRootDAO; import org.alfresco.repo.avm.VersionRootDAO;
import org.hibernate.Query; import org.hibernate.Query;
@@ -61,73 +61,70 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
} }
/** /**
* Get all the version roots in a given repository. * Get all the version roots in a given store.
* @param rep The repository. * @param store The store.
* @return A List of VersionRoots. In id order. * @return A List of VersionRoots. In id order.
*/ */
@SuppressWarnings("unchecked") @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 query = getSession().createQuery("from VersionRootImpl v where v.avmStore = :store order by v.versionID");
query.setEntity("rep", rep); query.setEntity("store", store);
return (List<VersionRoot>)query.list(); return (List<VersionRoot>)query.list();
} }
/** /**
* Get the version of a repository by dates. * Get the version of a store by dates.
* @param rep The repository. * @param store The store.
* @param from The starting date. May be null but not with to null also. * @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. * @param to The ending date. May be null but not with from null also.
* @return A List of VersionRoots. * @return A List of VersionRoots.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<VersionRoot> getByDates(Repository rep, Date from, Date to) public List<VersionRoot> getByDates(AVMStore store, Date from, Date to)
{ {
Query query; Query query;
if (from == null) if (from == null)
{ {
query = query =
getSession().createQuery("from VersionRootImpl vr where vr.createDate <= :to " + getSession().createQuery("from VersionRootImpl vr where vr.createDate <= :to " +
"and vr.repository = :rep " + "and vr.avmStore = :store " +
"order by vr.versionID"); "order by vr.versionID");
query.setLong("to", to.getTime()); query.setLong("to", to.getTime());
query.setEntity("rep", rep);
} }
else if (to == null) else if (to == null)
{ {
query = query =
getSession().createQuery("from VersionRootImpl vr " + getSession().createQuery("from VersionRootImpl vr " +
"where vr.createDate >= :from " + "where vr.createDate >= :from " +
"and vr.repository = :rep " + "and vr.avmStore = :store " +
"order by vr.versionID"); "order by vr.versionID");
query.setLong("from", from.getTime()); query.setLong("from", from.getTime());
query.setEntity("rep", rep);
} }
else else
{ {
query = query =
getSession().createQuery("from VersionRootImpl vr "+ getSession().createQuery("from VersionRootImpl vr "+
"where vr.createDate between :from and :to " + "where vr.createDate between :from and :to " +
"and vr.repository = :rep " + "and vr.avmStore = :store " +
"order by vr.versionID"); "order by vr.versionID");
query.setLong("from", from.getTime()); query.setLong("from", from.getTime());
query.setLong("to", to.getTime()); query.setLong("to", to.getTime());
query.setEntity("rep", rep);
} }
query.setEntity("rep", rep); query.setEntity("store", store);
return (List<VersionRoot>)query.list(); return (List<VersionRoot>)query.list();
} }
/** /**
* Get the VersionRoot corresponding to the given id. * Get the VersionRoot corresponding to the given id.
* @param rep The repository * @param store The store
* @param id The version id. * @param id The version id.
* @return The VersionRoot or null if not found. * @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 query = getSession().getNamedQuery("VersionRoot.VersionByID");
query.setEntity("rep", rep); query.setEntity("store", store);
query.setInteger("version", id); query.setInteger("version", id);
return (VersionRoot)query.uniqueResult(); return (VersionRoot)query.uniqueResult();
} }
@@ -137,7 +134,7 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
* @param rep The repository. * @param rep The repository.
* @return The highest numbered version. * @return The highest numbered version.
*/ */
public VersionRoot getMaxVersion(Repository rep) public VersionRoot getMaxVersion(AVMStore rep)
{ {
Query query = getSession().createQuery("from VersionRootImpl vr " + Query query = getSession().createQuery("from VersionRootImpl vr " +
"where vr.versionID = " + "where vr.versionID = " +