Package org.kie.api

Interface KieServices

  • All Superinterfaces:
    java.lang.Comparable<KieService>, KieService

    public interface KieServices
    extends KieService

    The KieServices is a thread-safe singleton acting as a hub giving access to the other Services provided by Kie. As general rule a getX() method just returns a reference to another singleton while a newX() one creates a new instance.

    It is possible to obtain a KieServices reference via its Factory as it follows

     KieServices kieServices = KieServices.Factory.get();
     
    • Method Detail

      • getResources

        KieResources getResources()
        Returns the KieResources, a factory that provides Resource implementations for the desired IO resource
        Returns:
        resources
      • getRepository

        KieRepository getRepository()
        Returns the KieRepository, a singleton acting as a repository for all the available KieModules
        Returns:
        repository
      • getCommands

        KieCommands getCommands()
        Returns the KieCommands, a factory for Commands
        Returns:
        commands
      • getMarshallers

        KieMarshallers getMarshallers()
        Returns the KieMarshallers service
        Returns:
        marshallers
      • getLoggers

        KieLoggers getLoggers()
        Returns KieLoggers, a factory for KieRuntimeLogger
        Returns:
        loggers
      • getStoreServices

        KieStoreServices getStoreServices()
        Returns KieStoreServices
        Returns:
        store services
      • getKieClasspathContainer

        KieContainer getKieClasspathContainer()
        Returns KieContainer for the classpath, this a global singleton.
        Returns:
        kie classpath container
      • getKieClasspathContainer

        KieContainer getKieClasspathContainer​(java.lang.ClassLoader classLoader)
        Returns KieContainer for the classpath using the given classLoader, this a global singleton.
        Parameters:
        classLoader - classLoader
        Returns:
        kie classpath container
        Throws:
        java.lang.IllegalStateException - if this method get called twice with 2 different ClassLoaders
      • getKieClasspathContainer

        KieContainer getKieClasspathContainer​(java.lang.String containerId)
        Returns KieContainer for the classpath enforcing the given containerId, this a global singleton.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        If you do not want to enforce a specific containerId, use the getKieClasspathContainer() method instead.

        Parameters:
        containerId - the containerId to enforce (non-null).
        Returns:
        kie classpath container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container and therefore cannot be enforced.
      • getKieClasspathContainer

        KieContainer getKieClasspathContainer​(java.lang.String containerId,
                                              java.lang.ClassLoader classLoader)
        Returns KieContainer for the classpath enforcing the given containerId and using the given classLoader, this a global singleton.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        Parameters:
        containerId - the containerId to enforce (non-null).
        classLoader - classLoader
        Returns:
        kie classpath container
        Throws:
        java.lang.IllegalStateException - if this method get called twice with 2 different ClassLoaders, or if the containerId is already existing for another container and therefore cannot be enforced.
      • newKieClasspathContainer

        KieContainer newKieClasspathContainer()
        Creates a new KieContainer for the classpath, regardless if there's already an existing one
        Returns:
        new kie classpath container
      • newKieClasspathContainer

        KieContainer newKieClasspathContainer​(java.lang.ClassLoader classLoader)
        Creates a new KieContainer for the classpath using the given classLoader, regardless if there's already an existing one
        Parameters:
        classLoader - classLoader
        Returns:
        new kie classpath container
      • newKieClasspathContainer

        KieContainer newKieClasspathContainer​(java.lang.String containerId)
        Creates a new KieContainer for the classpath, regardless if there's already an existing one, enforcing the given containerId.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        If you do not want to enforce a specific containerId, use the newKieClasspathContainer() method instead.

        Parameters:
        containerId - a unique containerId (non-null).
        Returns:
        new kie classpath container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container, and therefore cannot be enforced.
      • newKieClasspathContainer

        KieContainer newKieClasspathContainer​(java.lang.String containerId,
                                              java.lang.ClassLoader classLoader)
        Creates a new KieContainer for the classpath using the given classLoader, regardless if there's already an existing one, enforcing the given containerId.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        Parameters:
        containerId - a unique containerId (non-null).
        classLoader - classLoader
        Returns:
        new kie classpath container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container, and therefore cannot be enforced.
      • newKieClasspathContainer

        default KieContainer newKieClasspathContainer​(java.lang.String containerId,
                                                      java.lang.ClassLoader classLoaderContainer,
                                                      ReleaseId releaseId)
        Creates a new KieContainer for the classpath using the given classLoader, regardless if there's already an existing one, enforcing the given containerId.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        Parameters:
        containerId - a unique containerId (non-null).
        classLoaderContainer - classLoader
        releaseId - release id of this container
        Returns:
        new kie classpath container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container, and therefore cannot be enforced.
        java.lang.UnsupportedOperationException - if the operation is not supported by the kie services
      • newKieContainer

        KieContainer newKieContainer​(ReleaseId releaseId)
        Creates a new KieContainer wrapping the KieModule with the given ReleaseId
        Parameters:
        releaseId - releaseId
        Returns:
        new kie container
      • newKieContainer

        KieContainer newKieContainer​(java.lang.String containerId,
                                     ReleaseId releaseId)
        Creates a new KieContainer wrapping the KieModule with the given ReleaseId and enforcing the given containerId.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        If you do not want to enforce a specific containerId, use the newKieContainer(ReleaseId) method instead.

        Parameters:
        containerId - a unique containerId (non-null).
        releaseId - releaseId
        Returns:
        new kie container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container, and therefore cannot be enforced.
      • newKieContainer

        KieContainer newKieContainer​(ReleaseId releaseId,
                                     java.lang.ClassLoader classLoader)
        Creates a new KieContainer wrapping the KieModule with the given ReleaseId and using the given class loader
        Parameters:
        releaseId - releaseId
        classLoader - classLoader
        Returns:
        new kie container
      • newKieContainer

        KieContainer newKieContainer​(java.lang.String containerId,
                                     ReleaseId releaseId,
                                     java.lang.ClassLoader classLoader)
        Creates a new KieContainer wrapping the KieModule with the given ReleaseId, using the given class loader and enforcing the given containerId.

        If enforcing the containerId is successful, the KieContainer and its containerId are registered within the KieServices. Deregistration can be performed by calling KieContainer.dispose() on the resulting KieContainer.

        Parameters:
        containerId - a unique containerId (non-null).
        releaseId - releaseId
        classLoader - classLoader
        Returns:
        new kie container
        Throws:
        java.lang.IllegalStateException - if the containerId is already existing for another container, and therefore cannot be enforced.
      • newKieScanner

        KieScanner newKieScanner​(KieContainer kieContainer)
        Creates a maven based KieScanner to automatically discover if there are new releases of the KieModule (and its dependencies) wrapped by the given KieContainer
        Parameters:
        kieContainer - kieContainer
        Returns:
        new kie scanner
      • newKieScanner

        KieScanner newKieScanner​(KieContainer kieContainer,
                                 java.lang.String repositoryFolder)
        Creates a file system based KieScanner to automatically discover if there are new releases of the KieModule (and its dependencies) wrapped by the given KieContainer
        Parameters:
        kieContainer - kieContainer
        repositoryFolder - The folder where the new releases will be dropped
        Returns:
        new kie scanner
      • newKieBuilder

        KieBuilder newKieBuilder​(java.io.File rootFolder)
        Creates a new KieBuilder to build the KieModule contained in the given folder
        Parameters:
        rootFolder - rootFolder
        Returns:
        new kie builder
      • newKieBuilder

        KieBuilder newKieBuilder​(KieFileSystem kieFileSystem)
        Creates a new KieBuilder to build the KieModule contained in the given KieFileSystem
        Returns:
        new kie builder
      • newKieBuilder

        KieBuilder newKieBuilder​(KieFileSystem kieFileSystem,
                                 java.lang.ClassLoader classLoader)
        Creates a new KieBuilder to build the KieModule contained in the given KieFileSystem and using the given class loader
        Returns:
        new kie builder
      • newReleaseId

        ReleaseId newReleaseId​(java.lang.String groupId,
                               java.lang.String artifactId,
                               java.lang.String version)
        Creates a new ReleaseId with the given groupId, artifactId and version
        Parameters:
        groupId - groupId
        artifactId - artifactId
        version - version
        Returns:
        new release id
      • newKieFileSystem

        KieFileSystem newKieFileSystem()
        Creates a new KieFileSystem used to programmatically define the resources composing a KieModule
        Returns:
        new kie file system
      • newKieModuleModel

        KieModuleModel newKieModuleModel()
        Creates a new KieModuleModel to programmatically define a KieModule
        Returns:
        new kie module model
      • newKieBaseConfiguration

        KieBaseConfiguration newKieBaseConfiguration()
        Create a KieBaseConfiguration on which properties can be set.
        Returns:
        new kiebase configuration
      • newKieBaseConfiguration

        KieBaseConfiguration newKieBaseConfiguration​(java.util.Properties properties)
        Create a KieBaseConfiguration on which properties can be set. Use the given properties file.
        Parameters:
        properties - properties
        Returns:
        new kiebase configuration
      • newKieBaseConfiguration

        KieBaseConfiguration newKieBaseConfiguration​(java.util.Properties properties,
                                                     java.lang.ClassLoader classLoader)
        Deprecated.
        The classLoader has to be defined when creating the KieContainer, so the one passed here will be just ignored
        Create a KieBaseConfiguration on which properties can be set. Use the given properties file and ClassLoader - either of which can be null.
        Parameters:
        properties - properties
        classLoader - classLoader
        Returns:
        new kiebase configuration
      • newKieSessionConfiguration

        KieSessionConfiguration newKieSessionConfiguration()
        Create a KieSessionConfiguration on which properties can be set.
        Returns:
        new kiesession configuration
      • newKieSessionConfiguration

        KieSessionConfiguration newKieSessionConfiguration​(java.util.Properties properties)
        Create a KieSessionConfiguration on which properties can be set.
        Parameters:
        properties - properties
        Returns:
        new kiesession configuration
      • newKieSessionConfiguration

        KieSessionConfiguration newKieSessionConfiguration​(java.util.Properties properties,
                                                           java.lang.ClassLoader classLoader)
        Create a KieSessionConfiguration on which properties can be set. Use the given properties file and ClassLoader - either of which can be null.
        Parameters:
        properties - properties
        classLoader - classLoader
        Returns:
        new kiesession configuration
      • newEnvironment

        Environment newEnvironment()
        Instantiate and return an Environment
        Returns:
        The Environment
      • get

        static KieServices get()
        Returns a reference to the KieServices singleton