Package org.globus.workspace.client_core

Examples of org.globus.workspace.client_core.ParameterProblem


            try {
                this.dep = FileUtils.getRequestFromFile(
                                    this.pr, this.args.depRequestFilePath);
            } catch (Exception e) {
                final String err = "Problem with deployment request file: ";
                throw new ParameterProblem(err + e.getMessage(), e);
            }
        }

        int deployDuration = 0;
        if (this.args.deploy_DurationString != null) {
            deployDuration = this._getDurationArg();
        }

        int memoryRequest = 0;
        if (this.args.deploy_MemoryString != null) {
            memoryRequest = this._getMemoryArg();
        }

        short numNodes = 0;
        if (this.args.deploy_NumNodesString != null) {
            numNodes = this._getNumNodesArg();
        }

        InitialState_Type requestState = null;
        if (this.args.deploy_StateString != null) {
            requestState = this._getDeployStateArg();
        }

        ShutdownMechanism_Type shutdownMechanism = null;
        if (this.args.trashAtShutdown) {
            shutdownMechanism = ShutdownMechanism_Type.Trash;
        }

        URI newPropagationTargetURI = null;
        try {
            if (this.args.saveTarget != null) {
                newPropagationTargetURI = new URI(this.args.saveTarget);
            }
        } catch (Exception e) {
            throw new ParameterProblem("Problem with save-target '" +
                    this.args.saveTarget + "': " + e.getMessage(), e);
        }

        if (this.dep == null) {

            boolean end = false;
           
            String err = name() + " requires a deployment request.  This " +
                    "can be specified by file or by a number of arguments." +
                    "  Problem encountered is that a file request is not " +
                    "configured and expected commandline arguments are " +
                    "missing: ";

            if (deployDuration < 1 && memoryRequest < 1) {
                end = true;
                err += "duration and memory request.";
            } else if (memoryRequest < 1) {
                end = true;
                err += "memory request.";
            } else if (deployDuration < 1) {
                end = true;
                err += "duration.";
            }

            if (end) {
                throw new ParameterProblem(err);
            }

            // default is 1
            if (numNodes < 1) {
                numNodes = 1;
            }

            // default is Running
            if (requestState == null) {
                requestState = InitialState_Type.Running;
            }

            // shutdownMechanism has no default except 'not set' which
            // triggers 'normal'

            this.dep = WSUtils.constructDeploymentType(deployDuration,
                                                       memoryRequest,
                                                       numNodes,
                                                       requestState,
                                                       shutdownMechanism,
                                                       newPropagationTargetURI);

            if (this.pr.enabled()) {
                final String msg =
                        "Created deployment request soley from arguments.";
                if (this.pr.useThis()) {
                    this.pr.infoln(
                            PrCodes.DEPREQ__USING_ARGS, msg);
                } else if (this.pr.useLogging()) {
                    logger.info(msg);
                }
            }

        } else {

            if (deployDuration > 0) {
                if (this.pr.enabled()) {
                    final String msg =
                        "Duration argument provided: overriding duration " +
                        "found in deployment request file, it is now: " +
                        deployDuration + " minutes";

                    final String dbg;
                    try {
                        final int oldMins = CommonUtil.durationToMinutes(
                                this.dep.getDeploymentTime().getMinDuration());
                        dbg = "Old duration: " + oldMins + " minutes";
                    } catch (InvalidDurationException e) {
                        throw new ParameterProblem(e.getMessage(), e);
                    }

                    if (this.pr.useThis()) {
                        this.pr.infoln(
                            PrCodes.DEPREQ__FILE_OVERRIDE, msg);
View Full Code Here


       
        final int deployDuration;
        try {
            deployDuration = Integer.parseInt(this.args.deploy_DurationString);
        } catch (NumberFormatException nfe) {
            throw new ParameterProblem(
                    "The given duration argument is not a valid number " +
                        "(given '" + this.args.deploy_DurationString + "')");
        }

        if (deployDuration < 1) {
            throw new ParameterProblem(
                    "The given duration argument is less than one " +
                        "(given '" + this.args.deploy_DurationString + "')");
        }

        return deployDuration;
View Full Code Here

        final int memory;
        try {
            memory = Integer.parseInt(this.args.deploy_MemoryString);
        } catch (NumberFormatException nfe) {
            throw new ParameterProblem(
                    "The given memory argument is not a valid number " +
                        "(given '" + this.args.deploy_MemoryString + "')");
        }

        if (memory < 1) {
            throw new ParameterProblem(
                    "The given memory argument is less than one " +
                        "(given '" + this.args.deploy_MemoryString + "')");
        }

        return memory;
View Full Code Here

        final int numNodes;
        try {
            numNodes = Integer.parseInt(this.args.deploy_NumNodesString);
        } catch (NumberFormatException nfe) {
            throw new ParameterProblem(
                    "The given num-nodes argument is not a valid number " +
                        "(given '" + this.args.deploy_NumNodesString + "')");
        }

        if (numNodes < 1) {
            throw new ParameterProblem(
                    "The given num-nodes argument is less than one " +
                        "(given '" + this.args.deploy_NumNodesString + "')");
        }

        if (numNodes > Short.MAX_VALUE) {
            throw new ParameterProblem("Your num-nodes request exceeds the " +
                    "capacity of the num-nodes data-type.");
        }

        return (short)numNodes;
    }
View Full Code Here

    private InitialState_Type _getDeployStateArg() throws ParameterProblem {

        // will handle case difference:
        if (!StateUtils.isValidRequestState(this.args.deploy_StateString)) {
            throw new ParameterProblem(
                    "The given request-state argument is not a valid " +
                            "initial state to request (given '" +
                            this.args.deploy_StateString + "')");
        }
View Full Code Here

                this.optionalParameters =
                        FileUtils.getOptionalFromFile(
                                this.pr, this.args.optionalParametersPath);
            } catch (Exception e) {
                final String err = "Problem with optional parameters file: ";
                throw new ParameterProblem(err + e.getMessage(), e);
            }
        } else {
            this.optionalParameters = new OptionalParameters_Type();
        }
View Full Code Here

                logger.info(msg);
            }
        }

        if (this.args.delegationFactoryUrl == null) {
            throw new ParameterProblem("Delegation is required but a " +
                    "delegation factory URL was not supplied");
        } else {
            this.delegationFactoryUrl = this.args.delegationFactoryUrl;
        }

        if (this.args.delegationLifetimeString != null) {
            try {
                this.delegationLifetime =
                        Integer.parseInt(this.args.delegationLifetimeString);
            } catch (NumberFormatException nfe) {
                throw new ParameterProblem(
                        "The given delegation lifetime argument is not a " +
                        "valid number (given '" +
                        this.args.delegationLifetimeString + "')");
            }
            if (this.pr.enabled()) {
View Full Code Here

            sshPolicy =
                    FileUtils.getSshPolicyFromFile(this.pr,
                                                   this.args.sshKeyPath);
        } catch (IOException e) {
            final String err = "Problem with SSH policy file: ";
            throw new ParameterProblem(err + e.getMessage(), e);
        }

        if (sshPolicy == null || sshPolicy.trim().length() == 0) {
            throw new ParameterProblem("SSH policy file is empty?");
        }

        final CustomizeTask_Type ctt =
                new CustomizeTask_Type(sshPolicy,
                                       "/root/.ssh/authorized_keys");
View Full Code Here

            userData =
                    FileUtils.getUserDataFromFile(this.pr,
                                                  this.args.mdUserDataPath);
        } catch (IOException e) {
            final String err = "Problem with user data file: ";
            throw new ParameterProblem(err + e.getMessage(), e);
        }

        if (userData == null || userData.trim().length() == 0) {
            throw new ParameterProblem(
                    "User data file is empty? (specified file '" +
                            this.args.mdUserDataPath + "')");
        }
       
        this.optionalParameters.setMdServerUserdata(userData);
