P
- Subclasses of AbstractResourceOrigin are expected to produce Resource
instances which are subclasses of AbstractResource
.public abstract class AbstractResourceOrigin<P extends AbstractResource> extends Object implements ResourceOrigin<P>
AbstractResource
simply delegates to. Consequently, one only has to implement and
test AbstractResourceOrigin's methods, while navigation still happens naturally through the Resource methods.
AbstractResource implementations are merely vehicles for the underlying resource.ResourceOrigin.ResourceNotFoundException
Modifier | Constructor and Description |
---|---|
protected |
AbstractResourceOrigin(String name) |
Modifier and Type | Method and Description |
---|---|
void |
dispatchResourceChange(ResourceOriginChange change) |
protected abstract InputStream |
doOpenStream(P resource) |
protected abstract Charset |
getCharsetFor(P resource)
|
protected abstract long |
getLastModified(P resource) |
String |
getName()
Returns the name of this origin.
|
protected abstract String |
getName(P resource) |
protected abstract P |
getParent(P resource) |
protected abstract String |
getPath(P resource) |
protected void |
initializeResourceChangeMonitoring()
Start monitoring underlying resource changes.
|
protected abstract boolean |
isDirectory(P resource) |
protected boolean |
isEditable(P resource) |
protected abstract boolean |
isFile(P resource) |
protected abstract List<P> |
listChildren(P resource) |
protected Reader |
openReader(P resource) |
protected InputStream |
openStream(P resource) |
ResourceChangeHandlerRegistration |
registerResourceChangeHandler(ResourceChangeHandler changeHandler)
Hook the underlying resource change monitoring mechanism (if any) to a provided
handler . |
void |
traverseWith(ResourceVisitor visitor)
Traverses this ResourceOrigin from the root, according to the given
ResourceVisitor . |
void |
watchForChanges(ResourceVisitor visitor)
Deprecated.
since 5.4.6 - use
registerResourceChangeHandler(ResourceChangeHandler) instead. See ResourceOrigin.watchForChanges(ResourceVisitor) JavaDoc for more details |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getByPath, getRoot, hasPath
protected AbstractResourceOrigin(String name)
public String getName()
ResourceOrigin
getName
in interface ResourceOrigin<P extends AbstractResource>
public void traverseWith(ResourceVisitor visitor)
ResourceOrigin
ResourceVisitor
.traverseWith
in interface ResourceOrigin<P extends AbstractResource>
ResourceVisitor
,
PredicatedResourceVisitor
,
ResourceTreeWalker
@Deprecated public void watchForChanges(ResourceVisitor visitor)
registerResourceChangeHandler(ResourceChangeHandler)
instead. See ResourceOrigin.watchForChanges(ResourceVisitor)
JavaDoc for more detailsResourceOrigin
ResourceVisitor
.watchForChanges
in interface ResourceOrigin<P extends AbstractResource>
ResourceVisitor
,
PredicatedResourceVisitor
public ResourceChangeHandlerRegistration registerResourceChangeHandler(ResourceChangeHandler changeHandler)
ResourceOrigin
handler
.registerResourceChangeHandler
in interface ResourceOrigin<P extends AbstractResource>
ResourceOriginChange
public final void dispatchResourceChange(ResourceOriginChange change)
protected void initializeResourceChangeMonitoring()
protected abstract boolean isFile(P resource)
Resource.isFile()
protected abstract boolean isDirectory(P resource)
Resource.isDirectory()
protected boolean isEditable(P resource)
Resource.isEditable()
protected abstract String getPath(P resource)
Resource.getPath()
protected abstract String getName(P resource)
Resource.getName()
protected abstract long getLastModified(P resource)
Resource.getLastModified()
protected abstract List<P> listChildren(P resource)
Resource.listChildren()
protected abstract P getParent(P resource)
Resource.getParent()
protected InputStream openStream(P resource) throws IOException
IOException
Resource.openStream()
protected abstract InputStream doOpenStream(P resource) throws IOException
IOException
protected Reader openReader(P resource) throws IOException
IOException
Resource.openReader()
Copyright © 2003–2017 Magnolia International Ltd.. All rights reserved.