public class MinaInstallWrapper extends Object implements IVdsInstallWrapper
Modifier | Constructor and Description |
---|---|
|
MinaInstallWrapper() |
protected |
MinaInstallWrapper(org.apache.sshd.SshClient sshClient) |
Modifier and Type | Method and Description |
---|---|
static String |
byteArrayToHexString(byte[] b,
boolean fFormat)
A utility method to convert bytes into a printable string.
|
protected void |
callbackAddError(String message) |
protected void |
callbackAddMessage(String message) |
protected void |
callbackConnected() |
protected void |
callbackEndTransfer() |
protected void |
callbackFailed(String message) |
boolean |
ConnectToServer(String server) |
boolean |
ConnectToServer(String server,
String rootPassword) |
boolean |
ConnectToServer(String server,
String rootPassword,
long timeout) |
boolean |
ConnectToServer(String server,
String certPath,
String password) |
boolean |
DownloadFile(String remoteSource,
String localDestination)
This implementation uses gzip at the remote end to create a binary stream we gunzip on local machine to the
desired destination.
|
void |
fastFileCopy(String srcFile,
String dstFile,
boolean overwrite)
Optimized copy source file to destination, based on file size.
|
protected void |
finalize()
We use finalize in order to properly close the SSH client.
|
int |
getPort() |
protected boolean |
haveCallback() |
void |
InitCallback(IVdsInstallCallBack callback) |
protected String |
readInput(InputStream input)
Consume data from input stream and convert is into a String
|
protected String |
readLineFromInput(InputStream input)
Consume String lines from input stream
|
boolean |
RunSSHCommand(String command)
This method executes a given command in remote SSH shell.
|
void |
setPort(int port) |
boolean |
UploadFile(String source,
String destination)
This implementation checks for file size, and uses the relevant implementation to upload the given file.
|
boolean |
waitWithTimeout(org.apache.sshd.ClientChannel channel,
int timeoutInMilliSeconds)
A utility method to wait for channel to close.
|
void |
wrapperShutdown() |
public MinaInstallWrapper()
protected MinaInstallWrapper(org.apache.sshd.SshClient sshClient)
protected void finalize() throws Throwable
public final void InitCallback(IVdsInstallCallBack callback)
InitCallback
in interface IVdsInstallWrapper
public final boolean ConnectToServer(String server)
ConnectToServer
in interface IVdsInstallWrapper
public final boolean ConnectToServer(String server, String rootPassword)
ConnectToServer
in interface IVdsInstallWrapper
public final boolean ConnectToServer(String server, String rootPassword, long timeout)
ConnectToServer
in interface IVdsInstallWrapper
public final boolean ConnectToServer(String server, String certPath, String password)
ConnectToServer
in interface IVdsInstallWrapper
public final boolean RunSSHCommand(String command)
RunSSHCommand
in interface IVdsInstallWrapper
public final boolean DownloadFile(String remoteSource, String localDestination)
DownloadFile
in interface IVdsInstallWrapper
remoteSource
- source file on the remote machine. This should be a valid path and file name.localDestination
- destination file on the local machine. This should be a valid path and file name.public final boolean UploadFile(String source, String destination)
UploadFile
in interface IVdsInstallWrapper
source
- Source file on the local machine. This should be a valid path and file name.destination
- Destination file on the remote machine. This should be a valid path and file name.protected void callbackAddError(String message)
protected void callbackAddMessage(String message)
protected void callbackConnected()
protected void callbackEndTransfer()
protected void callbackFailed(String message)
protected boolean haveCallback()
public boolean waitWithTimeout(org.apache.sshd.ClientChannel channel, int timeoutInMilliSeconds)
channel
- A reference to client channel.timeoutInMilliSeconds
- Timeout period in milliseconds to wait for.public static String byteArrayToHexString(byte[] b, boolean fFormat)
b
- An array of bytes to be printedfFormat
- Should we use pretty format (add [] for each byte).protected String readInput(InputStream input)
input
- An input stream.protected String readLineFromInput(InputStream input)
input
- An input streampublic void fastFileCopy(String srcFile, String dstFile, boolean overwrite) throws IOException, IllegalArgumentException
src
- source filedst
- destination file or pathoverwrite
- overwrite destination fileIOException
- I/O problemIllegalArgumentException
- illegal argumentpublic void wrapperShutdown()
wrapperShutdown
in interface IVdsInstallWrapper
public int getPort()
public void setPort(int port)
Copyright © 2012. All Rights Reserved.