Package org.jbpm.runtime.manager.impl

## Class RuntimeEnvironmentBuilder

- java.lang.Object
- - org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder

- All Implemented Interfaces:
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`, `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

      public class RuntimeEnvironmentBuilder
      extends Object
      implements org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory, org.kie.api.runtime.manager.RuntimeEnvironmentBuilder

  A builder implementation that follows the fluent approach to build `RuntimeEnvironments`. Comes with short cut methods to get predefined configurations of the `RuntimeEnvironment`:
  - getDefault() - returns preconfigured environment with enabled persistence
  - getDefaultInMemory() - returns preconfigured environment with disabled persistence for runtime engine
  - getDefault(ReleaseId) - returns preconfigured environment with enabled persistence that is tailored for kjar
  - getDefault(ReleaseId, String, String) - returns preconfigured environment with enabled persistence that is tailored for kjar and allows to specify kbase and ksession name
  - getDefault(String, String, String) - returns preconfigured environment with enabled persistence that is tailored for kjar
  - getDefault(String, String, String, String, String) - returns preconfigured environment with enabled persistence that is tailored for kjar and allows to specify kbase and ksession name
  - getEmpty() - completely empty environment for self configuration
  - getClasspathKModuleDefault() - returns preconfigured environment with enabled persistence based on classpath kiecontainer
  - getClasspathKModuleDefault(String, String) - returns preconfigured environment with enabled persistence based on classpath kiecontainer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.kie.api.runtime.manager.RuntimeEnvironmentBuilder

      `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder.Factory`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RuntimeEnvironmentBuilder()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `RuntimeEnvironmentBuilder` | `addAsset​(org.kie.api.io.Resource asset, org.kie.api.io.ResourceType type)` |
    `RuntimeEnvironmentBuilder` | `addConfiguration​(String name, String value)` |
    `RuntimeEnvironmentBuilder` | `addEnvironmentEntry​(String name, Object value)` |
    `RuntimeEnvironmentBuilder` | `classLoader​(ClassLoader cl)` |
    `RuntimeEnvironmentBuilder` | `entityManagerFactory​(Object emf)` |
    `org.kie.internal.runtime.manager.RuntimeEnvironment` | `get()` |
    `static RuntimeEnvironmentBuilder` | `getClasspathKmoduleDefault()` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which defines the kjar itself.
    `static RuntimeEnvironmentBuilder` | `getClasspathKmoduleDefault​(String kbaseName, String ksessionName)` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which defines the kjar itself.
    `static RuntimeEnvironmentBuilder` | `getDefault()` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment
    `static RuntimeEnvironmentBuilder` | `getDefault​(String groupId, String artifactId, String version)` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
    `static RuntimeEnvironmentBuilder` | `getDefault​(String groupId, String artifactId, String version, String kbaseName, String ksessionName)` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
    `static RuntimeEnvironmentBuilder` | `getDefault​(org.kie.api.builder.ReleaseId releaseId)` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
    `static RuntimeEnvironmentBuilder` | `getDefault​(org.kie.api.builder.ReleaseId releaseId, String kbaseName, String ksessionName)` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
    `static RuntimeEnvironmentBuilder` | `getDefaultInMemory()` | Provides default configuration of `RuntimeEnvironmentBuilder` that is based on: DefaultRuntimeEnvironment but it does not have persistence for process engine configured so it will only store process instances in memory
    `static RuntimeEnvironmentBuilder` | `getEmpty()` | Provides completely empty `RuntimeEnvironmentBuilder` instance that allows to manually set all required components instead of relying on any defaults.
    `protected static Object` | `getInstanceFromModel​(org.kie.internal.runtime.conf.ObjectModel model, org.kie.api.runtime.KieContainer kieContainer, Map<String,​Object> contaxtParams)` |
    `RuntimeEnvironmentBuilder` | `knowledgeBase​(org.kie.api.KieBase kbase)` |
    `RuntimeEnvironmentBuilder` | `mapper​(org.kie.internal.runtime.manager.Mapper mapper)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newClasspathKmoduleDefaultBuilder()` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newClasspathKmoduleDefaultBuilder​(String kbaseName, String ksessionName)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultBuilder()` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultBuilder​(String groupId, String artifactId, String version)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultBuilder​(String groupId, String artifactId, String version, String kbaseName, String ksessionName)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultBuilder​(org.kie.api.builder.ReleaseId releaseId)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultBuilder​(org.kie.api.builder.ReleaseId releaseId, String kbaseName, String ksessionName)` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newDefaultInMemoryBuilder()` |
    `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `newEmptyBuilder()` |
    `RuntimeEnvironmentBuilder` | `persistence​(boolean persistenceEnabled)` |
    `RuntimeEnvironmentBuilder` | `registerableItemsFactory​(org.kie.api.runtime.manager.RegisterableItemsFactory factory)` |
    `RuntimeEnvironmentBuilder` | `schedulerService​(Object globalScheduler)` |
    `RuntimeEnvironmentBuilder` | `userGroupCallback​(org.kie.api.task.UserGroupCallback callback)` |
    `RuntimeEnvironmentBuilder` | `userInfo​(org.kie.api.task.UserInfo userInfo)` |

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

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

