org.objectweb.cjdbc.controller.jmx
Class RmiConnector

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.jmx.RmiConnector

public class RmiConnector
extends java.lang.Object

This class defines a RmiConnector

Version:
1.0
Author:
Marc Wick

Field Summary
private  javax.management.remote.JMXAuthenticator authenticator
           
private  JmxNotification cjdbcNotification
           
private  javax.management.remote.JMXConnectorServer connection
          we have to keep a reference to the server to avoid it from being garbage collected otherwise the client will throw a java.rmi.NoSuchObjectException (problem experienced with ssl connections)
private  java.lang.String controllerName
           
private  java.lang.String hostName
           
(package private) static Trace logger
           
private  java.util.Date myDate
           
private  javax.management.Notification notification
           
private  int port
           
private static java.util.List rmiConnectors
           
private  java.rmi.Remote rmiRegistry
           
private static long sequence
           
private  SSLConfiguration sslConfig
           
private  long time
           
 
Constructor Summary
RmiConnector(java.lang.String controllerName, java.lang.String hostName, int port, javax.management.remote.JMXAuthenticator authenticator, SSLConfiguration sslConfig)
          Creates a new RmiConnector.java object
 
Method Summary
private static void addRmiConnector(RmiConnector pRmiConnector)
          Adds an rmiConnector to the list.
static void broadcastNotification(AbstractStandardMBean mbean, java.lang.String type, java.lang.String priority, java.lang.String description, java.util.Hashtable data)
          Broadcast a jmx notification to any client connected to any RmiConnector registered in the static list.
private  void createJRMPAdaptor()
           
private  void createNamingService()
          Create naming service and starts rmi
 javax.management.remote.JMXAuthenticator getAuthenticator()
          Returns the authenticator value.
 javax.management.remote.JMXConnectorServer getConnection()
          Returns the connection value.
 java.lang.String getControllerName()
           
 java.lang.String getHostName()
           
 int getPort()
          Returns the port value.
static java.util.List getRmiConnectors()
          Returns a list of rmiConnectors .
 SSLConfiguration getSslConfig()
          Returns the sslConfig value.
 void sendNotification(AbstractStandardMBean mbean, java.lang.String type, java.lang.String priority, java.lang.String description, java.util.Hashtable data)
          This method sends notification to all client registered to an instance of the RmiConnector class.
 void setAuthenticator(javax.management.remote.JMXAuthenticator authenticator)
          Sets the authenticator value.
 void setPort(int port)
          Sets the port value.
 void setSslConfig(SSLConfiguration sslConfig)
          Sets the sslConfig value.
 void start()
          start the rmi connector and the rmi naming service
 void stop()
          stop the rmi connector and the rmi registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Trace logger

controllerName

private java.lang.String controllerName

hostName

private java.lang.String hostName

port

private int port

authenticator

private javax.management.remote.JMXAuthenticator authenticator

sslConfig

private SSLConfiguration sslConfig

connection

private javax.management.remote.JMXConnectorServer connection
we have to keep a reference to the server to avoid it from being garbage collected otherwise the client will throw a java.rmi.NoSuchObjectException (problem experienced with ssl connections)


rmiRegistry

private java.rmi.Remote rmiRegistry

rmiConnectors

private static java.util.List rmiConnectors

myDate

private java.util.Date myDate

time

private long time

cjdbcNotification

private JmxNotification cjdbcNotification

notification

private javax.management.Notification notification

sequence

private static long sequence
Constructor Detail

RmiConnector

public RmiConnector(java.lang.String controllerName,
                    java.lang.String hostName,
                    int port,
                    javax.management.remote.JMXAuthenticator authenticator,
                    SSLConfiguration sslConfig)
             throws JmxException
Creates a new RmiConnector.java object

Parameters:
controllerName - for reference when sending notification
hostName - the name of the host we bind to, if null the default InetAddress.getLocalHost().getHostName() is used
port - the port the rmi registry is listening on
authenticator - the jmxauthenticator used for the connection
sslConfig - ssl configuration
Throws:
JmxException - the name of the localhost could not be determined
Method Detail

getAuthenticator

public javax.management.remote.JMXAuthenticator getAuthenticator()
Returns the authenticator value.

Returns:
Returns the authenticator.

setAuthenticator

public void setAuthenticator(javax.management.remote.JMXAuthenticator authenticator)
Sets the authenticator value.

Parameters:
authenticator - The authenticator to set.

getPort

public int getPort()
Returns the port value.

Returns:
Returns the port.

setPort

public void setPort(int port)
Sets the port value.

Parameters:
port - The port to set.

getSslConfig

public SSLConfiguration getSslConfig()
Returns the sslConfig value.

Returns:
Returns the sslConfig.

setSslConfig

public void setSslConfig(SSLConfiguration sslConfig)
Sets the sslConfig value.

Parameters:
sslConfig - The sslConfig to set.

getConnection

public javax.management.remote.JMXConnectorServer getConnection()
Returns the connection value.

Returns:
Returns the connection.

start

public void start()
           throws JmxException
start the rmi connector and the rmi naming service

Throws:
JmxException - an exception

stop

public void stop()
          throws JmxException
stop the rmi connector and the rmi registry

Throws:
JmxException - an exception

createNamingService

private void createNamingService()
                          throws JmxException
Create naming service and starts rmi

Throws:
JmxException - if creation fails

createJRMPAdaptor

private void createJRMPAdaptor()
                        throws JmxException
Throws:
JmxException

getRmiConnectors

public static java.util.List getRmiConnectors()
Returns a list of rmiConnectors .

Returns:
Returns list of RmiConnector.

addRmiConnector

private static void addRmiConnector(RmiConnector pRmiConnector)
Adds an rmiConnector to the list.

Parameters:
pRmiConnector - The rmiConnector to add.

getControllerName

public java.lang.String getControllerName()
Returns:
Returns the controllerName.

getHostName

public java.lang.String getHostName()
Returns:
Returns the hostName.

sendNotification

public void sendNotification(AbstractStandardMBean mbean,
                             java.lang.String type,
                             java.lang.String priority,
                             java.lang.String description,
                             java.util.Hashtable data)
This method sends notification to all client registered to an instance of the RmiConnector class. The JmxNotification class is used here to create an object with all the information gathered in parameters, and then is serialized in xml for interaction on the client side.

Parameters:
mbean - the mbean that is generating the notification
type - the type as seen in CjdbcNotificationList
priority - notification level as seen in CjdbcNotificationList
description - a string description of the notification
data - a hashtable of data that can be used to give more information on the notification
See Also:
JmxNotification

broadcastNotification

public static void broadcastNotification(AbstractStandardMBean mbean,
                                         java.lang.String type,
                                         java.lang.String priority,
                                         java.lang.String description,
                                         java.util.Hashtable data)
Broadcast a jmx notification to any client connected to any RmiConnector registered in the static list. The method is static because it is sending notifications to all rmi connectors.

Parameters:
mbean - the mbean that is generating the notification
type - the type as seen in CjdbcNotificationList
priority - notification level as seen in CjdbcNotificationList
description - a string description of the notification
data - a hashtable of data that can be used to give more information on the notification


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.