Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.CommandException


                if (!getForce()) {
                    WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
                    WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, remoteInstallDirString);

                    if (remoteInstallDir.exists())
                        throw new CommandException(Strings.get("install.dir.exists", remoteInstallDir));
                }
            }
        }
        catch (WindowsException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here


        WindowsCredentials bonafides = new WindowsCredentials(host, domain, getRemoteUser(), remotePassword);
        WindowsRemoteScripter scripter = new WindowsRemoteScripter(bonafides);
        String out = scripter.run(unpackScript);

        if (out == null || out.length() < 50)
            throw new CommandException(Strings.get("dcom.error.unpacking", unpackScript, out));

        logger.fine("Output from Windows Unpacker:\n" + out);
    }
View Full Code Here

        // see StopLocalInstance for comments.  These 2 lines can be refactored.
        setLocalPassword();
        programOpts.setInteractive(false);

        if(!isRestartable())
            throw new CommandException(Strings.get("restart.notRestartable"));

        // find out how long the server has been up
        long uptimeOldServer = getUptime()// may throw CommandException

        // get the timestamp BEFORE calling the server!
View Full Code Here

        Globals.setDefaultHabitat(habitat);
        installDir = resolver.resolve(installDir);
        if (!force) {
            for (String host : hosts) {
                if (checkIfNodeExistsForHost(host, installDir)) {
                    throw new CommandException(Strings.get("call.delete.node.ssh", host));
                }
            }
        }
    }
View Full Code Here

        try {
            File serverDir = new File(nodeDir,node);

            if (serverDir == null || !serverDir.isDirectory()) {
                throw new CommandException(strings.get("bad.node.dir",serverDir));
            }
            String serverName = getServerDirs().getServerName();
            HostAndPort adminAddress = getAdminAddress(serverName);

            if (isRunning(adminAddress.getHost(), adminAddress.getPort()))
                throw new CommandException(strings.get("instance.is.running",
                        serverName));

            oldPassword = passwords.get("AS_ADMIN_MASTERPASSWORD");
            if (oldPassword == null) {
                oldPassword = super.readPassword(strings.get("old.mp"));
            }
            if (oldPassword == null)
                throw new CommandException(strings.get("no.console"));

            // for each instance iterate through the instances first,
            // read each keystore with the old password,
            // only then should it save the new master password.
            boolean valid = true;
            for(String instanceDir: getInstanceDirs(nodeDirChild)) {
               valid &= verifyInstancePassword(new File(nodeDirChild,instanceDir));
           }
           if (!valid) {
               throw new CommandException(strings.get("incorrect.old.mp"));
           }
            ParamModelData nmpo = new ParamModelData("AS_ADMIN_NEWMASTERPASSWORD",
                    String.class, false, null);
            nmpo.description = strings.get("new.mp");
            nmpo.param._password = true;
            newPassword = super.getPassword(nmpo, null, true);

            // for each instance encrypt the keystore
            for(String instanceDir: getInstanceDirs(nodeDirChild)) {
               encryptKeystore(instanceDir);
           }
            if (savemp) {
                createMasterPasswordFile();              
            }
            return 0;
        } catch(Exception e) {
            throw new CommandException(e.getMessage(),e);
        }
    }
View Full Code Here

                MASTER_PASSWORD_ALIAS.toCharArray());
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, newPassword.getBytes());
            pwdFile.setReadable(true);
            pwdFile.setWritable(true);
        } catch (Exception ex) {
            throw new CommandException(strings.get("masterPasswordFileNotCreated", pwdFile),
                ex);
        }
    }
View Full Code Here

        NodeKeystoreManager km = new NodeKeystoreManager();
        try {
            km.encryptKeystore(nodeConfig,oldPassword,newPassword);
          
        } catch (Exception e) {
             throw new CommandException(strings.get("Keystore.not.encrypted"),
                e);
        }

    }
View Full Code Here

                 return f.isDirectory();
             }
         });

         if (files == null || files.length == 0) {
             throw new CommandException(
                     strings.get("Instance.noInstanceDirs", parent));
         }

         for (File f : files) {
             if (!f.getName().equals("agent"))
View Full Code Here

                String pw = getWindowsPassword(host);
                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), pw);
                WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, getInstallDir());

                if (!remoteInstallDir.exists()) {
                    throw new CommandException(
                            Strings.get("remote.install.dir.already.gone", getInstallDir()));
                }
                remoteInstallDir.delete();

                // make sure it's gone now...
                if (remoteInstallDir.exists()) {
                    throw new CommandException(Strings.get("remote.install.dir.cant.delete", getInstallDir()));
                }
            }
            catch (CommandException ce) {
                throw ce;
            }
            catch (Exception e) {
                throw new CommandException(e);
            }
        }
    }
View Full Code Here

        }
        catch (CommandException ex) {
            throw ex;
        }
        catch (IOException ex) {
            throw new CommandException(ex);
        }
        catch (InterruptedException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here

TOP

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

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.