Class PluginThread

All Implemented Interfaces:
MBeanService, Runnable
Direct Known Subclasses:
HttpPlugin, HttpPlugin, MqttPlugin, ServerPlugin

public abstract class PluginThread extends ThreadService.ConfigurableRunnable implements MBeanService
The Class PluginThread.
  • Field Details

  • Constructor Details

    • PluginThread

      public PluginThread(String ref, Map<String,String> params)
      Instantiates a new plugin thread.
      Parameters:
      ref - the ref
      params - the params
  • Method Details

    • callerBack

      public void callerBack(boolean reset)
      Caller back.
      Parameters:
      reset - the reset
    • callerGone

      public void callerGone()
      Caller gone.
    • getCaller

      public static <T> T getCaller(Class<T> clazz)
      Gets the caller.
      Type Parameters:
      T - the generic type
      Parameters:
      clazz - the class
      Returns:
      the caller
    • getPluginName

      public abstract String getPluginName()
      Gets the plugin name.
      Returns:
      the plugin name
    • getParam

      public final String getParam(String name)
      Gets the param.
      Parameters:
      name - the name
      Returns:
      the param
    • getRef

      public final String getRef()
      Gets the ref.
      Returns:
      the ref
    • getVersion

      public abstract String getVersion()
      Gets the version.
      Returns:
      the version
    • setCaller

      public static final void setCaller(Object caller)
      Sets the caller.
      Parameters:
      caller - the new caller
    • handle

      public void handle(PluginEvent<?> event)
      Handle.
      Parameters:
      event - the event
    • handle

      protected final void handle(PluginEvent<?>[] events)
      Handle.
      Parameters:
      events - the events
    • subscribe

      public final void subscribe(String eventName)
      Subscribe.
      Parameters:
      eventName - the event name
    • unSubscribe

      public final void unSubscribe(String eventName)
      Un subscribe.
      Parameters:
      eventName - the event name
    • start

      public abstract boolean start()
      Start.
      Returns:
      true, if successful
    • stop

      public abstract void stop()
      Stop.
    • getAttribute

      public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException
      Gets the attribute. Gets the attribute.
      Specified by:
      getAttribute in interface MBeanService
      Parameters:
      attributeName - the attribute name
      Returns:
      the attribute
      Throws:
      AttributeNotFoundException - the attribute not found exception
      MBeanException - the MBean exception
    • getMBeanInfo

      public MBeanInfo getMBeanInfo()
      Gets the MBean info. Gets the MBean info.
      Specified by:
      getMBeanInfo in interface MBeanService
      Returns:
      the MBean info
    • getPluginContainer

      public PluginContainer getPluginContainer()
      Gets the plugin container.
      Returns:
      the plugin container
    • invoke

      public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException
      Invoke. Invoke.
      Specified by:
      invoke in interface MBeanService
      Parameters:
      operationName - the operation name
      params - the params
      signature - the signature
      Returns:
      the object
      Throws:
      NoSuchMethodException - the no such method exception
      MBeanException - the MBean exception
    • setAttribute

      public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException
      Sets the attribute. Sets the attribute.
      Specified by:
      setAttribute in interface MBeanService
      Parameters:
      name - the name
      value - the value
      Returns:
      true, if successful
      Throws:
      InvalidAttributeValueException - the invalid attribute value exception
      MBeanException - the MBean exception
    • setPluginContainer

      public void setPluginContainer(PluginContainer container)
      Sets the plugin container.
      Parameters:
      container - the new plugin container
    • configurableRun

      public void configurableRun()
      Configurable run. Configurable run.
      Specified by:
      configurableRun in class ThreadService.ConfigurableRunnable