org.objectweb.cjdbc.common.jmx.notifications
Class JmxNotification

java.lang.Object
  extended byorg.objectweb.cjdbc.common.jmx.notifications.JmxNotification

public class JmxNotification
extends java.lang.Object

This class defines a JmxNotification class. This class is used by the RmiConnector on the controller to send a JMXNotification. This is done by the following code:

 JmxNotification cjdbcNotification = new JmxNotification(priority,
                                       "" + sequence, type, description, ""
                                           + time, controllerName, mbean
                                           .getClass().getName(), "mbeanName",
                                       hostName, "" + port, data);
 
This create an instance of this JmxNotification class, specific to CJDBC. We then create a new instance of the Notification object as specified in the javax.management package
 Notification notification = new Notification(type, mbean, sequence, myDate
     .getTime(), description);
 
This class accepts a userData object. We wanted to set this user object to a specific CJDBC class but this forces generic JMX client to have this class in their classpath. We just serialize the JmxNotification into an XML string and feed it in the notification.
 notification.setUserData(cjdbcNotification.toString());
 
This can be retrieved on any jmx client, and on C-JDBC specific clients, the xml is transformed into an instance of this class again for easier notification handling.

Author:
Nicolas Modrzyk

Field Summary
private static java.lang.String ATT_ip
           
private static java.lang.String ATT_name
           
private static java.lang.String ATT_port
           
(package private)  java.lang.String controllerName
           
(package private)  java.util.Hashtable dataList
           
(package private)  java.lang.String description
           
private static java.lang.String ELT_class
           
private static java.lang.String ELT_controller
           
private static java.lang.String ELT_data
           
private static java.lang.String ELT_description
           
private static java.lang.String ELT_info
           
private static java.lang.String ELT_jmxevent
          All the tags and attributes used to parse the notification
private static java.lang.String ELT_mbean
           
private static java.lang.String ELT_priority
           
private static java.lang.String ELT_sequence
           
private static java.lang.String ELT_server
           
private static java.lang.String ELT_source
           
private static java.lang.String ELT_time
           
private static java.lang.String ELT_type
           
private static java.lang.String ELT_value
           
(package private)  java.lang.String mbeanClass
           
(package private)  java.lang.String mbeanName
           
(package private)  java.lang.String mbeanServerIP
           
(package private)  java.lang.String mbeanServerPort
           
(package private)  java.lang.String priority
           
(package private)  java.lang.String sequence
           
(package private)  java.lang.String time
           
(package private)  java.lang.String type
           
 
Constructor Summary
JmxNotification(java.lang.String priority, java.lang.String sequence, java.lang.String type, java.lang.String description, java.lang.String time, java.lang.String controllerName, java.lang.String mbeanClass, java.lang.String mbeanName, java.lang.String mbeanServerIP, java.lang.String mbeanServerPort, java.util.Hashtable dataList)
          Create a new JmxNotification object
 
Method Summary
static JmxNotification createNotificationFromXml(org.dom4j.Document document)
          Used as a factory to create an instance of this class from a xml document
static JmxNotification createNotificationFromXmlString(java.lang.String xml)
          Parse the given xml to create a notification
 java.lang.String getControllerJmxName()
          Return the controller jmx name
 java.lang.String getControllerName()
           
 java.util.Hashtable getDataList()
           
 java.lang.String getDataValue(java.lang.String key)
          Returns the first value of an entry in the data list of values
 java.lang.String getDescription()
           
 java.lang.String getMbeanClass()
           
 java.lang.String getMbeanName()
           
 java.lang.String getMbeanServerIP()
           
 java.lang.String getMbeanServerPort()
           
 java.lang.String getPriority()
           
 java.lang.String getSequence()
           
 java.lang.String getTime()
           
 java.lang.String getType()
           
 void setControllerName(java.lang.String controllerName)
           
 void setDataList(java.util.Hashtable dataList)
           
 void setDescription(java.lang.String description)
           
 void setMbeanClass(java.lang.String mbeanClass)
           
 void setMbeanName(java.lang.String mbeanName)
           
 void setMbeanServerIP(java.lang.String mbeanServerIP)
           
 void setMbeanServerPort(java.lang.String mbeanServerPort)
           
 void setPriority(java.lang.String priority)
           
 void setSequence(java.lang.String sequence)
           
 void setTime(java.lang.String time)
           
 void setType(java.lang.String type)
           
 java.lang.String toString()
           
 org.dom4j.Document toXmlDocument()
          Convert the object to the corresponding xml document instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ELT_jmxevent

private static final java.lang.String ELT_jmxevent
All the tags and attributes used to parse the notification

See Also:
Constant Field Values

ELT_info

private static final java.lang.String ELT_info
See Also:
Constant Field Values

ELT_source

private static final java.lang.String ELT_source
See Also:
Constant Field Values

ELT_data

private static final java.lang.String ELT_data
See Also:
Constant Field Values

ELT_priority

private static final java.lang.String ELT_priority
See Also:
Constant Field Values

ELT_sequence

private static final java.lang.String ELT_sequence
See Also:
Constant Field Values

ELT_type

private static final java.lang.String ELT_type
See Also:
Constant Field Values

ELT_description

private static final java.lang.String ELT_description
See Also:
Constant Field Values

ELT_time

private static final java.lang.String ELT_time
See Also:
Constant Field Values