- - ### Constructor Detail

    - #### RuntimeEnvironmentBuilder

          public RuntimeEnvironmentBuilder()

  - ### Method Detail

    - #### getEmpty

          public static RuntimeEnvironmentBuilder getEmpty()

      Provides completely empty `RuntimeEnvironmentBuilder` instance that allows to manually set all required components instead of relying on any defaults.
      Returns:
        new instance of `RuntimeEnvironmentBuilder`

    - #### getDefault

          public static RuntimeEnvironmentBuilder getDefault()

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getDefaultInMemory

          public static RuntimeEnvironmentBuilder getDefaultInMemory()

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      but it does not have persistence for process engine configured so it will only store process instances in memory
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getDefault

          public static RuntimeEnvironmentBuilder getDefault​(String groupId,
                                                             String artifactId,
                                                             String version)

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
      Parameters:
        `groupId` - group id of kjar
        `artifactId` - artifact id of kjar
        `version` - version number of kjar
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getDefault

          public static RuntimeEnvironmentBuilder getDefault​(String groupId,
                                                             String artifactId,
                                                             String version,
                                                             String kbaseName,
                                                             String ksessionName)

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
      Parameters:
        `groupId` - group id of kjar
        `artifactId` - artifact id of kjar
        `version` - version number of kjar
        `kbaseName` - name of the kbase defined in kmodule.xml stored in kjar
        `ksessionName` - name of the ksession define in kmodule.xml stored in kjar
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getDefault

          public static RuntimeEnvironmentBuilder getDefault​(org.kie.api.builder.ReleaseId releaseId)

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
      Parameters:
        `releaseId` - `ReleaseId` that described the kjar
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getDefault

          public static RuntimeEnvironmentBuilder getDefault​(org.kie.api.builder.ReleaseId releaseId,
                                                             String kbaseName,
                                                             String ksessionName)

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      This one is tailored to works smoothly with kjars as the notion of kbase and ksessions
      Parameters:
        `releaseId` - `ReleaseId` that described the kjar
        `kbaseName` - name of the kbase defined in kmodule.xml stored in kjar
        `ksessionName` - name of the ksession define in kmodule.xml stored in kjar
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getClasspathKmoduleDefault

          public static RuntimeEnvironmentBuilder getClasspathKmoduleDefault()

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which defines the kjar itself. Expects to use default kbase and ksession from kmodule.
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### getClasspathKmoduleDefault

          public static RuntimeEnvironmentBuilder getClasspathKmoduleDefault​(String kbaseName,
                                                                             String ksessionName)

      Provides default configuration of `RuntimeEnvironmentBuilder` that is based on:
      - DefaultRuntimeEnvironment
      It relies on KieClasspathContainer that requires to have kmodule.xml present in META-INF folder which defines the kjar itself.
      Parameters:
        `kbaseName` - name of the kbase defined in kmodule.xml
        `ksessionName` - name of the ksession define in kmodule.xml
      Returns:
        new instance of `RuntimeEnvironmentBuilder` that is already preconfigured with defaults
      See Also:
        `DefaultRuntimeEnvironment`

    - #### persistence

          public RuntimeEnvironmentBuilder persistence​(boolean persistenceEnabled)

      Specified by:
        `persistence` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### entityManagerFactory

          public RuntimeEnvironmentBuilder entityManagerFactory​(Object emf)

      Specified by:
        `entityManagerFactory` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### addAsset

          public RuntimeEnvironmentBuilder addAsset​(org.kie.api.io.Resource asset,
                                                    org.kie.api.io.ResourceType type)

      Specified by:
        `addAsset` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### addEnvironmentEntry

          public RuntimeEnvironmentBuilder addEnvironmentEntry​(String name,
                                                               Object value)

      Specified by:
        `addEnvironmentEntry` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### addConfiguration

          public RuntimeEnvironmentBuilder addConfiguration​(String name,
                                                            String value)

      Specified by:
        `addConfiguration` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### knowledgeBase

          public RuntimeEnvironmentBuilder knowledgeBase​(org.kie.api.KieBase kbase)

      Specified by:
        `knowledgeBase` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### userGroupCallback

          public RuntimeEnvironmentBuilder userGroupCallback​(org.kie.api.task.UserGroupCallback callback)

      Specified by:
        `userGroupCallback` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### userInfo

          public RuntimeEnvironmentBuilder userInfo​(org.kie.api.task.UserInfo userInfo)

      Specified by:
        `userInfo` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### mapper

          public RuntimeEnvironmentBuilder mapper​(org.kie.internal.runtime.manager.Mapper mapper)

    - #### registerableItemsFactory

          public RuntimeEnvironmentBuilder registerableItemsFactory​(org.kie.api.runtime.manager.RegisterableItemsFactory factory)

      Specified by:
        `registerableItemsFactory` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### get

          public org.kie.internal.runtime.manager.RuntimeEnvironment get()

      Specified by:
        `get` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### schedulerService

          public RuntimeEnvironmentBuilder schedulerService​(Object globalScheduler)

      Specified by:
        `schedulerService` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### classLoader

          public RuntimeEnvironmentBuilder classLoader​(ClassLoader cl)

      Specified by:
        `classLoader` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilder`

    - #### newEmptyBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newEmptyBuilder()

      Specified by:
        `newEmptyBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultBuilder()

      Specified by:
        `newDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultInMemoryBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultInMemoryBuilder()

      Specified by:
        `newDefaultInMemoryBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultBuilder​(String groupId,
                                                                                         String artifactId,
                                                                                         String version)

      Specified by:
        `newDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultBuilder​(String groupId,
                                                                                         String artifactId,
                                                                                         String version,
                                                                                         String kbaseName,
                                                                                         String ksessionName)

      Specified by:
        `newDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultBuilder​(org.kie.api.builder.ReleaseId releaseId)

      Specified by:
        `newDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newDefaultBuilder​(org.kie.api.builder.ReleaseId releaseId,
                                                                                         String kbaseName,
                                                                                         String ksessionName)

      Specified by:
        `newDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newClasspathKmoduleDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder()

      Specified by:
        `newClasspathKmoduleDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### newClasspathKmoduleDefaultBuilder

          public org.kie.api.runtime.manager.RuntimeEnvironmentBuilder newClasspathKmoduleDefaultBuilder​(String kbaseName,
                                                                                                         String ksessionName)

      Specified by:
        `newClasspathKmoduleDefaultBuilder` in interface `org.kie.api.runtime.manager.RuntimeEnvironmentBuilderFactory`

    - #### getInstanceFromModel

          protected static Object getInstanceFromModel​(org.kie.internal.runtime.conf.ObjectModel model,
                                                       org.kie.api.runtime.KieContainer kieContainer,
                                                       Map<String,​Object> contaxtParams)