Class CommandTemplate

java.lang.Object
io.nosqlbench.engine.api.templating.CommandTemplate

@Deprecated(forRemoval=true) public class CommandTemplate extends 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
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a CommandTemplate directly from an OpTemplate.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a CommandTemplate directly from an OpTemplate, as in CommandTemplate(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 Type
    Method
    Description
    boolean
    containsAny(String... varNames)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    get(String var, long input)
    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.
     
    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.
    Deprecated, for removal: This API element is subject to removal in a future version.
    The name of the operation
    getOr(String var, long input, String defaultVal)
    Deprecated, 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.
    getStatic(String staticVar)
    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.
     
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    isDynamic(String keyname)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    isDynamicSet(String... keynames)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    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.
    boolean
    isStatic(String keyname)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    isStaticSet(String... keynames)
    Deprecated, 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.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CommandTemplate

      public CommandTemplate(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, if OpTemplate.getOp() is non-null, then it taken as a line-oriented value and parsed according to default ParamsParser behavior. Additionally, any op params provided are considered as entries to add to the command template's map.
      Parameters:
      optpl - An OpTemplate
    • CommandTemplate

      public 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 in CommandTemplate(OpTemplate), with added support for parsing the oneline form with the provided parsers. In this form, if OpTemplate.getOp() is non-null, then it taken as a line-oriented value and parsed according to default ParamsParser behavior. However, the provided parsers (if any) are used first in order to match alternate forms of syntax. See CommandTemplate(String, String, Map, Map, List) for full details on the provided parsers.
      Parameters:
      optpl - An OpTemplate
      parsers - 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 Map of String to String.
      • Otherwise the parser should throw an exception, signifying either an internal parser error or invalid data.
      If none of the provided parsers (if any) return a map of values for the one-line format, then the default behavior of ParamsParser is used.

      Parameters:
      name - The name of the command template
      op - An object version of the parameters to be parsed by ParamsParser
      params - 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 Map<String,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 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(String keyname)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isStaticSet

      public boolean isStaticSet(String... keynames)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isDynamicSet

      public boolean isDynamicSet(String... keynames)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isDynamic

      public boolean isDynamic(String keyname)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • containsKey

      public boolean containsKey(String keyname)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getPropertyNames

      public Set<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 String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object
    • getStatic

      public String getStatic(String staticVar)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDynamic

      public String getDynamic(String dynamicVar, long input)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • get

      public String get(String var, long input)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getOr

      public String getOr(String var, long input, String defaultVal)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getStaticOr

      public String getStaticOr(String staticVar, String defaultVal)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDynamicOr

      public String getDynamicOr(String dynamicVar, long input, String defaultVal)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • equals

      public boolean equals(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      hashCode in class Object
    • containsAny

      public boolean containsAny(String... varNames)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isStaticOrUnsetSet

      public boolean isStaticOrUnsetSet(String... varnames)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getFieldDescription

      public String 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.
      Parameters:
      varname - The field name which you want to explain
      Returns:
      A string representation of the field name