From f671a6b838c70a122c77ea68e2e4a66a8e73b16a Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 20 May 2005 09:55:10 +0000 Subject: [PATCH] - Return the logical/script root in AbstractRepository.getRootRepository(). Fixes bug 425. - Added some Javadoc comments. --- .../repository/AbstractRepository.java | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/helma/framework/repository/AbstractRepository.java b/src/helma/framework/repository/AbstractRepository.java index 88ad88e5..e2a4d610 100644 --- a/src/helma/framework/repository/AbstractRepository.java +++ b/src/helma/framework/repository/AbstractRepository.java @@ -65,25 +65,38 @@ public abstract class AbstractRepository implements Repository { protected abstract Resource createResource(String name); /** - * - * @return + * Get the full name that identifies this repository globally */ public String getName() { return name; } + /** + * Get the local name that identifies this repository locally within its + * parent repository + */ public String getShortName() { return shortName; } + /** + * Get this repository's logical script root repository. + * + *@see {isScriptRoot()} + */ public Repository getRootRepository() { - if (parent == null) { + if (parent == null || isScriptRoot()) { return this; } else { return parent.getRootRepository(); } } + /** + * Get a resource contained in this repository identified by the given local name. + * If the name can't be resolved to a resource, a resource object is returned + * for which {@link Resource exists()} returns false. + */ public Resource getResource(String name) { update(); @@ -96,22 +109,35 @@ public abstract class AbstractRepository implements Repository { return res; } + /** + * Get an iterator over the resources contained in this repository. + */ public Iterator getResources() { update(); return resources.values().iterator(); } + /** + * Get an iterator over the sub-repositories contained in this repository. + */ public Repository[] getRepositories() { update(); return repositories; } + /** + * Get this repository's parent repository. + */ public Repository getParentRepository() { return parent; } + /** + * Get a deep list of this repository's resources, including all resources + * contained in sub-reposotories. + */ public List getAllResources() throws IOException { update(); @@ -125,6 +151,10 @@ public abstract class AbstractRepository implements Repository { return allResources; } + /** + * Returns the repositories full name as string representation. + * @see {getName()} + */ public String toString() { return getName(); }