JBoss.orgCommunity Documentation

Chapter 7. Packaging

7.1. Packaging
7.2. Imports and Globals
7.2.1. Basic View
7.2.2. Advanced View
7.3. Category rules
7.4. Building
7.5. Selectors
7.5.1. Built-in Selector
7.5.2. Custom Selector
7.6. Snapshots
7.7. Advanced configuration

Packaging is the process of assembling required assets into a single deployable unit, called a package, and configuring the package as necessary.

Some aspects of the configuration are also critical for authoring assets, such as the import of model classes and the definition of global variables. For example, you may add a model which has a class called com.something.Hello, you would then add import com.something.Hello in your package configuration and save the change.

The package configuration screen is reached by clicking on the required package in the "Package Explorer" and then selecting the "Edit" tab.




The "imports" section of the package configuration screen allows you to import Java classes needed by your assets.

When a POJO Model file is uploaded it is scanned for classes and imports are automatically created.

Globals are DRL Global variables that can be accessed by rules. Please consult the Drools Expert documentation for details.


TODO

TODO

Finally you would "build" a package. Any errors caught are then shown at this point. If the build was successful, then you will have the option to create a snapshot for deployment. You can also view the DRL that this package results in.


Warning

In cases of large numbers of rules, all these operations can take some time.

When building packages using the "Packages" feature you have the option to use a "selector". This selector will filter the list of rules that are built into the package.

Snapshots, URLS and binary packages:

URLs are central to how built packages are provided. The Guvnor provides packages via URLs (for download and use by the Knowledge Agent). These URLs take the form of:

http://<server>/guvnor-webapp/org.drools.guvnor.Guvnor/package/<packageName>/<packageVersion>

<packageName> is the name you gave the package. <packageVersion> is either the name of a snapshot, or "LATEST" (if its LATEST, then it will be the latest built version from the main package, not a snapshot). You can use these in the agent, or you can paste them into your browser and it will download them as a file.

Refer to the section on the Knowledge Agent for details on how you can use these URLs (and binary downloads) in your application, and how rules can be updated on the fly.


The above shows deployment snapshots view. On the left there is a list of packages. Clicking on a specific package will show you a list of snapshots for that package (if any). From there you can copy, remove or view an asset snapshot. Each snapshot is available for download or access via a URL for deployment.

As drools supports various configuration options for a package (such as adding functions for "accumulate" etc), this can be done by adding a X.package or X.conf file to the package - files which contain name/value pairs in the "properties" style. These will then be automatically added to the package configuration. See the main drools documentation for all the things you can do.