Examples of InitialState_Type


Examples of org.nimbustools.messaging.gt4_0.generated.negotiable.InitialState_Type

            } else {
                req.setShutdownType(type);
            }
        }

        final InitialState_Type initialState = dep.getInitialState();
        if (initialState == null) {
            req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);
        } else {
            final String state = (String) initialStateMap.get(initialState);
            if (state == null) {
                throw new CannotTranslateException("unknown initial " +
                        "state '" + initialState.toString() + "'");
            } else {
                req.setInitialStateRequest(state);
            }
        }
View Full Code Here

Examples of org.nimbustools.messaging.gt4_0.generated.negotiable.InitialState_Type

        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);
                        this.pr.dbg(dbg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                        logger.debug(dbg);
                    }
                }
                this.dep.setDeploymentTime(
                        WSUtils.constructDeploymentTime_Type(deployDuration));
            }

            if (memoryRequest > 0) {
                if (this.pr.enabled()) {
                    final String msg =
                        "Memory argument provided: overriding memory " +
                        "found in deployment request file, it is now: " +
                        memoryRequest + " MB";

                    if (this.pr.useThis()) {
                        this.pr.infoln(
                            PrCodes.DEPREQ__FILE_OVERRIDE, msg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                    }
                }

                WSUtils.setMemory(memoryRequest,
                                  this.dep.getResourceAllocation());
            }

            if (numNodes > 0) {
                if (this.pr.enabled()) {
                    final String msg =
                        "Num-nodes argument provided: overriding number " +
                        "found in deployment request file, it is now: " +
                        numNodes + " nodes";

                    final String dbg = "Old num-nodes: " +
                                this.dep.getNodeNumber();

                    if (this.pr.useThis()) {
                        this.pr.infoln(
                            PrCodes.DEPREQ__FILE_OVERRIDE, msg);
                        this.pr.dbg(dbg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                        logger.debug(dbg);
                    }
                }

                this.dep.setNodeNumber(numNodes);
            }

            if (requestState != null) {

                if (this.pr.enabled()) {
                    final String msg =
                        "Initial state argument provided: overriding " +
                        "initial state setting found in deployment request " +
                        "file, it is now: " + requestState.getValue();

                    final String dbg = "Old state: " +
                                this.dep.getInitialState().getValue();

                    if (this.pr.useThis()) {
                        this.pr.infoln(
                            PrCodes.DEPREQ__FILE_OVERRIDE, msg);
                        this.pr.dbg(dbg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                        logger.debug(dbg);
                    }
                }

                this.dep.setInitialState(requestState);
            }

            if (shutdownMechanism != null) {

                if (this.pr.enabled()) {

                    boolean presentInFile = false;
                    String dbg = "No setting in file for shutdown mechanism";
                    if (this.dep.getShutdownMechanism() != null) {
                        presentInFile = true;
                        dbg = "Old shutdown mechanism: " +
                            this.dep.getShutdownMechanism().getValue();
                    }

                    final String msg;
                    if (presentInFile) {
                        msg = "Shutdown mechanism argument provided: " +
                               "overriding shutdown mechanism setting found " +
                               "in deployment request file, it is now: " +
                               requestState.getValue();
                    } else {
                        msg = "Setting shutdown mechanism to: " +
                               requestState.getValue();
                    }

                    if (this.pr.useThis()) {
                        this.pr.infoln(
                            PrCodes.DEPREQ__FILE_OVERRIDE, msg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.