Chapter 5. Red Hat JBoss Developer Studio

Red Hat JBoss Developer Studio is the JBoss Integrated Development Environment (IDE) based on Eclipse. Get the latest Red Hat JBoss Developer Studio from the DOWNLOADS section of the Red Hat Customer Portal. Red Hat JBoss Developer Studio provides plug-ins with tools and interfaces for Red Hat JBoss BRMS and Red Hat JBoss BPM Suite. These plugins are based on the community version of these products. The Red Hat JBoss BRMS plug-in is called the Drools plug-in and the Red Hat JBoss BPM Suite plug-in is called the jBPM plug-in.

See the Red Hat JBoss Developer Studio documentation for the Red Hat JBoss Developer Studio installation and setup instructions.

Warning

Because of an issue in the way multi-byte rule names are handled, you must ensure that the instance of Red Hat JBoss Developer Studio is started with the file encoding set to UTF-8. You can do this by editing the $JBDS_HOME/studio/jbdevstudio.ini file and adding the following property: "-Dfile.encoding=UTF-8".

5.1. Installing Red Hat JBoss Developer Studio Plug-ins

The Drools plug-in for Red Hat JBoss Developer Studio is available through the update site.

Procedure: Installing Drools Red Hat JBoss Developer Studio Plug-in

  1. Start Red Hat JBoss Developer Studio.
  2. Click HelpInstall New Software.
  3. Click Add to enter the Add Repository menu.
  4. Give the software site a name next to Name field and add the following URL in the Location field: https://devstudio.jboss.com/10.0/stable/updates/integration-stack/.
  5. Click OK.
  6. Select the JBoss Business Process and Rule Development feature from the available options and click Next and then Next again.
  7. Read the license, accept it by selecting the appropriate radio button, and click Finish.
  8. After the installation completes, restart Red Hat JBoss Developer Studio.

5.2. Setting Drools Runtime

In order to use the Red Hat JBoss BRMS plug-in with Red Hat JBoss Developer Studio, it is necessary to set up the runtime.

A runtime is a collection of JAR files that represents a specific release of the software and provides libraries needed for compilation and running of your business assets.

Procedure: Configuring Red Hat JBoss BRMS Runtime

  1. Open the DOWNLOADS section of the Red Hat Customer Portal.
  2. Click Red Hat JBoss BRMS and log in.
  3. Download the Red Hat JBoss BRMS 6.4.0 Core Engine archive.
  4. Extract the runtime JAR files located in the jboss-brms-VERSION-engine.zip.
  5. From the Red Hat JBoss Developer Studio menu, click WindowPreferences.
  6. Click DroolsInstalled Drools Runtimes.
  7. Click Add…​; provide a name for the new runtime, and click Browse to navigate to the directory where you extracted the runtime files. Click OK to register the selected runtime in Red Hat JBoss Developer Studio.
  8. Mark the runtime you have created as the default Drools runtime by clicking on the check box next to it.
  9. Click OK. If you have existing projects, a dialog box will indicate that you have to restart Red Hat JBoss Developer Studio to update the Runtime.

5.3. Configuring Red Hat JBoss BRMS Server

Red Hat JBoss Developer Studio can be configured to run the Red Hat JBoss BRMS Server.

Procedure: Configuring Server

  1. Open the Drools view by clicking WindowPerspectiveOpen PerspectiveOther, then Drools, and click OK.
  2. Add the Server view by clicking WindowShow ViewOther…​ and then ServerServers.
  3. Open the server menu by right clicking the Servers panel and select NewServer.
  4. Define the server by selecting JBoss Enterprise MiddlewareJBoss Enterprise Application Platform 6.1+ and clicking Next.
  5. Click JBoss EAP 6.4 Runtime and select Create new runtime (next page). Click Next.
  6. Set the home directory by clicking Browse. Navigate to and select the installation directory for Red Hat JBoss EAP 6.4 which has Red Hat JBoss BRMS installed.
  7. Provide a name for the server in the Name field, ensure that the configuration file is set, and click Finish.

5.4. Kie Navigator

Kie Navigator enables you to browse, change, and deploy the content of your Red Hat JBoss BRMS server. Thus, you can seemlessly integrate Red Hat JBoss Developer Studio with Red Hat JBoss BRMS.

