org.jbpm.services.cdi.impl.manager

## Class InjectableRegisterableItemsFactory

- java.lang.Object
- - org.jbpm.runtime.manager.impl.SimpleRegisterableItemsFactory
  - - org.jbpm.runtime.manager.impl.DefaultRegisterableItemsFactory
    - - org.jbpm.services.cdi.impl.manager.InjectableRegisterableItemsFactory

- All Implemented Interfaces:
    org.kie.api.runtime.manager.RegisterableItemsFactory, org.kie.internal.runtime.manager.InternalRegisterableItemsFactory

      public class InjectableRegisterableItemsFactory
      extends DefaultRegisterableItemsFactory

  Implementation of `RegisterableItemsFactory` dedicated to CDI environments that allows us to get injections of following components:
  - `ExternalTaskEventListener` - required bean
  - `WorkItemHandlerProducer` - optional bean (0 or more)
  - `EventListenerProducer>` - optional bean (0 or more)
  - `EventListenerProducer>` - optional bean (0 or more)
  - `EventListenerProducer>` - optional bean (0 or more)
  - `RuntimeFinder` - optional required only when single CDI bean is going to manage many `RuntimeManager` instances
  In addition to that, `AbstractAuditLogger` can be set after the bean has been injected if the default is not sufficient. Although this factory extends `DefaultRegisterableItemsFactory`, it will not use any of the listeners and handlers that come from the super class. It relies mainly on CDI injections where the only exception from this rule is `AbstractAuditLogger`
  Even though this is a fully qualified bean for injection, it provides helper methods to build its instances using `BeanManager` in case more independent instances are required.
  - getFactory(BeanManager, AbstractAuditLogger)
  - getFactory(BeanManager, AbstractAuditLogger, KieContainer, String)

