Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.CommandValidationException


        if (StringUtils.ok(p)) {
            try {
                expandedPassword = RelativePathResolver.getRealPasswordFromAlias(p);
            }
            catch (IllegalArgumentException e) {
                throw new CommandValidationException(
                        Strings.get("no.such.password.alias", p));
            }
            catch (Exception e) {
                throw new CommandValidationException(
                        Strings.get("no.such.password.alias", p),
                        e);
            }

            if (expandedPassword == null) {
                throw new CommandValidationException(
                        Strings.get("no.such.password.alias", p));
            }
        }
    }
View Full Code Here


                break;
            case DCOM:
                pingDcomConnection(node);
                break;
            default:
                throw new CommandValidationException("Internal Error: unknown type");
        }
    }
View Full Code Here

                m2 = e2.getMessage();
            }
            String msg = Strings.get("ssh.bad.connect", node.getNodeHost(), "SSH");
            logger.warning(StringUtils.cat(": ", msg, m1, m2,
                    sshL.toString()));
            throw new CommandValidationException(StringUtils.cat(NL,
                    msg, m1, m2));
        }
    }
View Full Code Here

            if (e2 != null) {
                m2 = e2.getMessage();
            }
            String msg = Strings.get("ssh.bad.connect", node.getNodeHost(), "DCOM");
            logger.warning(StringUtils.cat(": ", msg, m1, m2));
            throw new CommandValidationException(StringUtils.cat(NL, msg, m1, m2));
        }
    }
View Full Code Here

            WindowsRemoteFile wrf = new WindowsRemoteFile(wrfs, installRoot);
            WindowsCredentials creds = new WindowsCredentials(host, domain, username, password);

            // also looking for side-effect of Exception getting thrown...
            if (!wrf.exists()) {
                throw new CommandValidationException(Strings.get("dcom.no.remote.install",
                        host, installRoot));
            }

            if (!WindowsRemotePinger.ping(installRoot, creds))
                throw new CommandValidationException(Strings.get("dcom.no.connection", host));
        }
        catch (CommandValidationException cve) {
            throw cve;
        }
        catch (Exception ex) {
            throw new CommandValidationException(ex);
        }
    }
View Full Code Here

        String sshkeypassphrase = map.getOne(PARAM_SSHKEYPASSPHRASE);
        boolean installFlag = Boolean.parseBoolean(map.getOne(PARAM_INSTALL));

        // We use the resolver to expand any system properties
        if (!NetUtils.isPortStringValid(resolver.resolve(sshport))) {
            throw new CommandValidationException(Strings.get(
                    "ssh.invalid.port", sshport));
        }

        int port = Integer.parseInt(resolver.resolve(sshport));

        try {
            // sshpassword and sshkeypassphrase may be password alias.
            // Those aliases are handled by sshLauncher
            String resolvedInstallDir = resolver.resolve(installdir);

            sshL.validate(resolver.resolve(nodehost),
                    port,
                    resolver.resolve(sshuser),
                    sshpassword,
                    resolver.resolve(sshkeyfile),
                    sshkeypassphrase,
                    resolvedInstallDir,
                    // Landmark file to ensure valid GF install
                    LANDMARK_FILE,
                    logger);
        }
        catch (IOException e) {
            String m1 = e.getMessage();
            String m2 = "";
            Throwable e2 = e.getCause();
            if (e2 != null) {
                m2 = e2.getMessage();
            }
            if (e instanceof FileNotFoundException) {
                logger.warning(StringUtils.cat(": ", m1, m2, sshL.toString()));
                if (!installFlag)
                    throw new CommandValidationException(StringUtils.cat(NL,
                            m1, m2));
            }
            else {
                String msg = Strings.get("ssh.bad.connect", nodehost, "SSH");
                logger.warning(StringUtils.cat(": ", msg, m1, m2,
                        sshL.toString()));
                throw new CommandValidationException(StringUtils.cat(NL,
                        msg, m1, m2));
            }
        }
    }
View Full Code Here

        try {
            return RemoteType.valueOf(map.getOne(PARAM_TYPE));
        }
        catch (Exception e) {
            throw new CommandValidationException(e);
        }
    }
View Full Code Here

        if (domainDir == null) {
            domainDir = getSystemProperty(
                    SystemPropertyConstants.DOMAINS_ROOT_PROPERTY);
        }
        if (domainDir == null) {
            throw new CommandValidationException(
                    strings.get("InvalidDomainPath", domainDir));
        }

        /*
         * The only required value is the domain_name operand, which might have
         * been prompted for before we get here.
         *
         * If --user wasn't specified as a program option, we treat it as a
         * required option and prompt for it if possible, unless --nopassword
         * was specified in which case we default the user name.
         *
         * The next prompted-for value will be the admin password, if required.
         */
        if (programOpts.getUser() == null && !noPassword) {
            // prompt for it (if interactive)
            Console cons = System.console();
            if (cons != null && programOpts.isInteractive()) {
                cons.printf("%s", strings.get("AdminUserRequiredPrompt",
                        SystemPropertyConstants.DEFAULT_ADMIN_USER));
                String val = cons.readLine();
                if (ok(val)) {
                    programOpts.setUser(val);
                    if (adminPassword == null) {
                        adminPassword = getAdminPassword();
                    }
                }
            }
            else {
                //logger.info(strings.get("AdminUserRequired"));
                throw new CommandValidationException(
                        strings.get("AdminUserRequired"));
            }
        }
        if (programOpts.getUser() != null) {
            try {
                FileRealmHelper.validateUserName(programOpts.getUser());
            }
            catch (IllegalArgumentException ise) {
                throw new CommandValidationException(
                        strings.get("InvalidUserName", programOpts.getUser()));
            }
        }
    }
View Full Code Here

            throws CommandValidationException {
        try {
            return Integer.parseInt(port);
        }
        catch (Exception e) {
            throw new CommandValidationException(
                    strings.get("InvalidPortNumber", port));
        }
    }
View Full Code Here

     * @throws CommandValidationException is port number is not a numeric value.
     */
    private void verifyPortBasePortIsValid(String portName, int portNum)
            throws CommandValidationException {
        if (portNum <= 0 || portNum > PORT_MAX_VAL) {
            throw new CommandValidationException(
                    strings.get("InvalidPortBaseRange", portNum, portName));
        }
        if (checkPorts && !NetUtils.isPortFree(portNum)) {
            throw new CommandValidationException(
                    strings.get("PortBasePortInUse", portNum, portName));
        }
        logger.log(Level.FINER, "Port ={0}", portNum);
    }
View Full Code Here

TOP

Related Classes of org.glassfish.api.admin.CommandValidationException

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.