Package org.apache.commons.scxml.invoke

Examples of org.apache.commons.scxml.invoke.Invoker


                errRep.onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
                        oe);
            }
            // check if invoke is active in this state
            if (invokers.containsKey(tt)) {
                Invoker toCancel = (Invoker) invokers.get(tt);
                try {
                    toCancel.cancel();
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(tt.getId()
                        + ".invoke.cancel.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                }
View Full Code Here


        for (Iterator invokeIter = scInstance.getInvokers().entrySet().
                iterator(); invokeIter.hasNext();) {
            Map.Entry iEntry = (Map.Entry) invokeIter.next();
            String parentId = ((TransitionTarget) iEntry.getKey()).getId();
            if (!finalizeMatch(parentId, allEvents)) { // prevent cycles
                Invoker inv = (Invoker) iEntry.getValue();
                try {
                    inv.parentEvents(events);
                } catch (InvokerException ie) {
                    appLog.error(ie.getMessage(), ie);
                    throw new ModelException(ie.getMessage(), ie.getCause());
                }
            }
View Full Code Here

                PathResolver pr = i.getPathResolver();
                if (pr != null) {
                    source = i.getPathResolver().resolvePath(src);
                }
                String ttype = i.getTargettype();
                Invoker inv = null;
                try {
                    inv = scInstance.newInvoker(ttype);
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(s.getId()
                        + ".invoke.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                    continue;
                }
                inv.setParentStateId(s.getId());
                inv.setSCInstance(scInstance);
                List params = i.params();
                Map args = new HashMap();
                for (Iterator pIter = params.iterator(); pIter.hasNext();) {
                    Param p = (Param) pIter.next();
                    String argExpr = p.getExpr();
                    Object argValue = null;
                    ctx.setLocal(NAMESPACES_KEY, p.getNamespaces());
                    // Do we have an "expr" attribute?
                    if (argExpr != null && argExpr.trim().length() > 0) {
                        // Yes, evaluate and store as parameter value
                        try {
                            argValue = eval.eval(ctx, argExpr);
                        } catch (SCXMLExpressionException see) {
                            errRep.onError(ErrorConstants.EXPRESSION_ERROR,
                                see.getMessage(), i);
                        }
                    } else {
                        // No. Does value of "name" attribute refer to a valid
                        // location in the data model?
                        try {
                            argValue = eval.evalLocation(ctx, p.getName());
                            if (argValue == null) {
                                // Generate error, 4.3.1 in WD-scxml-20080516
                                TriggerEvent te = new TriggerEvent(s.getId()
                                    + ERR_ILLEGAL_ALLOC,
                                    TriggerEvent.ERROR_EVENT);
                                internalEvents.add(te);
                            }
                        } catch (SCXMLExpressionException see) {
                            errRep.onError(ErrorConstants.EXPRESSION_ERROR,
                                see.getMessage(), i);
                        }
                    }
                    ctx.setLocal(NAMESPACES_KEY, null);
                    args.put(p.getName(), argValue);
                }
                try {
                    inv.invoke(source, args);
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(s.getId()
                        + ".invoke.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                    continue;
View Full Code Here

        Class invokerClass = (Class) invokerClasses.get(targettype);
        if (invokerClass == null) {
            throw new InvokerException("No Invoker registered for "
                + "targettype \"" + targettype + "\"");
        }
        Invoker invoker = null;
        try {
            invoker = (Invoker) invokerClass.newInstance();
        } catch (InstantiationException ie) {
            throw new InvokerException(ie.getMessage(), ie.getCause());
        } catch (IllegalAccessException iae) {
View Full Code Here

                errRep.onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
                        oe);
            }
            // check if invoke is active in this state
            if (invokers.containsKey(tt)) {
                Invoker toCancel = (Invoker) invokers.get(tt);
                try {
                    toCancel.cancel();
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(tt.getId()
                        + ".invoke.cancel.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                }
View Full Code Here

        for (Iterator invokeIter = scInstance.getInvokers().entrySet().
                iterator(); invokeIter.hasNext();) {
            Map.Entry iEntry = (Map.Entry) invokeIter.next();
            String parentId = ((TransitionTarget) iEntry.getKey()).getId();
            if (!finalizeMatch(parentId, eventNames)) { // prevent cycles
                Invoker inv = (Invoker) iEntry.getValue();
                try {
                    inv.parentEvents(events);
                } catch (InvokerException ie) {
                    appLog.error(ie.getMessage(), ie);
                    throw new ModelException(ie.getMessage(), ie.getCause());
                }
            }
View Full Code Here

                PathResolver pr = i.getPathResolver();
                if (pr != null) {
                    source = i.getPathResolver().resolvePath(src);
                }
                String ttype = i.getTargettype();
                Invoker inv = null;
                try {
                    inv = scInstance.newInvoker(ttype);
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(s.getId()
                        + ".invoke.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                    continue;
                }
                inv.setParentStateId(s.getId());
                inv.setSCInstance(scInstance);
                List params = i.params();
                Map args = new HashMap();
                for (Iterator pIter = params.iterator(); pIter.hasNext();) {
                    Param p = (Param) pIter.next();
                    String argExpr = p.getExpr();
                    Object argValue = null;
                    if (argExpr != null && argExpr.trim().length() > 0) {
                        try {
                            ctx.setLocal(NAMESPACES_KEY, p.getNamespaces());
                            argValue = eval.eval(ctx, argExpr);
                            ctx.setLocal(NAMESPACES_KEY, null);
                        } catch (SCXMLExpressionException see) {
                            errRep.onError(ErrorConstants.EXPRESSION_ERROR,
                                see.getMessage(), i);
                        }
                    }
                    args.put(p.getName(), argValue);
                }
                try {
                    inv.invoke(source, args);
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(s.getId()
                        + ".invoke.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                    continue;
View Full Code Here

        Class invokerClass = (Class) invokerClasses.get(targettype);
        if (invokerClass == null) {
            throw new InvokerException("No Invoker registered for "
                + "targettype \"" + targettype + "\"");
        }
        Invoker invoker = null;
        try {
            invoker = (Invoker) invokerClass.newInstance();
        } catch (InstantiationException ie) {
            throw new InvokerException(ie.getMessage(), ie.getCause());
        } catch (IllegalAccessException iae) {
View Full Code Here

                errRep.onError(ErrorReporter.EXPRESSION_ERROR, e.getMessage(),
                        oe);
            }
            // check if invoke is active in this state
            if (invokers.containsKey(tt)) {
                Invoker toCancel = (Invoker) invokers.get(tt);
                try {
                    toCancel.cancel();
                } catch (InvokerException ie) {
                    TriggerEvent te = new TriggerEvent(tt.getId()
                        + ".invoke.cancel.failed", TriggerEvent.ERROR_EVENT);
                    internalEvents.add(te);
                }
View Full Code Here

        for (Iterator invokeIter = scInstance.getInvokers().entrySet().
                iterator(); invokeIter.hasNext();) {
            Map.Entry iEntry = (Map.Entry) invokeIter.next();
            String parentId = ((TransitionTarget) iEntry.getKey()).getId();
            if (!finalizeMatch(parentId, eventNames)) { // prevent cycles
                Invoker inv = (Invoker) iEntry.getValue();
                try {
                    inv.parentEvents(events);
                } catch (InvokerException ie) {
                    appLog.error(ie.getMessage(), ie);
                    throw new ModelException(ie.getMessage(), ie.getCause());
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.scxml.invoke.Invoker

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.