|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.packaging.ConfigRegistry
The ConfigRegistry class maps between config classes (subclasses of
AbstractConfig
), and a location used
for persisting the values in a config class. The ConfigRegistry
also stores the set of configured packages for a particular CCM
instance, and a list of URLs for parent configurations that are
used for defaulting values not present in the local configuration.
This mapping is maintained and extended by CCM developers through
the use of an XML configuration file placed in the src tree for a
particular package. If a particular package is configured, the
ConfigRegistry class will look in the classpath for a registry
configuration file named package-key.config, and parse the
file according to the following specification:
<?xml version="1.0" encoding="utf-8"?>
<registry>
...
<config class="CLASSNAME"
storage="FILENAME"/>
...
</registry>
Field Summary | |
static String |
versionId
|
Constructor Summary | |
ConfigRegistry()
Invokes ConfigRegistry(URL) defaulting the URL to new
File(System.getProperty("ccm.conf")).toURL() . |
|
ConfigRegistry(ClassLoader loader)
Invokes ConfigRegistry(URL, ClassLoader) defaulting the URL to
new File(System.getProperty("ccm.conf")).toURL() . |
|
ConfigRegistry(URL url)
Invokes ConfigRegistry(URL, ClassLoader) defaulting the
loader to the context class loader. |
|
ConfigRegistry(URL url,
ClassLoader loader)
Constructs a new config registry that will resolve all locations relative to url , and use
loader when searching the classpath for registry
configuration files. |
Method Summary | |
List |
getContexts()
Returns a list of config classes for this ConfigRegistry. |
List |
getPackages()
Returns the list of configured packages for this ConfigRegistry. |
String |
getStorage(Class context)
Returns the relative location used to store values for the given config class. |
void |
initialize(String key)
This method is not supported API. |
boolean |
isConfigured(Class context)
Returns true if this ConfigRegistry contains a mapping for context |
void |
load(ParameterContext ctx,
ErrorList errs)
Loads the given config object from the correct location based on its class. |
InputStream |
load(String resource)
Searches through this ConfigRegistry and its parents for the given resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public ConfigRegistry(URL url, ClassLoader loader)
url
, and use
loader
when searching the classpath for registry
configuration files.
url
- The base url for registry locations.loader
- The ClassLoader to use for retrieving registry
configuration files.public ConfigRegistry(URL url)
ConfigRegistry(URL, ClassLoader)
defaulting the
loader to the context class loader.
url
- The base url for registry locations.Thread.getContextClassLoader()
public ConfigRegistry(ClassLoader loader)
ConfigRegistry(URL, ClassLoader)
defaulting the URL to
new File(System.getProperty("ccm.conf")).toURL()
. The value
of the ccm.conf system property may or may not include a trailing slash.
loader
- The ClassLoader to use when searching for
registry configuration files.public ConfigRegistry()
ConfigRegistry(URL)
defaulting the URL to new
File(System.getProperty("ccm.conf")).toURL()
. The value of the
ccm.conf system property may or may not include a trailing slash.
Method Detail |
public final void initialize(String key)
public List getPackages()
public List getContexts()
public String getStorage(Class context)
context
- a subclass of AbstractConfig
context
IllegalArgumentException
- if this ConfigRegistry does
not contain a mapping for context
public boolean isConfigured(Class context)
context
context
- a subclass of AbstractConfig
context
public void load(ParameterContext ctx, ErrorList errs)
waf.config.parents
parameter. Any errors
encountered during loading are reported in the given ErrorList.
ctx
- the config object to loaderrs
- used to accumulate errors during loading
IllegalArgumentException
- if this ConfigRegistry does
not contain a mapping for ctx.getClass()
public InputStream load(String resource)
resource
- the path to the resource
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |