Class CommandTemplate
java.lang.Object
io.nosqlbench.engine.api.templating.CommandTemplate
@Deprecated(forRemoval=true)
public class CommandTemplate
extends java.lang.Object
Deprecated, for removal: This API element is subject to removal in a future version.
This is a general purpose template which uses a map of named parameters.
The result is a template which is comprised of a map of names and values, which can
be used to create a cycle-specific map of values that can describe a literal operation
for some native driver. How this map is used is context dependent.
Generally speaking, the properties in this map are taken as parameters or field values,
or a command verb. How the keys in the resulting map are used to construct an operation
for execution is entirely dependent on how a developer wants to map these fields to
a native driver's API.
A CommandTemplate can be crated directly, or from an OpTemplate. Additional map parsers
may be provided when needed for specialized forms of syntax or variations which should also
be supported. See the constructor docs for details on these variations.
-
Constructor Summary
Constructors Constructor Description CommandTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate optpl)Deprecated, for removal: This API element is subject to removal in a future version.Create a CommandTemplate directly from an OpTemplate.CommandTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate optpl, java.util.List<java.util.function.Function<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> parsers)Deprecated, for removal: This API element is subject to removal in a future version.Create a CommandTemplate directly from an OpTemplate, as inCommandTemplate(OpTemplate), with added support for parsing the oneline form with the provided parsers.CommandTemplate(java.lang.String name, java.lang.String op, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> bindings, java.util.List<java.util.function.Function<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> optionalParsers)Deprecated, for removal: This API element is subject to removal in a future version.Create a command template from a set of optional properties. -
Method Summary
Modifier and Type Method Description booleancontainsAny(java.lang.String... varNames)Deprecated, for removal: This API element is subject to removal in a future version.booleancontainsKey(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version.booleanequals(java.lang.Object o)Deprecated, for removal: This API element is subject to removal in a future version.java.lang.Stringget(java.lang.String var, long input)Deprecated, for removal: This API element is subject to removal in a future version.java.util.Map<java.lang.String,java.lang.String>getCommand(long cycle)Deprecated, for removal: This API element is subject to removal in a future version.Apply the provided binding functions to the command template, yielding a map with concrete values to be used by a native command.java.lang.StringgetDynamic(java.lang.String dynamicVar, long input)Deprecated, for removal: This API element is subject to removal in a future version.java.lang.StringgetDynamicOr(java.lang.String dynamicVar, long input, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version.java.lang.StringgetFieldDescription(java.lang.String varname)Deprecated, for removal: This API element is subject to removal in a future version.This should only be used to provide a view of a field definition, never for actual use in a payload.java.lang.StringgetName()Deprecated, for removal: This API element is subject to removal in a future version.The name of the operationjava.lang.StringgetOr(java.lang.String var, long input, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version.java.util.Set<java.lang.String>getPropertyNames()Deprecated, for removal: This API element is subject to removal in a future version.The set of key names known by this command template.java.lang.StringgetStatic(java.lang.String staticVar)Deprecated, for removal: This API element is subject to removal in a future version.java.lang.StringgetStaticOr(java.lang.String staticVar, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version.inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.booleanisDynamic(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version.booleanisDynamicSet(java.lang.String... keynames)Deprecated, for removal: This API element is subject to removal in a future version.booleanisStatic()Deprecated, for removal: This API element is subject to removal in a future version.True if the command template contains all static (non-binding) values.booleanisStatic(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version.booleanisStaticOrUnsetSet(java.lang.String... varnames)Deprecated, for removal: This API element is subject to removal in a future version.booleanisStaticSet(java.lang.String... keynames)Deprecated, for removal: This API element is subject to removal in a future version.java.lang.StringtoString()Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
CommandTemplate
public CommandTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate optpl)Deprecated, for removal: This API element is subject to removal in a future version.Create a CommandTemplate directly from an OpTemplate. In this form, ifOpTemplate.getOp()is non-null, then it taken as a line-oriented value and parsed according to defaultParamsParserbehavior. Additionally, any op params provided are considered as entries to add to the command template's map.- Parameters:
optpl- An OpTemplate
-
CommandTemplate
public CommandTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate optpl, java.util.List<java.util.function.Function<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> parsers)Deprecated, for removal: This API element is subject to removal in a future version.Create a CommandTemplate directly from an OpTemplate, as inCommandTemplate(OpTemplate), with added support for parsing the oneline form with the provided parsers. In this form, ifOpTemplate.getOp()is non-null, then it taken as a line-oriented value and parsed according to defaultParamsParserbehavior. However, the provided parsers (if any) are used first in order to match alternate forms of syntax. SeeCommandTemplate(String, String, Map, Map, List)for full details on the provided parsers.- Parameters:
optpl- An OpTemplateparsers- A list of parser functions
-
CommandTemplate
public CommandTemplate(java.lang.String name, java.lang.String op, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> bindings, java.util.List<java.util.function.Function<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> optionalParsers)Deprecated, for removal: This API element is subject to removal in a future version.Create a command template from a set of optional properties.The parsers provided should honor these expectations:
- If the one-line format is not recognized, the parser should return null.
- If the one-line format is recognized, and the values provided are valid, then they should be
returned as a
MapofStringtoString. - Otherwise the parser should throw an exception, signifying either an internal parser error or invalid data.
ParamsParseris used.- Parameters:
name- The name of the command templateop- An object version of the parameters to be parsed byParamsParserparams- A set of named parameters and values in name:value form.bindings- A set of named bindings in name:recipe form.optionalParsers- A set of functions which, if provided, will be used to read the oneline form.
-
-
Method Details
-
getCommand
public java.util.Map<java.lang.String,java.lang.String> getCommand(long cycle)Deprecated, for removal: This API element is subject to removal in a future version.Apply the provided binding functions to the command template, yielding a map with concrete values to be used by a native command.- Parameters:
cycle- The cycle value which will be used by the binding functions- Returns:
- A map of specific values
-
getName
public java.lang.String getName()Deprecated, for removal: This API element is subject to removal in a future version.The name of the operation -
isStatic
public boolean isStatic()Deprecated, for removal: This API element is subject to removal in a future version.True if the command template contains all static (non-binding) values. -
isStatic
public boolean isStatic(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version. -
isStaticSet
public boolean isStaticSet(java.lang.String... keynames)Deprecated, for removal: This API element is subject to removal in a future version. -
isDynamicSet
public boolean isDynamicSet(java.lang.String... keynames)Deprecated, for removal: This API element is subject to removal in a future version. -
isDynamic
public boolean isDynamic(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version. -
containsKey
public boolean containsKey(java.lang.String keyname)Deprecated, for removal: This API element is subject to removal in a future version. -
getPropertyNames
public java.util.Set<java.lang.String> getPropertyNames()Deprecated, for removal: This API element is subject to removal in a future version.The set of key names known by this command template. -
toString
public java.lang.String toString()Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
toStringin classjava.lang.Object
-
getStatic
public java.lang.String getStatic(java.lang.String staticVar)Deprecated, for removal: This API element is subject to removal in a future version. -
getDynamic
public java.lang.String getDynamic(java.lang.String dynamicVar, long input)Deprecated, for removal: This API element is subject to removal in a future version. -
get
public java.lang.String get(java.lang.String var, long input)Deprecated, for removal: This API element is subject to removal in a future version. -
getOr
public java.lang.String getOr(java.lang.String var, long input, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version. -
getStaticOr
public java.lang.String getStaticOr(java.lang.String staticVar, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version. -
getDynamicOr
public java.lang.String getDynamicOr(java.lang.String dynamicVar, long input, java.lang.String defaultVal)Deprecated, for removal: This API element is subject to removal in a future version. -
equals
public boolean equals(java.lang.Object o)Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
hashCodein classjava.lang.Object
-
containsAny
public boolean containsAny(java.lang.String... varNames)Deprecated, for removal: This API element is subject to removal in a future version. -
isStaticOrUnsetSet
public boolean isStaticOrUnsetSet(java.lang.String... varnames)Deprecated, for removal: This API element is subject to removal in a future version. -
getFieldDescription
public java.lang.String getFieldDescription(java.lang.String varname)Deprecated, for removal: This API element is subject to removal in a future version.This should only be used to provide a view of a field definition, never for actual use in a payload.- Parameters:
varname- The field name which you want to explain- Returns:
- A string representation of the field name
-