public final class AbstractNutDao.WithRootPathNutDao extends Object implements NutDao
This class represents a modification of the the enclosing class behavior when the NutDao.create(String, ProcessContext)
method is called. Each time this method is called, the given path is prefixed by a root path.
NutDao.PathFormat| Modifier and Type | Method and Description |
|---|---|
List<Nut> |
create(String path,
NutDao.PathFormat format,
ProcessContext processContext)
Creates a list of
nuts thanks to the given path. |
List<Nut> |
create(String path,
ProcessContext processContext)
Creates a list of
nuts thanks to the given path considered as represented in any format. |
Boolean |
exists(String path,
ProcessContext processContext)
Indicates if the given path exists or not.
|
String |
getRootPath()
Gets the root path.
|
InputStream |
newInputStream(String path,
ProcessContext processContext)
Opens the stream for the given path.
|
void |
observe(String realPath,
NutDaoListener... listeners)
Adds a set of
listeners to be notified when an update has been detected on the nut. |
String |
proxyUriFor(Nut nut)
Returns an URI in a
String representation of a proxy serving the given nut. |
void |
save(Nut nut)
Saves the give nut.
|
Boolean |
saveSupported()
Indicates if this DAO is able to save a nut, which depends on the underlying protocol.
|
void |
shutdown()
Shutdowns this DAO by releasing its resources.
|
NutDao |
withRootPath(String rp)
Returns an instance that prefixes any nut name to be created with the given root path.
|
public String getRootPath()
Gets the root path.
public void observe(String realPath, NutDaoListener... listeners) throws IOException
Adds a set of listeners to be notified when an update has been detected on the nut.
The targeted nut is represented by the specified path.
The listeners will be stored in a weak reference so if no strong reference to them exist, they will be garbage collected.
observe in interface NutDaorealPath - the real path name of the nut.listeners - some listeners to be notified when an update has been detected on a nutIOException - if an I/O occurs while retrieving last update of the nutpublic List<Nut> create(String path, ProcessContext processContext) throws IOException
Creates a list of nuts thanks to the given path considered as represented in any format.
create in interface NutDaopath - the path representing the location of the nut(s)processContext - the process context calling this methodIOException - if an I/O error occurs when creating the nutNutDao.create(String, com.github.wuic.nut.dao.NutDao.PathFormat, com.github.wuic.ProcessContext)public List<Nut> create(String path, NutDao.PathFormat format, ProcessContext processContext) throws IOException
Creates a list of nuts thanks to the given path.
A NutDao.PathFormat also gives information on the format used in the string representation of the given path.
create in interface NutDaopath - the path representing the location of the nut(s)format - the path formatprocessContext - the process context calling this methodIOException - if an I/O error occurs when creating the nutpublic String proxyUriFor(Nut nut)
Returns an URI in a String representation of a proxy serving the given nut.
If many proxies are defined, proxy URI is selected in a round-robin mode. Each time a proxy is used, it won't be reused until all other proxies have been used too.
proxyUriFor in interface NutDaonut - the nutnull if not proxy is setpublic void save(Nut nut)
Saves the give nut. An UnsupportedOperationException will be thrown if the implementation supports
only nut access.
public Boolean saveSupported()
Indicates if this DAO is able to save a nut, which depends on the underlying protocol.
saveSupported in interface NutDaotrue if NutDao.save(Nut) is supported, false otherwisepublic void shutdown()
Shutdowns this DAO by releasing its resources.
public NutDao withRootPath(String rp)
Returns an instance that prefixes any nut name to be created with the given root path.
withRootPath in interface NutDaorp - the root pathpublic InputStream newInputStream(String path, ProcessContext processContext) throws IOException
Opens the stream for the given path.
newInputStream in interface NutDaopath - the path to accessprocessContext - the process context calling this methodIOException - if stream could not be openedpublic Boolean exists(String path, ProcessContext processContext) throws IOException
Indicates if the given path exists or not.
exists in interface NutDaopath - the path the DAO should be able to resolveprocessContext - the process context calling this methodtrue if path is resolved, false otherwiseIOException - if any I/O error occursCopyright © 2012-2015. All Rights Reserved.