Element componentDefinition = (Element) actionDefinition.getComponentSection();
setCurrentComponent( componentClassName );
setCurrentActionDef( actionDefinition );
IComponent component = null;
Class componentClass = null;
Object componentTmp = null;
// Explicitly using the short name instead of the fully layed out class name
if ( ( pluginManager != null ) && ( pluginManager.isBeanRegistered( componentAlias ) ) ) {
if ( RuntimeContext.debug ) {
this.debug( "Component alias " + componentAlias + " will be resolved by the plugin manager." ); //$NON-NLS-1$ //$NON-NLS-2$
}
componentTmp = pluginManager.getBean( componentAlias );
if ( RuntimeContext.debug ) {
this.debug( "Component found in a plugin, class is: " + componentTmp.getClass().getName() ); //$NON-NLS-1$
}
}
if ( RuntimeContext.debug ) {
this.debug( "Component alias " + componentAlias + " will be resolved by the platform" ); //$NON-NLS-1$ //$NON-NLS-2$
}
// Ok - the plugin didn't load - try the old route
if ( componentTmp == null ) {
componentClass = Class.forName( componentClassName );
componentTmp = componentClass.newInstance();
}
if ( componentTmp instanceof IComponent ) {
component = (IComponent) componentTmp;
} else if ( componentTmp instanceof IAction ) {
component = new ActionDelegate( componentTmp );
} else {
// Try this out...
PojoComponent pc = new PojoComponent();
pc.setPojo( componentTmp );
component = pc;
}
component.setInstanceId( currentInstanceId );
component.setActionName( getActionName() );
component.setProcessId( currentProcessId );
// This next conditional is used to allow components to use the new action sequence dom commons project. The
// ActionFactory should return an object that wraps the action definition element to be processed by the component.
// The component can then use the wrappers API to access the action definition rather than make explicit references
// to the dom nodes.
if ( component instanceof IParameterResolver ) {
component.setActionDefinition( ActionFactory.getActionDefinition( (Element) actionDefinition.getNode(),
new ActionSequenceParameterMgr( this, currentSession, (IParameterResolver) component ) ) );
} else {
component.setActionDefinition( ActionFactory.getActionDefinition( (Element) actionDefinition.getNode(),
new ActionSequenceParameterMgr( this, currentSession ) ) );
}
// create a map of the top level component definition nodes and their text
Map<String, String> componentDefinitionMap = new HashMap<String, String>();
List elements = componentDefinition.elements();
Element element;
String name;
String value;
String customXsl = null;
for ( int idx = 0; idx < elements.size(); idx++ ) {
element = (Element) elements.get( idx );
name = element.getName();
value = element.getText();
// see if we have a target window for the output
if ( "target".equals( name ) ) { //$NON-NLS-1$
setParameterTarget( value );
} else if ( "xsl".equals( name ) ) { //$NON-NLS-1$
customXsl = value; // setParameterXsl(value);
}
componentDefinitionMap.put( element.getName(), element.getText() );
}
if ( customXsl != null ) {
setParameterXsl( customXsl );
}
component.setComponentDefinitionMap( componentDefinitionMap );
component.setComponentDefinition( componentDefinition );
component.setRuntimeContext( this );
component.setSession( currentSession );
component.setLoggingLevel( getLoggingLevel() );
component.setMessages( getMessages() );
return component;
}