Added
This commit is contained in:
parent
960e38039e
commit
5eeabceea3
|
|
@ -16,9 +16,14 @@
|
|||
*/
|
||||
package org.graylog.plugins.custom;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.multibindings.MapBinder;
|
||||
import org.graylog.plugins.pipelineprocessor.ast.functions.Function;
|
||||
import org.graylog2.plugin.PluginConfigBean;
|
||||
import org.graylog2.plugin.PluginModule;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -31,6 +36,7 @@ public class Base64InflateFunctionModule extends PluginModule {
|
|||
*
|
||||
* Implementing this method is optional. The default method returns an empty {@link Set}.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Set<? extends PluginConfigBean> getConfigBeans() {
|
||||
return Collections.emptySet();
|
||||
|
|
@ -38,23 +44,17 @@ public class Base64InflateFunctionModule extends PluginModule {
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
/*
|
||||
* Register your plugin types here.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* addMessageInput(Class<? extends MessageInput>);
|
||||
* addMessageFilter(Class<? extends MessageFilter>);
|
||||
* addMessageOutput(Class<? extends MessageOutput>);
|
||||
* addPeriodical(Class<? extends Periodical>);
|
||||
* addAlarmCallback(Class<? extends AlarmCallback>);
|
||||
* addInitializer(Class<? extends Service>);
|
||||
* addRestResource(Class<? extends PluginRestResource>);
|
||||
*
|
||||
*
|
||||
* Add all configuration beans returned by getConfigBeans():
|
||||
*
|
||||
* addConfigBeans();
|
||||
*/
|
||||
addMessageProcessorFunction(Base64InflateFunction.NAME, Base64InflateFunction.class);
|
||||
}
|
||||
protected void addMessageProcessorFunction(String name, Class<? extends Function<?>> functionClass) {
|
||||
addMessageProcessorFunction(binder(), name, functionClass);
|
||||
}
|
||||
|
||||
public static MapBinder<String, Function<?>> processorFunctionBinder(Binder binder) {
|
||||
return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), new TypeLiteral<Function<?>>() {});
|
||||
}
|
||||
|
||||
public static void addMessageProcessorFunction(Binder binder, String name, Class<? extends Function<?>> functionClass) {
|
||||
processorFunctionBinder(binder).addBinding(name).to(functionClass);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue