public abstract class AbstractRepository extends Object implements Repository
SEPARATOR| Constructor and Description |
|---|
AbstractRepository() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract AbstractRepository |
createChildRepository(String name)
Create a new child reposiotory with the given name.
|
AbstractRepository |
getChildRepository(String subpath)
Get a child repository with the given name
|
String |
getModuleName()
Utility method to get the name for the module defined by this resource.
|
String |
getName()
Get the local name that identifies this repository locally within its
parent repository
|
AbstractRepository |
getParentRepository()
Get this repository's parent repository.
|
String |
getPath()
Get the full name that identifies this repository globally
|
String |
getRelativePath()
Get the path of this repository relative to its root repository.
|
Resource |
getResource(String subpath)
Get a resource contained in this repository identified by the given local name.
|
Resource[] |
getResources()
Get a list of resources contained in this repository identified by the
given local name.
|
Resource[] |
getResources(boolean recursive)
Get a list of resources contained in this repository identified by the
given local name.
|
protected abstract void |
getResources(List<Resource> list,
boolean recursive)
Add the repository's resources into the list, optionally descending into
nested repositories.
|
Resource[] |
getResources(String resourcePath,
boolean recursive)
Get a list of resources contained in this repository identified by the
given local name.
|
Repository |
getRootRepository()
Get the repository's root repository
|
boolean |
isAbsolute()
Return true if this Repository is in absolute mode.
|
protected AbstractRepository |
lookupRepository(String name) |
protected abstract Resource |
lookupResource(String name)
Called to create a child resource for this repository if it exists.
|
protected String[] |
resolve(String path,
boolean absolute)
Resolve path relative to this repository.
|
void |
setAbsolute(boolean absolute)
Set this Repository to absolute mode.
|
void |
setRoot()
Mark this repository as root repository.
|
String |
toString()
Returns the repositories full path as string representation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetRepositoriesexists, getChecksum, getUrl, lastModifiedprotected abstract Resource lookupResource(String name) throws IOException
name - the name of the child resourceIOException - an I/O error occurredprotected abstract AbstractRepository createChildRepository(String name) throws IOException
name - the nameIOException - an I/O error occurredprotected abstract void getResources(List<Resource> list, boolean recursive) throws IOException
list - the list to add the resources torecursive - whether to descend into nested repositoriesIOException - an I/O related error occurredpublic String getPath()
public String getName()
public void setRoot()
setRoot in interface Repositorypublic void setAbsolute(boolean absolute)
setAbsolute in interface Trackableabsolute - true to operate in absolute modepublic boolean isAbsolute()
isAbsolute in interface Trackablepublic String getRelativePath()
getRelativePath in interface RepositorygetRelativePath in interface Trackablepublic String getModuleName()
getModuleName in interface Trackableprotected String[] resolve(String path, boolean absolute)
path - a path stringabsolute - whether to return an absolute path that can be used without this repositorypublic Resource getResource(String subpath) throws IOException
exists() returns false.getResource in interface Repositorysubpath - name of the child resource to returnIOExceptionpublic AbstractRepository getChildRepository(String subpath) throws IOException
getChildRepository in interface Repositorysubpath - the name of the repositoryIOException - an IOException occurredprotected AbstractRepository lookupRepository(String name) throws IOException
IOExceptionpublic AbstractRepository getParentRepository()
getParentRepository in interface Trackablepublic Repository getRootRepository()
getRootRepository in interface Trackablepublic Resource[] getResources() throws IOException
RepositorygetResources in interface RepositoryIOExceptionpublic Resource[] getResources(boolean recursive) throws IOException
RepositorygetResources in interface Repositoryrecursive - whether to include nested resourcesIOExceptionpublic Resource[] getResources(String resourcePath, boolean recursive) throws IOException
RepositorygetResources in interface RepositoryresourcePath - the repository pathrecursive - whether to include nested resourcesIOExceptionCopyright © 2016. All rights reserved.