/**
* Must be called exactly once, and must be called before any call
* to the configure method.
*/
public void init(Digester digester, PluginManager pm) throws PluginException {
Log log = digester.getLogger();
boolean debug = log.isDebugEnabled();
if (debug) {
log.debug("init being called!");
}
if (initialized) {
throw new PluginAssertionFailure("Init called multiple times.");
}
if ((pluginClass == null) && (pluginClassName != null)) {
try {
// load the plugin class object
pluginClass =
digester.getClassLoader().loadClass(pluginClassName);
} catch(ClassNotFoundException cnfe) {
throw new PluginException(
"Unable to load class " + pluginClassName, cnfe);
}
}
if (ruleLoader == null) {
// the caller didn't provide a ruleLoader to the constructor,
// so get the plugin manager to "discover" one.
log.debug("Searching for ruleloader...");
ruleLoader = pm.findLoader(digester, id, pluginClass, properties);
} else {
log.debug("This declaration has an explicit ruleLoader.");
}
if (debug) {
if (ruleLoader == null) {
log.debug(
"No ruleLoader found for plugin declaration"
+ " id [" + id + "]"
+ ", class [" + pluginClass.getClass().getName() + "].");
} else {
log.debug(
"RuleLoader of type [" + ruleLoader.getClass().getName()
+ "] associated with plugin declaration"
+ " id [" + id + "]"
+ ", class [" + pluginClass.getClass().getName() + "].");
}