Package org.globus.workspace.client_core

Examples of org.globus.workspace.client_core.ParameterProblem


    void handleParameters() throws ParameterProblem {

        Set<AllArgs.Action> actions = this.args.getActions();

        if (actions.isEmpty()) {
            throw new ParameterProblem("At least one action must be specified.");
        }

        if (actions.contains(AllArgs.Action.HELP)) {
            return;
        }
View Full Code Here


    void handleCommonParameters() throws ParameterProblem {

        String clouddirPath = this.args.getCloudConfDir();

        if (clouddirPath == null) {
            throw new ParameterProblem("You must specify a cloud configuration" +
                " directory with --"+Opts.CLOUD_DIR_OPT_STRING);
        }
        this.cloudManager = new CloudManager(clouddirPath);

        String historyDirectory = this.args.getHistoryDirectory();
         if (historyDirectory == null) {
            throw new ParameterProblem("You must specify a cloud history dir "+
                                       " with --"+Opts.HISTORY_DIR_OPT_STRING);
        }

        CloudClientUtil.verifyHistoryDir(historyDirectory, true, true);
View Full Code Here

        int duration = this.args.getDurationMinutes();
        int pollMs = this.args.getPollMs();


        if (clusterPath == null) {
            throw new ParameterProblem("You must specify a cluster " +
                "document with --" + Opts.CLUSTER_OPT_STRING);
        }

        this.cluster = ClusterUtil.getCluster(clusterPath, this.print);

        Cloudworkspace_Type[] workspaces = this.cluster.getWorkspace();
        if (workspaces == null || workspaces.length == 0) {
            throw new ParameterProblem("The cluster document must contain "+
                "at least one workspace");
        }

        for (Cloudworkspace_Type ws : workspaces) {

            final Clouddeploy_Type[] deploys = ws.getDeploy();
            if (deploys != null && deploys.length > 0) {
                // we may want to enable this functionality in the future
                // but let's keep things simple for now
                throw new ParameterProblem("Your cluster document includes <deploy> " +
                    "elements, which are not allowed at this time.");
            }

            String name = ws.getName();
            if (name == null || name.trim().length() == 0) {
                throw new ParameterProblem("Every workspace must have a unique "+
                    "name");
            }
            name = name.trim();

            for (Cloudworkspace_Type existingWs : this.workspaceList) {
                String existingWsName = existingWs.getName().trim();

                if (existingWsName.equals(name)) {
                    throw new ParameterProblem("Every workspace must have a " +
                        "unique name");
                }
            }

            this.workspaceList.add(ws);
        }

        if (deployPath == null) {
            throw new ParameterProblem("You must specify a deployment document " +
                "using the --"+Opts.DEPLOY_OPT_STRING+" option");
        }

        final Map<String, Clouddeploy_Type[]> deployMap;

        try {
            final Clouddeployment_Type deployDoc =
                ClusterUtil.parseDeployDocument(deployPath);
            deployMap = ClusterUtil.parseDeployment(deployDoc);

        } catch (DeserializationException de) {
            throw new ParameterProblem("Failed to parse deployment " +
                "document: " + de.getMessage());
        } catch (IOException ie) {
            throw new ParameterProblem("Failed to read deployment "+
                "document: "+ ie.getMessage());
        }

        handleDeploymentMap(deployMap);

        if (this.needsBroker) {
            if (brokerUrl == null || brokerId == null) {
                throw new ParameterProblem("You must specify a valid Context " +
                    "Broker URL and identity string in your properties file ("+
                    this.args.getPropertiesPath()+") keys: "+
                    Props.KEY_BROKER_URL+" and " + Props.KEY_BROKER_IDENTITY
                );
            }
        }

        if (sshFile == null) {
            this.print.info("\nWarning: a SSH public key was not specified. " +
                "It will not be installed into cluster.");
        }

        if (duration <= 0) {
            throw new ParameterProblem("Please specify a valid duration (--"+
                Opts.HOURS_OPT_STRING+")");
        }

        if (pollMs <= 0) {
            throw new ParameterProblem("Please specify a valid polling " +
                "frequency in the properties file ("+
                this.args.getPropertiesPath()+")");
        }

    }
View Full Code Here

        for (Map.Entry<String,Clouddeploy_Type[]> entry : deployMap.entrySet()) {

            final String workspaceName = entry.getKey();
            int workspaceIndex = getWorkspaceIndex(workspaceName);
            if (workspaceIndex == -1) {
                throw new ParameterProblem("Deployment document contains "+
                    "a workspace: '"+ entry.getKey()+"' which is not present "+
                    "in the cluster definition");
            }

            final Cloudworkspace_Type workspace =
                this.cluster.getWorkspace(workspaceIndex);

            final short workspaceQuantity =
                workspace.getQuantity();

            short foundQuantity = 0;

            for (Clouddeploy_Type deploy : entry.getValue()) {

                String cloudName = deploy.getCloud();
                if (cloudName != null) {
                    cloudName = cloudName.trim();
                }
                if (cloudName == null || cloudName.length() == 0) {
                    throw new ParameterProblem("Invalid <cloud> name");
                }

                foundQuantity += deploy.getQuantity();

                CloudDeployment cloud = getDeploymentByName(cloudName);

                final String localNicPrefix =
                    cloud.getCloud().getBrokerLocalNicPrefix();

                final String publicNicPrefix =
                    cloud.getCloud().getBrokerPublicNicPrefix();

                ClusterMember member = ClusterUtil.parseRequest(this.cluster,
                    workspaceIndex, this.print, localNicPrefix, publicNicPrefix);

                if (member.getClusterForUserData() != null) {
                    needsBroker = true;
                }

                final MemberDeployment md = new MemberDeployment(member, deploy);
                cloud.addMember(md);
            }

            if (foundQuantity != workspaceQuantity) {
                throw new ParameterProblem("The workspace '"+workspaceName+
                    "' has a quantity of "+workspaceQuantity+" but the total "+
                    "quantity of all deployments of this workspace is "+
                    foundQuantity);
            }
        }

        // we already know that every deployment workspace is a valid
        // ClusterMember, so if the sizes match we can be sure that every
        // ClusterMember is accounted for
        if (deployMap.size() != this.workspaceList.size()) {
            throw new ParameterProblem("There must be a deployment entry "+
                "for each defined workspace.");
        }


    }