ELT_controller

private static final java.lang.String ELT_controller
See Also:
Constant Field Values

ELT_mbean

private static final java.lang.String ELT_mbean
See Also:
Constant Field Values

ELT_class

private static final java.lang.String ELT_class
See Also:
Constant Field Values

ELT_server

private static final java.lang.String ELT_server
See Also:
Constant Field Values

ELT_value

private static final java.lang.String ELT_value
See Also:
Constant Field Values

ATT_ip

private static final java.lang.String ATT_ip
See Also:
Constant Field Values

ATT_port

private static final java.lang.String ATT_port
See Also:
Constant Field Values

ATT_name

private static final java.lang.String ATT_name
See Also:
Constant Field Values

priority

java.lang.String priority

sequence

java.lang.String sequence

type

java.lang.String type

description

java.lang.String description

controllerName

java.lang.String controllerName

mbeanClass

java.lang.String mbeanClass

mbeanName

java.lang.String mbeanName

mbeanServerIP

java.lang.String mbeanServerIP

mbeanServerPort

java.lang.String mbeanServerPort

time

java.lang.String time

dataList

java.util.Hashtable dataList
Constructor Detail

JmxNotification

public JmxNotification(java.lang.String priority,
                       java.lang.String sequence,
                       java.lang.String type,
                       java.lang.String description,
                       java.lang.String time,
                       java.lang.String controllerName,
                       java.lang.String mbeanClass,
                       java.lang.String mbeanName,
                       java.lang.String mbeanServerIP,
                       java.lang.String mbeanServerPort,
                       java.util.Hashtable dataList)
Create a new JmxNotification object

Parameters:
priority - notification priority
sequence - sequence number
type - notification type
description - notification description
time - time the notification was issued
controllerName - name of the controller issuing the notification
mbeanClass - class of the mbean issuing the notification
mbeanName - name of the mbean issuing the notification
mbeanServerIP - IP address of the mbean
mbeanServerPort - Port of the mbean
dataList - Additional data
Method Detail

createNotificationFromXmlString

public static JmxNotification createNotificationFromXmlString(java.lang.String xml)
                                                       throws java.lang.Exception
Parse the given xml to create a notification

Parameters:
xml - the xml to use to create a JmxNotification instance
Returns:
a JmxNotification instance which xml version is that of the given xml arg
Throws:
java.lang.Exception - if cannot create an instance (the xml is invalid)

getDataList

public java.util.Hashtable getDataList()
Returns:
Returns the dataList.

getDataValue

public java.lang.String getDataValue(java.lang.String key)
Returns the first value of an entry in the data list of values

Parameters:
key - value of a data parameter in the list
Returns:
String value of the corresponding key

getControllerName

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

getControllerJmxName

public java.lang.String getControllerJmxName()
Return the controller jmx name

Returns:
IP:Port

setControllerName

public void setControllerName(java.lang.String controllerName)
Parameters:
controllerName - The controllerName to set.

getDescription

public java.lang.String getDescription()
Returns:
Returns the description.

setDescription

public void setDescription(java.lang.String description)
Parameters:
description - The description to set.

getMbeanClass

public java.lang.String getMbeanClass()
Returns:
Returns the mbeanClass.

setMbeanClass

public void setMbeanClass(java.lang.String mbeanClass)
Parameters:
mbeanClass - The mbeanClass to set.

getMbeanName

public java.lang.String getMbeanName()
Returns:
Returns the mbeanName.

setMbeanName

public void setMbeanName(java.lang.String mbeanName)
Parameters:
mbeanName - The mbeanName to set.

getMbeanServerIP

public java.lang.String getMbeanServerIP()
Returns:
Returns the mbeanServerIP.

setMbeanServerIP

public void setMbeanServerIP(java.lang.String mbeanServerIP)
Parameters:
mbeanServerIP - The mbeanServerIP to set.

getMbeanServerPort

public java.lang.String getMbeanServerPort()
Returns:
Returns the mbeanServerPort.

setMbeanServerPort

public void setMbeanServerPort(java.lang.String mbeanServerPort)
Parameters:
mbeanServerPort - The mbeanServerPort to set.

getPriority

public java.lang.String getPriority()
Returns:
Returns the priority.

setPriority

public void setPriority(java.lang.String priority)
Parameters:
priority - The priority to set.

getSequence

public java.lang.String getSequence()
Returns:
Returns the sequence.

setSequence

public void setSequence(java.lang.String sequence)
Parameters:
sequence - The sequence to set.

getType

public java.lang.String getType()
Returns:
Returns the type.

setType

public void setType(java.lang.String type)
Parameters:
type - The type to set.

createNotificationFromXml

public static JmxNotification createNotificationFromXml(org.dom4j.Document document)
Used as a factory to create an instance of this class from a xml document

Parameters:
document - a dom4j document
Returns:
an instance of this class with the corresponding parameters

toXmlDocument

public org.dom4j.Document toXmlDocument()
Convert the object to the corresponding xml document instance

Returns:
Document object with the proper values

toString

public java.lang.String toString()
Returns:
String version in xml formatted text

getTime

public java.lang.String getTime()
Returns:
Returns the time.

setTime

public void setTime(java.lang.String time)
Parameters:
time - The time to set.

setDataList

public void setDataList(java.util.Hashtable dataList)
Parameters:
dataList - The dataList to set.


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