Class ECtransSetup

java.lang.Object
ecmwf.common.ectrans.ECtransSetup
All Implemented Interfaces:
Serializable

public final class ECtransSetup extends Object implements Serializable
The Class ECtransSetup.
See Also:
  • Field Details

  • Constructor Details

    • ECtransSetup

      public ECtransSetup(String moduleName)
      Instantiates a new ectrans setup.
      Parameters:
      moduleName - the module name
    • ECtransSetup

      public ECtransSetup(String moduleName, String data, Pair<?>... parameters)
      Instantiates a new ectrans setup.
      Parameters:
      moduleName - the module name
      data - the data
      parameters - the parameters
  • Method Details

    • replace

      public ECtransSetup replace(Pair<?>... parameters)
      Allow getting a new instance with the added parameters provided.
      Parameters:
      parameters - the parameters
      Returns:
      the ectrans setup
    • setData

      public void setData(String data)
      Sets the data.
      Parameters:
      data - the new data
    • remove

      public String remove(String name)
      Removes the.
      Parameters:
      name - the name
      Returns:
      the string
    • remove

      public String remove(ECtransOptions option)
      Removes the.
      Parameters:
      option - the option
      Returns:
      the string
    • removeAll

      public void removeAll(String moduleName)
      Removes all parameters for the specified module name. This is used to clean a host.
      Parameters:
      moduleName - the module name
    • removeAll

      public void removeAll(ECtransGroups.Module module)
      Removes all parameters for the specified module name. This is used to clean a host.
      Parameters:
      module - the module
    • matches

      public boolean matches(String name, String value, String defaultRegex)
      Matches.
      Parameters:
      name - the name
      value - the value
      defaultRegex - the default regex
      Returns:
      true, if successful
    • matches

      public boolean matches(ECtransOptions options, String value)
      Matches.
      Parameters:
      options - the options
      value - the value
      Returns:
      true, if successful
    • matches

      public boolean matches(ECtransOptions option, String value, String defaultRegex)
      Matches.
      Parameters:
      option - the option
      value - the value
      defaultRegex - the default regex
      Returns:
      true, if successful
    • get

      public String get(String name, String defaultValue)
      Gets the.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the string
    • get

      public String get(ECtransOptions option, String defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the string
    • getDuration

      public Duration getDuration(ECtransOptions option)
      Gets the.
      Parameters:
      option - the option
      Returns:
      the duration
    • get

      public Duration get(ECtransOptions option, Duration defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the duration
    • getPeriod

      public Period getPeriod(ECtransOptions option)
      Gets the.
      Parameters:
      option - the option
      Returns:
      the period
    • get

      public Period get(ECtransOptions option, Period defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the period
    • get

      public ByteSize get(ECtransOptions option, ByteSize defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the byte size
    • getList

      public String[] getList(String name, String... defaultValues)
      Gets the list.
      Parameters:
      name - the name
      defaultValues - the default values
      Returns:
      the list
    • getOptions

      public Options getOptions(ECtransOptions option)
      Gets the.
      Parameters:
      option - the option
      Returns:
      the options
    • getOptions

      public Options getOptions(ECtransOptions option, String delimiters)
      Gets the.
      Parameters:
      option - the option
      delimiters - the delimiters
      Returns:
      the options
    • getOptions

      public Options getOptions(ECtransOptions option, String key, String delimiters)
      Gets the.
      Parameters:
      option - the option
      key - the key
      delimiters - the delimiters
      Returns:
      the options
    • getOptions

      public Options getOptions(String name, String key, String delimiters)
      Gets the.
      Parameters:
      name - the name
      key - the key
      delimiters - the delimiters
      Returns:
      the options
    • getDuration

      public Duration getDuration(String name)
      Gets duration.
      Parameters:
      name - the name
      Returns:
      the duration
    • getDuration

      public Duration getDuration(String name, Duration defaultValue)
      Gets duration.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the duration
    • getDuration

      public Duration getDuration(String moduleName, String name, Duration defaultValue)
      Gets the duration.
      Parameters:
      moduleName - the module name
      name - the name
      defaultValue - the default value
      Returns:
      the duration
    • getPeriod

      public Period getPeriod(String name)
      Gets the period.
      Parameters:
      name - the name
      Returns:
      the period
    • getPeriod

      public Period getPeriod(String name, Period defaultValue)
      Gets the period.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the period
    • getPeriod

      public Period getPeriod(String moduleName, String name, Period defaultValue)
      Gets the period.
      Parameters:
      moduleName - the module name
      name - the name
      defaultValue - the default value
      Returns:
      the period
    • getByteSize

      public ByteSize getByteSize(String name)
      Gets byte size.
      Parameters:
      name - the name
      Returns:
      the long
    • getByteSize

      public ByteSize getByteSize(String name, ByteSize defaultValue)
      Gets byte size.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the long
    • getByteSize

      public ByteSize getByteSize(String moduleName, String name, ByteSize defaultValue)
      Gets byte size.
      Parameters:
      moduleName - the module name
      name - the name
      defaultValue - the default value
      Returns:
      the long
    • getBooleanList

      public List<Boolean> getBooleanList(ECtransOptions option)
      Gets the list of booleans.
      Parameters:
      option - the option
      Returns:
      the list of booleans
    • getBoolean

      public boolean getBoolean(ECtransOptions option)
      Gets the boolean.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getBooleanObject

      public Boolean getBooleanObject(ECtransOptions option)
      Gets the boolean object.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalBoolean

      public Optional<Boolean> getOptionalBoolean(ECtransOptions option)
      Gets the optional boolean.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setBooleanIfPresent

      public void setBooleanIfPresent(ECtransOptions option, Consumer<? super Boolean> action)
      Sets the optional boolean if present.
      Parameters:
      option - the option
      action - the action
    • getStringList

      public List<String> getStringList(ECtransOptions option)
      Gets list of strings.
      Parameters:
      option - the option
      Returns:
      the list of strings
    • getString

      public String getString(ECtransOptions option)
      Gets the string.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalString

      public Optional<String> getOptionalString(ECtransOptions option)
      Gets the optional string.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setStringIfPresent

      public void setStringIfPresent(ECtransOptions option, Consumer<? super String> action)
      Sets the optional string if present.
      Parameters:
      option - the option
      action - the action
    • getIntegerList

      public List<Integer> getIntegerList(ECtransOptions option)
      Gets the lif of integers.
      Parameters:
      option - the option
      Returns:
      the list of integers
    • getInteger

      public Integer getInteger(ECtransOptions option)
      Gets the integer.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalInteger

      public Optional<Integer> getOptionalInteger(ECtransOptions option)
      Gets the optional integer.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setIntegerIfPresent

      public void setIntegerIfPresent(ECtransOptions option, Consumer<? super Integer> action)
      Sets the optional integer if present.
      Parameters:
      option - the option
      action - the action
    • getLongList

      public List<Long> getLongList(ECtransOptions option)
      Gets the list of longs.
      Parameters:
      option - the option
      Returns:
      the list of longs
    • getLong

      public Long getLong(ECtransOptions option)
      Gets the long.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalLong

      public Optional<Long> getOptionalLong(ECtransOptions option)
      Gets the optional long.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setLongIfPresent

      public void setLongIfPresent(ECtransOptions option, Consumer<? super Long> action)
      Sets the optional long if present.
      Parameters:
      option - the option
      action - the action
    • getDoubleList

      public List<Double> getDoubleList(ECtransOptions option)
      Gets the list of doubles.
      Parameters:
      option - the option
      Returns:
      the list of doubles
    • getDouble

      public Double getDouble(ECtransOptions option)
      Gets the double.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalDouble

      public Optional<Double> getOptionalDouble(ECtransOptions option)
      Gets the optional double.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setDoubleIfPresent

      public void setDoubleIfPresent(ECtransOptions option, Consumer<? super Double> action)
      Sets the optional double if present.
      Parameters:
      option - the option
      action - the action
    • getByteSizeList

      public List<ByteSize> getByteSizeList(ECtransOptions option)
      Gets the list of byte sizes.
      Parameters:
      option - the option
      Returns:
      the list of byte sizes
    • getByteSize

      public ByteSize getByteSize(ECtransOptions option)
      Gets the byte size.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • getOptionalByteSize

      public Optional<ByteSize> getOptionalByteSize(ECtransOptions option)
      Gets the optional byte size.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setByteSizeIfPresent

      public void setByteSizeIfPresent(ECtransOptions option, Consumer<? super ByteSize> action)
      Sets the optional byte size if present.
      Parameters:
      option - the option
      action - the action
    • getOptionalDuration

      public Optional<Duration> getOptionalDuration(ECtransOptions option)
      Gets the optional duration.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setDurationIfPresent

      public void setDurationIfPresent(ECtransOptions option, Consumer<? super Duration> action)
      Sets the optional duration if present.
      Parameters:
      option - the option
      action - the action
    • getOptionalPeriod

      public Optional<Period> getOptionalPeriod(ECtransOptions option)
      Gets the optional period.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setPeriodIfPresent

      public void setPeriodIfPresent(ECtransOptions option, Consumer<? super Period> action)
      Sets the optional period if present.
      Parameters:
      option - the option
      action - the action
    • getTimeRangeList

      public List<TimeRange> getTimeRangeList(ECtransOptions option)
      Gets the list of time ranges.
      Parameters:
      option - the option
      Returns:
      the list of time ranges
    • getTimeRange

      public TimeRange getTimeRange(ECtransOptions option)
      Gets the time range.
      Parameters:
      option - the option
      Returns:
      the time range
    • getOptionalTimeRange

      public Optional<TimeRange> getOptionalTimeRange(ECtransOptions option)
      Gets the optional time range.
      Parameters:
      option - the option
      Returns:
      the object of type class
    • setTimeRangeIfPresent

      public void setTimeRangeIfPresent(ECtransOptions option, Consumer<? super TimeRange> action)
      Sets the optional time range if present.
      Parameters:
      option - the option
      action - the action
    • exists

      public static boolean exists(String name, char separator, String content)
      Exists.
      Parameters:
      name - the name
      separator - the separator
      content - the content
      Returns:
      true, if successful
    • get

      public boolean get(ECtransOptions option, boolean defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the true, if successful
    • get

      public long get(ECtransOptions option, long defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the result
    • get

      public int get(ECtransOptions option, int defaultValue)
      Gets the.
      Parameters:
      option - the option
      defaultValue - the default value
      Returns:
      the result
    • exists

      public boolean exists(String name)
      Check if the parameter exists in the current module. If the parameter is related to a function then the function is not executed.
      Parameters:
      name - the name
      Returns:
      true, if exists
    • set

      public void set(ECtransOptions option, String value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(ECtransOptions option, ByteSize value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(ECtransOptions option, boolean value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(ECtransOptions option, long value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(ECtransOptions option, int value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(ECtransOptions option, double value)
      Sets the.
      Parameters:
      option - the option
      value - the value
    • set

      public void set(String name, String value)
      Allow setting the aliases.
      Parameters:
      name - the name
      value - the value
    • set

      public void set(String name, int value)
      Sets the int.
      Parameters:
      name - the name
      value - the value
    • set

      public void set(String name, double value)
      Sets the double.
      Parameters:
      name - the name
      value - the value
    • standardize

      public void standardize(ECtransOptions option, boolean removeIfSameAsDefault)
      Normalize the representation of the data and remove option with same value as default value if required.
      Parameters:
      option - the option
      removeIfSameAsDefault - remove if same as default value
    • getProperties

      public String getProperties(boolean secured)
      Gets the sorted properties.
      Parameters:
      secured - if true then the private fields are hidden
      Returns:
      the script
    • getScript

      public String getScript()
      Gets the script if the engine exists.
      Returns:
      the script
    • getData

      public String getData()
      Gets the data (sorted properties and script if engine exists).
      Returns:
      the data
    • eval

      public <T> T eval(Class<T> clazz, String script) throws ScriptException
      Evaluate the script. The result is expected to be of the class clazz.
      Type Parameters:
      T - the generic type
      Parameters:
      clazz - the object class expected
      script - the name of the function
      Returns:
      the result of the function execution
      Throws:
      ScriptException - the script exception
    • eval

      public void eval(String script) throws ScriptException
      Evaluate the script. No return is expected from the function (void).
      Parameters:
      script - the name of the function
      Throws:
      ScriptException - the script exception
    • get

      public int get(String name, int defaultValue)
      Gets the.
      Parameters:
      name - the name
      defaultValue - the default value
      Returns:
      the int
    • getModuleName

      public String getModuleName()
      Gets the module name.
      Returns:
      the module name