Package org.tubo.resource.component

Examples of org.tubo.resource.component.ComponentManager


        //
        // get Manager identified by id
        Manager manager = getManager(id);
        //
        // define var
        ComponentManager componentManager;
        //
        // check instanceof
        if (manager instanceof ComponentManager) {
            //
            // cast manager to ComponentManager
View Full Code Here


        //
        // 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);
View Full Code Here

TOP

Related Classes of org.tubo.resource.component.ComponentManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.