mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
delegate plugin names to service selectors
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package io.nosqlbench.engine.api.extensions;
|
||||
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
@@ -49,7 +50,9 @@ public interface ScriptingPluginInfo<T> {
|
||||
/**
|
||||
* @return a simple name at the root of the variable namespace to anchor this extension.
|
||||
*/
|
||||
String getBaseVariableName();
|
||||
default String getBaseVariableName() {
|
||||
return getClass().getAnnotation(Service.class).selector();
|
||||
}
|
||||
|
||||
/**
|
||||
* If auto loading is true, then the extension will be injected into every
|
||||
|
||||
@@ -24,8 +24,9 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "csvmetrics")
|
||||
public class CSVMetricsPluginData implements ScriptingPluginInfo<CSVMetricsPlugin> {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Allows a script to log some or all metrics to CSV files";
|
||||
@@ -36,9 +37,4 @@ public class CSVMetricsPluginData implements ScriptingPluginInfo<CSVMetricsPlugi
|
||||
return new CSVMetricsPlugin(logger, metricRegistry, scriptContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "csvmetrics";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "adder")
|
||||
public class ExamplePluginData implements ScriptingPluginInfo<ExamplePlugin> {
|
||||
|
||||
@Override
|
||||
@@ -39,9 +39,4 @@ public class ExamplePluginData implements ScriptingPluginInfo<ExamplePlugin> {
|
||||
return new ExamplePlugin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "adder";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@ import org.apache.logging.log4j.Logger;
|
||||
import javax.script.ScriptContext;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "globalvars")
|
||||
public class GlobalVarsScriptingPluginData implements ScriptingPluginInfo<ConcurrentHashMap<String, Object>> {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "The global access map from shared state";
|
||||
@@ -22,8 +23,4 @@ public class GlobalVarsScriptingPluginData implements ScriptingPluginInfo<Concur
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "globalvars";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "histostatslogger")
|
||||
public class HistoStatsPluginData implements ScriptingPluginInfo<HistoStatsPlugin> {
|
||||
|
||||
@Override
|
||||
@@ -36,9 +36,4 @@ public class HistoStatsPluginData implements ScriptingPluginInfo<HistoStatsPlugi
|
||||
public HistoStatsPlugin getExtensionObject(Logger logger, MetricRegistry metricRegistry, ScriptContext scriptContext) {
|
||||
return new HistoStatsPlugin(logger,metricRegistry,scriptContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "histostatslogger";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "http")
|
||||
public class HttpPluginData implements ScriptingPluginInfo<HttpPlugin> {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "use http get and post in scripts";
|
||||
@@ -18,9 +19,4 @@ public class HttpPluginData implements ScriptingPluginInfo<HttpPlugin> {
|
||||
public HttpPlugin getExtensionObject(Logger logger, MetricRegistry metricRegistry, ScriptContext scriptContext) {
|
||||
return new HttpPlugin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "http";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "optimos")
|
||||
public class BobyqaOptimizerPluginData implements ScriptingPluginInfo<BobyqaOptimizerPlugin> {
|
||||
|
||||
@Override
|
||||
@@ -37,8 +37,4 @@ public class BobyqaOptimizerPluginData implements ScriptingPluginInfo<BobyqaOpti
|
||||
return new BobyqaOptimizerPlugin(logger, metricRegistry, scriptContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "optimos";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(ScriptingPluginInfo.class)
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "scriptingmetrics")
|
||||
public class ScriptingMetricsPluginData implements ScriptingPluginInfo<ScriptingMetrics> {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Allows you to create and append metrics within your scenario scripts";
|
||||
@@ -35,9 +36,4 @@ public class ScriptingMetricsPluginData implements ScriptingPluginInfo<Scripting
|
||||
public ScriptingMetrics getExtensionObject(Logger logger, MetricRegistry metricRegistry, ScriptContext scriptContext) {
|
||||
return new ScriptingMetrics(logger,metricRegistry,scriptContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseVariableName() {
|
||||
return "scriptingmetrics";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user