Search in sources :

Example 1 with WindowsCredentials

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

the class InstallNodeDcomCommand method unpackOnHosts.

private void unpackOnHosts(String host, String remotePassword, String unpackScript) throws WindowsException, CommandException {
    String domain = windowsDomain;
    if (!ok(domain))
        domain = host;
    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));
    if (logger.isLoggable(Level.FINE))
        logger.fine("Output from Windows Unpacker:\n" + out);
}
Also used : WindowsRemoteScripter(com.sun.enterprise.util.cluster.windows.process.WindowsRemoteScripter) CommandException(org.glassfish.api.admin.CommandException) WindowsCredentials(com.sun.enterprise.util.cluster.windows.process.WindowsCredentials)

Example 2 with WindowsCredentials

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

the class NodeUtils method pingDcomConnection.

/**
 * Make sure GF is installed and available.
 *
 * @throws CommandValidationException
 */
void pingDcomConnection(String host, String domain, String username, String password, String installRoot) throws CommandValidationException {
    if (!StringUtils.ok(password))
        throw new CommandValidationException(Strings.get("dcom.nopassword"));
    // resolve password aliases
    password = DcomUtils.resolvePassword(resolver.resolve(password));
    if (NetUtils.isThisHostLocal(host))
        throw new CommandValidationException(Strings.get("dcom.yes.local", host));
    try {
        installRoot = installRoot.replace('/', '\\');
        WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, username, password);
        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);
    }
}
Also used : WindowsRemoteFile(com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile) WindowsRemoteFileSystem(com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFileSystem) WindowsCredentials(com.sun.enterprise.util.cluster.windows.process.WindowsCredentials) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException) ProcessManagerException(com.sun.enterprise.universal.process.ProcessManagerException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) FileNotFoundException(java.io.FileNotFoundException)

Example 3 with WindowsCredentials

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

the class ValidateDcom method init.

private boolean init(AdminCommandContext context) {
    report = context.getActionReport();
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
    user = resolver.resolve(user);
    password = DcomUtils.resolvePassword(resolver.resolve(password));
    if (!ok(password)) {
        setError(Strings.get("dcom.nopassword"));
        return false;
    }
    // backslash does not actually matter but it's neater
    testdir = resolver.resolve(testdir).replace('/', '\\');
    if (testdir.endsWith("\\"))
        testdir = testdir.substring(0, testdir.length() - 1);
    if (!ok(windowsdomain))
        windowsdomain = host;
    creds = new WindowsCredentials(host, windowsdomain, user, password);
    try {
        wrfs = new WindowsRemoteFileSystem(creds);
    } catch (WindowsException ex) {
        // probably the j-interop-repackagted.jar is missing
        setError(ex.getMessage());
        return false;
    }
    scriptFullPath = testdir + "\\" + SCRIPT_NAME;
    return true;
}
Also used : WindowsRemoteFileSystem(com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFileSystem) WindowsCredentials(com.sun.enterprise.util.cluster.windows.process.WindowsCredentials) WindowsException(com.sun.enterprise.util.cluster.windows.process.WindowsException)

Aggregations

WindowsCredentials (com.sun.enterprise.util.cluster.windows.process.WindowsCredentials)3 WindowsRemoteFileSystem (com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFileSystem)2 WindowsException (com.sun.enterprise.util.cluster.windows.process.WindowsException)2 ProcessManagerException (com.sun.enterprise.universal.process.ProcessManagerException)1 WindowsRemoteFile (com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile)1 WindowsRemoteScripter (com.sun.enterprise.util.cluster.windows.process.WindowsRemoteScripter)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 CommandException (org.glassfish.api.admin.CommandException)1