Package jrpc.clightning.plugins
Class CLightningPlugin
- java.lang.Object
-
- jrpc.clightning.plugins.CLightningPlugin
-
- All Implemented Interfaces:
ICLightningPlugin
public abstract class CLightningPlugin extends java.lang.Object implements ICLightningPlugin
-
-
Field Summary
Fields Modifier and Type Field Description protected CLightingPluginConfigconfigsprotected java.util.Map<java.lang.String,java.lang.Object>parameters
-
Constructor Summary
Constructors Constructor Description CLightningPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInterceptorAfterRPCMethod(Interceptor interceptor)voidaddInterceptorBeforeRPCMethod(Interceptor interceptor)voidaddNotification(java.lang.String methodName)Method to help the user to register a custom notification for the pluginvoidaddParameter(java.lang.String key, java.lang.Object value)voidaddRPCMethod(AbstractRPCMethod method)voidaddSubscription(java.lang.String event)booleancontainsNotification(java.lang.String methodName)Helper method to check if a notification with the key (method name) exist in the plugin.CLightingPluginConfiggetConfigs()java.util.List<java.lang.String>getHooks()<T> TgetParameter(java.lang.String key)java.util.List<AbstractRPCMethod>getRpcMethods()java.util.List<java.lang.String>getSubscriptions()booleanhasParameter(java.lang.String key)booleanhasParametersReady()protected voidinitPostHandlerInterceptor()protected voidinitPreHandlerInterceptor()booleanisDynamic()voidlog(PluginLog level, java.lang.Object json)voidlog(PluginLog level, java.lang.String logMessage)This call should be enable also in RPC methods.voidlog(PluginLog level, CLightningJsonObject json)voidonInit(ICLightningPlugin plugin, CLightningJsonObject request, CLightningJsonObject response)protected voidregisterMethod()voidsendNotification(java.lang.String methodName, CLightningJsonObject params)Method to tell the plugin that the user want send a notificationvoidsetConfigs(CLightingPluginConfig configs)voidsetParametersReady(boolean parametersReady)voidstart()java.lang.StringtoString()
-
-
-
Field Detail
-
parameters
protected java.util.Map<java.lang.String,java.lang.Object> parameters
-
configs
protected CLightingPluginConfig configs
-
-
Method Detail
-
addRPCMethod
public void addRPCMethod(AbstractRPCMethod method)
- Specified by:
addRPCMethodin interfaceICLightningPlugin
-
addInterceptorBeforeRPCMethod
public void addInterceptorBeforeRPCMethod(Interceptor interceptor)
- Specified by:
addInterceptorBeforeRPCMethodin interfaceICLightningPlugin
-
addInterceptorAfterRPCMethod
public void addInterceptorAfterRPCMethod(Interceptor interceptor)
- Specified by:
addInterceptorAfterRPCMethodin interfaceICLightningPlugin
-
onInit
public void onInit(ICLightningPlugin plugin, CLightningJsonObject request, CLightningJsonObject response)
- Specified by:
onInitin interfaceICLightningPlugin
-
start
public void start()
- Specified by:
startin interfaceICLightningPlugin
-
setConfigs
public void setConfigs(CLightingPluginConfig configs)
- Specified by:
setConfigsin interfaceICLightningPlugin
-
getConfigs
public CLightingPluginConfig getConfigs()
- Specified by:
getConfigsin interfaceICLightningPlugin
-
hasParametersReady
public boolean hasParametersReady()
- Specified by:
hasParametersReadyin interfaceICLightningPlugin
-
setParametersReady
public void setParametersReady(boolean parametersReady)
-
log
public void log(PluginLog level, CLightningJsonObject json)
- Specified by:
login interfaceICLightningPlugin
-
log
public void log(PluginLog level, java.lang.Object json)
- Specified by:
login interfaceICLightningPlugin
-
log
public void log(PluginLog level, java.lang.String logMessage)
This call should be enable also in RPC methods.- Specified by:
login interfaceICLightningPlugin- Parameters:
level- level log, this class should be an instance of enum CLightningLevelLoglogMessage- log message should be the log message
-
addNotification
public void addNotification(java.lang.String methodName)
Method to help the user to register a custom notification for the plugin- Parameters:
methodName- : A unique key to identify notification in the plugin
-
containsNotification
public boolean containsNotification(java.lang.String methodName)
Helper method to check if a notification with the key (method name) exist in the plugin.- Parameters:
methodName- A unique key to identify notification in the plugin- Returns:
- true if the plugin contains a notification with the key (methodName), false otherwise.
-
sendNotification
public void sendNotification(java.lang.String methodName, CLightningJsonObject params)Method to tell the plugin that the user want send a notification- Parameters:
methodName- : A unique key to identify notification in the pluginparams- : A json object (CLightningJsonObject) that contains all the parameters that the notification need to ship.
-
initPreHandlerInterceptor
protected void initPreHandlerInterceptor()
-
initPostHandlerInterceptor
protected void initPostHandlerInterceptor()
-
registerMethod
protected void registerMethod()
-
addSubscription
public void addSubscription(java.lang.String event)
-
addParameter
public void addParameter(java.lang.String key, java.lang.Object value)- Specified by:
addParameterin interfaceICLightningPlugin
-
getParameter
public <T> T getParameter(java.lang.String key)
- Specified by:
getParameterin interfaceICLightningPlugin
-
hasParameter
public boolean hasParameter(java.lang.String key)
- Specified by:
hasParameterin interfaceICLightningPlugin
-
getRpcMethods
public java.util.List<AbstractRPCMethod> getRpcMethods()
- Specified by:
getRpcMethodsin interfaceICLightningPlugin
-
getSubscriptions
public java.util.List<java.lang.String> getSubscriptions()
- Specified by:
getSubscriptionsin interfaceICLightningPlugin
-
getHooks
public java.util.List<java.lang.String> getHooks()
- Specified by:
getHooksin interfaceICLightningPlugin
-
isDynamic
public boolean isDynamic()
- Specified by:
isDynamicin interfaceICLightningPlugin
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-