Package org.apache.oozie.command

Examples of org.apache.oozie.command.CommandException


        }
        try {
            writeSlaStatusEvent(id, stat, appType, log);
        }
        catch (Exception e) {
            throw new CommandException(ErrorCode.E1007, " id " + id, e);
        }
    }
View Full Code Here


                this.actionList = jpaService.execute(new CoordJobGetActionsNotCompletedJPAExecutor(jobId));
                prevStatus = coordJob.getStatus();
                LogUtils.setLogInfo(coordJob, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
            }
        }
        catch (XException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

        }
        action.setLastModifiedTime(new Date());
        try {
            jpaService.execute(new CoordActionUpdateStatusJPAExecutor(action));
        } catch (JPAExecutorException e) {
            throw new CommandException(e);
        }
    }
View Full Code Here

            jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));

            LOG.debug("Killed coord actions for the coordinator=[{0}]", jobId);
        }
        catch (JPAExecutorException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

    public void updateJob() throws CommandException {
        try {
            jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
        }
        catch (JPAExecutorException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

                LogUtils.setLogInfo(bundleJob, logInfo);
                super.setJob(bundleJob);

            }
            else {
                throw new CommandException(ErrorCode.E0610);
            }
        }
        catch (XException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

                for (Element elem : coordElems) {
                    Attribute name = elem.getAttribute("name");
                    Attribute critical = elem.getAttribute("critical");
                    if (name != null) {
                        if (map.containsKey(name.getValue())) {
                            throw new CommandException(ErrorCode.E1304, name);
                        }
                        boolean isCritical = false;
                        if (critical != null && Boolean.parseBoolean(critical.getValue())) {
                            isCritical = true;
                        }
                        map.put(name.getValue(), isCritical);
                    }
                    else {
                        throw new CommandException(ErrorCode.E1305);
                    }
                }
            }
            catch (JDOMException jex) {
                throw new CommandException(ErrorCode.E1301, jex);
            }

            try {
                // if there is no coordinator for this bundle, failed it.
                if (map.isEmpty()) {
                    bundleJob.setStatus(Job.Status.FAILED);
                    bundleJob.resetPending();
                    jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
                    LOG.debug("No coord jobs for the bundle=[{0}], failed it!!", jobId);
                    throw new CommandException(ErrorCode.E1318, jobId);
                }

                for (Entry<String, Boolean> coordName : map.entrySet()) {
                    BundleActionBean action = createBundleAction(jobId, coordName.getKey(), coordName.getValue());

                    jpaService.execute(new BundleActionInsertJPAExecutor(action));
                }
            }
            catch (JPAExecutorException je) {
                throw new CommandException(je);
            }

        }
        else {
            throw new CommandException(ErrorCode.E0604, jobId);
        }
    }
View Full Code Here

                    updateBundleAction(name.getValue());
                }
            }
            catch (JDOMException jex) {
                throw new CommandException(ErrorCode.E1301, jex);
            }
            catch (JPAExecutorException je) {
                throw new CommandException(je);
            }
        }
        else {
            throw new CommandException(ErrorCode.E0604, jobId);
        }
    }
View Full Code Here

        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new CommandException(ErrorCode.E1101);
        }
        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new CommandException(ErrorCode.E1102);
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime()
                    + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined
        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        JPAService jpaService = Services.get().get(JPAService.class);

        if (jpaService != null) {
            jpaService.execute(new SLAEventInsertJPAExecutor(sla));
        }
        else {
            throw new CommandException(ErrorCode.E0610, "unable to write sla event.");
        }

    }
View Full Code Here

        if (jpaService != null) {
            jpaService.execute(new SLAEventInsertJPAExecutor(sla));
        }
        else {
            throw new CommandException(ErrorCode.E0610, "unable to write sla event.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.command.CommandException

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.