View Full Code Here

    private void validateEnsembleCmdlineArgs() throws ParameterProblem {

        if (this.args.joinEnsembleEprFile != null &&
                this.args.newEnsembleEprFile != null) {

            throw new ParameterProblem("Both --" +
                    Opts.ENSEMBLE_JOIN_OPT_STRING + " and --" +
                    Opts.ENSEMBLE_NEW_OPT_STRING + " were given.  " +
                    "Only provide one.  --" +
                    Opts.ENSEMBLE_JOIN_OPT_STRING + " if you want " +
                    "this deployment to be part of an already " +
                    "created ensemble, --" +
                    Opts.ENSEMBLE_NEW_OPT_STRING + " if a new " +
                    "ensemble should be created along with this " +
                    "deployment.");
        }

        this.lastInEnsemble = this.args.lastInEnsemble;

        if (this.args.newEnsembleEprFile != null && this.lastInEnsemble) {

            throw new ParameterProblem("You may not specify --" +
                    Opts.ENSEMBLE_NEW_OPT_STRING + " (which " +
                    "requests a new ensemble be created) and --" +
                    Opts.ENSEMBLE_LAST_OPT_STRING + ".");
        }

        this.joinEnsembleEPR = null;
        if (this.args.joinEnsembleEprFile != null) {

            try {
                this.joinEnsembleEPR =
                        FileUtils.getEPRfromFile(this.args.joinEnsembleEprFile);
            } catch (Exception e) {
                throw new ParameterProblem("Problem deserializing " +
                        "EPR from '" + this.args.joinEnsembleEprFile +
                        "' file: " + e.getMessage(), e);
            }

            if(!EPRUtils.isEnsembleEPR(this.joinEnsembleEPR)) {
                throw new ParameterProblem("File '" +
                        this.args.joinEnsembleEprFile + "' does not " +
                        "contain a valid ensemble EPR file");
            }
        }
View Full Code Here

TOP

Related Classes of org.globus.workspace.client_core.ParameterProblem

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.