public File getResultFile(String resultFile, String outPutFile) throws Exception { ftp.init(); ftp.setAscii(true); ftp.copyFileFromRemoteMachineToLocalMachine(new File(outPutFile), new File(resultFile)); /* * 18/6/06 when working on linux and not closing ftp session, * the system object will fail when ftp reaches max ftp connection * limit. */ ftp.close(); return new File(resultFile); }
public void closeFileTransferSession() throws Exception { if (fileTransfer != null) { fileTransfer.closeFileTransferSession(); } }
public void copyFileFromLocalMachineToRemoteMachine(InputStream source,File destination) throws Exception{ getFileTransfer().copyFileFromLocalMachineToRemoteMachine(source, destination); }
private FTPFileTransfer createFileTransferObject() throws Exception { FTPFileTransfer newFileTransfer; newFileTransfer = new FTPFileTransfer(getHost(),getCliUser(),getCliPassword()); newFileTransfer.setProtocol(getCliProtocol()); if (getFtpUser() != null){ newFileTransfer.setFtpUserName(getFtpUser()); } if (getFtpPassword()!= null){ newFileTransfer.setFtpPassword(getFtpPassword()); } if (getLocalHostExternalName() != null){ newFileTransfer.setLocalHostExternalName(getLocalHostExternalName()); } newFileTransfer.setOperatingSystem(getOperatingSystem()); newFileTransfer.init(); return newFileTransfer; }
public void copyFileFromRemoteMachineToLocalMachine(File source,File destination) throws Exception{ getFileTransfer().copyFileFromRemoteMachineToLocalMachine(source, destination); }
public void connect() throws Exception { if (ftpUser) { ftp = new FTPFileTransfer((CliConnection) this.cliConnection.clone()); } copyIperfExec(); }
public void copyFileFromLocalMachineToRemoteMachine(File source,File destination) throws Exception{ getFileTransfer().copyFileFromLocalMachineToRemoteMachine(source, destination); }
public void enableAdapter(String adapterPhisicalName) throws Exception{ initCli(); InputStream stream = getClass().getResourceAsStream( "/com/aqua/stations/windows/devcon/i386/devcon.exe"); getFileTransfer().copyFileFromLocalMachineToRemoteMachine(stream, new File(getTempDirectory(), "devcon.exe")); String command = MessageFormat.format(FIND_ADAPTER, getTempDirectory(), getHost()); getCliApplication().cliCommand(command); String regExp = MessageFormat.format(FIND_ADAPTER_REGEXP, adapterPhisicalName); GetParameterValue val = new GetParameterValue(regExp); getCliApplication().analyze(val); String id = val.getValue(); String enable = MessageFormat.format(ENABLE_ADAPTER,getTempDirectory(),id); getCliApplication().cliCommand(enable); FindText findText = new FindText("device(s) enabled"); getCliApplication().analyze(findText); }
public void resetAdapter(String adapterPhisicalName) throws Exception { initCli(); InputStream stream = getClass().getResourceAsStream( "/com/aqua/stations/windows/devcon/i386/devcon.exe"); getFileTransfer().copyFileFromLocalMachineToRemoteMachine(stream, new File(getTempDirectory(), "devcon.exe")); String command = MessageFormat.format(FIND_ADAPTER, getTempDirectory(), getHost()); getCliApplication().cliCommand(command); String regExp = MessageFormat.format(FIND_ADAPTER_REGEXP, adapterPhisicalName); GetParameterValue val = new GetParameterValue(regExp); getCliApplication().analyze(val); String id = val.getValue(); String restart = MessageFormat.format(RESTART_ADAPTER,getTempDirectory(),id); getCliApplication().cliCommand(restart); FindText findText = new FindText("device(s) restarted"); getCliApplication().analyze(findText); }
public void diableAdapter(String adapterPhisicalName) throws Exception{ initCli(); InputStream stream = getClass().getResourceAsStream( "/com/aqua/stations/windows/devcon/i386/devcon.exe"); getFileTransfer().copyFileFromLocalMachineToRemoteMachine(stream, new File(getTempDirectory(), "devcon.exe")); String command = MessageFormat.format(FIND_ADAPTER, getTempDirectory(), getHost()); getCliApplication().cliCommand(command); String regExp = MessageFormat.format(FIND_ADAPTER_REGEXP, adapterPhisicalName); GetParameterValue val = new GetParameterValue(regExp); getCliApplication().analyze(val); String id = val.getValue(); String enable = MessageFormat.format(DISABLE_ADAPTER,getTempDirectory(),id); getCliApplication().cliCommand(enable); FindText findText = new FindText("device(s) disabled"); getCliApplication().analyze(findText); }