Class CommandTemplate
java.lang.Object
io.nosqlbench.engine.api.templating.CommandTemplate
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
ConstructorsConstructorDescriptionCommandTemplate(OpTemplate optpl) Deprecated, for removal: This API element is subject to removal in a future version.Create a CommandTemplate directly from an OpTemplate.CommandTemplate(OpTemplate optpl, List<Function<String, Map<String, 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(String name, String op, Map<String, String> params, Map<String, String> bindings, List<Function<String, Map<String, 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 TypeMethodDescriptionbooleancontainsAny(String... varNames) Deprecated, for removal: This API element is subject to removal in a future version.booleancontainsKey(String keyname) Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.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.getDynamic(String dynamicVar, long input) Deprecated, for removal: This API element is subject to removal in a future version.getDynamicOr(String dynamicVar, long input, String defaultVal) Deprecated, for removal: This API element is subject to removal in a future version.getFieldDescription(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.getName()Deprecated, for removal: This API element is subject to removal in a future version.The name of the operationDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.The set of key names known by this command template.Deprecated, for removal: This API element is subject to removal in a future version.getStaticOr(String staticVar, 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.booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanisDynamicSet(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.booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanisStaticOrUnsetSet(String... varnames) Deprecated, for removal: This API element is subject to removal in a future version.booleanisStaticSet(String... keynames) Deprecated, for removal: This API element is subject to removal in a future version.toString()Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
CommandTemplate
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
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(String name, String op, Map<String, String> params, Map<String, String> bindings, List<Function<String, Map<String, 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
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
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
Deprecated, for removal: This API element is subject to removal in a future version. -
isStaticSet
Deprecated, for removal: This API element is subject to removal in a future version. -
isDynamicSet
Deprecated, for removal: This API element is subject to removal in a future version. -
isDynamic
Deprecated, for removal: This API element is subject to removal in a future version. -
containsKey
Deprecated, for removal: This API element is subject to removal in a future version. -
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
Deprecated, for removal: This API element is subject to removal in a future version. -
getStatic
Deprecated, for removal: This API element is subject to removal in a future version. -
getDynamic
Deprecated, for removal: This API element is subject to removal in a future version. -
get
Deprecated, for removal: This API element is subject to removal in a future version. -
getOr
Deprecated, for removal: This API element is subject to removal in a future version. -
getStaticOr
Deprecated, for removal: This API element is subject to removal in a future version. -
getDynamicOr
Deprecated, for removal: This API element is subject to removal in a future version. -
equals
Deprecated, for removal: This API element is subject to removal in a future version. -
hashCode
public int hashCode()Deprecated, for removal: This API element is subject to removal in a future version. -
containsAny
Deprecated, for removal: This API element is subject to removal in a future version. -
isStaticOrUnsetSet
Deprecated, for removal: This API element is subject to removal in a future version. -
getFieldDescription
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
-