protected class AbstractDataResourceFactory.DataResourceAdapter extends AbstractDataResourceProxy
DataResource
interface, that adapts another
DataResource
and enhances the navigate(String)
-method to support switching schemes via the
DataResourceFactory
that created this DataResource
.Modifier and Type | Field and Description |
---|---|
private DataResource |
delegate |
Constructor and Description |
---|
DataResourceAdapter(DataResource delegate)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected DataResource |
getDelegate()
This method gets the
DataResource this proxy delegates to. |
DataResource |
navigate(String relativePath)
This method retrieves a
DataResource pointing to the given resourcePath based on this resource.E.g. |
getLastModificationDate, getName, getPath, getSize, getUri, getUrl, isAvailable, isData, isModifiedSince, openOutputStream, openStream, toString
private final DataResource delegate
public DataResourceAdapter(DataResource delegate)
delegate
- is the DataResource
to adapt.protected DataResource getDelegate()
AbstractDataResourceProxy
DataResource
this proxy delegates to.getDelegate
in class AbstractDataResourceProxy
public DataResource navigate(String relativePath) throws ResourceUriUndefinedException
DataResource
DataResource
pointing to the given resourcePath
based on this resource.resourcePath
would be "../apt/sources.list"
the resulting resource would point to "/etc/apt/sources.list". folder
of this resource. This will also be the case if this resource itself is
a folder
. Due to this generic API this is the only consistent way as there are
implementations that can not easily know if they represent a folder
or a
file
or maybe even both at the same time. However, please be aware of this and
do not get confused as you might expect this to be a cd
command if invoked on
a folder
what is not exactly not the case (instead it is a
cd
on the parent folder). On a BrowsableResource
you can use
BrowsableResource.cd(String)
instead to avoid confusion.navigate
in interface DataResource
navigate
in class AbstractDataResourceProxy
relativePath
- the absolute or relative path pointing to a new resource. If it is a relative path, it is
interpreted relative to the parent URI (directory) of this resource.ResourceUriUndefinedException
- if the given resourcePath
leads to an undefined or illegal URI.BrowsableResource.cd(String)
Copyright © 2001–2016 mmm-Team. All rights reserved.