com.sun.grid.jgdi.management
Class JGDIProxy

java.lang.Object
  extended by com.sun.grid.jgdi.management.JGDIProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, java.util.EventListener, javax.management.NotificationListener

public class JGDIProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler, javax.management.NotificationListener

This class can be used to communicate with qmaster over JMX.


Constructor Summary
JGDIProxy(javax.management.remote.JMXServiceURL url, java.lang.Object credentials)
          Create a new proxy to the jgdi MBean
 
Method Summary
 void addEventListener(EventListener lis)
          Register an jgdi event listener.
 void close()
          Close the connection to the MBean server
static java.lang.String[] createCredentialsFromKeyStore(java.security.KeyStore ks, java.lang.String username, char[] pw)
          Create JMX credentials for password less authentication with a keystore
 javax.management.MBeanServerConnection getMBeanServerConnection()
          Get the MBeanServerConnection connection
 JGDIJMXMBean getProxy()
          Get the dynamic proxy object
 void handleNotification(javax.management.Notification notification, java.lang.Object handback)
          JMX will call this method of a notification for the proxy is available.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Invoke a method on the remote MBean.
static java.lang.String isAttributeSetter(java.lang.reflect.Method method)
          Get a new instanceof of ComponentAttributeDescriptor from an attribute getter.
 boolean isConnected()
          Determine of the connection to the JMX MBean servers is established
 void removeEventListener(EventListener lis)
          Remove a jgdi event listener.
static void resetSSL(java.io.File caTop)
          Deprecated.  
static void resetSSL(java.lang.String serverHostname, int serverPort, java.io.File caTop)
          Reset the SSL setup.
static void setupSSL(java.io.File caTop, java.io.File ks, char[] pw)
          Deprecated.  
static void setupSSL(java.io.File caTop, java.security.KeyStore ks, char[] pw)
          Deprecated.  
static void setupSSL(java.lang.String serverHostname, int serverPort, java.io.File caTop, java.io.File ks, char[] pw)
          Set up the ssl context
static void setupSSL(java.lang.String serverHostname, int serverPort, java.io.File caTop, java.security.KeyStore ks, char[] pw)
          Set up the ssl context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGDIProxy

public JGDIProxy(javax.management.remote.JMXServiceURL url,
                 java.lang.Object credentials)
Create a new proxy to the jgdi MBean

Parameters:
url - jmx connection url to qmaster allows username/password authentication this parameter must be a string array. The first element is the username, the second element is the password.
credentials - the credentials for jmx authentication
Method Detail

getProxy

public JGDIJMXMBean getProxy()
Get the dynamic proxy object

Returns:
the dynamic proxy object

getMBeanServerConnection

public javax.management.MBeanServerConnection getMBeanServerConnection()
Get the MBeanServerConnection connection

Returns:
the MBeanServerConnection connection

setupSSL

public static void setupSSL(java.io.File caTop,
                            java.security.KeyStore ks,
                            char[] pw)
Deprecated. 

Set up the ssl context

Parameters:
caTop - ca top directory if the Grid Engine CA ($SGE_ROOT/$SGE_CELL/common/sgeCA
ks - keystore of the user
pw - password for the keystore

setupSSL

public static void setupSSL(java.io.File caTop,
                            java.io.File ks,
                            char[] pw)
Deprecated. 

Set up the ssl context

Parameters:
caTop - ca top directory if the Grid Engine CA ($SGE_ROOT/$SGE_CELL/common/sgeCA
ks - keystore file of the user
pw - password for the keystore

resetSSL

public static void resetSSL(java.io.File caTop)
Deprecated. 

Reset the SSL setup.

Parameters:
caTop - the ca top directory of the cluster

setupSSL

public static void setupSSL(java.lang.String serverHostname,
                            int serverPort,
                            java.io.File caTop,
                            java.security.KeyStore ks,
                            char[] pw)
Set up the ssl context

Parameters:
serverHostname - the server hostname
caTop - ca top directory if the Grid Engine CA ($SGE_ROOT/$SGE_CELL/common/sgeCA
ks - keystore of the user
pw - password for the keystore

setupSSL

public static void setupSSL(java.lang.String serverHostname,
                            int serverPort,
                            java.io.File caTop,
                            java.io.File ks,
                            char[] pw)
Set up the ssl context

Parameters:
serverHostname - the server hostname
caTop - ca top directory if the Grid Engine CA ($SGE_ROOT/$SGE_CELL/common/sgeCA
ks - keystore file of the user
pw - password for the keystore

resetSSL

public static void resetSSL(java.lang.String serverHostname,
                            int serverPort,
                            java.io.File caTop)
Reset the SSL setup.

Parameters:
serverHostname - the server hostname
caTop - the ca top directory of the cluster

addEventListener

public void addEventListener(EventListener lis)
Register an jgdi event listener.

Parameters:
lis - the jgdi event listener

removeEventListener

public void removeEventListener(EventListener lis)
Remove a jgdi event listener.

Parameters:
lis - the jgdi event listener

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object handback)
JMX will call this method of a notification for the proxy is available. If the notification contains a JGDI event it will be propagated to all registered JGDI event listeners.

Specified by:
handleNotification in interface javax.management.NotificationListener
Parameters:
notification - the notification
handback - the handback object

isConnected

public boolean isConnected()
Determine of the connection to the JMX MBean servers is established

Returns:
true if the connection is established otherwise false

close

public void close()
Close the connection to the MBean server


invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Invoke a method on the remote MBean.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - the JGDIProxy object
method - the method which should be invoked
args - arguments for the method
Throws:
java.lang.Throwable

isAttributeSetter

public static java.lang.String isAttributeSetter(java.lang.reflect.Method method)
Get a new instanceof of ComponentAttributeDescriptor from an attribute getter.

Parameters:
method - the attribute getter
Returns:
the CoComponentAttributeDescriptorcode> or null if method is not an attribute getter

createCredentialsFromKeyStore

public static java.lang.String[] createCredentialsFromKeyStore(java.security.KeyStore ks,
                                                               java.lang.String username,
                                                               char[] pw)
                                                        throws JGDIException
Create JMX credentials for password less authentication with a keystore

Parameters:
ks - the keystore
username - the username
pw - password of the private key in the keystore
Returns:
the jmx credentials
Throws:
JGDIException


Copyright © 2007 Sun Microsystems, Inc. All rights reserved.