it.jnrpe.plugins
Class PluginBase

java.lang.Object
  extended by it.jnrpe.plugins.PluginBase
All Implemented Interfaces:
IPluginInterface, IPluginInterfaceEx
Direct Known Subclasses:
PluginProxy

public abstract class PluginBase
extends Object
implements IPluginInterfaceEx

If your plugin needs to send events and you don't mind extending this class, you can save some coding using this as a base.

Author:
Massimiliano Ziccardi

Constructor Summary
PluginBase()
           
 
Method Summary
 void addListener(IJNRPEEventListener listener)
          Adds a new listener to the list of objects that will receive the messages.
 void addListeners(Collection<IJNRPEEventListener> listeners)
          Adds a new collection of listeners.
protected  Set<IJNRPEEventListener> getListeners()
          Returns all the registered listeners.
 void sendEvent(LogEvent evt, String sMessage)
          Sends an event.
 void sendEvent(LogEvent evt, String sMessage, Exception exc)
          Sends an event.
 void sendEvent(String sCustomEvent, EventParam... vParams)
          Sends a custom event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.jnrpe.plugins.IPluginInterface
execute
 

Constructor Detail

PluginBase

public PluginBase()
Method Detail

addListener

public final void addListener(IJNRPEEventListener listener)
Adds a new listener to the list of objects that will receive the messages. sent by this class.

Specified by:
addListener in interface IPluginInterfaceEx
Parameters:
listener - The new listener

addListeners

public final void addListeners(Collection<IJNRPEEventListener> listeners)
Adds a new collection of listeners.

Specified by:
addListeners in interface IPluginInterfaceEx
Parameters:
listeners - The collection of listeners to be added

sendEvent

public final void sendEvent(LogEvent evt,
                            String sMessage)
Sends an event.

Parameters:
evt - The event type
sMessage - The message

sendEvent

public final void sendEvent(LogEvent evt,
                            String sMessage,
                            Exception exc)
Sends an event.

Parameters:
evt - The event type
sMessage - The message
exc - The exception to be attached to the event

sendEvent

public final void sendEvent(String sCustomEvent,
                            EventParam... vParams)
Sends a custom event.

Parameters:
sCustomEvent - The custom event identifier
vParams - The parameter of the event. Can be null.

getListeners

protected final Set<IJNRPEEventListener> getListeners()
Returns all the registered listeners.

Returns:
All the listeners


Copyright © 2012. All Rights Reserved.