Search in sources :

Example 1 with WindowsException

use of com.sun.enterprise.util.cluster.windows.process.WindowsException in project Payara by payara.

the class ValidateDcom method testDcomFileWrite.

private boolean testDcomFileWrite() {
    try {
        script = new WindowsRemoteFile(wrf, SCRIPT_NAME);
        script.copyFrom("dir " + testdir + "\\\n");
        out.append(Strings.get("dcom.write.ok", SCRIPT_NAME, testdir, host)).append('\n');
    } catch (WindowsException ex) {
        setError(ex, Strings.get("dcom.no.write", SCRIPT_NAME, testdir, host));
        return false;
    }
    return true;
}
Also used : WindowsRemoteFile(com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException)

Example 2 with WindowsException

use of com.sun.enterprise.util.cluster.windows.process.WindowsException in project Payara by payara.

the class ValidateDcom method testWMI.

private boolean testWMI() {
    int count = -1;
    try {
        WindowsWmi ww = new WindowsWmi(creds);
        count = ww.getCount();
        if (debug) {
            String[] info = ww.getInfo();
            out.append(Strings.get("dcom.wmi.procinfolegend"));
            for (String s : info) {
                // e.g. '\tCommandLine = "xxxxx"'
                String[] lines = s.split("[\t\n\r]");
                for (String line : lines) {
                    if (line.startsWith("CommandLine")) {
                        out.append("    ").append(line).append('\n');
                        break;
                    }
                }
            }
        }
    } catch (WindowsException ex) {
        setError(ex, Strings.get("dcom.no.wmi", host));
        return false;
    }
    out.append(Strings.get("dcom.wmi.ok", host, count)).append('\n');
    return true;
}
Also used : WindowsWmi(com.sun.enterprise.util.cluster.windows.process.WindowsWmi) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException)

Example 3 with WindowsException

use of com.sun.enterprise.util.cluster.windows.process.WindowsException in project Payara by payara.

the class ValidateDcom method testRemoteScript.

private boolean testRemoteScript() {
    String scriptOut = null;
    try {
        WindowsRemoteScripter scripter = new WindowsRemoteScripter(creds);
        scriptOut = scripter.run(scriptFullPath);
        script.delete();
    } catch (WindowsException ex) {
        setError(ex, Strings.get("dcom.no.run", host));
        return false;
    }
    out.append(Strings.get("dcom.run.ok", host, crunch(12, scriptOut))).append('\n');
    return true;
}
Also used : WindowsRemoteScripter(com.sun.enterprise.util.cluster.windows.process.WindowsRemoteScripter) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException)

Example 4 with WindowsException

use of com.sun.enterprise.util.cluster.windows.process.WindowsException in project Payara by payara.

the class ValidateDcom method testJdkAvailable.

private boolean testJdkAvailable() {
    try {
        script = new WindowsRemoteFile(wrf, SCRIPT_NAME);
        script.copyFrom("javac -version \r\n");
        WindowsRemoteScripter scripter = new WindowsRemoteScripter(creds);
        // javac and jar write to stderr NOT stdout
        scripter.wantStdErr();
        String scriptOut = scripter.run(scriptFullPath);
        script.delete();
        out.append(Strings.get("dcom.yes.jdk", host, scriptOut));
        out.append('\n');
        return true;
    } catch (WindowsException ex) {
        setError(ex, Strings.get("dcom.no.jdk", host));
        return false;
    }
}
Also used : WindowsRemoteFile(com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile) WindowsRemoteScripter(com.sun.enterprise.util.cluster.windows.process.WindowsRemoteScripter) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException)

Example 5 with WindowsException

use of com.sun.enterprise.util.cluster.windows.process.WindowsException in project Payara by payara.

the class NodeRunnerDcom method runAdminCommandOnRemoteNode.

/*
     * return 0 is success, otherwise failure
     */
public final int runAdminCommandOnRemoteNode(Node thisNode, StringBuilder output, List<String> args, List<String> stdinLines) throws SSHCommandExecutionException, IllegalArgumentException, UnsupportedOperationException {
    String humanreadable = null;
    try {
        this.node = thisNode;
        dcomInfo = new DcomInfo(node);
        List<String> fullcommand = new ArrayList<String>();
        WindowsRemoteAsadmin asadmin = dcomInfo.getAsadmin();
        if (stdinLines != null && !stdinLines.isEmpty())
            setupAuthTokenFile(fullcommand, stdinLines);
        fullcommand.addAll(args);
        humanreadable = dcomInfo.getNadminPath() + " " + commandListToString(fullcommand);
        // This is where the rubber meets the road...
        String out = asadmin.run(fullcommand);
        output.append(out);
        logger.info(Strings.get("remote.command.summary", humanreadable, out));
        return determineStatus(args);
    } catch (WindowsException ex) {
        throw new SSHCommandExecutionException(Strings.get("remote.command.error", ex.getMessage(), humanreadable), ex);
    } finally {
        teardownAuthTokenFile();
    }
}
Also used : WindowsRemoteAsadmin(com.sun.enterprise.util.cluster.windows.process.WindowsRemoteAsadmin) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException) DcomInfo(org.glassfish.cluster.ssh.util.DcomInfo) SSHCommandExecutionException(org.glassfish.api.admin.SSHCommandExecutionException)

Aggregations

WindowsException (com.sun.enterprise.util.cluster.windows.process.WindowsException)16 WindowsRemoteFile (com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile)8 WindowsRemoteFileSystem (com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFileSystem)5 DcomInfo (org.glassfish.cluster.ssh.util.DcomInfo)5 File (java.io.File)4 IOException (java.io.IOException)4 SSHLauncher (org.glassfish.cluster.ssh.launcher.SSHLauncher)4 Node (com.sun.enterprise.config.serverbeans.Node)3 SFTPv3DirectoryEntry (com.trilead.ssh2.SFTPv3DirectoryEntry)3 FileOutputStream (java.io.FileOutputStream)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 SFTPClient (org.glassfish.cluster.ssh.sftp.SFTPClient)3 Nodes (com.sun.enterprise.config.serverbeans.Nodes)2 WindowsRemoteScripter (com.sun.enterprise.util.cluster.windows.process.WindowsRemoteScripter)2 WindowsCredentials (com.sun.enterprise.util.cluster.windows.process.WindowsCredentials)1 WindowsRemoteAsadmin (com.sun.enterprise.util.cluster.windows.process.WindowsRemoteAsadmin)1 WindowsWmi (com.sun.enterprise.util.cluster.windows.process.WindowsWmi)1 SCPClient (com.trilead.ssh2.SCPClient)1 SFTPv3FileAttributes (com.trilead.ssh2.SFTPv3FileAttributes)1