Class HttpPlugin
java.lang.Object
ecmwf.common.technical.ThreadService.ConfigurableRunnable
ecmwf.common.plugin.PluginThread
ecmwf.ecpds.master.plugin.http.HttpPlugin
- All Implemented Interfaces:
MBeanService, HttpCertificateProvider, HandlerReceiver, Runnable
public final class HttpPlugin
extends PluginThread
implements HandlerReceiver, HttpCertificateProvider
The Class HttpPlugin.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Class AccessRestrictionFilter.static classThe Class SessionRule. -
Field Summary
Fields inherited from class PluginThread
_params -
Constructor Summary
ConstructorsConstructorDescriptionHttpPlugin(String ref, Map<String, String> params) Instantiates a new http plugin. -
Method Summary
Modifier and TypeMethodDescriptionReturns a JSON-encoded snapshot of the TLS certificate currently loaded by this plugin's HTTPS server, or"{}"if no certificate is available.voiddeployCertificate(byte[] pkcs12Bytes, String keystorePassword) Deploys a new PKCS#12 keystore to this plugin's HTTPS server and hot-reloads the certificate without restarting the server (where supported).Returns the password for the keystore currently in use by the Monitor HTTPS server.Returns the path to the keystore currently in use by the Monitor HTTPS server, ornullif the plugin has not been started.getAttribute(String attributeName) Gets the attribute.Returns metadata about the certificate currently loaded in the Monitor HTTPS server.Gets the MBean info.Gets the plugin name.Gets the version.voidhandle(PluginEvent<?> event) Handle.Invoke.voidregisterEventHandler(EventHandler eventHandler) Register event handler.voidReloads the TLS certificate from the keystore currently in use without restarting the Jetty server (zero-downtime hot-reload).booleanstart()Start.voidstop()Stop.voidwaitForMasterConnection(boolean initialiseEventHandler) Initialise event handler.Methods inherited from class PluginThread
callerBack, callerGone, configurableRun, getCaller, getParam, getPluginContainer, getRef, handle, setAttribute, setCaller, setPluginContainer, subscribe, unSubscribeMethods inherited from class ThreadService.ConfigurableRunnable
execute, execute, execute, getContextClassLoader, getPriority, getThreadName, interrupt, interrupted, isAlive, isStarted, join, join, run, setContextClassLoader, setForceCookie, setInheritCookie, setPriority, setThreadNameAndCookie
-
Constructor Details
-
HttpPlugin
-
-
Method Details
-
getPluginName
Gets the plugin name.- Specified by:
getPluginNamein classPluginThread- Returns:
- the plugin name
-
getVersion
Gets the version.- Specified by:
getVersionin classPluginThread- Returns:
- the version
-
start
public boolean start()Start.- Specified by:
startin classPluginThread- Returns:
- true, if successful
-
reloadCertificate
Reloads the TLS certificate from the keystore currently in use without restarting the Jetty server (zero-downtime hot-reload).- Specified by:
reloadCertificatein interfaceHttpCertificateProvider- Throws:
Exception- if the reload fails
-
getCertificateInfo
Returns metadata about the certificate currently loaded in the Monitor HTTPS server.- Returns:
- a
CertificateManager.CertificateInfosnapshot, ornullif the plugin has not been started or no keystore is configured
-
getActiveKeystorePath
Returns the path to the keystore currently in use by the Monitor HTTPS server, ornullif the plugin has not been started.- Returns:
- the active keystore path
-
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:
buildCertificateJsonin interfaceHttpCertificateProvider- Returns:
- JSON string; never
null
-
deployCertificate
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:
deployCertificatein interfaceHttpCertificateProvider- Parameters:
pkcs12Bytes- the PKCS#12 keystore byteskeystorePassword- password for the keystore and private key- Throws:
Exception- if the deployment or reload fails
-
getActiveKeystorePassword
Returns the password for the keystore currently in use by the Monitor HTTPS server.- Returns:
- the active keystore password
-
registerEventHandler
Register event handler.- Specified by:
registerEventHandlerin interfaceHandlerReceiver- Parameters:
eventHandler- the event handler
-
waitForMasterConnection
Initialise event handler.- Parameters:
initialiseEventHandler- the initialise event handler- Throws:
RemoteException- the remote exception
-
stop
-
getAttribute
Gets the attribute.- Specified by:
getAttributein interfaceMBeanService- Overrides:
getAttributein classPluginThread- Parameters:
attributeName- the attribute name- Returns:
- the attribute
- Throws:
AttributeNotFoundException- the attribute not found exceptionMBeanException- the MBean exception
-
getMBeanInfo
Gets the MBean info.- Specified by:
getMBeanInfoin interfaceMBeanService- Overrides:
getMBeanInfoin classPluginThread- Returns:
- the MBean info
-
invoke
public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException Invoke.- Specified by:
invokein interfaceMBeanService- Overrides:
invokein classPluginThread- Parameters:
operationName- the operation nameparams- the paramssignature- the signature- Returns:
- the object
- Throws:
NoSuchMethodException- the no such method exceptionMBeanException- the MBean exception
-
handle
Handle.- Overrides:
handlein classPluginThread- Parameters:
event- the event
-