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

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


    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


                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(info.getHost(), info.getUser(), info.getPassword());

                if (logFileName == null || logFileName.equals("")) {
                    logFileName = "server.log";
                }
                WindowsRemoteFile wrf = new WindowsRemoteFile(wrfs, loggingDir + File.separator + logFileName);

                instanceLogFile = new File(logFileDirectoryOnServer + File.separator + logFileName);

                wrf.copyTo(instanceLogFile);
            } catch (WindowsException ex) {
                throw new IOException("Unable to download instance log file from DCOM Instance Node");
            }

View Full Code Here

                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(info.getHost(), info.getUser(), info.getPassword());

                for (int i = 0; i < instanceLogFileNames.size(); i++) {

                    String logFileName = (String) instanceLogFileNames.get(i);
                    WindowsRemoteFile wrf = new WindowsRemoteFile(wrfs, sourceDir + File.separator + logFileName);
                    File instanceLogFile = new File(tempDirectoryOnServer + File.separator + logFileName);
                    wrf.copyTo(instanceLogFile);
                }
            } catch (WindowsException ex) {
                throw new IOException("Unable to download instance log file from DCOM Instance Node");
            }
View Full Code Here

            String loggingDir = getLoggingDirectoryForNode(instanceLogFileDetails, node, sNode, instanceName);

            try {
                DcomInfo info = new DcomInfo(node);
                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(info.getHost(), info.getUser(), info.getPassword());
                WindowsRemoteFile wrf = new WindowsRemoteFile(wrfs, loggingDir);
                String[] allLogFileNames = wrf.list();

                for (int i = 0; i < allLogFileNames.length; i++) {
                    File file = new File(allLogFileNames[i]);
                    String fileName = file.getName();
                    // code to remove . and .. file which is return
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 RemoteFileCopyProgress() {
                @Override
                public void callback(long numcopied, long numtotal) {
                    //final int percent = (int)((double)numcopied / (double)numtotal * 100.0);
                    System.out.print(".");
                }
                @Override
                public int getChunkSize() {
                    return 1048576;
                }
            });
            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

        try {
            for (String host : hosts) {
                String remotePassword = getWindowsPassword(host);
                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
                WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, getInstallDir());

                if (remoteInstallDir.exists())
                    throw new CommandException(Strings.get("install.dir.exists", getInstallDir()));
            }
        }
        catch (WindowsException ex) {
            throw new CommandException(ex);
View Full Code Here

        final String unpackScriptName = "unpack.bat";

        for (String host : hosts) {
            String remotePassword = getWindowsPassword(host);
            WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
            WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, windowsInstallDir);
            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 = SmartFile.sanitize(windowsInstallDir + "/" + zipFileName);
            String fullUnpackScriptPath = SmartFile.sanitize(windowsInstallDir + "/" + unpackScriptName);
            unpackScript.copyFrom(makeScriptString(windowsInstallDir, 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

     * 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

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.