org.oddjob.jmx.client
Class ClientNode

java.lang.Object
  extended byorg.oddjob.jmx.client.ClientNode
All Implemented Interfaces:
Exportable, java.lang.reflect.InvocationHandler

public class ClientNode
extends java.lang.Object
implements java.lang.reflect.InvocationHandler, Exportable

The client side representation of a remote node. A proxy is used to implement a mirror of the remote node. This class is the invocation handler for that proxy. This class is never accessed directly by client code.

On creation the client node will lookup up various things on the server on configure the proxy, register for notifications and start a resync.

It is possible that a serverside node has bean created and destroyed and that the client hasn't caught up. In this case dead placeholder nodes are put in the tree. They should be short lived, and removed when the client catches up with the notifications.

Author:
Rob Gordon

Nested Class Summary
 class ClientNode.ClientListener
          Member class which listens for notifications coming across the network.
 class ClientNode.DeadNode
          Used in place of a proxy if the remote node has dissappeared before all notifications have caught up.
 
Method Summary
 void addIconListener(IconListener listener)
           
 void addJobStateListener(JobStateListener listener)
          Add a job state listener.
 void addStructuralListener(StructuralListener listener)
           
 java.lang.String consoleId()
          Get the consoleId which has been saved from the remote OddjobMBean.
protected static java.lang.Object createProxyFor(javax.management.ObjectName objectName, ClientNode parent)
           
static java.lang.Object createProxyFor(javax.management.ObjectName objectName, javax.management.MBeanServerConnection serverConnection, java.lang.Object linkNode, ComponentRegistry parentRegistry, NotificationProcessor notificationProcessor)
          Static factory method.
 void destroy()
          Destroy this node.
 boolean equals(java.lang.Object other)
           
 Transportable exportTransportable()
          Part of the implementation of the HostRelative interface.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Called by the proxy to invoke a method.
 void removeIconListener(IconListener listener)
           
 void removeJobStateListener(JobStateListener listener)
          Remove a job state listener.
 void removeStructuralListener(StructuralListener listener)
           
 LogEvent[] retrieveConsoleEvents(long from, int max)
           
 LogEvent[] retrieveLogEvents(long from, int max)
           
 java.lang.String toString()
           
 java.lang.String url()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createProxyFor

public static java.lang.Object createProxyFor(javax.management.ObjectName objectName,
                                              javax.management.MBeanServerConnection serverConnection,
                                              java.lang.Object linkNode,
                                              ComponentRegistry parentRegistry,
                                              NotificationProcessor notificationProcessor)
                                       throws javax.management.JMException,
                                              java.io.IOException
Static factory method.

Parameters:
objectName - The remote node.
serverConnection - The server connection.
Returns:
A proxy oject that implements it's interfaces.
Throws:
java.rmi.RemoteException
javax.management.JMException
java.io.IOException

createProxyFor

protected static java.lang.Object createProxyFor(javax.management.ObjectName objectName,
                                                 ClientNode parent)
                                          throws javax.management.JMException,
                                                 java.io.IOException
Parameters:
objectName -
parent -
Returns:
Throws:
javax.management.JMException
java.io.IOException

toString

public java.lang.String toString()

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Exception
Called by the proxy to invoke a method.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Exception

addJobStateListener

public void addJobStateListener(JobStateListener listener)
Add a job state listener.

Parameters:
listener - The job state listener.

removeJobStateListener

public void removeJobStateListener(JobStateListener listener)
Remove a job state listener.

Parameters:
listener - The job state listener.

addIconListener

public void addIconListener(IconListener listener)

removeIconListener

public void removeIconListener(IconListener listener)

addStructuralListener

public void addStructuralListener(StructuralListener listener)

removeStructuralListener

public void removeStructuralListener(StructuralListener listener)

retrieveLogEvents

public LogEvent[] retrieveLogEvents(long from,
                                    int max)

retrieveConsoleEvents

public LogEvent[] retrieveConsoleEvents(long from,
                                        int max)

consoleId

public java.lang.String consoleId()
Get the consoleId which has been saved from the remote OddjobMBean. The console identifies the console on a remote server. The console will frequently be shared between components in a single JVM and so we don't want to get the same messages on a component by component bases.

Returns:
The consoleId.

url

public java.lang.String url()

equals

public boolean equals(java.lang.Object other)

destroy

public void destroy()
Destroy this node. Clean up resources, remove remote connections.


exportTransportable

public Transportable exportTransportable()
Part of the implementation of the HostRelative interface. This is called when the proxy is just about to be sent over the network.

Specified by:
exportTransportable in interface Exportable
Returns:
The object for transit.