Search in sources :

Example 1 with WindowsRemoteAsadmin

use of com.sun.enterprise.util.cluster.windows.process.WindowsRemoteAsadmin 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)1 WindowsRemoteAsadmin (com.sun.enterprise.util.cluster.windows.process.WindowsRemoteAsadmin)1 SSHCommandExecutionException (org.glassfish.api.admin.SSHCommandExecutionException)1 DcomInfo (org.glassfish.cluster.ssh.util.DcomInfo)1