FileDocCategorySizeDatePackage
MBeanServerConnectionFactory.javaAPI DocGlassfish v2 API4862Fri May 04 22:36:22 BST 2007com.sun.enterprise.admin.jmx.remote

MBeanServerConnectionFactory

public final class MBeanServerConnectionFactory extends Object
A Factory class that creates the instances of MBeanServerConnection depending upon the given JMXServiceURL {@link javax.management.remote.JMXServiceURL}. The returned instances are proxies to actual remote MBeanServerConnection.
author
Kedar Mhaswade
since
S1AS8.0
version
1.0

Fields Summary
Constructors Summary
private MBeanServerConnectionFactory()

    
Methods Summary
private static com.sun.enterprise.admin.jmx.remote.comm.AuthenticationInfoenv2AuthenticationInfo(java.util.Map env)
Sets the authentication information

        final String user = (String) env.get(DefaultConfiguration.ADMIN_USER_ENV_PROPERTY_NAME);
        final String pwd  = (String) env.get(DefaultConfiguration.ADMIN_PASSWORD_ENV_PROPERTY_NAME);
        return ( new AuthenticationInfo(user, pwd) );
    
private static com.sun.enterprise.admin.jmx.remote.comm.HttpConnectorAddressenv2HttpAddress(java.util.Map env, javax.management.remote.JMXServiceURL serviceUrl)
Sets the HttpAddress for the given Map and JMXServiceURL

/* BEGIN -- S1WS_MOD */
        final HttpConnectorAddress ad = new HttpConnectorAddress(serviceUrl.getHost(), serviceUrl.getPort(), isHttps(serviceUrl), serviceUrl.getURLPath());
/* END -- S1WS_MOD */
        ad.setAuthenticationInfo(env2AuthenticationInfo(env));
        return ( ad );
    
static javax.management.MBeanServerConnectiongetRemoteMBeanServerConnection(java.util.Map env, javax.management.remote.JMXServiceURL serviceUrl)
The static factory method that creates instance of MBeanServerConnection. This method always creates a new MBeanServerConnection instance every time it is called. If the call succeeds, the returned instance can be used to invoke any MBeanServerConnection method immediately.

param
env a Map containing all the necessary varialbes.
param
serviceUrl an instance of JMXServiceURL specifying the JMXConnector
return
a ready-to-call MBeanServerConnection instance.
throws
Exception, in case the connection could not be established to the server-side.

        return new RemoteMBeanServerConnection(env2HttpAddress(env, serviceUrl), env);
    
private static booleanisHttps(javax.management.remote.JMXServiceURL url)

		return ( DefaultConfiguration.S1_HTTPS_PROTOCOL.equals(url.getProtocol()) );