Class 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
    • 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
      • 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
      • 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)