- - ### Field Summary

    - ### Fields inherited from class org.jbpm.runtime.manager.impl.SimpleRegisterableItemsFactory

      `runtimeManager`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InjectableRegisterableItemsFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<org.kie.api.event.rule.AgendaEventListener>` | `getAgendaEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `AbstractAuditLogger` | `getAuditlogger()`
    `protected AbstractAuditLogger` | `getAuditLoggerInstance(org.kie.api.runtime.manager.RuntimeEngine engine)` Provides AuditLogger implementation, JPA or JMS.
    `static org.kie.api.runtime.manager.RegisterableItemsFactory` | `getFactory(javax.enterprise.inject.spi.BeanManager beanManager, AbstractAuditLogger auditlogger)` Allows us to create an instance of this class dynamically via `BeanManager`.
    `static org.kie.api.runtime.manager.RegisterableItemsFactory` | `getFactory(javax.enterprise.inject.spi.BeanManager beanManager, AbstractAuditLogger auditlogger, org.kie.api.runtime.KieContainer kieContainer, String ksessionName)` Allows us to create instance of this class dynamically via `BeanManager`.
    `static org.kie.api.runtime.manager.RegisterableItemsFactory` | `getFactory(javax.enterprise.inject.spi.BeanManager beanManager, AuditEventBuilder eventBuilder)` Allows to create instance of this class dynamically via `BeanManager`.
    `static org.kie.api.runtime.manager.RegisterableItemsFactory` | `getFactory(javax.enterprise.inject.spi.BeanManager beanManager, AuditEventBuilder eventBuilder, org.kie.api.runtime.KieContainer kieContainer, String ksessionName)` Allows to create instance of this class dynamically via `BeanManager`.
    `Map<String,Object>` | `getGlobals(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `protected static <T> T` | `getInstanceByType(javax.enterprise.inject.spi.BeanManager manager, Class<T> type, Annotation... bindings)`
    `org.kie.api.runtime.KieContainer` | `getKieContainer()`
    `String` | `getKsessionName()`
    `List<org.kie.api.event.process.ProcessEventListener>` | `getProcessEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `List<org.kie.api.event.rule.RuleRuntimeEventListener>` | `getRuleRuntimeEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `List<org.kie.api.task.TaskLifeCycleEventListener>` | `getTaskListeners()`
    `Map<String,org.kie.api.runtime.process.WorkItemHandler>` | `getWorkItemHandlers(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `void` | `setAuditlogger(AbstractAuditLogger auditlogger)`
    `void` | `setKieContainer(org.kie.api.runtime.KieContainer kieContainer)`
    `void` | `setKsessionName(String ksessionName)`

    - ### Methods inherited from class org.jbpm.runtime.manager.impl.DefaultRegisterableItemsFactory

      `getAuditBuilder, getAuditBuilder, getEventListenerFromDescriptor, getGlobalsFromDescriptor, getHTWorkItemHandler, getInstanceFromModel, getParametersMap, getTaskListenersFromDescriptor, getWorkItemHandlersFromDescriptor, loadJMSProperties, setAuditBuilder`

    - ### Methods inherited from class org.jbpm.runtime.manager.impl.SimpleRegisterableItemsFactory

      `addAgendaListener, addGlobal, addProcessListener, addTaskListener, addWorkingMemoryListener, addWorkItemHandler, createInstance, getRuntimeManager, setRuntimeManager`

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

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

- - ### Constructor Detail

    - #### InjectableRegisterableItemsFactory

          public InjectableRegisterableItemsFactory()

  - ### Method Detail

    - #### getWorkItemHandlers

          public Map<String,org.kie.api.runtime.process.WorkItemHandler> getWorkItemHandlers(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Specified by:
        `getWorkItemHandlers` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getWorkItemHandlers` in class `DefaultRegisterableItemsFactory`

    - #### getProcessEventListeners

          public List<org.kie.api.event.process.ProcessEventListener> getProcessEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Specified by:
        `getProcessEventListeners` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getProcessEventListeners` in class `DefaultRegisterableItemsFactory`

    - #### getRuleRuntimeEventListeners

          public List<org.kie.api.event.rule.RuleRuntimeEventListener> getRuleRuntimeEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Specified by:
        `getRuleRuntimeEventListeners` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getRuleRuntimeEventListeners` in class `DefaultRegisterableItemsFactory`

    - #### getAgendaEventListeners

          public List<org.kie.api.event.rule.AgendaEventListener> getAgendaEventListeners(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Specified by:
        `getAgendaEventListeners` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getAgendaEventListeners` in class `DefaultRegisterableItemsFactory`

    - #### getTaskListeners

          public List<org.kie.api.task.TaskLifeCycleEventListener> getTaskListeners()

      Specified by:
        `getTaskListeners` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getTaskListeners` in class `DefaultRegisterableItemsFactory`

    - #### getGlobals

          public Map<String,Object> getGlobals(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Specified by:
        `getGlobals` in interface `org.kie.api.runtime.manager.RegisterableItemsFactory`
      Overrides:
        `getGlobals` in class `DefaultRegisterableItemsFactory`

    - #### getFactory

          public static org.kie.api.runtime.manager.RegisterableItemsFactory getFactory(javax.enterprise.inject.spi.BeanManager beanManager,
                                                                                        AbstractAuditLogger auditlogger)

      Allows us to create an instance of this class dynamically via `BeanManager`. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices.
      Parameters:
        `beanManager` - - bean manager instance of the container
        `auditlogger` - - `AbstractAuditLogger` logger instance to be used, might be null
      Returns:
        new instance of the factory

    - #### getFactory

          public static org.kie.api.runtime.manager.RegisterableItemsFactory getFactory(javax.enterprise.inject.spi.BeanManager beanManager,
                                                                                        AbstractAuditLogger auditlogger,
                                                                                        org.kie.api.runtime.KieContainer kieContainer,
                                                                                        String ksessionName)

      Allows us to create instance of this class dynamically via `BeanManager`. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices.
      Parameters:
        `beanManager` - - bean manager instance of the container
        `auditlogger` - - `AbstractAuditLogger` logger instance to be used, might be null
        `kieContainer` - - `KieContainer` that the factory is built for
        `ksessionName` - - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used.
      Returns:

    - #### getFactory

          public static org.kie.api.runtime.manager.RegisterableItemsFactory getFactory(javax.enterprise.inject.spi.BeanManager beanManager,
                                                                                        AuditEventBuilder eventBuilder)

      Allows to create instance of this class dynamically via `BeanManager`. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices.
      Parameters:
        `beanManager` - - bean manager instance of the container
        `eventBuilder` - - `AuditEventBuilder` logger builder instance to be used, might be null
      Returns:
        new instance of the factory

    - #### getFactory

          public static org.kie.api.runtime.manager.RegisterableItemsFactory getFactory(javax.enterprise.inject.spi.BeanManager beanManager,
                                                                                        AuditEventBuilder eventBuilder,
                                                                                        org.kie.api.runtime.KieContainer kieContainer,
                                                                                        String ksessionName)

      Allows to create instance of this class dynamically via `BeanManager`. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices.
      Parameters:
        `beanManager` - - bean manager instance of the container
        `eventBuilder` - - `AbstractAuditLogger` logger builder instance to be used, might be null
        `kieContainer` - - `KieContainer` that the factory is built for
        `ksessionName` - - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used.
      Returns:

    - #### getInstanceByType

          protected static <T> T getInstanceByType(javax.enterprise.inject.spi.BeanManager manager,
                                                   Class<T> type,
                                                   Annotation... bindings)

    - #### getAuditlogger

          public AbstractAuditLogger getAuditlogger()

    - #### setAuditlogger

          public void setAuditlogger(AbstractAuditLogger auditlogger)

    - #### getKieContainer

          public org.kie.api.runtime.KieContainer getKieContainer()

    - #### setKieContainer

          public void setKieContainer(org.kie.api.runtime.KieContainer kieContainer)

    - #### getKsessionName

          public String getKsessionName()

    - #### setKsessionName

          public void setKsessionName(String ksessionName)

    - #### getAuditLoggerInstance

          protected AbstractAuditLogger getAuditLoggerInstance(org.kie.api.runtime.manager.RuntimeEngine engine)

      Provides AuditLogger implementation, JPA or JMS. JPA is the default one and JMS requires to have configuration file (.properties) to be available on classpath under 'jbpm.audit.jms.properties' name. This file must have following properties defined:
      - jbpm.audit.jms.connection.factory.jndi - JNDI name of the connection factory to look up - type String
      - jbpm.audit.jms.queue.jndi - JNDI name of the queue to look up - type String
      Returns:
        instance of the audit logger

Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.