//
// get component id (which this node reference)
String componentId = componentRef.getRefId();
//
// get (via resource manager) the correct manager
ComponentManager componentManager = resourceManager.getComponentManager(componentId);
//
// set flow node properties
Properties flowNodeProps = componentRef.getProperties();
Map itemProps = context.getItem().getProperties();
itemProps.putAll(flowNodeProps);
//
// FIXME: ONLY TEST, FIX THAT!!!!!!!!!!!!!!!!!!
// we need exception management :D
Component component = null;
String methodName = null;
try {
//
// get component (via manager)
component = componentManager.getComponent();
//
// check event listen
String action = context.getOriginEvent().getAction();
if(componentRef.isListenEvent(action)) {
//
// get method to execute
methodName = componentRef.getListenEventDef(action).getExecute();
//
// call method
Method method = component.getClass().getMethod(methodName, new Class[] {FlowContext.class});
method.invoke(component,new Object[] {context});
} else {
//
// execute default method
component.execute(context);
}
} catch (NoSuchMethodException e) {
Object args[] = {
component.getClass().getName(),
methodName,
componentId
};
throw resourceManager.getExceptionManager().getException(1500,args,e);
} catch (IllegalAccessException e) {
Object args[] = {
component.getClass().getName(),
methodName,
componentId
};
throw resourceManager.getExceptionManager().getException(1501,args,e);
} catch (IllegalArgumentException e) {
Object args[] = {
component.getClass().getName(),
methodName,
componentId
};
throw resourceManager.getExceptionManager().getException(1502,args,e);
} catch (InvocationTargetException e) {
Object args[] = {
component.getClass().getName(),
methodName,
componentId
};
throw resourceManager.getExceptionManager().getException(1503,args,e);
} finally {
//
// restore component
if (component!=null)
componentManager.restore(component);
//
// delete flow node properties
for(Iterator it=flowNodeProps.keySet().iterator(); it.hasNext(); ) {
String prop = (String)it.next();
itemProps.remove(prop);