Package org.apache.oozie.command

Examples of org.apache.oozie.command.CommandException


        try {
            runConf = new XConfiguration(new StringReader(jobConf));
        }
        catch (IOException e1) {
            LOG.warn("Configuration parse error in:" + jobConf);
            throw new CommandException(ErrorCode.E1306, e1.getMessage(), e1);
        }
        // Step 2: Merge local properties into runConf
        // extract 'property' tags under 'configuration' block in the coordElem
        // convert Element to XConfiguration
        Element localConfigElement = coordElem.getChild("configuration", coordElem.getNamespace());

        if (localConfigElement != null) {
            String strConfig = XmlUtils.prettyPrint(localConfigElement).toString();
            Configuration localConf;
            try {
                localConf = new XConfiguration(new StringReader(strConfig));
            }
            catch (IOException e1) {
                LOG.warn("Configuration parse error in:" + strConfig);
                throw new CommandException(ErrorCode.E1307, e1.getMessage(), e1);
            }

            // copy configuration properties in the coordElem to the runConf
            XConfiguration.copy(localConf, runConf);
        }

        // Step 3: Extract value of 'app-path' in coordElem, save it as a
        // new property called 'oozie.coord.application.path', and normalize.
        String appPath = coordElem.getChild("app-path", coordElem.getNamespace()).getValue();
        runConf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
        // Normalize coordinator appPath here;
        try {
            JobUtils.normalizeAppPath(runConf.get(OozieClient.USER_NAME), runConf.get(OozieClient.GROUP_NAME), runConf);
        }
        catch (IOException e) {
            throw new CommandException(ErrorCode.E1001, runConf.get(OozieClient.COORDINATOR_APP_PATH));
        }
        return runConf;
    }
View Full Code Here


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

    public void updateJob() throws CommandException {
        try {
            jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
        }
        catch (JPAExecutorException je) {
            throw new CommandException(je);
        }
    }
View Full Code Here

     */
    private void checkPauseTime(Date newPauseTime) throws CommandException {
        // New pauseTime has to be a non-past time.
        Date d = new Date();
        if (newPauseTime.before(d)) {
            throw new CommandException(ErrorCode.E1317, newPauseTime, "must be a non-past time");
        }
    }
View Full Code Here

     */
    private void checkEndTime(Date newEndTime) throws CommandException {
        // New endTime has to be a non-past start time.
        Date startTime = bundleJob.getKickoffTime();
        if (startTime != null && newEndTime.before(startTime)) {
            throw new CommandException(ErrorCode.E1317, newEndTime, "must be greater then kickoff time");
        }
    }
View Full Code Here

     */
    private void validateChangeValue(String changeValue) throws CommandException {
        Map<String, String> map = JobUtils.parseChangeValue(changeValue);

        if (map.size() > ALLOWED_CHANGE_OPTIONS.size() || !(map.containsKey(OozieClient.CHANGE_VALUE_PAUSETIME) || map.containsKey(OozieClient.CHANGE_VALUE_ENDTIME))) {
            throw new CommandException(ErrorCode.E1317, changeValue, "can only change pausetime or end time");
        }

        if (map.containsKey(OozieClient.CHANGE_VALUE_PAUSETIME)) {
            isChangePauseTime = true;
        }
        else if(map.containsKey(OozieClient.CHANGE_VALUE_ENDTIME)){
            isChangeEndTime = true;
        }
        else {
            throw new CommandException(ErrorCode.E1317, changeValue, "should change pausetime or endtime");
        }

        if(isChangePauseTime){
            String value = map.get(OozieClient.CHANGE_VALUE_PAUSETIME);
            if (!value.equals(""))   {
                try {
                    newPauseTime = DateUtils.parseDateUTC(value);
                }
                catch (Exception ex) {
                    throw new CommandException(ErrorCode.E1317, value, "is not a valid date");
                }

                checkPauseTime(newPauseTime);
            }
        }
        else if (isChangeEndTime){
            String value = map.get(OozieClient.CHANGE_VALUE_ENDTIME);
            if (!value.equals(""))   {
                try {
                    newEndTime = DateUtils.parseDateUTC(value);
                }
                catch (Exception ex) {
                    throw new CommandException(ErrorCode.E1317, value, "is not a valid date");
                }

                checkEndTime(newEndTime);
            }
        }
View Full Code Here

                jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
            }
            return null;
        }
        catch (XException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

        try{
            eagerLoadState();
            this.bundleActions = jpaService.execute(new BundleActionsGetJPAExecutor(jobId));
        }
        catch(Exception Ex){
            throw new CommandException(ErrorCode.E1311,this.jobId);
        }
    }
View Full Code Here

            if (jpaService != null) {
                this.bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
                LogUtils.setLogInfo(bundleJob, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
            }
        }
        catch (XException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

                    queue(new BundleStartXCommand(jobId));
                }
            }
        }
        catch (Exception ex) {
            throw new CommandException(ErrorCode.E1310, ex.getMessage(), ex);
        }
        LOG.info("ENDED Bundle Submit");
        return this.jobId;
    }
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.