JBoss.orgCommunity Documentation
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.
The "Basic View" of Imports and Globals is shown by default. This view allows either to be managed visually.
Imports or Globals can be inserted by clicking the [+] icon beside the applicable panel. Either can also be deleted by selecting the appropriate Import or Global and clicking the dustbin icon.
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.
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.
Guvnor provides several built-in selectors which allow you to choose what assets form part of a package build according to asset's status and category.
You can use a custom selector if the built-in selector does not satisfy your requirement.
To configure a custom selector, you will need to "explode" the WAR file for Guvnor, and locate the
selectors.properties
file (note you can also put your own selectors.properties
file in the system classpath if you like). In this file, you will
find details on how you can configure a custom selector. The options are to use a DRL file, or the name of
a class that you have written (and which is available on the classpath). Classes must implement the
AssetSelector
interface. DRL files can also be used and there is an example one in the
selectors.properties
file). Each selector you configure has a unique name in this
properties file - and this is the name that you can use when building packages.
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.