Package com.sun.enterprise.universal.process

Examples of com.sun.enterprise.universal.process.ProcessManager


    private int uninstall() throws ProcessManagerException {
        if (info.dryRun || !targetWin32Exe.canExecute())
            return 0;
        // it is NOT an error to not be able to uninstall
        ProcessManager mgr = new ProcessManager(targetWin32Exe.getPath(), "uninstall");
        mgr.setEcho(false);
        mgr.execute();
        trace("Uninstall STDERR: " + mgr.getStderr());
        trace("Uninstall STDOUT: " + mgr.getStdout());
        return mgr.getExitValue();
    }
View Full Code Here


            targetXml.delete();
            targetWin32Exe.delete();
        }
        else {
            ProcessManager mgr = new ProcessManager(targetWin32Exe.getPath(), "install");
            mgr.setEcho(false);
            mgr.execute();
            int ret = mgr.getExitValue();

            if (ret != 0)
                throw new RuntimeException(Strings.get("windows.services.install.bad",
                        "" + ret, mgr.getStdout(), mgr.getStderr()));

            trace("Install STDERR: " + mgr.getStderr());
            trace("Install STDOUT: " + mgr.getStdout());
        }
    }
View Full Code Here

                throw new RuntimeException(Strings.get("not_installed"));

            if (!targetWin32Exe.canExecute())
                throw new RuntimeException(Strings.get("cant_exec"));

            ProcessManager pm = new ProcessManager(targetWin32Exe.getAbsolutePath(), "stop");
            pm.setEcho(false);
            pm.execute();

            pm = new ProcessManager(targetWin32Exe.getAbsolutePath(), "uninstall");
            pm.setEcho(false);
            pm.execute();

            trace("Uninstalled Windows Service");

            if (!targetWin32Exe.delete())
                targetWin32Exe.deleteOnExit();
View Full Code Here

        final File keyStoreFile = serverEnv.getJKS();
        final File trustStoreFile = new File(serverEnv.getConfigDirPath(), "cacerts.jks");
        final String pw = masterPassword();
        final char[] pwChar = pw.toCharArray();
       
        ProcessManager pm = new ProcessManager(new String[]{
            "keytool",
            "-genkey",
            "-keyalg", "RSA",
            "-keystore", keyStoreFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS,
            "-dname", getCertificateDN(),
            "-validity", "3650",
            "-keypass", pw,
            "-storepass", pw,});
        pm.execute();
        if (pm.getExitValue() != 0) {
            final String err = pm.getStdout();
            throw new RuntimeException(err);
        }
       
        final File tempCertFile = new File(serverEnv.getConfigDirPath(),"temp.cer");
        tempCertFile.deleteOnExit();
        pm = new ProcessManager(new String[] {
            "keytool",
            "-exportcert",
            "-keystore", keyStoreFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS,
            "-keypass", pw,
            "-storepass", pw,
            "-file", tempCertFile.getAbsolutePath()
        });
        pm.execute();
       
        if (pm.getExitValue() != 0) {
            throw new RuntimeException(pm.getStderr());
        }
       
        pm = new ProcessManager(new String[] {
            "keytool",
            "-importcert",
            "-noprompt",
            "-trustcacerts",
            "-storepass", pw,
            "-keypass", pw,
            "-keystore", trustStoreFile.getAbsolutePath(),
            "-file", tempCertFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS
        });
        pm.execute();
        tempCertFile.delete();
       
        if (pm.getExitValue() != 0) {
            throw new RuntimeException(pm.getStderr());
        }
       
        /*
         * Reload the keystore and truststore from disk.
         */
 
View Full Code Here

         */
        final File keyStoreFile = serverEnv.getJKS();
        final File trustStoreFile = new File(serverEnv.getConfigDirPath(), "cacerts.jks");
        final String pw = masterPassword();
       
        ProcessManager pm = new ProcessManager(new String[]{
            "keytool",
            "-genkey",
            "-keyalg", "RSA",
            "-keystore", keyStoreFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS,
            "-dname", getCertificateDN(),
            "-validity", "3650",
            "-keypass", pw,
            "-storepass", pw,});
        pm.execute();
        if (pm.getExitValue() != 0) {
            final String err = pm.getStdout();
            throw new RuntimeException(err);
        }
       
        final File tempCertFile = new File(serverEnv.getConfigDirPath(),"temp.cer");
        tempCertFile.deleteOnExit();
        pm = new ProcessManager(new String[] {
            "keytool",
            "-exportcert",
            "-keystore", keyStoreFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS,
            "-keypass", pw,
            "-storepass", pw,
            "-file", tempCertFile.getAbsolutePath()
        });
        pm.execute();
       
        if (pm.getExitValue() != 0) {
            throw new RuntimeException(pm.getStderr());
        }
       
        pm = new ProcessManager(new String[] {
            "keytool",
            "-importcert",
            "-noprompt",
            "-trustcacerts",
            "-storepass", pw,
            "-keypass", pw,
            "-keystore", trustStoreFile.getAbsolutePath(),
            "-file", tempCertFile.getAbsolutePath(),
            "-alias", SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS
        });
        pm.execute();
        if ( ! tempCertFile.delete()) {
            logger.log(Level.FINE, "Unable to delete temp file {0}; continuing", tempCertFile.getAbsolutePath());
        }
       
        if (pm.getExitValue() != 0) {
            throw new RuntimeException(pm.getStderr());
        }
       
        /*
         * Reload the keystore and truststore from disk.
         */
 
View Full Code Here

        }

        fullcommand.add("--interactive=false");
        fullcommand.addAll(cmdLine);

        ProcessManager pm = new ProcessManager(fullcommand);
        if (!pass.isEmpty())
            pm.setStdinLines(pass);

        if (logger.isLoggable(Level.INFO)) {
            logger.info("Running command on DAS: " + commandListToString(fullcommand));
        }
        pm.setTimeoutMsec(DEFAULT_TIMEOUT_MSEC);

        if (logger.isLoggable(Level.FINER))
            pm.setEcho(true);
        else
            pm.setEcho(false);

        try {
            exit = pm.execute();
        }
        catch (ProcessManagerException ex) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Error while executing command: " + ex.getMessage());
            }
            exit = 1;
        }

        String stdout = pm.getStdout();
        String stderr = pm.getStderr();

        if (output != null) {
            if (StringUtils.ok(stdout)) {
                output.append(stdout);
            }
View Full Code Here

        }

        fullcommand.add("--interactive=false");
        fullcommand.addAll(cmdLine);

        ProcessManager pm = new ProcessManager(fullcommand);
        if (!pass.isEmpty())
            pm.setStdinLines(pass);

        if (logger.isLoggable(Level.INFO)) {
            logger.info("Running command on DAS: " + commandListToString(fullcommand));
        }
        pm.setTimeoutMsec(DEFAULT_TIMEOUT_MSEC);

        if (logger.isLoggable(Level.FINER))
            pm.setEcho(true);
        else
            pm.setEcho(false);

        try {
            exit = pm.execute();
        }
        catch (ProcessManagerException ex) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Error while executing command: " + ex.getMessage());
            }
            exit = 1;
        }

        String stdout = pm.getStdout();
        String stderr = pm.getStderr();

        if (output != null) {
            if (StringUtils.ok(stdout)) {
                output.append(stdout);
            }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.universal.process.ProcessManager

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.