Package com.sun.enterprise.util.cluster.windows.io

Examples of com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile


     */
    private void setupAuthTokenFile(List<String> cmd, List<String> stdin) throws WindowsException {
        WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(dcomInfo.getCredentials());
        authTokenFilePath = dcomInfo.getNadminParentPath() + "\\token_" + System.nanoTime() + new Random().nextInt(1000);
        authTokenFilePath = createUniqueFilename(dcomInfo.getNadminParentPath());
        authTokenFile = new WindowsRemoteFile(wrfs, authTokenFilePath);
        authTokenFile.copyFrom(stdin);

        cmd.add(AsadminInput.CLI_INPUT_OPTION);
        cmd.add(authTokenFilePath);
    }
View Full Code Here


        String instanceName = args.get(args.size() - 1);

        if (isCommand(args, "_delete-instance-filesystem")) {
            try {
                String dir = Paths.getInstanceDirPath(node, instanceName);
                WindowsRemoteFile instanceDir = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);
                return instanceDir.exists() ? 1 : 0;
            }
            catch (WindowsException ex) {
                return 0;
            }
        }
        else if (isCommand(args, "_create-instance-filesystem")) {
            try {
                String dir = Paths.getDasPropsPath(node);
                WindowsRemoteFile dasProps = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);

                if (dasProps.exists())
                    return 0;

                // uh-oh.  Wipe out the instance directory that was created
                dir = Paths.getInstanceDirPath(node, instanceName);
                WindowsRemoteFile instanceDir = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);
                instanceDir.delete();
                return 1;
            }
            catch (WindowsException ex) {
                return 1;
            }
View Full Code Here

        } else if (node.getType().equals("DCOM")) {
            DcomInfo info;
            try {
                info = new DcomInfo(node);
                String path = info.getRemoteNodeRootDirectory() + "\\config\\pid";
                wrf = new WindowsRemoteFile(info.getCredentials(), path);
                if(wrf.exists())
                    errorMessage = pollForRealDeath("DCOM");

            }catch (WindowsException ex) {
                //could not get to other host
View Full Code Here

                String remotePassword = getWindowsPassword(host);
                passwords.add(new HostAndPassword(host, remotePassword));

                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) {
View Full Code Here

        final String unpackScriptName = "unpack.bat";

        for (String host : hosts) {
            String remotePassword = getPassword(host);
            WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
            WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, remoteInstallDirString);
            remoteInstallDir.mkdirs(getForce());
            WindowsRemoteFile remoteZip = new WindowsRemoteFile(remoteInstallDir, zipFileName);
            WindowsRemoteFile unpackScript = new WindowsRemoteFile(remoteInstallDir, unpackScriptName);
            //createUnpackScript
            System.out.printf("Copying %d bytes", zipFile.length());
            remoteZip.copyFrom(zipFile, new WindowsRemoteFileCopyProgress() {
                @Override
                public void callback(long numcopied, long numtotal) {
                    //final int percent = (int)((double)numcopied / (double)numtotal * 100.0);
                    System.out.print(".");
                }
            });
            System.out.println("");
            String fullZipFileName = remoteInstallDirString + "\\" + zipFileName;
            String fullUnpackScriptPath = remoteInstallDirString + "\\" + unpackScriptName;
            unpackScript.copyFrom(makeScriptString(remoteInstallDirString, zipFileName));
            logger.fine("WROTE FILE TO REMOTE SYSTEM: " + fullZipFileName + " and " + fullUnpackScriptPath);
            unpackOnHosts(host, remotePassword, fullUnpackScriptPath.replace('/', '\\'));
        }
    }
View Full Code Here

    final void deleteFromHosts() throws CommandException {
        for (String host : hosts) {
            try {
                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;
View Full Code Here

            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))
View Full Code Here

        } else if (node.getType().equals("DCOM")) {
            DcomInfo info;
            try {
                info = new DcomInfo(node);
                String path = info.getRemoteNodeRootDirectory() + "\\config\\pid";
                wrf = new WindowsRemoteFile(info.getCredentials(), path);
                if(wrf.exists())
                    errorMessage = pollForRealDeath("DCOM");

            }catch (WindowsException ex) {
                //could not get to other host
View Full Code Here

     * return true if A-OK.  Otherwise set up the reporter and return false
     * @throws CommandValidationException
     */
    private boolean testDcomFileAccess() {
        try {
            wrf = new WindowsRemoteFile(wrfs, testdir);
        }
        catch (WindowsException ex) {
            setError(ex, Strings.get("dcom.no.remote.access", testdir, host));
            return false;
        }
View Full Code Here

        return true;
    }

    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));
View Full Code Here

TOP

Related Classes of com.sun.enterprise.util.cluster.windows.io.WindowsRemoteFile

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.