Show Table of Contents
18.2. Deployment Service
The
DeploymentService service is responsible for deploying and undeploying deployment units into the runtime environment. Deployment units includes resources such as rule, processes, and forms. The DeploymentService can be used to retrieve:
- a RuntimeManager instance for given deployment id
- a deployed unit that represents complete deployment process for given deployment id
- list of all deployed units known to the deployment
DeploymentServiceservice
DeploymentService service fires CDI events in case of deployment or undeployment of deployment units. This allows application components to react real time to the CDI events and store or remove deployment details from the memory. The deployment event with qualifier @Deploy is fired on deployment and the deployment event with qualifier @Undeploy is fired on undeployment. You can use CDI observer mechanism to get a notification on these events.
18.2.1. Saving and Removing Deployments from Database
The deployment service stores the deployed units in memory by default. Here is how you can save deployments in the data store of your choice:
public void saveDeployment(@Observes @Deploy DeploymentEvent event) {
// store deployed unit info for further needs
DeployedUnit deployedUnit = event.getDeployedUnit();
}
Here is how you can remove a saved deployment when undeployed:
public void removeDeployment(@Observes @Undeploy DeploymentEvent event) {
// remove deployment with id event.getDeploymentId()
}
Note
Deployment service comes with deployment synchronization mechanism that allows to persist deployed units into data base that is by default enabled.
18.2.2. Available Deployment Services
You can use qualifiers to instruct the CDI container which deployment service it must use. JBoss BPM Suite comes with the following Deployment Services out of the box:
@Kjar: This Kmodule deployment service is tailored to work with KmoduleDeploymentUnits that is a small descriptor on top of a kjar.@Vfs: This VFS deployment service allows you to deploy assets directly from VFS (Virtual File System).
Note that every implementation of deployment service must have with a dedicated implementation of deployment unit as the services mentioned above.
18.2.3. FormProviderService Service
The
FormProviderService service provides access to form representations for the user and process forms. It is built on the concept of isolated FormProviders.
Implementations of
FormProvider interface must define a priority, as this is the main driver for the FormProviderService service to ask for the content of the form of a given provider. FormProviderService service collects all available providers and iterates over them asking for the form content in the order of the specified priority. The lower the priority number, the higher priority it gets during evaluation. For example, a provider with priority 5 is evaluated before provider with priority 10. FormProviderService service iterates over available providers as long as one delivers the content. In a worse case scenario, it returns simple text based forms.
The
FormProvider interface shown below describes contract for the implementations:
public interface FormProvider {
int getPriority();
String render(String name, ProcessDesc process, Map<String, Object> renderContext);
String render(String name, Task task, ProcessDesc process, Map<String, Object> renderContext);
}
JBoss BPM Suite comes with following
FormProvidersService out of the box:
- Additional
FormProviderServiceavailable with the form modeler. The priority number of thisFormProviderServiceis 2. - Fremarker based implementation to support process and task forms. The priority number of this
FormProvideServiceris 3. - Default forms provider. This is has the lowest priority and considered as a last resort if none of the other providers deliver content. This provider provides simplest possible forms.
18.2.4. RuntimeDataService Service
The
RuntimeDataService service provides access to actual data that is available on runtime such as:
- Available processes to be executed
- Active process instances
- Process instance history
- Process instance variables
- Active and completed nodes of process instance
In a default implementation, the
RuntimeDataService service observes deployment events and indexes all deployed processes to expose them to the calling components.
18.2.5. DefinitionService Service
A
DefinitionService is a service that provides access to process details stored as part of BPMN2 XML. Before using any method that provides information, you must invoke the buildProcessDefinition method to populate repository with process information taken from BPMN2 content.
The BPMN2 Data Service provides access to following data:
- Overall description of process for given process definition
- Collection of all user tasks found in the process definition
- Information about defined inputs for user task node
- Information about defined outputs for user task node
- IDs of reusable processes (call activity) defined within the given process definition
- Information about process variables defined within given process definition
Information about all organizational entities (users and groups) included in the process definition. Depending on the actual process definition the returned values for users and groups can contain actual user or group name or process variable that is used to get actual user or group name on runtime.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.