Package org.globus.workspace.client_core

Examples of org.globus.workspace.client_core.ParameterProblem


        }

        if (this.args.eprIdDir != null) {
            final File hacky = new File(this.args.eprIdDir);
            if (!hacky.exists()) {
                throw new ParameterProblem(
                        "Does not exist: " + this.args.eprIdDir);
            }
            if (!hacky.isDirectory()) {
                throw new ParameterProblem(
                        "Must be a directory: " + this.args.eprIdDir);
            }
            if (!hacky.canWrite()) {
                throw new ParameterProblem(
                        "Can not write to: " + this.args.eprIdDir);
            }
        }
    }
View Full Code Here


                                                       Object protection,
                                                       Authorization authz)
            throws ParameterProblem {

        if (mech == null) {
            throw new ParameterProblem(
                    "security mechanism is not specified");
        }

        if (protection == null) {
            throw new ParameterProblem(
                    "protection mechanism is not specified");
        }

        if (authz == null) {
            throw new ParameterProblem(
                    "service-authorization mechanism is not specified");
        }

        final ClientSecurityDescriptor desc = new ClientSecurityDescriptor();
View Full Code Here

                                                  this.stubConf,
                                                  this.pr);
    }

    protected void setGroupAction() throws ParameterProblem {
        throw new ParameterProblem("Can not query with group EPR.");
    }
