com.hazelcast.jet.config

## Class JetConfig

- java.lang.Object
- - com.hazelcast.jet.config.JetConfig

-     public class JetConfig
      extends Object

  Configuration object for a Jet instance.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_GROUP_NAME` The default group name for a Jet cluster See `GroupConfig`
    `static int` | `DEFAULT_JET_MULTICAST_PORT` The default port number for the cluster auto-discovery mechanism's multicast communication.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JetConfig()` Creates a new, empty `JetConfig` with the default configuration.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `EdgeConfig` | `getDefaultEdgeConfig()` Returns the default DAG edge configuration.
    `Config` | `getHazelcastConfig()` Returns the configuration object for the underlying Hazelcast IMDG instance.
    `InstanceConfig` | `getInstanceConfig()` Returns the Jet instance config.
    `MetricsConfig` | `getMetricsConfig()` Returns the metrics collection config.
    `Properties` | `getProperties()` Returns the Jet-specific configuration properties.
    `static JetConfig` | `loadDefault()` Loads JetConfig using the default lookup mechanism to locate the configuration file.
    `static JetConfig` | `loadDefault(Properties properties)` Loads JetConfig using the built-in `lookup mechanism` to locate the configuration file.
    `static JetConfig` | `loadFromClasspath(ClassLoader classLoader, String resource)` Creates a JetConfig which is loaded from a classpath resource.
    `static JetConfig` | `loadFromClasspath(ClassLoader classLoader, String resource, Properties properties)` Creates a JetConfig which is loaded from a classpath resource.
    `static JetConfig` | `loadFromClasspath(String resource)` Deprecated. see loadFromClasspath(ClassLoader,String)}
    `static JetConfig` | `loadFromClasspath(String resource, Properties properties)` Deprecated. see loadFromClasspath(ClassLoader, String, Properties)}
    `static JetConfig` | `loadFromFile(File configFile)` Creates a JetConfig based on a Hazelcast Jet configuration file (XML or YAML) and uses the System.properties to resolve variables in the file.
    `static JetConfig` | `loadFromFile(File configFile, Properties properties)` Creates a JetConfig based on a Hazelcast Jet configuration file (XML or YAML).
    `static JetConfig` | `loadFromStream(InputStream configStream)` Deprecated. see loadXmlFromStream(InputStream) and loadYamlFromStream(InputStream)
    `static JetConfig` | `loadFromStream(InputStream configStream, Properties properties)` Deprecated. see loadXmlFromStream(InputStream, Properties) and loadYamlFromStream(InputStream, Properties)
    `static JetConfig` | `loadXmlFromStream(InputStream configStream)` Loads JetConfig from the supplied input stream.
    `static JetConfig` | `loadXmlFromStream(InputStream configStream, Properties properties)` Loads JetConfig from the supplied input stream.
    `static JetConfig` | `loadXmlFromString(String xml)` Creates a JetConfig from the provided XML string and uses the System.properties to resolve variables in the XML.
    `static JetConfig` | `loadXmlFromString(String xml, Properties properties)` Creates a JetConfig from the provided XML string and properties to resolve the variables in the XML.
    `static JetConfig` | `loadYamlFromStream(InputStream configStream)` Loads JetConfig from the supplied input stream.
    `static JetConfig` | `loadYamlFromStream(InputStream configStream, Properties properties)` Loads JetConfig from the supplied input stream.
    `static JetConfig` | `loadYamlFromString(String yaml)` Creates a JetConfig from the provided YAML string and uses the System.properties to resolve variables in the YAML.
    `static JetConfig` | `loadYamlFromString(String yaml, Properties properties)` Creates a JetConfig from the provided YAML string and properties to resolve the variables in the YAML.
    `JetConfig` | `setDefaultEdgeConfig(EdgeConfig defaultEdgeConfig)` Sets the configuration object that specifies the defaults to use for a DAG edge configuration.
    `JetConfig` | `setHazelcastConfig(Config config)` Sets the underlying Hazelcast IMDG instance's configuration object.
    `JetConfig` | `setInstanceConfig(InstanceConfig instanceConfig)` Sets the Jet instance config.
    `JetConfig` | `setMetricsConfig(MetricsConfig metricsConfig)` Sets the metrics collection config.
    `JetConfig` | `setProperties(Properties properties)` Sets the Jet-specific configuration properties.
    `JetConfig` | `setProperty(String name, String value)` Sets the value of the specified property.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_JET_MULTICAST_PORT

          public static final int DEFAULT_JET_MULTICAST_PORT

      The default port number for the cluster auto-discovery mechanism's multicast communication.
      See Also:
        Constant Field Values

    - #### DEFAULT_GROUP_NAME

          public static final String DEFAULT_GROUP_NAME

      The default group name for a Jet cluster See `GroupConfig`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JetConfig

          public JetConfig()

      Creates a new, empty `JetConfig` with the default configuration. Doesn't consider any configuration XML files.

  - ### Method Detail

    - #### loadDefault

          @Nonnull
          public static JetConfig loadDefault()

      Loads JetConfig using the default lookup mechanism to locate the configuration file. Loads the nested Hazelcast config also by using its default lookup mechanism. Uses `System.getProperties()` to resolve the variables in the XML or YAML.

      This is the lookup mechanism for the Jet configuration:

      1. Read the system property `hazelcast.jet.config`. If it starts with `classpath:`, treat it as a classpath resource, otherwise it's a file pathname. If it's defined but Jet can't find the file it specifies, startup fails.
      2. Look for `hazelcast-jet.xml` in the working directory.
      3. Look for `hazelcast-jet.xml` in the classpath.
      4. Look for `hazelcast-jet.yaml` in the working directory.
      5. Look for `hazelcast-jet.yaml` in the classpath.
      6. Load the default XML configuration packaged in Jet's JAR.
      The mechanism is the same for the nested Hazelcast config, just with the `hazelcast.config` system property.

    - #### loadDefault

          @Nonnull
          public static JetConfig loadDefault(Properties properties)

      Loads JetConfig using the built-in `lookup mechanism` to locate the configuration file. Loads the nested Hazelcast config also by using the lookup mechanism. Uses the given `properties` to resolve the variables in the XML or YAML.

    - #### loadFromClasspath

          @Nonnull
          public static JetConfig loadFromClasspath(ClassLoader classLoader,
                                                             String resource)

      Creates a JetConfig which is loaded from a classpath resource. The System.properties are used to resolve variables in the configuration file.
      Parameters:
        `classLoader` - the ClassLoader used to load the resource
        `resource` - the resource, an XML or YAML configuration file from the classpath, without the "classpath:" prefix
      Throws:
        `IllegalArgumentException` - if classLoader or resource is `null`, or if the resource is not found
        `InvalidConfigurationException` - if the resource content is invalid

    - #### loadFromClasspath

          @Nonnull
          public static JetConfig loadFromClasspath(ClassLoader classLoader,
                                                             String resource,
                                                             Properties properties)

      Creates a JetConfig which is loaded from a classpath resource. Uses the given `properties` to resolve the variables in the resource.
      Parameters:
        `classLoader` - the ClassLoader used to load the resource
        `resource` - the resource, an XML or YAML configuration file from the classpath, without the "classpath:" prefix
        `properties` - the properties used to resolve variables in the resource
      Throws:
        `IllegalArgumentException` - if classLoader or resource is `null`, or if the resource is not found
        `InvalidConfigurationException` - if the resource content is invalid

    - #### loadFromFile

          @Nonnull
          public static JetConfig loadFromFile(File configFile)
                                                 throws FileNotFoundException

      Creates a JetConfig based on a Hazelcast Jet configuration file (XML or YAML) and uses the System.properties to resolve variables in the file.
      Parameters:
        `configFile` - the path of the Hazelcast Jet configuration file
      Throws:
        `FileNotFoundException` - if the file doesn't exist
        `InvalidConfigurationException` - if the file content is invalid

    - #### loadFromFile

          @Nonnull
          public static JetConfig loadFromFile(File configFile,
                                                        Properties properties)
                                                 throws FileNotFoundException

      Creates a JetConfig based on a Hazelcast Jet configuration file (XML or YAML). Uses the given `properties` to resolve the variables in the file.
      Parameters:
        `configFile` - the path of the Hazelcast Jet configuration file
        `properties` - the Properties to resolve variables in the file
      Throws:
        `IllegalArgumentException` - if configFile or properties is `null`
        `FileNotFoundException` - if the file doesn't exist
        `InvalidConfigurationException` - if the file content is invalid

    - #### loadXmlFromStream

          @Nonnull
          public static JetConfig loadXmlFromStream(@Nonnull
                                                             InputStream configStream)

      Loads JetConfig from the supplied input stream. Uses `System.getProperties()` to resolve the variables in the XML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
      Throws:
        `HazelcastException` - if the XML content is invalid

    - #### loadXmlFromStream

          @Nonnull
          public static JetConfig loadXmlFromStream(@Nonnull
                                                             InputStream configStream,
                                                             @Nonnull
                                                             Properties properties)

      Loads JetConfig from the supplied input stream. Uses the given `properties` to resolve the variables in the XML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
        `properties` - the properties to resolve variables in the XML
      Throws:
        `HazelcastException` - if the XML content is invalid

    - #### loadXmlFromString

          @Nonnull
          public static JetConfig loadXmlFromString(String xml)

      Creates a JetConfig from the provided XML string and uses the System.properties to resolve variables in the XML.
      Parameters:
        `xml` - the XML content as a Hazelcast Jet XML String
      Throws:
        `IllegalArgumentException` - if the XML is null or empty
        `InvalidConfigurationException` - if the XML content is invalid

    - #### loadXmlFromString

          @Nonnull
          public static JetConfig loadXmlFromString(String xml,
                                                             Properties properties)

      Creates a JetConfig from the provided XML string and properties to resolve the variables in the XML.
      Parameters:
        `xml` - the XML content as a Hazelcast Jet XML String
      Throws:
        `IllegalArgumentException` - if the XML is null or empty or if properties is null
        `InvalidConfigurationException` - if the XML content is invalid

    - #### loadYamlFromStream

          @Nonnull
          public static JetConfig loadYamlFromStream(@Nonnull
                                                              InputStream configStream)

      Loads JetConfig from the supplied input stream. Uses `System.getProperties()` to resolve the variables in the YAML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathYamlConfig` or `FileSystemYamlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
      Throws:
        `HazelcastException` - if the YAML content is invalid
      Since:
        3.1

    - #### loadYamlFromStream

          @Nonnull
          public static JetConfig loadYamlFromStream(@Nonnull
                                                              InputStream configStream,
                                                              @Nonnull
                                                              Properties properties)

      Loads JetConfig from the supplied input stream. Uses the given `properties` to resolve the variables in the YAML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathYamlConfig` or `FileSystemYamlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
      Throws:
        `HazelcastException` - if the YAML content is invalid
      Since:
        3.1

    - #### loadYamlFromString

          @Nonnull
          public static JetConfig loadYamlFromString(String yaml)

      Creates a JetConfig from the provided YAML string and uses the System.properties to resolve variables in the YAML.
      Parameters:
        `yaml` - the YAML content as a Hazelcast Jet YAML String
      Throws:
        `IllegalArgumentException` - if the YAML is null or empty
        `InvalidConfigurationException` - if the YAML content is invalid
      Since:
        3.1

    - #### loadYamlFromString

          @Nonnull
          public static JetConfig loadYamlFromString(String yaml,
                                                              Properties properties)

      Creates a JetConfig from the provided YAML string and properties to resolve the variables in the YAML.
      Parameters:
        `yaml` - the YAML content as a Hazelcast Jet YAML String
      Throws:
        `IllegalArgumentException` - if the YAML is null or empty or if properties is null
        `InvalidConfigurationException` - if the YAML content is invalid
      Since:
        3.1

    - #### loadFromClasspath

          @Nonnull
           @Deprecated
          public static JetConfig loadFromClasspath(@Nonnull
                                                                          String resource)

      Deprecated. see loadFromClasspath(ClassLoader,String)}
      Uses the thread's context class loader to load JetConfig from the classpath resource named by the argument. Uses `System.getProperties()` to resolve the variables in the XML or Yaml.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `resource` - names the classpath resource containing the XML or Yaml configuration file
      Throws:
        `HazelcastException` - if the XML or Yaml content is invalid
        `IllegalArgumentException` - if classpath resource is not found

    - #### loadFromClasspath

          @Nonnull
           @Deprecated
          public static JetConfig loadFromClasspath(@Nonnull
                                                                          String resource,
                                                                          @Nonnull
                                                                          Properties properties)

      Deprecated. see loadFromClasspath(ClassLoader, String, Properties)}
      Uses the thread's context class loader to load JetConfig from the classpath resource named by the argument. Uses the given `properties` to resolve the variables in the XML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `resource` - the classpath resource, an XML configuration file on the classpath
      Throws:
        `HazelcastException` - if the XML content is invalid
        `IllegalArgumentException` - if classpath resource is not found

    - #### loadFromStream

          @Nonnull
           @Deprecated
          public static JetConfig loadFromStream(@Nonnull
                                                                       InputStream configStream)

      Deprecated. see loadXmlFromStream(InputStream) and loadYamlFromStream(InputStream)
      Loads JetConfig from the supplied input stream. Uses `System.getProperties()` to resolve the variables in the XML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
      Throws:
        `HazelcastException` - if the XML content is invalid

    - #### loadFromStream

          @Nonnull
           @Deprecated
          public static JetConfig loadFromStream(@Nonnull
                                                                       InputStream configStream,
                                                                       @Nonnull
                                                                       Properties properties)

      Deprecated. see loadXmlFromStream(InputStream, Properties) and loadYamlFromStream(InputStream, Properties)
      Loads JetConfig from the supplied input stream. Uses the given `properties` to resolve the variables in the XML.

      This method loads the nested Hazelcast config using the built-in `lookup mechanism`, but you can replace it afterwards by calling `setHazelcastConfig()` with, for example, `ClasspathXmlConfig` or `FileSystemXmlConfig`.

      Parameters:
        `configStream` - the InputStream to load the config from
        `properties` - the properties to resolve variables in the XML
      Throws:
        `HazelcastException` - if the XML content is invalid

    - #### getHazelcastConfig

          @Nonnull
          public Config getHazelcastConfig()

      Returns the configuration object for the underlying Hazelcast IMDG instance.

    - #### setHazelcastConfig

          @Nonnull
          public JetConfig setHazelcastConfig(@Nonnull
                                                       Config config)

      Sets the underlying Hazelcast IMDG instance's configuration object.

    - #### getInstanceConfig

          @Nonnull
          public InstanceConfig getInstanceConfig()

      Returns the Jet instance config.

    - #### setInstanceConfig

          @Nonnull
          public JetConfig setInstanceConfig(@Nonnull
                                                      InstanceConfig instanceConfig)

      Sets the Jet instance config.

    - #### getMetricsConfig

          @Nonnull
          public MetricsConfig getMetricsConfig()

      Returns the metrics collection config.

    - #### setMetricsConfig

          @Nonnull
          public JetConfig setMetricsConfig(@Nonnull
                                                     MetricsConfig metricsConfig)

      Sets the metrics collection config.

    - #### getProperties

          @Nonnull
          public Properties getProperties()

      Returns the Jet-specific configuration properties.

    - #### setProperties

          @Nonnull
          public JetConfig setProperties(@Nonnull
                                                  Properties properties)

      Sets the Jet-specific configuration properties.

    - #### setProperty

          @Nonnull
          public JetConfig setProperty(@Nonnull
                                                String name,
                                                @Nonnull
                                                String value)

      Sets the value of the specified property.

    - #### getDefaultEdgeConfig

          @Nonnull
          public EdgeConfig getDefaultEdgeConfig()

      Returns the default DAG edge configuration.

    - #### setDefaultEdgeConfig

          @Nonnull
          public JetConfig setDefaultEdgeConfig(@Nonnull
                                                         EdgeConfig defaultEdgeConfig)

      Sets the configuration object that specifies the defaults to use for a DAG edge configuration.

Copyright © 2019. All rights reserved.