Class HttpPlugin

All Implemented Interfaces:
MBeanService, HttpCertificateProvider, HandlerReceiver, Runnable

public final class HttpPlugin extends PluginThread implements HandlerReceiver, HttpCertificateProvider
The Class HttpPlugin.
  • Constructor Details

    • HttpPlugin

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

    • getPluginName

      public String getPluginName()
      Gets the plugin name.
      Specified by:
      getPluginName in class PluginThread
      Returns:
      the plugin name
    • getVersion

      public String getVersion()
      Gets the version.
      Specified by:
      getVersion in class PluginThread
      Returns:
      the version
    • start

      public boolean start()
      Start.
      Specified by:
      start in class PluginThread
      Returns:
      true, if successful
    • reloadCertificate

      public void reloadCertificate() throws Exception
      Reloads the TLS certificate from the keystore currently in use without restarting the Jetty server (zero-downtime hot-reload).
      Specified by:
      reloadCertificate in interface HttpCertificateProvider
      Throws:
      Exception - if the reload fails
    • getCertificateInfo

      public CertificateManager.CertificateInfo getCertificateInfo()
      Returns metadata about the certificate currently loaded in the Monitor HTTPS server.
      Returns:
      a CertificateManager.CertificateInfo snapshot, or null if the plugin has not been started or no keystore is configured
    • getActiveKeystorePath

      public String getActiveKeystorePath()
      Returns the path to the keystore currently in use by the Monitor HTTPS server, or null if the plugin has not been started.
      Returns:
      the active keystore path
    • buildCertificateJson

      public String buildCertificateJson()
      Returns a JSON-encoded snapshot of the TLS certificate currently loaded by this plugin's HTTPS server, or "{}" if no certificate is available.
      Specified by:
      buildCertificateJson in interface HttpCertificateProvider
      Returns:
      JSON string; never null
    • deployCertificate

      public void deployCertificate(byte[] pkcs12Bytes, String keystorePassword) throws Exception
      Deploys a new PKCS#12 keystore to this plugin's HTTPS server and hot-reloads the certificate without restarting the server (where supported).
      Specified by:
      deployCertificate in interface HttpCertificateProvider
      Parameters:
      pkcs12Bytes - the PKCS#12 keystore bytes
      keystorePassword - password for the keystore and private key
      Throws:
      Exception - if the deployment or reload fails
    • getActiveKeystorePassword

      public String getActiveKeystorePassword()
      Returns the password for the keystore currently in use by the Monitor HTTPS server.
      Returns:
      the active keystore password
    • registerEventHandler

      public void registerEventHandler(EventHandler eventHandler)
      Register event handler.
      Specified by:
      registerEventHandler in interface HandlerReceiver
      Parameters:
      eventHandler - the event handler
    • waitForMasterConnection

      public void waitForMasterConnection(boolean initialiseEventHandler) throws RemoteException
      Initialise event handler.
      Parameters:
      initialiseEventHandler - the initialise event handler
      Throws:
      RemoteException - the remote exception
    • stop

      public void stop()
      Stop.
      Specified by:
      stop in class PluginThread
    • getAttribute

      public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException
      Gets the attribute.
      Specified by:
      getAttribute in interface MBeanService
      Overrides:
      getAttribute in class PluginThread
      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.
      Specified by:
      getMBeanInfo in interface MBeanService
      Overrides:
      getMBeanInfo in class PluginThread
      Returns:
      the MBean info
    • invoke

      public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException
      Invoke.
      Specified by:
      invoke in interface MBeanService
      Overrides:
      invoke in class PluginThread
      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
    • handle

      public void handle(PluginEvent<?> event)
      Handle.
      Overrides:
      handle in class PluginThread
      Parameters:
      event - the event