Changed signatures of directory listing returning methods to

SortedMap where appropriate.  Fixed embarassing accumulation of
broken javadocs.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-06-27 23:29:57 +00:00
parent 39728a6f86
commit be6dd8c9dc
26 changed files with 86 additions and 81 deletions

View File

@@ -79,14 +79,15 @@ interface AVMNode
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @param name The name of this in the current context.
* @return The descriptor for this node.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name);
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return The descriptor for this node.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath);

View File

@@ -290,7 +290,7 @@ public class AVMNodeDescriptor
/**
* Get the layer id of this node.
* @return
* @return The layer id if there is one or -1.
*/
public long getLayerID()
{

View File

@@ -94,7 +94,7 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
/**
* Set the ancestor of this node.
* @param ancector The ancestor to set.
* @param ancestor The ancestor to set.
*/
public void setAncestor(AVMNode ancestor)
{
@@ -279,7 +279,7 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
/**
* Get the version for concurrency control.
* @return
* @return The version for optimistic locks.
*/
protected long getVers()
{
@@ -287,7 +287,8 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
}
/**
* @return
* Get whether this is a root node.
* @return Whether this is a root node.
*/
public boolean getIsRoot()
{

View File

@@ -22,7 +22,7 @@ import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
/**
* This is the service interface for the [Alfresco|Addled|Advanced|Aleatoric|Apotheosed|Awful]
@@ -70,26 +70,25 @@ public interface AVMService
* @param path The simple absolute path to the file node.
* @return A List of FolderEntrys.
*/
public Map<String, AVMNodeDescriptor> getDirectoryListing(int version, String path);
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(int version, String path);
/**
* Get a directory listing from a node descriptor.
* @param dir The directory node descriptor.
* @return A Map of names to node descriptors.
*/
public Map<String, AVMNodeDescriptor> getDirectoryListing(AVMNodeDescriptor dir);
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(AVMNodeDescriptor dir);
/**
* Create a new File. Fails if the file already exists.
* @param path The simple absolute path to the parent.
* @param name The name to give the file.
* @param source A possibly null stream to draw initial contents from.
*/
public OutputStream createFile(String path, String name);
/**
* Create a new directory.
* @param parent The simple absolute path to the parent.
* @param path The simple absolute path to the parent.
* @param name The name to give the folder.
*/
public void createDirectory(String path, String name);

View File

@@ -23,7 +23,7 @@ import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import org.alfresco.repo.avm.SuperRepository;
import org.alfresco.repo.avm.hibernate.HibernateHelper;
@@ -76,7 +76,6 @@ public class AVMServiceImpl implements AVMService
/**
* Basic constructor for the service.
* @param createTables Flag for whether tables should be created.
*/
public AVMServiceImpl()
{
@@ -241,7 +240,7 @@ public class AVMServiceImpl implements AVMService
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMService#getFolderListing(int, java.lang.String)
*/
public Map<String, AVMNodeDescriptor> getDirectoryListing(final int version, final String path)
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(final int version, final String path)
{
if (path == null)
{
@@ -249,7 +248,7 @@ public class AVMServiceImpl implements AVMService
}
class HTxnCallback implements HibernateTxnCallback
{
public Map<String, AVMNodeDescriptor> listing;
public SortedMap<String, AVMNodeDescriptor> listing;
public void perform(Session session)
{
@@ -267,7 +266,7 @@ public class AVMServiceImpl implements AVMService
* @param dir The directory node descriptor.
* @return A Map of names to node descriptors.
*/
public Map<String, AVMNodeDescriptor> getDirectoryListing(final AVMNodeDescriptor dir)
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(final AVMNodeDescriptor dir)
{
if (dir == null)
{
@@ -275,7 +274,7 @@ public class AVMServiceImpl implements AVMService
}
class HTxnCallback implements HibernateTxnCallback
{
public Map<String, AVMNodeDescriptor> listing;
public SortedMap<String, AVMNodeDescriptor> listing;
public void perform(Session session)
{

View File

@@ -76,7 +76,7 @@ public class AVMServiceTestBase extends TestCase
* Get the recursive contents of the given path and version.
* @param path
* @param version
* @return
* @return A string representation of the contents.
*/
protected String recursiveContents(String path, int version, boolean followLinks)
{

View File

@@ -73,7 +73,7 @@ public class AVMStressTest extends AVMServiceTestBase
thread.start();
}
int exited = 0;
long sampStart = System.currentTimeMillis();
// long sampStart = System.currentTimeMillis();
while (exited != nThreads)
{
try

View File

@@ -80,7 +80,7 @@ public class ChildEntryImpl implements ChildEntry, Serializable
/**
* Get the name of this entry.
* @return
* @return The name of this entry.
*/
public String getName()
{
@@ -98,7 +98,7 @@ public class ChildEntryImpl implements ChildEntry, Serializable
/**
* Get the parent in this entry.
* @return
* @return The parent.
*/
public DirectoryNode getParent()
{
@@ -116,7 +116,7 @@ public class ChildEntryImpl implements ChildEntry, Serializable
/**
* Get the child in this entry.
* @return
* @return The child.
*/
public AVMNode getChild()
{
@@ -124,8 +124,9 @@ public class ChildEntryImpl implements ChildEntry, Serializable
}
/**
* Equals override.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)
@@ -143,7 +144,8 @@ public class ChildEntryImpl implements ChildEntry, Serializable
}
/**
* @return
* Get the hash code.
* @return The hash code.
*/
@Override
public int hashCode()
@@ -152,7 +154,8 @@ public class ChildEntryImpl implements ChildEntry, Serializable
}
/**
* @return the vers
* Get the version for optimistic locking.
* @return The version for optimistic locking.
*/
protected long getVers()
{
@@ -160,6 +163,7 @@ public class ChildEntryImpl implements ChildEntry, Serializable
}
/**
* Set the version for optimistic locking.
* @param vers the vers to set
*/
protected void setVers(long vers)

View File

@@ -95,7 +95,7 @@ public class DeletedChildImpl implements DeletedChild, Serializable
/**
* Equality in the database entity sense.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)
@@ -113,6 +113,7 @@ public class DeletedChildImpl implements DeletedChild, Serializable
}
/**
* Get a hash code.
* @return A hash code.
*/
@Override

View File

@@ -18,6 +18,7 @@ package org.alfresco.repo.avm;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
/**
* The interface for Directory Nodes.
@@ -65,8 +66,7 @@ interface DirectoryNode extends AVMNode
/**
* Get a directory listing.
* @param lPath The lookup context.
* @param version The version to look under.
* @return A Map of names to DirectoryEntries.
* @return A SortedMap of names to DirectoryEntries.
*/
public Map<String, AVMNode> getListing(Lookup lPath);
@@ -75,7 +75,7 @@ interface DirectoryNode extends AVMNode
* @param dir The directory to list.
* @return A Map of names to node descriptors
*/
public Map<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir);
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir);
/**
* Set the directory, which must be in a layer, into a primary

View File

@@ -64,7 +64,6 @@ interface FileContent
/**
* Get the length of the file.
* @param superRepo
* @return The length of the file.
*/
public long getLength();

View File

@@ -182,7 +182,6 @@ class FileContentImpl implements FileContent, Serializable
* Get a random access file from this content. It's the responsibility of
* the caller of this to insure that this object has been copied if the
* access argument is a write mode.
* @param superRepo The SuperRepository.
* @param access The access more for RandomAccessFile.
* @return A RandomAccessFile.
*/
@@ -300,7 +299,7 @@ class FileContentImpl implements FileContent, Serializable
/**
* Equals predicate. Based on object ID.
* @param obj The obect to compare against.
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)

View File

@@ -43,7 +43,7 @@ interface HistoryLink
/**
* Get the descendent part of this.
* @return
* @return The descendent of this link.
*/
public AVMNode getDescendent();
}

View File

@@ -74,8 +74,9 @@ class HistoryLinkImpl implements HistoryLink, Serializable
}
/**
* Equals override.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)
@@ -94,7 +95,8 @@ class HistoryLinkImpl implements HistoryLink, Serializable
}
/**
* @return
* Get the hashcode.
* @return The hashcode.
*/
@Override
public int hashCode()

View File

@@ -4,7 +4,7 @@
package org.alfresco.repo.avm;
/**
* Layered nodes share this method.
* Layered nodes share these methods.
* @author britt
*/
interface Layered
@@ -14,7 +14,7 @@ interface Layered
* node points to.
* @param lookup The lookup path. Needed for most nodes to determine
* underlying path.
* @return
* @return The underlying indirection.
*/
public String getUnderlying(Lookup lookup);

View File

@@ -10,7 +10,7 @@ interface LayeredDirectoryNode extends DirectoryNode, Layered
{
/**
* Does this node have a primary indirection.
* @returns Whether this is a primary indirection.
* @return Whether this is a primary indirection.
*/
public boolean getPrimaryIndirection();
@@ -28,7 +28,7 @@ interface LayeredDirectoryNode extends DirectoryNode, Layered
/**
* Set the layer id for this node.
* @param layerID The id to set.
* @param id The id to set.
*/
public void setLayerID(long id);

View File

@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.hibernate.Query;
@@ -68,7 +69,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/**
* Make a new one from a specified indirection path.
* @param indirection The indirection path to set.
* @param repository The repository that owns this node.
* @param repos The repository that owns this node.
*/
public LayeredDirectoryNodeImpl(String indirection, Repository repos)
{
@@ -329,7 +330,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
}
}
// Filter the base listing by taking out anything in the deleted Set.
Map<String, AVMNode> listing = new TreeMap<String, AVMNode>();
Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
for (String name : baseListing.keySet())
{
if (getDeleted(name) != null)
@@ -350,13 +351,13 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
* @param dir The directory node descriptor.
* @return A Map of names to node descriptors.
*/
public Map<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
{
if (dir.getPath() == null || dir.getIndirection() == null)
{
throw new AVMBadArgumentException("Illegal null argument.");
}
Map<String, AVMNodeDescriptor> baseListing = new TreeMap<String, AVMNodeDescriptor>();
SortedMap<String, AVMNodeDescriptor> baseListing = new TreeMap<String, AVMNodeDescriptor>();
// If we are not opaque, get the underlying base listing.
if (!fOpacity)
{
@@ -570,7 +571,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name)
@@ -605,7 +606,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath)
@@ -636,7 +637,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
* @param parentPath The parent path.
* @param name The name this was looked up with.
* @param parentIndirection The indirection of the parent.
* @return
* @return The descriptor.
*/
public AVMNodeDescriptor getDescriptor(String parentPath, String name, String parentIndirection)
{

View File

@@ -95,7 +95,6 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
/**
* Get the content of the specified version.
* @param repo The Repository.
* @return A FileContent object.
*/
public FileContent getContentForRead()
@@ -143,7 +142,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name)
@@ -178,7 +177,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath)
@@ -208,7 +207,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
* @param parentPath The parent path.
* @param name The name this was looked up with.
* @param parentIndirection The parent indirection.
* @return
* @return The descriptor.
*/
public AVMNodeDescriptor getDescriptor(String parentPath, String name, String parentIndirection)
{

View File

@@ -74,8 +74,9 @@ class MergeLinkImpl implements MergeLink, Serializable
}
/**
* Override of equals.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)
@@ -93,7 +94,8 @@ class MergeLinkImpl implements MergeLink, Serializable
}
/**
* @return
* Get the hash code.
* @return The hash code.
*/
@Override
public int hashCode()

View File

@@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.hibernate.Session;
@@ -85,7 +86,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
/**
* Get a directory listing.
* @param lPath The lookup path.
* @param version Which version.
* @return The listing.
*/
@SuppressWarnings("unchecked")
@@ -105,13 +105,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
* @param dir The directory node descriptor.
* @return A Map of names to node descriptors.
*/
public Map<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
{
if (dir.getPath() == null)
{
throw new AVMBadArgumentException("Path is null.");
}
TreeMap<String, AVMNodeDescriptor> result = new TreeMap<String, AVMNodeDescriptor>();
SortedMap<String, AVMNodeDescriptor> result = new TreeMap<String, AVMNodeDescriptor>();
List<ChildEntry> children = getChildren();
for (ChildEntry child : children)
{
@@ -200,7 +200,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
/**
* Copy on write logic.
* @param lPath The lookup path.
* @return
* @return A brand new copied version.
*/
public AVMNode copy(Lookup lPath)
{
@@ -265,7 +265,8 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @param name The name of this node in this context.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name)
@@ -300,7 +301,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath)

View File

@@ -42,7 +42,6 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
* Make one from just a repository.
* This is the constructor used when a brand new plain file is being made.
* @param repos A Repository.
* @param source A possibly null stream from which to get data.
*/
public PlainFileNodeImpl(Repository repos)
{
@@ -133,7 +132,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name)
@@ -168,7 +167,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
/**
* Get the descriptor for this node.
* @param The Lookup.
* @param lPath The Lookup.
* @return A descriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath)

View File

@@ -21,7 +21,7 @@ import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
/**
* The repository interface. Methods for filesystem like, versioning,
@@ -69,7 +69,7 @@ interface Repository
* Create a new file. The designated file cannot already exist.
* @param path The path to the directory to contain the new file.
* @param name The name to give the new file.
* @param source An InputStream of data to put in the file. May be null.
* @return An OutputStream.
*/
public OutputStream createFile(String path, String name);
@@ -95,7 +95,7 @@ interface Repository
* @param path The path to the directory.
* @return A listing.
*/
public Map<String, AVMNodeDescriptor> getListing(int version, String path);
public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path);
/**
* Get an output stream to a file.

View File

@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.hibernate.Query;
@@ -222,7 +223,6 @@ class RepositoryImpl implements Repository, Serializable
* Create a new file.
* @param path The path to the directory to contain the new file.
* @param name The name to give the new file.
* @param source A (possibly null) InputStream from which to get
* initial content.
*/
public OutputStream createFile(String path, String name)
@@ -288,12 +288,12 @@ class RepositoryImpl implements Repository, Serializable
* @param path The path to the directory.
* @return A List of FolderEntries.
*/
public Map<String, AVMNodeDescriptor> getListing(int version, String path)
public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path)
{
Lookup lPath = lookupDirectory(version, path, false);
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
Map<String, AVMNode> listing = dir.getListing(lPath);
Map<String, AVMNodeDescriptor> results = new TreeMap<String, AVMNodeDescriptor>();
SortedMap<String, AVMNodeDescriptor> results = new TreeMap<String, AVMNodeDescriptor>();
for (String name : listing.keySet())
{
AVMNode child = listing.get(name);
@@ -728,8 +728,9 @@ class RepositoryImpl implements Repository, Serializable
}
/**
* Equals override.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)
@@ -746,13 +747,13 @@ class RepositoryImpl implements Repository, Serializable
}
/**
* @return
* Get a hash code.
* @return The hash code.
*/
@Override
public int hashCode()
{
// TODO Auto-generated method stub
return super.hashCode();
return fName.hashCode();
}
/**
@@ -829,7 +830,7 @@ class RepositoryImpl implements Repository, Serializable
/**
* Get the descriptor for this.
* @return
* @return A RepositoryDescriptor
*/
public RepositoryDescriptor getDescriptor()
{

View File

@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import org.hibernate.LockMode;
import org.hibernate.Query;
@@ -76,7 +76,6 @@ class SuperRepository
* Create a new one. It's given issuers and a storage directory.
* @param nodeIssuer
* @param contentIssuer
* @param branchIssuer
* @param layerIssuer
* @param storage
*/
@@ -108,7 +107,6 @@ class SuperRepository
* Create a file.
* @param path The path to the containing directory.
* @param name The name for the new file.
* @param source A (possibly null) InputStream with content for the new file.
*/
public OutputStream createFile(String path, String name)
{
@@ -542,7 +540,7 @@ class SuperRepository
* @param path The path to the directory.
* @return A List of FolderEntries.
*/
public Map<String, AVMNodeDescriptor> getListing(int version, String path)
public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path)
{
fLookupCount.set(1);
String [] pathParts = SplitPath(path);
@@ -554,9 +552,9 @@ class SuperRepository
/**
* Get a directory listing from a directory node descriptor.
* @param dir The directory node descriptor.
* @return
* @return A SortedMap listing.
*/
public Map<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir)
{
fLookupCount.set(1);
AVMNode node = (AVMNode)fSession.get().get(AVMNodeImpl.class, dir.getId());
@@ -894,7 +892,7 @@ class SuperRepository
/**
* Get the single instance of SuperRepository.
* @return
* @return The single instance.
*/
public static SuperRepository GetInstance()
{

View File

@@ -157,7 +157,7 @@ public class VersionRootImpl implements VersionRoot, Serializable
/**
* Check equality. Based on Repository equality and version id equality.
* @param obj
* @return
* @return Equality.
*/
@Override
public boolean equals(Object obj)

View File

@@ -67,7 +67,6 @@ public class HibernateTxn
* Keep trying if the operation fails because of a concurrency issue.
* @param callback The worker.
* @param write Whether this is a write operation.
* @return Whether the operation finished with a commit.
*/
public void perform(HibernateTxnCallback callback, boolean write)
{