mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Just a pass at kruft removal.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3307 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -76,7 +76,6 @@ public interface AVMNode
|
||||
*/
|
||||
public int getType();
|
||||
|
||||
|
||||
/**
|
||||
* Get the descriptor for this node.
|
||||
* @param lPath The Lookup.
|
||||
|
@@ -35,7 +35,7 @@ public interface AVMNodeDAO
|
||||
* point to that repository.
|
||||
* @param rep The Repository.
|
||||
*/
|
||||
public void dereferenceNodesInRepository(Repository rep);
|
||||
public void unreferenceRepository(Repository rep);
|
||||
|
||||
/**
|
||||
* Delete a single node.
|
||||
|
@@ -19,9 +19,6 @@ package org.alfresco.repo.avm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
|
||||
/**
|
||||
* Base class for all repository file system like objects.
|
||||
* @author britt
|
||||
|
@@ -22,8 +22,7 @@ import org.hibernate.proxy.HibernateProxy;
|
||||
/**
|
||||
* Utility for unwrapping (getting the actual instance of) an AVMNode from what
|
||||
* may be a HibernateProxy. Bitter Hibernate note: Hibernate proxies for polymorphic
|
||||
* types are fundamentally broken. The Hibernate schmucks claim its a CGLIB problem.
|
||||
* The CGLIB villains dither unintelligibly.
|
||||
* types are fundamentally broken.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMNodeUnwrapper
|
||||
|
@@ -101,22 +101,6 @@ public class AVMStressTest extends AVMServiceTestBase
|
||||
exited++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - sampStart > 30000)
|
||||
{
|
||||
System.err.println("RATE: " + (((long)AVMTester.GetCount()) * 1000 / (now - sampStart)));
|
||||
for (AVMTester tester : testers)
|
||||
{
|
||||
tester.setExit();
|
||||
}
|
||||
for (Thread thread : threads)
|
||||
{
|
||||
thread.join();
|
||||
}
|
||||
fail();
|
||||
}
|
||||
*/
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
@@ -91,12 +90,6 @@ public interface DirectoryNode extends AVMNode
|
||||
*/
|
||||
public void retarget(Lookup lPath, String target);
|
||||
|
||||
/**
|
||||
* Get all the directly contained children of a node.
|
||||
* @return A List of Child entries.
|
||||
*/
|
||||
public List<ChildEntry> getChildren();
|
||||
|
||||
/**
|
||||
* Set whether this node is a root node.
|
||||
* @param isRoot
|
||||
|
@@ -17,8 +17,6 @@
|
||||
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Base class for Directories.
|
||||
* @author britt
|
||||
@@ -42,36 +40,4 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
|
||||
{
|
||||
super(id, repo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the ChildEntry in this directory with the given name.
|
||||
* @param name The name to look for.
|
||||
* @param write Whether the child should be looked up for writing.
|
||||
* @return The ChildEntry or null if not found.
|
||||
*/
|
||||
protected ChildEntry getChild(String name, boolean write)
|
||||
{
|
||||
return AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the children of this directory. NB, this should
|
||||
* really be considered an internal method but it needs to be
|
||||
* exposed through the interface.
|
||||
* @return A List of ChildEntries.
|
||||
*/
|
||||
public List<ChildEntry> getChildren()
|
||||
{
|
||||
return AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ChildEntry that has the given child.
|
||||
* @param child The child node to look for.
|
||||
* @return The ChildEntry or null if not found.
|
||||
*/
|
||||
protected ChildEntry getChild(AVMNode child)
|
||||
{
|
||||
return AVMContext.fgInstance.fChildEntryDAO.getByParentChild(this, child);
|
||||
}
|
||||
}
|
||||
|
@@ -91,7 +91,6 @@ class HistoryLinkImpl implements HistoryLink, Serializable
|
||||
}
|
||||
HistoryLink o = (HistoryLink)obj;
|
||||
return fAncestor.equals(o.getAncestor()) && fDescendent.equals(o.getDescendent());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -92,7 +92,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
fLayerID = -1;
|
||||
fOpacity = false;
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
for (ChildEntry child : other.getChildren())
|
||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
||||
{
|
||||
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
||||
this,
|
||||
@@ -128,7 +128,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
if (copyContents)
|
||||
{
|
||||
for (ChildEntry child : other.getChildren())
|
||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
||||
{
|
||||
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
||||
this,
|
||||
@@ -260,7 +260,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
*/
|
||||
public void putChild(String name, AVMNode node)
|
||||
{
|
||||
ChildEntry existing = getChild(name, true);
|
||||
ChildEntry existing = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.setChild(node);
|
||||
@@ -286,7 +286,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
*/
|
||||
public boolean directlyContains(AVMNode node)
|
||||
{
|
||||
return getChild(node) != null;
|
||||
return AVMContext.fgInstance.fChildEntryDAO.getByParentChild(this, node) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,7 +331,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
}
|
||||
listing.put(name, baseListing.get(name));
|
||||
}
|
||||
for (ChildEntry entry : getChildren())
|
||||
for (ChildEntry entry : AVMContext.fgInstance.fChildEntryDAO.getByParent(this))
|
||||
{
|
||||
listing.put(entry.getName(), entry.getChild());
|
||||
}
|
||||
@@ -379,7 +379,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
baseListing.remove(child.getName());
|
||||
}
|
||||
List<ChildEntry> children = getChildren();
|
||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
for (ChildEntry child : children)
|
||||
{
|
||||
baseListing.put(child.getName(),
|
||||
@@ -406,7 +406,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ChildEntry entry = getChild(name, write);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry != null)
|
||||
{
|
||||
return AVMNodeUnwrapper.Unwrap(entry.getChild());
|
||||
@@ -449,7 +449,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ChildEntry entry = getChild(name, false);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry != null)
|
||||
{
|
||||
return entry.getChild().getDescriptor(mine.getPath(),
|
||||
@@ -489,7 +489,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
@SuppressWarnings("unchecked")
|
||||
public void removeChild(String name)
|
||||
{
|
||||
ChildEntry entry = getChild(name, true);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry != null)
|
||||
{
|
||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
||||
|
@@ -128,7 +128,6 @@ class Lookup
|
||||
fPosition++;
|
||||
return;
|
||||
}
|
||||
// SuperRepository.GetInstance().getSession().lock(node, LockMode.READ);
|
||||
if (fPosition >= 0 && fDirectlyContained &&
|
||||
fComponents.get(fPosition).getNode().getType() == AVMNodeType.LAYERED_DIRECTORY)
|
||||
{
|
||||
@@ -195,7 +194,6 @@ class Lookup
|
||||
fTopLayer = (LayeredDirectoryNode)node;
|
||||
}
|
||||
((DirectoryNode)fComponents.get(fPosition - 1).getNode()).putChild(name, node);
|
||||
// TODO More Hibernate hijinx: SuperRepository.GetInstance().getSession().flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,16 +336,4 @@ class Lookup
|
||||
{
|
||||
return fComponents.get(fPosition).getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire locks for writing, in path lookup order.
|
||||
*/
|
||||
// public void acquireLocks()
|
||||
// {
|
||||
// Session sess = SuperRepository.GetInstance().getSession();
|
||||
// for (LookupComponent comp : fComponents)
|
||||
// {
|
||||
// sess.lock(comp.getNode(), LockMode.UPGRADE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@@ -243,7 +243,7 @@ public class OrphanReaper implements Runnable
|
||||
}
|
||||
AVMContext.fgInstance.fAVMNodeDAO.delete(node);
|
||||
}
|
||||
else if (node instanceof PlainFileNode)
|
||||
else if (node.getType() == AVMNodeType.PLAIN_FILE)
|
||||
{
|
||||
AVMContext.fgInstance.fAVMNodeDAO.delete(node);
|
||||
// FileContent should be purged if nobody else references it.
|
||||
|
@@ -59,7 +59,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
super(repos.getSuperRepository().issueID(), repos);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||
// TODO Something about this. sess.flush();
|
||||
for (ChildEntry child : other.getChildren())
|
||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
||||
{
|
||||
ChildEntry newChild = new ChildEntryImpl(child.getName(),
|
||||
this,
|
||||
@@ -76,7 +76,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
*/
|
||||
public boolean directlyContains(AVMNode node)
|
||||
{
|
||||
return getChild(node) != null;
|
||||
return AVMContext.fgInstance.fChildEntryDAO.getByParentChild(this, node) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
public Map<String, AVMNode> getListing(Lookup lPath)
|
||||
{
|
||||
TreeMap<String, AVMNode> result = new TreeMap<String, AVMNode>();
|
||||
List<ChildEntry> children = getChildren();
|
||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
for (ChildEntry child : children)
|
||||
{
|
||||
result.put(child.getName(), child.getChild());
|
||||
@@ -108,7 +108,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
throw new AVMBadArgumentException("Path is null.");
|
||||
}
|
||||
SortedMap<String, AVMNodeDescriptor> result = new TreeMap<String, AVMNodeDescriptor>();
|
||||
List<ChildEntry> children = getChildren();
|
||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
for (ChildEntry child : children)
|
||||
{
|
||||
result.put(child.getName(),
|
||||
@@ -130,7 +130,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
{
|
||||
// We're doing the hand unrolling of the proxy because
|
||||
// Hibernate/CGLIB proxies are broken.
|
||||
ChildEntry entry = getChild(name, write);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry == null)
|
||||
{
|
||||
return null;
|
||||
@@ -150,7 +150,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
{
|
||||
throw new AVMBadArgumentException("Path is null.");
|
||||
}
|
||||
ChildEntry entry = getChild(name, false);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry == null)
|
||||
{
|
||||
return null;
|
||||
@@ -165,7 +165,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
@SuppressWarnings("unchecked")
|
||||
public void removeChild(String name)
|
||||
{
|
||||
ChildEntry entry = getChild(name, true);
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry != null)
|
||||
{
|
||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
||||
|
@@ -29,8 +29,6 @@ import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
||||
/**
|
||||
* A Repository contains a current root directory and a list of
|
||||
* root versions. Each root version corresponds to a separate snapshot
|
||||
@@ -141,7 +139,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
for (AVMNode newNode : anDAO.getNewInRepo(this))
|
||||
{
|
||||
newNode.setIsNew(false);
|
||||
// anDAO.update(newNode);
|
||||
}
|
||||
// TODO: This is a grotesque hack to deal with hibernate.
|
||||
anDAO.flush();
|
||||
@@ -165,7 +162,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
public void createDirectory(String path, String name)
|
||||
{
|
||||
Lookup lPath = lookupDirectory(-1, path, true);
|
||||
// lPath.acquireLocks();
|
||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||
if (dir.lookupChild(lPath, name, -1, true) != null)
|
||||
{
|
||||
@@ -199,7 +195,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
String name)
|
||||
{
|
||||
Lookup lPath = lookupDirectory(-1, dstPath, true);
|
||||
// lPath.acquireLocks();
|
||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||
if (dir.lookupChild(lPath, name, -1, true) != null)
|
||||
{
|
||||
@@ -234,7 +229,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
public OutputStream createFile(String path, String name)
|
||||
{
|
||||
Lookup lPath = lookupDirectory(-1, path, true);
|
||||
// lPath.acquireLocks();
|
||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||
if (dir.lookupChild(lPath, name, -1, true) != null)
|
||||
{
|
||||
@@ -276,7 +270,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
public void createLayeredFile(String srcPath, String dstPath, String name)
|
||||
{
|
||||
Lookup lPath = lookupDirectory(-1, dstPath, true);
|
||||
// lPath.acquireLocks();
|
||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||
if (dir.lookupChild(lPath, name, -1, true) != null)
|
||||
{
|
||||
@@ -339,7 +332,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
public OutputStream getOutputStream(String path)
|
||||
{
|
||||
Lookup lPath = lookup(-1, path, true);
|
||||
// lPath.acquireLocks();
|
||||
AVMNode node = lPath.getCurrentNode();
|
||||
if (node.getType() != AVMNodeType.PLAIN_FILE &&
|
||||
node.getType() != AVMNodeType.LAYERED_FILE)
|
||||
@@ -367,10 +359,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
throw new AVMException("Access denied: " + path);
|
||||
}
|
||||
Lookup lPath = lookup(version, path, write);
|
||||
// if (write)
|
||||
// {
|
||||
// lPath.acquireLocks();
|
||||
// }
|
||||
AVMNode node = lPath.getCurrentNode();
|
||||
if (node.getType() != AVMNodeType.PLAIN_FILE &&
|
||||
node.getType() != AVMNodeType.LAYERED_FILE)
|
||||
@@ -398,9 +386,7 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
*/
|
||||
public void removeNode(String path, String name)
|
||||
{
|
||||
// TODO Are we double checking for existence?
|
||||
Lookup lPath = lookupDirectory(-1, path, true);
|
||||
// lPath.acquireLocks();
|
||||
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
|
||||
if (dir.lookupChild(lPath, name, -1, true) == null)
|
||||
{
|
||||
@@ -418,7 +404,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
public void uncover(String dirPath, String name)
|
||||
{
|
||||
Lookup lPath = lookup(-1, dirPath, true);
|
||||
// lPath.acquireLocks();
|
||||
AVMNode node = lPath.getCurrentNode();
|
||||
if (node.getType() != AVMNodeType.LAYERED_DIRECTORY)
|
||||
{
|
||||
@@ -540,7 +525,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
{
|
||||
throw new AVMWrongTypeException("Not a directory: " + pathElements[i]);
|
||||
}
|
||||
// fSuper.getSession().lock(dir, LockMode.READ);
|
||||
result.add(child, pathElements[i], write);
|
||||
dir = (DirectoryNode)result.getCurrentNode();
|
||||
}
|
||||
@@ -550,7 +534,6 @@ public class RepositoryImpl implements Repository, Serializable
|
||||
{
|
||||
throw new AVMNotFoundException("Not found: " + pathElements[pathElements.length - 1]);
|
||||
}
|
||||
// fSuper.getSession().lock(child, LockMode.READ);
|
||||
result.add(child, pathElements[pathElements.length - 1], write);
|
||||
return result;
|
||||
}
|
||||
|
@@ -11,5 +11,4 @@ public interface RetryingTransaction
|
||||
* @param write Whether this is a write operation.
|
||||
*/
|
||||
public void perform(RetryingTransactionCallback callback, boolean write);
|
||||
|
||||
}
|
@@ -122,7 +122,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.createDirectory(pathParts[1], name);
|
||||
}
|
||||
|
||||
@@ -157,7 +156,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(dstPath);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.createLayeredFile(srcPath, pathParts[1], name);
|
||||
}
|
||||
|
||||
@@ -201,15 +199,12 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(srcPath);
|
||||
Repository srcRepo = getRepositoryByName(pathParts[0], false);
|
||||
// fSession.get().lock(srcRepo, LockMode.READ);
|
||||
Lookup sPath = srcRepo.lookup(version, pathParts[1], false);
|
||||
// Lookup the destination directory.
|
||||
fLookupCount.set(1);
|
||||
pathParts = SplitPath(dstPath);
|
||||
Repository dstRepo = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(dstRepo, LockMode.UPGRADE);
|
||||
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
// dPath.acquireLocks();
|
||||
DirectoryNode dirNode = (DirectoryNode)dPath.getCurrentNode();
|
||||
AVMNode srcNode = sPath.getCurrentNode();
|
||||
AVMNode dstNode = null;
|
||||
@@ -250,7 +245,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
return rep.getOutputStream(pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -266,7 +260,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
return rep.getRandomAccess(version, pathParts[1], access);
|
||||
}
|
||||
|
||||
@@ -288,9 +281,7 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(srcPath);
|
||||
Repository srcRepo = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(srcRepo, LockMode.UPGRADE);
|
||||
Lookup sPath = srcRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
// sPath.acquireLocks();
|
||||
DirectoryNode srcDir = (DirectoryNode)sPath.getCurrentNode();
|
||||
AVMNode srcNode = srcDir.lookupChild(sPath, srcName, -1, true);
|
||||
if (srcNode == null)
|
||||
@@ -300,9 +291,7 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
pathParts = SplitPath(dstPath);
|
||||
Repository dstRepo = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(dstRepo, LockMode.UPGRADE);
|
||||
Lookup dPath = dstRepo.lookupDirectory(-1, pathParts[1], true);
|
||||
// dPath.acquireLocks();
|
||||
DirectoryNode dstDir = (DirectoryNode)dPath.getCurrentNode();
|
||||
AVMNode dstNode = dstDir.lookupChild(dPath, dstName, -1, true);
|
||||
if (dstNode != null)
|
||||
@@ -405,7 +394,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(dirPath);
|
||||
Repository repo = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(repo, LockMode.UPGRADE);
|
||||
repo.uncover(pathParts[1], name);
|
||||
}
|
||||
|
||||
@@ -420,7 +408,6 @@ class SuperRepository
|
||||
for (String repName : repositories)
|
||||
{
|
||||
Repository repo = getRepositoryByName(repName, true);
|
||||
// fSession.get().lock(repo, LockMode.UPGRADE);
|
||||
result.add(repo.createSnapshot());
|
||||
}
|
||||
return result;
|
||||
@@ -434,8 +421,6 @@ class SuperRepository
|
||||
public int createSnapshot(String repository)
|
||||
{
|
||||
Repository repo = getRepositoryByName(repository, true);
|
||||
// fSession.get().lock(repo, LockMode.UPGRADE);
|
||||
// fSession.get().lock(repo, LockMode.UPGRADE);
|
||||
return repo.createSnapshot();
|
||||
}
|
||||
|
||||
@@ -449,7 +434,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(repo, LockMode.UPGRADE);
|
||||
repo.removeNode(pathParts[1], name);
|
||||
}
|
||||
|
||||
@@ -462,17 +446,14 @@ class SuperRepository
|
||||
public void purgeRepository(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
AVMNode root = rep.getRoot();
|
||||
root.setIsRoot(false);
|
||||
// AVMContext.fgInstance.fAVMNodeDAO.update(root);
|
||||
VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO;
|
||||
List<VersionRoot> vRoots = vrDAO.getAllInRepository(rep);
|
||||
for (VersionRoot vr : vRoots)
|
||||
{
|
||||
AVMNode node = vr.getRoot();
|
||||
node.setIsRoot(false);
|
||||
// AVMContext.fgInstance.fAVMNodeDAO.update(node);
|
||||
vrDAO.delete(vr);
|
||||
}
|
||||
Iterator<AVMNode> iter = AVMContext.fgInstance.fAVMNodeDAO.getByRepository(rep);
|
||||
@@ -493,7 +474,6 @@ class SuperRepository
|
||||
public void purgeVersion(String name, int version)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.purgeVersion(version);
|
||||
}
|
||||
|
||||
@@ -508,7 +488,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], false);
|
||||
// fSession.get().lock(repo, LockMode.READ);
|
||||
return repo.getInputStream(version, pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -545,7 +524,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository repo = getRepositoryByName(pathParts[0], false);
|
||||
// fSession.get().lock(repo, LockMode.READ);
|
||||
return repo.getListing(version, pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -602,7 +580,6 @@ class SuperRepository
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.getVersions();
|
||||
}
|
||||
|
||||
@@ -617,7 +594,6 @@ class SuperRepository
|
||||
public List<VersionDescriptor> getRepositoryVersions(String name, Date from, Date to)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.getVersions(from, to);
|
||||
}
|
||||
|
||||
@@ -659,7 +635,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], false);
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.getIndirectionPath(version, pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -671,7 +646,6 @@ class SuperRepository
|
||||
public int getLatestVersionID(String name)
|
||||
{
|
||||
Repository rep = getRepositoryByName(name, false);
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.getNextVersionID();
|
||||
}
|
||||
|
||||
@@ -704,7 +678,6 @@ class SuperRepository
|
||||
{
|
||||
throw new AVMNotFoundException("Not found: " + name);
|
||||
}
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.getRoot(version);
|
||||
}
|
||||
|
||||
@@ -778,7 +751,6 @@ class SuperRepository
|
||||
}
|
||||
String [] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], false);
|
||||
// fSession.get().lock(rep, LockMode.READ);
|
||||
return rep.lookupDirectory(version, pathParts[1], false);
|
||||
}
|
||||
|
||||
@@ -815,7 +787,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.makePrimary(pathParts[1]);
|
||||
}
|
||||
|
||||
@@ -829,7 +800,6 @@ class SuperRepository
|
||||
fLookupCount.set(1);
|
||||
String[] pathParts = SplitPath(path);
|
||||
Repository rep = getRepositoryByName(pathParts[0], true);
|
||||
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||
rep.retargetLayeredDirectory(pathParts[1], target);
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
* @param rep The Repository.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void dereferenceNodesInRepository(Repository rep)
|
||||
public void unreferenceRepository(Repository rep)
|
||||
{
|
||||
Session sess = getSession();
|
||||
Query query = sess.createQuery("from AVMNodeImpl an where an.repository = :rep");
|
||||
|
Reference in New Issue
Block a user