| 
 | J2EE1.4 SDK | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.appserv.management.client.AppserverConnectionSource
Supports connectivity to Sun Appserver 8.1. This is the only official way to get a connection to the appserver.
If the server is running with TLS enabled, then you must use the constructor that includes TLSParams. Here is an example of how to connect using TLS:
final File trustStore	= new File( "~/.keystore" );
        final char[] trustStorePassword	= "changeme".toCharArray();	// or whatever it is
final HandshakeCompletedListener listener = new HandshakeCompletedListenerImpl();
final TrustStoreTrustManager trustMgr = new TrustStoreTrustManager( trustStore, trustStorePassword);
trustMgr.setPrompt( true );
final TLSParams	tlsParams = new TLSParams( new X509TrustManager[] { trustMgr }, listener );
final AppserverConnectionSource src	=
        new AppserverConnectionSource( AppserverConnectionSource.PROTOCOL_RMI,
                "localhost", 8686, "admin", "admin123",
                tlsParams,
                null );
final DomainRoot domainRoot	= src.getDomainRoot();
        If security is not an  issue, it is recommended to simply disable TLS on the
        server.  However, you can also connect using TLS whereby the 
        server certificate is blindly trusted:
final TLSParams	tlsParams = new TLSParams( TrustAnyTrustManager.getInstanceArray(), null );
final AppserverConnectionSource src	=
        new AppserverConnectionSource( AppserverConnectionSource.PROTOCOL_RMI,
                "localhost", 8686, "admin", "admin123",
                tlsParams,
                null );
final DomainRoot domainRoot	= src.getDomainRoot();
TrustStoreTrustManager, 
TrustAnyTrustManager, 
HandshakeCompletedListenerImpl, 
TLSParams| Field Summary | |
| static java.lang.String | DEFAULT_PROTOCOLDefault protocol to the Appserver eg PROTOCOL_RMI. | 
| static java.lang.String | HANDSHAKE_COMPLETED_LISTENER_KEY[used internally] | 
| protected  javax.management.remote.JMXConnector | mJMXConnector | 
| static java.lang.String | PROTOCOL_HTTPInternal unsupported protocol. | 
| static java.lang.String | PROTOCOL_RMIRMI protocol to the Appserver. | 
| static java.lang.String | TRUST_MANAGERS_KEY[used internally] | 
| Constructor Summary | |
| AppserverConnectionSource(java.lang.String host,
                          int port,
                          java.lang.String user,
                          java.lang.String password,
                          java.util.Map reserved)Create a new instance using the default protocol without TLS. | |
| AppserverConnectionSource(java.lang.String protocol,
                          java.lang.String host,
                          int port,
                          java.lang.String user,
                          java.lang.String password,
                          java.util.Map reserved)Create a new instance connecting to the specified host/port with the specified protocol without TLS. | |
| AppserverConnectionSource(java.lang.String protocol,
                          java.lang.String host,
                          int port,
                          java.lang.String user,
                          java.lang.String password,
                          TLSParams tlsParams,
                          java.util.Map reserved)Create a new instance which will optionally TLS for security. | |
| Method Summary | |
|  DomainRoot | getDomainRoot() | 
|  MBeanServerConnection | getExistingMBeanServerConnection() | 
|  javax.management.remote.JMXConnector | getJMXConnector(boolean forceNew)If the connection has already been created, return the existing JMXConnector unless 'forceNew' is true or the connection is currently null. | 
|  MBeanServerConnection | getMBeanServerConnection(boolean forceNew)Return a valid MBeanServerConnection, making a new connection if necessary, or returning an existing one if still valid. | 
|  void | handleNotification(Notification notifIn,
                   java.lang.Object handback)Invoked when a JMX notification occurs. | 
| static boolean | isSupportedProtocol(java.lang.String protocol) | 
|  java.lang.String | toString() | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
protected javax.management.remote.JMXConnector mJMXConnector
public static final java.lang.String TRUST_MANAGERS_KEY
public static final java.lang.String HANDSHAKE_COMPLETED_LISTENER_KEY
public static final java.lang.String PROTOCOL_RMI
public static final java.lang.String DEFAULT_PROTOCOL
public static final java.lang.String PROTOCOL_HTTP
| Constructor Detail | 
public AppserverConnectionSource(java.lang.String host,
                                 int port,
                                 java.lang.String user,
                                 java.lang.String password,
                                 java.util.Map reserved)
host - hostname or IP addressport - port to which to connectuser - admin user namepassword - admin password for admin userreserved - reserved for future use
public AppserverConnectionSource(java.lang.String protocol,
                                 java.lang.String host,
                                 int port,
                                 java.lang.String user,
                                 java.lang.String password,
                                 java.util.Map reserved)
                Note:The only supported protocol is PROTOCOL_RMI.
                Use of any other protocol is not supported and these protocols are
                subject to change or removal at any time.
protocol - protocol to use eg PROTOCOL_RMIhost - hostname or IP addressport - port to which to connectuser - admin user namepassword - admin password for admin userreserved - reserved for future use
public AppserverConnectionSource(java.lang.String protocol,
                                 java.lang.String host,
                                 int port,
                                 java.lang.String user,
                                 java.lang.String password,
                                 TLSParams tlsParams,
                                 java.util.Map reserved)
protocol - protocol to use eg PROTOCOL_RMIhost - hostname or IP addressport - port to which to connectuser - admin user namepassword - admin password for admin usertlsParams - (may be null if TLS is not desired)reserved - reserved for future useTLSParams| Method Detail | 
public static boolean isSupportedProtocol(java.lang.String protocol)
public void handleNotification(Notification notifIn,
                               java.lang.Object handback)
NotificationListener
handleNotification in interface NotificationListenernotifIn - The notification.handback - An opaque object which helps the listener to associate information
 regarding the MBean emitter. This object is passed to the MBean during the
 addListener call and resent, without modification, to the listener. The MBean object 
 should not use or modify the object.
public javax.management.remote.JMXConnector getJMXConnector(boolean forceNew)
                                                     throws java.io.IOException
getJMXConnector in interface ConnectionSourceforceNew - if a new connection should be created
java.io.IOExceptionpublic MBeanServerConnection getExistingMBeanServerConnection()
getExistingMBeanServerConnection in interface ConnectionSource
public MBeanServerConnection getMBeanServerConnection(boolean forceNew)
                                               throws java.io.IOException
ConnectionSourceShould not be called frequently, as the check for validity will make a remote call.
An implementation may choose to ignore the 'forceNew' parameter and always return the same connection.
getMBeanServerConnection in interface ConnectionSourceforceNew - creates a new connection instead of reusing an existing one
java.io.IOException
public DomainRoot getDomainRoot()
                         throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
| 
 | J2EE1.4 SDK | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2003 Sun Microsystems, Inc. All rights reserved.