Java EE 5 SDK

com.sun.appserv.management.helper
Class Connect

java.lang.Object
  extended by com.sun.appserv.management.helper.Connect

public class Connect
extends Object

Miscellaneous helper routines for connecting to the Appserver.

Since:
AppServer 9.0

Method Summary
static AppserverConnectionSource connectNoTLS(String host, int port, String user, String userPassword)
           
static AppserverConnectionSource connectTLS(String host, int port, String user, String userPassword, boolean promptForUnknownCertificate)
          Connect to an Appserver using TLS (SSL) using the default TrustStore and default TrustStore password.
static TLSParams createTLSParams(File trustStore, String trustStorePasswordIn, boolean promptForUnknownCertificate)
          Get TLSParams for the specified truststore and password.
static TLSParams createTLSParams(String trustStorePassword, boolean promptForNewCertificate)
          Get TLSParams for the default truststore, assuming the default password.
static File getDefaultTrustStore()
          The File will use the name AppserverConnectionSource.DEFAULT_TRUST_STORE_NAME in the user's home directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

connectTLS

public static AppserverConnectionSource connectTLS(String host,
                                                   int port,
                                                   String user,
                                                   String userPassword,
                                                   boolean promptForUnknownCertificate)
                                            throws IOException
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.

Parameters:
host - hostname or IP address
port - port to which to connect
user - admin user name
userPassword - password for specified user
promptForUnknownCertificate - prompts via System.out if the server certificate is unrecognized, otherwise rejects the connection
Throws:
IOException

connectNoTLS

public static AppserverConnectionSource connectNoTLS(String host,
                                                     int port,
                                                     String user,
                                                     String userPassword)
                                              throws IOException
Throws:
IOException

getDefaultTrustStore

public static File getDefaultTrustStore()
The File will use the name AppserverConnectionSource.DEFAULT_TRUST_STORE_NAME in the user's home directory.

Returns:
a File for the default truststore. May not yet exist.

createTLSParams

public static TLSParams createTLSParams(String trustStorePassword,
                                        boolean promptForNewCertificate)
Get TLSParams for the default truststore, assuming the default password.

Parameters:
trustStorePassword - a truststore, or null for the default one
promptForNewCertificate -

createTLSParams

public static TLSParams createTLSParams(File trustStore,
                                        String trustStorePasswordIn,
                                        boolean promptForUnknownCertificate)
Get TLSParams for the specified truststore and password.

A HandshakeCompletedListener is installed which may be obtained by calling 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.

Parameters:
trustStore - a truststore, or null for the default one
trustStorePasswordIn - the truststore password, if null the default one will be used
promptForUnknownCertificate - prompts via System.out if the server certificate is unrecognized

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.