View Full Code Here

    public static int mainImpl(String[] argv, Print pr) {

        final CloudClient client = new CloudClient(pr);

        // used:
        ParameterProblem parameterProblem = null;
        ExitNow exitNow = null;
        Throwable any = null;

        // unused currently:
        //Throwable throwable = null;
View Full Code Here

        try {
            allArgs.intakeCmdlineOptions(argv);
        } catch (ParseException e) {
            // in all likelihood due to issue with given parameter
            throw new ParameterProblem(e.getMessage(), e);
        }
       
        try {
            allArgs.intakeUserProperties();
            allArgs.intakeDefaultProperties();
        } catch (IOException e) {
            // in all likelihood due to issue with given parameter
            throw new ParameterProblem(e.getMessage(), e);
        }

        client.run(allArgs);
       
        return BaseClient.SUCCESS_EXIT_CODE;
View Full Code Here

                NimbusCredential.setNimbusUnencryptedKeyPath(keyPath);
            }
           
            this.parameterCheck();
        } catch (Exception e) {
            throw new ParameterProblem(e.getMessage(), e);
        }

        try {
            this.runNoParameterCheck();
        } finally {
View Full Code Here

    void parameterCheck() throws Exception {

        final List actions = this.args.getActions();

        if (actions == null || actions.isEmpty()) {
            throw new ParameterProblem("Give at least one action.");
        }

        if (actions.contains(AllArgs.ACTION_HELP) ||
                actions.contains(AllArgs.ACTION_EXTRAHELP) ||
                    actions.contains(AllArgs.ACTION_USAGE)) {
View Full Code Here

    }

    void parameterCheck_hashPrint() throws ParameterProblem {

        if (this.args.getHashPrintDN() == null) {
            throw new ParameterProblem("Hash print requires DN to hash");
        }
    }
View Full Code Here

    void parameterCheck_securityPrint() throws ParameterProblem {
        CloudClientUtil.checkX509Credential("Security printing", this.print);
        try {
            loadX509BeingUsed();
        } catch (Exception e) {
            throw new ParameterProblem(e.getMessage());
        }
    }
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.