org.apache.cocoon.acting
abstract public class: AbstractComplementaryConfigurableAction [javadoc |
source]
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.AbstractConfigurableAction
org.apache.cocoon.acting.ConfigurableServiceableAction
org.apache.cocoon.acting.AbstractComplementaryConfigurableAction
All Implemented Interfaces:
org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, Action
Direct Known Subclasses:
DatabaseDeleteAction, OraUpdateAction, DbXMLAuthenticatorAction, SessionValidatorAction, DatabaseAddAction, FormValidatorAction, DatabaseAddAction, DatabaseAuthenticatorAction, DatabaseCookieAuthenticatorAction, AbstractValidatorAction, CookieValidatorAction, DatabaseUpdateAction, SessionFormAction, DatabaseSelectAction, OraAddAction, DatabaseDeleteAction, DatabaseSelectAction, DatabaseAction, DatabaseQueryAction, DatabaseUpdateAction, AbstractDatabaseAction
Set up environment for configurable form handling data. This group
of actions are unique in that they employ a terciary mapping.
Each configuration file must use the same format in order to be
effective. The name of the root configuration element is irrelevant.
- author:
< - a href="mailto:bloritsch@apache.org">Berin Loritsch
- version:
CVS - $Id: AbstractComplementaryConfigurableAction.java 433543 2006-08-22 06:22:54Z crossley $
| Methods from org.apache.cocoon.acting.ConfigurableServiceableAction: |
|---|
|
service |
| Methods from org.apache.cocoon.acting.AbstractConfigurableAction: |
|---|
|
configure |
| Method from org.apache.cocoon.acting.AbstractComplementaryConfigurableAction Detail: |
protected Configuration getConfiguration(String descriptor) throws ConfigurationException {
boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
if (this.settings.containsKey("reloadable"))
reloadable = Boolean.valueOf((String) this.settings.get("reloadable")).booleanValue();
return this.getConfiguration(descriptor, null, reloadable);
}
Set up the complementary configuration file. Please note that
multiple Actions can share the same configurations. By using
this approach, we can limit the number of config files.
Also note that the configuration file does not have to be a file.
Defaults to reload configuration file it has changed. |
protected Configuration getConfiguration(String descriptor,
boolean reloadable) throws ConfigurationException {
return this.getConfiguration( descriptor, null, reloadable );
} Deprecated! please - use the getConfiguration(String, SourceResolver, boolean)
version of this method instead.
|
protected Configuration getConfiguration(String descriptor,
SourceResolver resolver,
boolean reloadable) throws ConfigurationException {
ConfigurationHelper conf = null;
if (descriptor == null) {
throw new ConfigurationException("The form descriptor is not set!");
}
synchronized (AbstractComplementaryConfigurableAction.configurations) {
Source resource = null;
try {
resource = resolver.resolveURI(descriptor);
conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations.get(resource.getURI());
if (conf == null || (reloadable && conf.lastModified != resource.getLastModified())) {
getLogger().debug("(Re)Loading " + descriptor);
if (conf == null) {
conf = new ConfigurationHelper();
}
SAXConfigurationHandler builder = new SAXConfigurationHandler();
SourceUtil.parse(this.manager, resource, builder);
conf.lastModified = resource.getLastModified();
conf.configuration = builder.getConfiguration();
AbstractComplementaryConfigurableAction.configurations.put(resource.getURI(), conf);
} else {
getLogger().debug("Using cached configuration for " + descriptor);
}
} catch (Exception e) {
getLogger().error("Could not configure Database mapping environment", e);
throw new ConfigurationException("Error trying to load configurations for resource: "
+ (resource == null ? "null" : resource.getURI()));
} finally {
resolver.release(resource);
}
}
return conf.configuration;
}
Set up the complementary configuration file. Please note that
multiple Actions can share the same configurations. By using
this approach, we can limit the number of config files.
Also note that the configuration file does not have to be a file. |