4.16. Service Repository

The service repository feature allows you to import an already existing work item from a repository directly into your project. It allows multiple users to reuse generic work items, such as work items allowing integration with Twitter, performing file system operations, and similar. Imported work items are automatically added to your palette and ready to use.

Public Service Repository

A public service repository with various predefined work items is available at http://docs.jboss.org/jbpm/v6.4/repository/.

Note

Although you can import any of these work items, only the following work items are available by default (and supported) in Red Hat JBoss BPM Suite: Log, Email, Rest, and WS. You can still import the other work items, but they are not supported by Red Hat.

4.16.1. Importing from Service Repository

To import a work item from a service repository, do the following:

  1. Open your process in the Process Designer.
  2. In the editor menu, click the Connect to a Service Repository ( 5346 ) button.
  3. In the Service Repository Connection window, define the location of the repository on the location input line and click Connect.

    Figure 4.23. Establishing Connection to Service Repository

    Service Repository Connection window with loaded content.
  4. Click the asset you want to import and then Install selected item.
Work Items May Not Appear in Your Palette

Every work item must be registered in the DEPLOY_DIRECTORY/business-central.war/WEB-INF/classes/META-INF/CustomWorkItemHandler.conf file. If a work item is not registered in the file, it will not be available for use.

4.16.2. Setting up Service Repository

A service repository can be any repository, local or remote, with the index.conf file in its root directory.

Repository Configuration File

The index.conf file must be located in the root directory of the service repository. It contains a list of any directory within the repository that are to be considered directories of the service repository.

Example 4.7. index.conf

Email
FileSystem
ESB
FTP
Google
Java
Jabber
Rest
RSS
Transform
Twitter

Each directory contains either another index.conf file so as to serve as a directory or work item resources. Note that the hierarchical structure of the repository is not shown when browsing the repository using the import wizard, as the category property in the configuration file is used for that.

Work Items and Their Resources

Directories with work items must contain:

  • A work item configuration file is a file with the same name as the parent directory (for example Twitter.conf) that contains details about the work item resources in the service repository. The file is an extension of the work item definition file (see Section 4.15.1, “Work Item Definition”). Note that the configuration file must contain references to any dependencies the work item handler requires. Optionally, it can define the documentation property with a path to documentation and category which defines the category the custom work item is placed under in the repository.

    Example 4.8. Work Item Configuration File

    import org.drools.core.process.core.datatype.impl.type.StringDataType;
    [
      [
      "name" : "Twitter",
      "description" : "Send a twitter message",
      "parameters" : [
      "Message" : new StringDataType()
      ],
      "displayName" : "Twitter",
      "eclipse:customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor",
      "icon" : "twitter.gif",
      "category" : "Communication",
      "defaultHandler" : "org.jbpm.process.workitem.twitter.TwitterHandler",
      "documentation" : "index.html",
      //Every work item definition should specify dependencies even if it doesn't have one.
      "dependencies" : []
        [
      	"file:./lib/jbpm-twitter.jar",
      	"file:./lib/twitter4j-core-2.2.2.jar"
        ]
      ]
    ]
  • All resources referenced in the work item configuration file: icon, documentation, and dependencies.