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