JBoss.orgCommunity Documentation

Chapter 16. Integration

16.1. Overview
16.2. Persistent Storage
16.2.1. Database: JPA and Hibernate
16.2.2. XML: XStream
16.2.3. XML: JAXB
16.3. SOA and ESB
16.3.1. Camel and Karaf
16.4. Other Environments
16.4.1. JBoss Modules, WildFly and JBoss EAP
16.4.2. OSGi
16.4.3. Android
16.5. Integration with Human Planners (Politics)

Planner's input and output data (the planning problem and the best solution) are plain old JavaBeans (POJO's), so integration with other Java technologies is straightforward. For example:

Camel is an enterprise integration framework which includes support for Planner (starting from Camel 2.13). It can expose a use case as a REST service, a SOAP service, a JMS service, ...

Read the documentation for the camel-optaplanner component. That component works in Karaf too.

To deploy an Planner web application on WildFly, simply include the optaplanner dependency jars in the war file's WEB-INF/lib directory (just like any other dependency) as shown in the optaplanner-webexamples-*.war. However, in this approach the war file can easily grow to several MB in size, which is fine for a one-time deployment, but too heavyweight for frequent redeployments (especially over a slow network connection).

The remedy is to use deliver the optaplanner jars in a JBoss module to WildFly and create a skinny war. Let's create an module called org.optaplanner:

Android is not a complete JVM. Some JDK libraries of the java.beans package are missing for proper Planner functionality. However, it is possible to use Planner with Java score calculation by adding missing libraries to your Android project. The Drools rule engine does not work on Android yet, so Drools score calculation doesn't work on Android.

Workaround to use Planner on Android:

  1. Download OpenBeans redistribution of the java.beans package.

  2. Download Jar Jar Links utility for repacking the redistribution.

  3. Create a jarJarRule.txt text file with a single line:

    rule com.googlecode.openbeans.** java.beans.@1
  4. Place all the files in the same folder and run the command:

    $ java -jar jarjar-1.4.jar process jarJarRule.txt openbeans-1.0.jar javabeans-1.0.jar
  5. Move the created javabeans-1.0.jar into the libs folder in your Android project.

  6. Add these lines to the android area in the build.gradle file in your Android project to allow classes of the java.* package inside the javabeans-1.0.jar file to be used:

    android {
        ...
        dexOptions {
            preDexLibraries = false
        }
        project.tasks.withType(com.android.build.gradle.tasks.Dex) {
            additionalParameters=['--core-library']
        }
        ...
    }
  7. Add a dependency to the build.gradle file in your Android project to exclude org.drools and xmlpull dependencies:

    dependencies {
        ...
        compile('org.optaplanner:optaplanner-core:...') {
            exclude group: 'xmlpull'
            exclude group: 'org.drools'
        }
        ...
    }

A good Planner implementation beats any good human planner for non-trivial datasets. Many human planners fail to accept this, often because they feel threatened by an automated system.

But despite that, Planner can benefit from a human planner as supervisor:

Therefore, it's often a good idea to involve the human planner in your project.