Connectpublic class Connect extends Object Miscellaneous helper routines for connecting to the Appserver. |
Constructors Summary |
---|
private Connect()
|
Methods Summary |
---|
public static com.sun.appserv.management.client.AppserverConnectionSource | connectNoTLS(java.lang.String host, int port, java.lang.String user, java.lang.String userPassword)
return new AppserverConnectionSource(
host, port, user, userPassword, null);
| public static com.sun.appserv.management.client.AppserverConnectionSource | connectTLS(java.lang.String host, int port, java.lang.String user, java.lang.String userPassword, boolean promptForUnknownCertificate)Connect to an Appserver using TLS (SSL) using the default TrustStore and
default TrustStore password.
If the server certificate is unknown, prompting will occur via System.out if
'promptForNewCertificate' is true; otherwise the connection will be rejected.
If a new server certificate is found, and the user enters "yes", then it
is added to the default truststore.
final TLSParams tlsParams = createTLSParams( null, promptForUnknownCertificate );
return new AppserverConnectionSource( AppserverConnectionSource.PROTOCOL_RMI,
host, port, user, userPassword, tlsParams, null);
| public static com.sun.appserv.management.client.TLSParams | createTLSParams(java.lang.String trustStorePassword, boolean promptForNewCertificate)Get TLSParams for the default truststore, assuming the default password.
return createTLSParams( null, trustStorePassword , promptForNewCertificate);
| public static com.sun.appserv.management.client.TLSParams | createTLSParams(java.io.File trustStore, java.lang.String trustStorePasswordIn, boolean promptForUnknownCertificate)Get TLSParams for the specified truststore and password.
A {@link HandshakeCompletedListener} is installed which may be obtained
by calling {@link TLSParams#getHandshakeCompletedListener}.
If a new server certificate is found, and the user enters "yes" in response
to prompting, then the certificate is added to the truststore.
final File trustStoreFile = (trustStore == null) ? getDefaultTrustStore() : trustStore;
final char[] trustStorePassword = ((trustStorePasswordIn == null) ?
AppserverConnectionSource.DEFAULT_TRUST_STORE_PASSWORD : trustStorePasswordIn).toCharArray();
final HandshakeCompletedListener handshakeCompletedListener =
new HandshakeCompletedListenerImpl();
final TrustStoreTrustManager trustMgr =
new TrustStoreTrustManager( trustStoreFile, trustStorePassword);
trustMgr.setPrompt( promptForUnknownCertificate );
final TLSParams tlsParams = new TLSParams( trustMgr, handshakeCompletedListener );
return( tlsParams );
| public static java.io.File | getDefaultTrustStore()The File will use the name
{@link AppserverConnectionSource#DEFAULT_TRUST_STORE_NAME}
in the user's home directory.
final String homeDir = System.getProperty( "user.home" );
final String sep = System.getProperty( "file.separator" );
return new File ( homeDir + sep + AppserverConnectionSource.DEFAULT_TRUST_STORE_NAME );
|
|