public final class DataRootHandler
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean
The "data roots" are read in from one or more trees of config catalogs and are defined by the datasetScan and datasetRoot elements in the config catalogs.
Uses the singleton design pattern.
| Modifier and Type | Class and Description |
|---|---|
static interface |
DataRootHandler.ConfigListener
To receive notice of TDS configuration events, implement this interface
and use the DataRootHandler.registerConfigListener() method to register
an instance with a DataRootHandler instance.
|
static class |
DataRootHandler.DataRootMatch |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
debug |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
java.lang.String |
findDataRootLocation(java.lang.String path)
Find the location match for a dataRoot.
|
DataRootHandler.DataRootMatch |
findDataRootMatch(javax.servlet.http.HttpServletRequest req)
Extract the DataRoot from the request.
|
DataRootHandler.DataRootMatch |
findDataRootMatch(java.lang.String spath) |
thredds.client.catalog.Catalog |
getCatalog(java.lang.String path,
java.net.URI baseURI)
If a catalog exists and is allowed (not filtered out) for the given path, return
the catalog as an Catalog.
|
thredds.inventory.MFile |
getFileFromRequestPath(java.lang.String path)
Return the the MFile to which the given path maps.
|
static DataRootHandler |
getInstance()
Get the singleton.
|
PathMatcher |
getPathMatcher() |
boolean |
hasDataRootMatch(java.lang.String path)
Return true if the given path matches a dataRoot, otherwise return false.
|
void |
makeDebugActions() |
boolean |
registerConfigListener(DataRootHandler.ConfigListener cl) |
void |
reinit()
Reinitialize lists of static catalogs, data roots, dataset Ids.
|
void |
setDataRootLocationAliasExpanders(java.util.Map<java.lang.String,java.lang.String> aliases) |
static void |
setInstance(DataRootHandler drh)
Initialize the DataRootHandler singleton instance.
|
void |
showRoots(java.util.Formatter f) |
boolean |
unregisterConfigListener(DataRootHandler.ConfigListener cl) |
public static final boolean debug
public static void setInstance(DataRootHandler drh)
drh - the singleton instance of DataRootHandler being usedpublic static DataRootHandler getInstance()
java.lang.IllegalStateException - if setInstance() has not been called.public void setDataRootLocationAliasExpanders(java.util.Map<java.lang.String,java.lang.String> aliases)
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic boolean registerConfigListener(DataRootHandler.ConfigListener cl)
public boolean unregisterConfigListener(DataRootHandler.ConfigListener cl)
public void reinit()
public java.lang.String findDataRootLocation(java.lang.String path)
path - the dataRoot path namepublic DataRootHandler.DataRootMatch findDataRootMatch(javax.servlet.http.HttpServletRequest req)
req - the requestpublic DataRootHandler.DataRootMatch findDataRootMatch(java.lang.String spath)
public boolean hasDataRootMatch(java.lang.String path)
path - the request path, ie req.getServletPath() + req.getPathInfo()public thredds.inventory.MFile getFileFromRequestPath(java.lang.String path)
path - the request path.java.lang.IllegalStateException - if the request is not for a descendant of (or the same as) the matching DatasetRoot collection location.public thredds.client.catalog.Catalog getCatalog(java.lang.String path,
java.net.URI baseURI)
throws java.io.IOException
path - the path for the requested catalog.baseURI - the base URI for the catalog, used to resolve relative URLs.java.io.IOExceptionpublic PathMatcher getPathMatcher()
public void showRoots(java.util.Formatter f)
public void makeDebugActions()