How to use Bonita bundles in IntelliJ IDEA

A common practice when developing a web application is having the server directly accessible in the IDE. This article explains how to do this using BOS bundles for a client-side application.

This tutorial uses the most recent version of IntelliJ IDEA. It has been tested with IDEA 11 and BOS 5.6.2.

First, download the BOS-Tomcat bundle from the BOS download page (from the Bundles tab) and unzip it. Name this BOS_INSTALL.

Everything you’ll have to do next will be in IntelliJ. If you have already created a project, you can right click on your project and select Add framework support…

Alternatively, you can create a new project. On the framework support form, tick Application server, select New Tomcat Server and enter BOS_INSTALL in the Tomcat home field.

Then, in the settings of your project (F4), add the bonita-client-5.6.2.jar to the classpath and optionally add its documentation URL (http://www.bonitasoft.org/docs/javadoc/bpm_engine/5.6/)

Create a simple JSP file to test the installation:
[cc lang=“java”]
<%@ page contentType=“text/html;charset=UTF-8” language=“java” %>

<%@page import=“org.ow2.bonita.facade.QueryDefinitionAPI”%>
<%@ page import=“org.ow2.bonita.util.AccessorUtil” %>
<%@ page import=“org.ow2.bonita.light.LightProcessDefinition” %>
<%@ page import=“javax.security.auth.login.LoginContext” %>
<%@ page import=“org.ow2.bonita.util.SimpleCallbackHandler” %>

Deployed processes

    <% LoginContext loginContext = new LoginContext("BonitaStore", new SimpleCallbackHandler("user", "")); loginContext.login(); QueryDefinitionAPI queryDefinitionAPI = AccessorUtil.getQueryDefinitionAPI();

    for (LightProcessDefinition lightProcessDefinition : queryDefinitionAPI.getLightProcesses()) {
    out.println("

  • "+lightProcessDefinition.getName()+"
  • "); } loginContext.logout();

    %>


[/cc]

And here is what you should get: