Package org.apache.oozie.workflow

Examples of org.apache.oozie.workflow.WorkflowException


        status = Status.KILLED;
    }

    public synchronized void suspend() throws WorkflowException {
        if (status != Status.RUNNING) {
            throw new WorkflowException(ErrorCode.E0716);
        }
        log.debug(XLog.STD, "Suspending job");
        this.status = Status.SUSPENDED;
    }
View Full Code Here


        return (status == Status.SUSPENDED);
    }

    public synchronized void resume() throws WorkflowException {
        if (status != Status.SUSPENDED) {
            throw new WorkflowException(ErrorCode.E0717);
        }
        log.debug(XLog.STD, "Resuming job");
        status = Status.RUNNING;
    }
View Full Code Here

    public static class JoinNodeHandler extends NodeHandler {

        public void loopDetection(Context context) throws WorkflowException {
            String flag = getLoopFlag(context.getNodeDef().getName());
            if (context.getVar(flag) != null) {
                throw new WorkflowException(ErrorCode.E0709, context.getNodeDef().getName());
            }
            String parentExecutionPath = context.getParentExecutionPath(context.getExecutionPath());
            String forkCount = context.getVar(ForkNodeDef.FORK_COUNT_PREFIX + parentExecutionPath);
            if (forkCount == null) {
                throw new WorkflowException(ErrorCode.E0720, context.getNodeDef().getName());
            }
            int count = Integer.parseInt(forkCount) - 1;
            if (count == 0) {
                context.setVar(flag, "true");
            }
View Full Code Here

        public boolean enter(Context context) throws WorkflowException {
            String parentExecutionPath = context.getParentExecutionPath(context.getExecutionPath());
            String forkCount = context.getVar(ForkNodeDef.FORK_COUNT_PREFIX + parentExecutionPath);
            if (forkCount == null) {
                throw new WorkflowException(ErrorCode.E0720, context.getNodeDef().getName());
            }
            int count = Integer.parseInt(forkCount) - 1;
            if (count > 0) {
                context.setVar(ForkNodeDef.FORK_COUNT_PREFIX + parentExecutionPath, "" + count);
                context.deleteExecutionPath();
View Full Code Here

     */
    public static class StartNodeHandler extends NodeHandler {

        public boolean enter(Context context) throws WorkflowException {
            if (!context.getSignalValue().equals(StartNodeDef.START)) {
                throw new WorkflowException(ErrorCode.E0715, context.getSignalValue());
            }
            return true;
        }
View Full Code Here

                validateForkJoin(app);
            }
            return app;
        }
        catch (JDOMException ex) {
            throw new WorkflowException(ErrorCode.E0700, ex.getMessage(), ex);
        }
        catch (SAXException ex) {
            throw new WorkflowException(ErrorCode.E0701, ex.getMessage(), ex);
        }
        catch (IOException ex) {
            throw new WorkflowException(ErrorCode.E0702, ex.getMessage(), ex);
        }
    }
View Full Code Here

     * @throws WorkflowException
     */
    private void validateForkJoin(LiteWorkflowApp app) throws WorkflowException {
        // Make sure the number of forks and joins in wf are equal
        if (forkList.size() != joinList.size()) {
            throw new WorkflowException(ErrorCode.E0730);
        }

        while(!forkList.isEmpty()){
            // Make sure each of the fork node has a corresponding join; start with the root fork Node first
            validateFork(app.getNode(forkList.remove(0)), app);
View Full Code Here

            NodeDef node = app.getNode(transitions.get(i));
            if (node instanceof DecisionNodeDef) {
                Set<String> decisionSet = new HashSet<String>(node.getTransitions());
                for (String ds : decisionSet) {
                    if (transitions.contains(ds)) {
                        throw new WorkflowException(ErrorCode.E0734, node.getName(), ds);
                    } else {
                        transitions.add(ds);
                    }
                }
            } else if (node instanceof ActionNodeDef) {
                // Make sure the transition is valid
                validateTransition(errorToTransitions, transitions, app, node);
                // Add the "ok-to" transition of node
                transitions.add(node.getTransitions().get(0));
                String errorTo = node.getTransitions().get(1);
                // Add the "error-to" transition if the transition is a Action Node
                if (app.getNode(errorTo) instanceof ActionNodeDef) {
                    errorToTransitions.add(errorTo);
                }
            } else if (node instanceof ForkNodeDef) {
                forkList.remove(node.getName());
                // Make a recursive call to resolve this fork node
                NodeDef joinNd = validateFork(node, app);
                // Make sure the transition is valid
                validateTransition(errorToTransitions, transitions, app, node);
                // Add the "ok-to" transition of node
                transitions.add(joinNd.getTransitions().get(0));
            } else if (node instanceof JoinNodeDef) {
                // If joinNode encountered for the first time, remove it from the joinList and remember it
                String currentJoin = node.getName();
                if (joinList.contains(currentJoin)) {
                    joinList.remove(currentJoin);
                    joinNode = currentJoin;
                } else {
                    // Make sure this join is the same as the join seen from the first time
                    if (joinNode == null) {
                        throw new WorkflowException(ErrorCode.E0733, forkNode);
                    }
                    if (!joinNode.equals(currentJoin)) {
                        throw new WorkflowException(ErrorCode.E0732, forkNode, joinNode);
                    }
                }
            } else {
                throw new WorkflowException(ErrorCode.E0730);
            }
        }
        return app.getNode(joinNode);

    }
View Full Code Here

    private void validateTransition(List<String> errorToTransitions, List<String> transitions, LiteWorkflowApp app, NodeDef node)
            throws WorkflowException {
        for (String transition : node.getTransitions()) {
            // Make sure the transition node is either a join node or is not already visited
            if (transitions.contains(transition) && !(app.getNode(transition) instanceof JoinNodeDef)) {
                throw new WorkflowException(ErrorCode.E0734, node.getName(), transition);
            }
            // Make sure the transition node is not the same as an already visited 'error-to' transition
            if (errorToTransitions.contains(transition)) {
                throw new WorkflowException(ErrorCode.E0735, node.getName(), transition);
            }
        }

    }
View Full Code Here

                                    else {
                                        if (SLA_INFO.equals(eNode.getName()) || CREDENTIALS.equals(eNode.getName())) {
                                            // No operation is required
                                        }
                                        else {
                                            throw new WorkflowException(ErrorCode.E0703, eNode.getName());
                                        }
                                    }
                                }
                            }
                        }
View Full Code Here

TOP

Related Classes of org.apache.oozie.workflow.WorkflowException

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.