Package org.glassfish.cluster.ssh.util
Class SSHUtil
- java.lang.Object
-
- org.glassfish.cluster.ssh.util.SSHUtil
-
public class SSHUtil extends Object
- Author:
- Rajiv Mordani
-
-
Constructor Summary
Constructors Constructor Description SSHUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcheckString(String s)Convert empty string to null.static StringgetDefaultKeyFile()static StringgetExistingKeyFile()static booleanisEncryptedKey(String keyFile)Simple method to validate an encrypted key filestatic voidregister(com.trilead.ssh2.Connection connection)Registers a connection for cleanup when the plugin is stopped.static voidunregister(com.trilead.ssh2.Connection connection)Unregisters a connection for cleanup when the plugin is stopped.static booleanvalidateKeyFile(String file)This method validates either private or public key file.
-
-
-
Method Detail
-
register
public static void register(com.trilead.ssh2.Connection connection)
Registers a connection for cleanup when the plugin is stopped.- Parameters:
connection- The connection.
-
unregister
public static void unregister(com.trilead.ssh2.Connection connection)
Unregisters a connection for cleanup when the plugin is stopped.- Parameters:
connection- The connection.
-
getExistingKeyFile
public static String getExistingKeyFile()
-
getDefaultKeyFile
public static String getDefaultKeyFile()
-
isEncryptedKey
public static boolean isEncryptedKey(String keyFile) throws CommandException
Simple method to validate an encrypted key file- Returns:
- true|false
- Throws:
CommandException
-
validateKeyFile
public static boolean validateKeyFile(String file) throws CommandException
This method validates either private or public key file. In case of private key, it parses the key file contents to verify if it indeed contains a key- Parameters:
file- the key file- Returns:
- success if file exists, false otherwise
- Throws:
CommandException
-
-