org.oddjob.jmx
Class JMXClientJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.SimpleService
          extended by org.oddjob.jmx.ClientBase
              extended by org.oddjob.jmx.JMXClientJob
All Implemented Interfaces:
Runnable, ArooaContextAware, ArooaSessionAware, BeanDirectoryOwner, PropertyChangeNotifier, Iconic, RemoteDirectoryOwner, ConsoleArchiver, LogArchiver, LogEnabled, Resetable, Stateful, Stoppable, Structural

public class JMXClientJob
extends ClientBase
implements Structural, LogArchiver, ConsoleArchiver, RemoteDirectoryOwner

Nested Class Summary
 
Nested classes/interfaces inherited from class org.oddjob.jmx.ClientBase
ClientBase.WhyStop
 
Field Summary
static long DEFAULT_LOG_POLLING_INTERVAL
           
 
Fields inherited from class org.oddjob.framework.SimpleService
stateHandler
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Fields inherited from interface org.oddjob.logging.LogArchiver
MAX_HISTORY, NO_LOG_AVAILABLE
 
Constructor Summary
JMXClientJob()
           
 
Method Summary
 void addConsoleListener(LogListener l, Object component, long last, int max)
          Add a listener to the archiver which will receive all missed events.
 void addLogListener(LogListener l, Object component, LogLevel level, long last, int history)
          Add a listener to the archiver which will receive all missed events.
 void addStructuralListener(StructuralListener listener)
          Add a listener.
 String consoleIdFor(Object component)
          Get the console id for a given component.
protected  void doStart(MBeanServerConnection mbsc, ScheduledExecutorService notificationProcessor)
          Overridden by subclasses to provide a specific startup.
 long getLogPollingInterval()
           
 int getMaxConsoleLines()
           
 int getMaxLoggerLines()
           
 void onInitialised()
          Subclasses override this method to perform post creation initialisation.
protected  void onStop(ClientBase.WhyStop why)
           
 RemoteDirectory provideBeanDirectory()
          Provide a remote directory.
 void removeConsoleListener(LogListener l, Object component)
          Remove the LogListener.
 void removeLogListener(LogListener l, Object component)
          Remove the LogListener.
 void removeStructuralListener(StructuralListener listener)
          Remove a listener.
 void setLogPollingInterval(long logPollingInterval)
           
 void setMaxConsoleLines(int maxConsoleLines)
           
 void setMaxLoggerLines(int maxLoggerLines)
           
 void setUrl(String url)
          Deprecated. 
 
Methods inherited from class org.oddjob.jmx.ClientBase
doStop, getConnection, getEnvironment, getHeartbeat, onStart, onStop, setConnection, setEnvironment, setHeartbeat
 
Methods inherited from class org.oddjob.framework.SimpleService
fireDestroyedState, getName, getStateChanger, hardReset, logger, loggerName, onDestroy, run, setName, softReset, stateHandler, stop, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, removeIconListener, removePropertyChangeListener, removeStateListener, save, save, setArooaContext, setArooaSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Field Detail

DEFAULT_LOG_POLLING_INTERVAL

public static final long DEFAULT_LOG_POLLING_INTERVAL
See Also:
Constant Field Values
Constructor Detail

JMXClientJob

public JMXClientJob()
Method Detail

setUrl

@Deprecated
public void setUrl(String url)
Deprecated. 

Property: url

Description: This property is now deprecated in favour of connection which reflects that the connection string no longer need only be a full JMX URL.

Required: No.


addLogListener

public void addLogListener(LogListener l,
                           Object component,
                           LogLevel level,
                           long last,
                           int history)
Description copied from interface: LogArchiver
Add a listener to the archiver which will receive all missed events. The idea of receiving only missed events is to minimise network traffic when used remotely.

Event numbers begin at 0. To recieve all events, last must be -1.

Specified by:
addLogListener in interface LogArchiver
Parameters:
l - The logListener which will recieve the events.
level - The level of events required.
last - The last event number recieved. The LogArchive will not send messages from before this number.
history - The maximum messages to send up to the most recent.

removeLogListener

public void removeLogListener(LogListener l,
                              Object component)
Description copied from interface: LogArchiver
Remove the LogListener.

Specified by:
removeLogListener in interface LogArchiver
Parameters:
l - The LogListener.

addConsoleListener

public void addConsoleListener(LogListener l,
                               Object component,
                               long last,
                               int max)
Description copied from interface: ConsoleArchiver
Add a listener to the archiver which will receive all missed events. The idea of receiving only missed event is to minimise network traffic when used remotely.

Specified by:
addConsoleListener in interface ConsoleArchiver
Parameters:
l - The logListener which will recieve the events.
component - The component whose console to receive events for.
last - The last event number recieved. The LogArchive will not send messages from before this number.
max - The maximum messages to send up to the most recent.

removeConsoleListener

public void removeConsoleListener(LogListener l,
                                  Object component)
Description copied from interface: ConsoleArchiver
Remove the LogListener.

Specified by:
removeConsoleListener in interface ConsoleArchiver
Parameters:
l - The LogListener.

consoleIdFor

public String consoleIdFor(Object component)
Description copied from interface: ConsoleArchiver
Get the console id for a given component.

Specified by:
consoleIdFor in interface ConsoleArchiver
Parameters:
component - The component.
Returns:
The console id.

onInitialised

public void onInitialised()
Description copied from class: BaseComponent
Subclasses override this method to perform post creation initialisation.

Overrides:
onInitialised in class BaseComponent

doStart

protected void doStart(MBeanServerConnection mbsc,
                       ScheduledExecutorService notificationProcessor)
                throws Exception
Description copied from class: ClientBase
Overridden by subclasses to provide a specific startup.

Specified by:
doStart in class ClientBase
Throws:
Exception

onStop

protected void onStop(ClientBase.WhyStop why)
Specified by:
onStop in class ClientBase

provideBeanDirectory

public RemoteDirectory provideBeanDirectory()
Description copied from interface: RemoteDirectoryOwner
Provide a remote directory.

Specified by:
provideBeanDirectory in interface BeanDirectoryOwner
Specified by:
provideBeanDirectory in interface RemoteDirectoryOwner
Returns:
The BeanDirectory or null.

addStructuralListener

public void addStructuralListener(StructuralListener listener)
Description copied from interface: Structural
Add a listener. The listener will immediately receive add notifications for all existing children.

Specified by:
addStructuralListener in interface Structural
Parameters:
listener - The listener.

removeStructuralListener

public void removeStructuralListener(StructuralListener listener)
Description copied from interface: Structural
Remove a listener.

Specified by:
removeStructuralListener in interface Structural
Parameters:
listener - The listener.

getMaxConsoleLines

public int getMaxConsoleLines()

setMaxConsoleLines

public void setMaxConsoleLines(int maxConsoleLines)

getMaxLoggerLines

public int getMaxLoggerLines()

setMaxLoggerLines

public void setMaxLoggerLines(int maxLoggerLines)

getLogPollingInterval

public long getLogPollingInterval()

setLogPollingInterval

public void setLogPollingInterval(long logPollingInterval)