- Return the logical/script root in AbstractRepository.getRootRepository(). Fixes bug 425.

- Added some Javadoc comments.
This commit is contained in:
hns 2005-05-20 09:55:10 +00:00
parent e284f39be5
commit f671a6b838

View file

@ -65,25 +65,38 @@ public abstract class AbstractRepository implements Repository {
protected abstract Resource createResource(String name); protected abstract Resource createResource(String name);
/** /**
* * Get the full name that identifies this repository globally
* @return
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/**
* Get the local name that identifies this repository locally within its
* parent repository
*/
public String getShortName() { public String getShortName() {
return shortName; return shortName;
} }
/**
* Get this repository's logical script root repository.
*
*@see {isScriptRoot()}
*/
public Repository getRootRepository() { public Repository getRootRepository() {
if (parent == null) { if (parent == null || isScriptRoot()) {
return this; return this;
} else { } else {
return parent.getRootRepository(); 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 <code>false<code>.
*/
public Resource getResource(String name) { public Resource getResource(String name) {
update(); update();
@ -96,22 +109,35 @@ public abstract class AbstractRepository implements Repository {
return res; return res;
} }
/**
* Get an iterator over the resources contained in this repository.
*/
public Iterator getResources() { public Iterator getResources() {
update(); update();
return resources.values().iterator(); return resources.values().iterator();
} }
/**
* Get an iterator over the sub-repositories contained in this repository.
*/
public Repository[] getRepositories() { public Repository[] getRepositories() {
update(); update();
return repositories; return repositories;
} }
/**
* Get this repository's parent repository.
*/
public Repository getParentRepository() { public Repository getParentRepository() {
return parent; return parent;
} }
/**
* Get a deep list of this repository's resources, including all resources
* contained in sub-reposotories.
*/
public List getAllResources() throws IOException { public List getAllResources() throws IOException {
update(); update();
@ -125,6 +151,10 @@ public abstract class AbstractRepository implements Repository {
return allResources; return allResources;
} }
/**
* Returns the repositories full name as string representation.
* @see {getName()}
*/
public String toString() { public String toString() {
return getName(); return getName();
} }