View Full Code Here

    private void validateEndpoint() throws ParameterProblem {

        final EndpointReferenceType epr = this.stubConf.getEPR();

        if (epr == null) {
            throw new ParameterProblem(name() + " requires EPR");
        }

        final String eprStr;
        try {
            eprStr = EPRUtils.eprToString(epr);
        } catch (Exception e) {
            final String err = CommonUtil.genericExceptionMessageWrapper(e);
            throw new ParameterProblem(err, e);
        }

        if (this.pr.enabled()) {
            // xml print
            final String dbg =
View Full Code Here

        final EndpointReferenceType epr;
        if (this.stubConf.getEPR() == null) {

            if (this.args.targetServiceUrl == null) {
                throw new ParameterProblem(name() + " requires a " +
                        "Context Broker URL, see \"" +
                        Opts.CTX_CREATE_OPT_STRING + " -h\"");
            }

            try {
                epr = new EndpointReferenceType(
                                new Address(this.args.targetServiceUrl));
            } catch (URI.MalformedURIException e) {
                throw new ParameterProblem("Given context broker URL " +
                        "appears to be invalid: " + e.getMessage(), e);
            }

            this.stubConf.setEPR(epr);
        } else {
View Full Code Here

        for (Clouddeployworkspace_Type ws : workspaces) {

            String wsName = ws.getName();
            if (wsName == null || wsName.trim().length() == 0) {
                throw new ParameterProblem(
                    "Workspace name cannot be empty or null");
            }

            Clouddeploy_Type[] deploys = ws.getDeploy();
            if (deploys == null || deploys.length == 0) {
                throw new ParameterProblem("Each provided deployment "+
                    "workspace must have at least one deploy element");
            }


           if (map.put(wsName, deploys) != null) {
               throw new ParameterProblem("Each deployment workspace entry "+
                   "must have a unique name");
           }

        }
View Full Code Here

            name = null;
        }

        final String image = member.getImage();
        if (image == null || image.trim().length() == 0) {
            throw new ParameterProblem("Cluster member has no image");
        }

        final short quantity = member.getQuantity();
        if (quantity < 1) {
            throw new ParameterProblem("Illegal, requested less than 1 " +
                    "instance of cluster member '" + name + "'");
        }

        final Cloudnic_Type[] xmlnics = member.getNic();
        if (xmlnics == null || xmlnics.length == 0) {
            throw new ParameterProblem("Cluster member '" + name +
                                            "' has no nic definition.");
        }

        final ClusterMemberNic[] nics = new ClusterMemberNic[xmlnics.length];

        final boolean nicNamesRequired = nics.length > 1;

        for (int i = 0; i < nics.length; i++) {
           
            if (xmlnics[i] == null) {
                throw new ParameterProblem("Cluster member '" + name +
                        "' has null nic element"); // ??
            }

            final String assoc = xmlnics[i].get_value();
            if (assoc == null || assoc.trim().length() == 0) {
                throw new ParameterProblem("Cluster member '" + name +
                        "' has \"<nic>\" element with no network name.");
            }

            String iface = xmlnics[i].get_interface();
           
            if (iface == null || iface.trim().length() == 0) {

                if (nicNamesRequired) {

                    throw new ParameterProblem("Cluster member '" + name +
                        "' has multiple NICs and a \"<nic>\" element with " +
                        "empty or missing interface name.  With multiple " +
                        "NICs you need to explicitly name each one (either" +
                        "'publicnic' or 'localnic'), see " +
                        "samples.");

                } else {

                    final String assocComp = assoc.toLowerCase().trim();
                    final String pubComp;
                    if (brokerPublicNicPrefix != null) {
                        pubComp = brokerPublicNicPrefix.toLowerCase().trim();
                    } else {
                        pubComp = "";
                    }
                    final String privComp;
                    if (brokerLocalNicPrefix != null) {
                        privComp = brokerLocalNicPrefix.toLowerCase().trim();
                    } else {
                        privComp = "";
                    }

                    final String nicName;
                    if (assocComp.startsWith(pubComp)) {
                        nicName = "publicnic";
                    } else if (assocComp.startsWith(privComp)) {
                        nicName = "localnic";
                    } else {
                        throw new ParameterProblem("Cannot pick a broker " +
                                "NIC name for the network '" + assocComp + "'");
                    }

                    iface = doctorContext(nicName,
                                          member.getCtx(),
View Full Code Here

        }

        final Provides_Type provides = ctx.getProvides();

        if (provides == null) {
            throw new ParameterProblem("no provides element?");
        }

        final IdentityProvides_Type[] idents = provides.getIdentity();
        if (idents == null || idents.length == 0) {
            final IdentityProvides_Type ident = new IdentityProvides_Type();
            ident.set_interface(iface);
            final IdentityProvides_Type[] newidents = {ident};
            provides.setIdentity(newidents);

            pr.debugln(memberName + ": found no provides identities, created " +
                    "new, empty one with iface '" + iface + "'");

            return iface; // *** EARLY RETURN ***
        }

        if (idents.length > 1) {
            throw new ParameterProblem(memberName + ": found multiple " +
                    "identities in context 'provides' section, but " +
                    "only one NIC is defined in the cluster definition");
        }

        final String ctxIface = idents[0].get_interface();
View Full Code Here

        if (ssh_hostsfile.startsWith("~")) {

            final String homedir = System.getProperty("user.home");

            if (homedir == null || homedir.trim().length() == 0) {
                throw new ParameterProblem("Need to replace tilde in " +
                        "SSH known hosts file, but cannot determine " +
                        "user home directory.  Please hardcode, see " +
                        "properties file.");
            }

            print.debugln("\n(tilde expansion necessary)");
            print.debugln("$user.home = " + homedir);

            final String result =
                    ssh_hostsfile.replaceFirst("~", homedir);

            print.infoln("SSH known_hosts contained tilde:");
            print.infoln("  - '" + ssh_hostsfile + "' --> '" +
                                            result + "'");

            ssh_hostsfile = result;
        }

        final File f2 = new File(ssh_hostsfile);
        ssh_hostsfile = f2.getAbsolutePath();

        print.debugln("Examining '" + ssh_hostsfile + "'");

        if (!CloudClientUtil.
                fileExistsAndReadwritable(ssh_hostsfile)) {

            throw new ParameterProblem("SSH known_hosts file does " +
                    "not exist or is not read+writable: '" +
                    ssh_hostsfile + "'");
        }

        print.debugln("Exists, readable, and writable: '" +
View Full Code Here

        print.debugln("Examining cluster definition @ '" +
                                        clusterPath + "'");

        if (!CloudClientUtil.fileExistsAndReadable(clusterPath)) {
            throw new ParameterProblem("Given cluster description file " +
                    "does not exist or is not readable: '" +
                    clusterPath + "'");
        }

        print.debugln("Exists and readable: '" + clusterPath + "'");

        print.infoln();

        final Cloudcluster_Type cluster;
        try {
            cluster = parseClusterDocument(clusterPath);
            if (cluster == null) {
                throw new DeserializationException("No parsing result?");
            }
        } catch (DeserializationException e) {
            final String msg = "Could not parse the contents of the cluster " +
                    "definition file you provided.\n - Path: '" +
                    clusterPath + "'\n - Is it legal XML?  Try " +
                    "diffing your file with one of the example files or see " +
                    "the online instructions.\n - Error: " + e.getMessage();
            throw new ParameterProblem(msg, e);
        } catch (IOException e) {
            final String msg = "Problem with the cluster definition file: " +
                    e.getMessage();
            throw new ParameterProblem(msg, e);
        }
        return cluster;
    }
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.