componentKey = (String)key;
else
componentKey = ((Class)key).getName();
ConfigurationManager manager =
(ConfigurationManager)exocontainer.getComponentInstanceOfType(ConfigurationManager.class);
Component component = manager.getComponent(componentKey);
//
try
{
InitParams params = null;
boolean debug = false;
if (component != null)
{
params = component.getInitParams();
debug = component.getShowDeployInfo();
}
instance_ = exocontainer.createComponent(getComponentImplementation(), params);
if (debug)
log.debug("==> create component : " + instance_);
if (component != null && component.getComponentPlugins() != null)
{
addComponentPlugin(debug, instance_, component.getComponentPlugins(), exocontainer);
}
ExternalComponentPlugins ecplugins = manager.getConfiguration().getExternalComponentPlugins(componentKey);
if (ecplugins != null)
{
addComponentPlugin(debug, instance_, ecplugins.getComponentPlugins(), exocontainer);
}
// check if component implement the ComponentLifecycle
if (instance_ instanceof ComponentLifecycle)
{
ComponentLifecycle lc = (ComponentLifecycle)instance_;
lc.initComponent(exocontainer);
}
}
catch (Exception ex)
{
String msg = "Cannot instantiate component " + getComponentImplementation();
if (component != null)
{
msg =
"Cannot instantiate component key=" + component.getKey() + " type=" + component.getType() + " found at "
+ component.getDocumentURL();
}
throw new RuntimeException(msg, ex);
}
return instance_;
}