Package org.jbpm.kie.services.impl

## Class KModuleDeploymentService

- java.lang.Object
- - org.jbpm.kie.services.impl.AbstractDeploymentService
  - - org.jbpm.kie.services.impl.KModuleDeploymentService

- All Implemented Interfaces:
    `DeploymentService`, `ListenerSupport`
  Direct Known Subclasses:
    `DeploymentServiceCDIImpl`, `DeploymentServiceEJBImpl`

      public class KModuleDeploymentService
      extends AbstractDeploymentService

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected DefinitionService` | `bpmn2Service` |
    `protected XPathExpression` | `caseIdXPathExpression` |
    `protected org.kie.api.executor.ExecutorService` | `executorService` |
    `protected FormManagerService` | `formManagerService` |
    `protected static org.slf4j.Logger` | `logger` |
    `protected DeploymentDescriptorMerger` | `merger` |
    `protected XPathExpression` | `processIdXPathExpression` |

    - ### Fields inherited from class org.jbpm.kie.services.impl.AbstractDeploymentService

      `deploymentsMap, emf, identityProvider, listeners, managerFactory, runtimeDataService`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `activate​(String deploymentId)` | Activates given deployment by making sure it will be available for execution.
    `protected void` | `addClassToDeployedUnit​(Class deploymentClass, DeployedUnitImpl deployedUnit)` |
    `protected org.kie.api.runtime.manager.RuntimeEnvironmentBuilder` | `boostrapRuntimeEnvironmentBuilder​(KModuleDeploymentUnit deploymentUnit, DeployedUnit deployedUnit, org.kie.api.runtime.KieContainer kieContainer, org.kie.internal.runtime.conf.MergeMode mode)` | This creates and fills a `RuntimeEnvironmentBuilder` instance, which is later used when creating services.
    `protected Map<String,​Object>` | `buildContextParameters​(org.kie.api.runtime.KieContainer kieContainer)` |
    `void` | `deactivate​(String deploymentId)` | Deactivates given deployment by making it only available for already running instances.
    `void` | `deploy​(DeploymentUnit unit)` | Performs deployment operation of given `unit`.
    `protected String` | `getCaseId​(String processSource)` |
    `protected Object` | `getInstanceFromModel​(org.kie.internal.runtime.conf.ObjectModel model, org.kie.api.runtime.KieContainer kieContainer, Map<String,​Object> contaxtParams)` |
    `protected String` | `getProcessId​(String processSource)` |
    `protected org.kie.api.runtime.manager.RegisterableItemsFactory` | `getRegisterableItemsFactory​(AuditEventBuilder auditLoggerBuilder, org.kie.api.runtime.KieContainer kieContainer, KModuleDeploymentUnit unit)` |
    `void` | `onInit()` |
    `protected void` | `processClassloader​(org.kie.api.runtime.KieContainer kieContainer, DeployedUnitImpl deployedUnit)` | This processes the deployment dependencies, which are made available by the `KieContainer` `ClassLoader`.
    `protected void` | `processResources​(org.drools.compiler.kie.builder.impl.InternalKieModule module, Collection<String> files, org.kie.api.runtime.KieContainer kieContainer, DeploymentUnit unit, DeployedUnitImpl deployedUnit, org.kie.api.builder.ReleaseId releaseId, Map<String,​ProcessDescriptor> processes)` | Goes through all files in a deployment, and processes them so that they are then ready for use after deployment.
    `void` | `setBpmn2Service​(DefinitionService bpmn2Service)` |
    `void` | `setExecutorService​(org.kie.api.executor.ExecutorService executorService)` |
    `void` | `setFormManagerService​(FormManagerService formManagerService)` |
    `void` | `setMerger​(DeploymentDescriptorMerger merger)` |
    `void` | `undeploy​(DeploymentUnit unit, Function<DeploymentUnit,​Boolean> beforeUndeploy)` | Performs undeployment operation of given `unit` aborting existing process instances if needed.

    - ### Methods inherited from class org.jbpm.kie.services.impl.AbstractDeploymentService

      `addListener, commonDeploy, getDeployedUnit, getDeployedUnits, getDeploymentsMap, getEmf, getListeners, getManagerFactory, getRuntimeDataService, getRuntimeManager, isDeployed, notifyOnActivate, notifyOnDeactivate, notifyOnDeploy, notifyOnUnDeploy, removeListener, setEmf, setIdentityProvider, setManagerFactory, setRuntimeDataService, setupAuditLogger, shutdown, undeploy`

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

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

- - ### Field Detail

    - #### logger

          protected static org.slf4j.Logger logger

    - #### bpmn2Service

          protected DefinitionService bpmn2Service

    - #### merger

          protected DeploymentDescriptorMerger merger

    - #### formManagerService

          protected FormManagerService formManagerService

    - #### executorService

          protected org.kie.api.executor.ExecutorService executorService

    - #### processIdXPathExpression

          protected XPathExpression processIdXPathExpression

    - #### caseIdXPathExpression

          protected XPathExpression caseIdXPathExpression

  - ### Constructor Detail

    - #### KModuleDeploymentService

          public KModuleDeploymentService()

  - ### Method Detail

    - #### onInit

          public void onInit()

    - #### deploy

          public void deploy​(DeploymentUnit unit)

      Description copied from interface: `DeploymentService`
      Performs deployment operation of given `unit`.
      Specified by:
        `deploy` in interface `DeploymentService`
      Overrides:
        `deploy` in class `AbstractDeploymentService`
      Parameters:
        `unit` - deployment unit to be deployed to runtime

    - #### getRegisterableItemsFactory

          protected org.kie.api.runtime.manager.RegisterableItemsFactory getRegisterableItemsFactory​(AuditEventBuilder auditLoggerBuilder,
                                                                                                     org.kie.api.runtime.KieContainer kieContainer,
                                                                                                     KModuleDeploymentUnit unit)

    - #### undeploy

          public void undeploy​(DeploymentUnit unit,
                               Function<DeploymentUnit,​Boolean> beforeUndeploy)

      Description copied from interface: `DeploymentService`
      Performs undeployment operation of given `unit` aborting existing process instances if needed.
      Specified by:
        `undeploy` in interface `DeploymentService`
      Overrides:
        `undeploy` in class `AbstractDeploymentService`
      Parameters:
        `unit` - deployment unit to be undeployed from runtime
        `beforeUndeploy` - a function to run custom actions before undeploying a given `DeploymentUnit` . It should return if the unit can be deployed or not determining if the deployment can continue.

    - #### boostrapRuntimeEnvironmentBuilder

          protected org.kie.api.runtime.manager.RuntimeEnvironmentBuilder boostrapRuntimeEnvironmentBuilder​(KModuleDeploymentUnit deploymentUnit,
                                                                                                            DeployedUnit deployedUnit,
                                                                                                            org.kie.api.runtime.KieContainer kieContainer,
                                                                                                            org.kie.internal.runtime.conf.MergeMode mode)

      This creates and fills a `RuntimeEnvironmentBuilder` instance, which is later used when creating services. A lot of the logic here is used to process the information in the `DeploymentDescriptor` instance, which is part of the `DeploymentUnit`.
      Parameters:
        `deploymentUnit` - The `KModuleDeploymentUnit`, which is filled by the method
        `deployedUnit` - The `DeployedUnit`, which is also filled by the method
        `kieContainer` - The `KieContainer`, which contains information needed to fill the above two arguments
        `mode` - The `MergeMode` used to resolve conflicts in the `DeploymentDescriptor`.
      Returns:
        A `RuntimeEnvironmentBuilder` instance ready for use

    - #### buildContextParameters

          protected Map<String,​Object> buildContextParameters​(org.kie.api.runtime.KieContainer kieContainer)

    - #### getInstanceFromModel

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

    - #### processResources

          protected void processResources​(org.drools.compiler.kie.builder.impl.InternalKieModule module,
                                          Collection<String> files,
                                          org.kie.api.runtime.KieContainer kieContainer,
                                          DeploymentUnit unit,
                                          DeployedUnitImpl deployedUnit,
                                          org.kie.api.builder.ReleaseId releaseId,
                                          Map<String,​ProcessDescriptor> processes)

      Goes through all files in a deployment, and processes them so that they are then ready for use after deployment.
      Parameters:
        `module` - The `InternalKieModule`, necessary to get form content
        `files` - The `List` of file (names) to process.
        `kieContainer` - The `KieContainer`, necesary in order to load classes
        `deploymentUnit` - The `DeploymentUnit`, necessary to get the deployment id
        `deployedUnit` - The `DeployedUnit`, which contains the results of actions here

    - #### addClassToDeployedUnit

          protected void addClassToDeployedUnit​(Class deploymentClass,
                                                DeployedUnitImpl deployedUnit)

    - #### processClassloader

          protected void processClassloader​(org.kie.api.runtime.KieContainer kieContainer,
                                            DeployedUnitImpl deployedUnit)

      This processes the deployment dependencies, which are made available by the `KieContainer` `ClassLoader`.
      Parameters:
        `kieContainer` - The `KieContainer`, used to get the `ClassLoader`
        `deployedUnit` - The `DeployedUnitImpl`, used to store the classes loaded

    - #### setBpmn2Service

          public void setBpmn2Service​(DefinitionService bpmn2Service)

    - #### setMerger

          public void setMerger​(DeploymentDescriptorMerger merger)

    - #### setFormManagerService

          public void setFormManagerService​(FormManagerService formManagerService)

    - #### setExecutorService

          public void setExecutorService​(org.kie.api.executor.ExecutorService executorService)

    - #### activate

          public void activate​(String deploymentId)

      Description copied from interface: `DeploymentService`
      Activates given deployment by making sure it will be available for execution.

    - #### deactivate

          public void deactivate​(String deploymentId)

      Description copied from interface: `DeploymentService`
      Deactivates given deployment by making it only available for already running instances.

    - #### getProcessId

          protected String getProcessId​(String processSource)

    - #### getCaseId

          protected String getCaseId​(String processSource)