Configuring Kie Navigator

  1. In Red Hat JBoss Developer Studio, click WindowShow ViewOther…​.
  2. Type Kie Navigator and select the Kie Navigator option.
  3. If you have no server with Red Hat JBoss BRMS configured in your Red Hat JBoss Developer Studio, you will be asked to configure a server first. See Section 5.3, “Configuring Red Hat JBoss BRMS Server” for more information.
  4. Right click your server name you want to use and select Properties.
  5. Enter username and pasword that has a kie role, for example kie-server.
  6. Enter the following:

    • KIE Application Name: business-central
    • HTTP Port: 8080
    • Git Port: 8001

      Note

      The values above are the default values. If you changed the default values of Git or Business Central ports, use your values.

  7. Check Use default Git Repository Path and click Apply.
  8. Start your server in the Servers tab and wait until the server has started.
  9. In the Kie Navigator tab, right click your server name and click Refresh. You will see the contents of the Red Hat JBoss BRMS git repository. Double click a project to import it into your Red Hat JBoss Developer Studio.
kienav

Kie Navigator Features

In the Kie Navigator tree, you can see four levels:

  • Server ( kienav server )
  • Organizational Unit ( kienav org )
  • Repository ( kienav repo )
  • Project ( kienav project )

Kie Navigator Server Level

Right clicking kienav server gives you the following options:

Refresh
Makes a REST call to update the entire tree.
Create Organization
Enables you to create a new Organizational Unit.
Properties
Displays the server properties.

Kie Navigator Organizational Unit Level

Right clicking kienav org gives you the following options:

Add Repository…
Enables you to add a repository that is not associated with another Organizational Unit.
Create Repository…
Enables you to create a repository.
Delete Organization…
Enables you to delete selected Organizational Unit.
Properties
Displays properties of selected Organziational Unit.

Kie Navigator Repository Level

Right clicking kienav repo gives you the following options:

Import Repository
Clones the Repository and makes it available in the Git Repository View. This menu action is available if the Repository has not already been cloned.
Create Project…
Enables you to create a project.
Remove Repository…
Enables you to remove selected repository.
Show in Git Repository View
Opens the Git Repositories View and highlights selected Repository.
Properties
Displays properties of selected repository.

Kie Navigator Project Level

Right clicking kienav project gives you the following options:

Import Project
Imports the project into your Red Hat JBoss Developer Studio.
Delete Project…
Enables you to deletes selected Project.
Properties
Displays project properties.

5.5. Importing Projects from Git Repository into Red Hat JBoss Developer Studio

Note

This is an additional feature not required for working with Red Hat JBoss Developer Studio.

You can configure Red Hat JBoss Developer Studio to connect to a central Git asset repository. The repository stores rules, models, functions, and processes.

You can either clone a remote Git repository or import a local Git repository.

Procedure: Cloning Remote Git Repository

  1. Start the Red Hat JBoss BRMS server by selecting the server from the Server tab and clicking the start icon.
  2. Start the Secure Shell server, if not running already, by using the following command. The command is specific to Linux and Mac environments. If sshd has already been started, this command fails. In that case, you may safely ignore this step.

    /sbin/service sshd start
  3. In Red Hat JBoss Developer Studio , click FileImport…​ and navigate to the Git folder. Open the Git folder to select Projects from Git and click Next.
  4. Select the repository source as Clone URI and click Next.
  5. Enter the details of the Git repository in the next window and click Next.

    Figure 5.1. Git Repository Details

    getting started guide 4912
  6. Select the branch you wish to import in the following window and click Next.
  7. To define the local storage for this project, enter (or select) a non-empty directory, make any configuration changes and click Next.
  8. Import the project as a general project in the following window and click Next. Name the project and click Finish.

Procedure: Importing Local Git Repository

  1. Start the Red Hat JBoss BRMS server by selecting the server from the Server tab and click the start icon.
  2. In Red Hat JBoss Developer Studio, click FileImport…​ and navigate to the Git folder. Open the Git folder to select Projects from Git and click Next.
  3. Select the repository source as Existing local repository and click Next.

    Figure 5.2. Git Repository Details

    getting started guide 4257
  4. Select the repository that is to be configured from the list of available repositories and click Next.
  5. In the dialog that opens, select the radio button Import as general project from the Wizard for project import group and click Next. Name the project and click Finish.

    Figure 5.3. Wizard for Project Import

    getting started guide 6110

5.6. Creating Drools Project

Procedure: Creating New Red Hat JBoss Developer Studio Project

  1. From the main menu, click FileNewProject.
  2. Click DroolsDrools Project and click Next.
  3. For now, choose the second option. Red Hat JBoss Developer Studio creates a project with a Red Hat JBoss BRMS example. Click Next.
  4. Enter a name for the project into the Project name: text box and click Finish.

To test the project:

  1. Navigate to the src/main/java directory and expand the com.sample package.
  2. Right click a Java class and select Run AsJava Application.

    The output will be displayed on the console tab.