[jboss-cvs] JBossAS SVN: r105534 - projects/docs/enterprise/EAP/trunk/5.x/Seam_Reference_Guide/en-US.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 1 23:10:17 EDT 2010
Author: misty at redhat.com
Date: 2010-06-01 23:10:17 -0400 (Tue, 01 Jun 2010)
New Revision: 105534
Modified:
projects/docs/enterprise/EAP/trunk/5.x/Seam_Reference_Guide/en-US/Drools.xml
Log:
JBPAPP-4387
Modified: projects/docs/enterprise/EAP/trunk/5.x/Seam_Reference_Guide/en-US/Drools.xml
===================================================================
--- projects/docs/enterprise/EAP/trunk/5.x/Seam_Reference_Guide/en-US/Drools.xml 2010-06-02 03:07:00 UTC (rev 105533)
+++ projects/docs/enterprise/EAP/trunk/5.x/Seam_Reference_Guide/en-US/Drools.xml 2010-06-02 03:10:17 UTC (rev 105534)
@@ -13,7 +13,7 @@
The first step is to make an instance of <literal>org.drools.RuleBase</literal> available in a Seam context variable. For testing purposes, Seam provides a built-in component that compiles a static set of rules from the classpath. You can install this component via <filename>components.xml</filename>:
</para>
-<programlisting role="XML"><![CDATA[<drools:rule-base name="policyPricingRules">
+<programlisting language="XML" role="XML"><![CDATA[<drools:rule-base name="policyPricingRules">
<drools:rule-files>
<value>policyPricingRules.drl</value>
</drools:rule-files>
@@ -26,7 +26,7 @@
If you want to use a Drools DSL, you must also specify the DSL definition:
</para>
-<programlisting role="XML"><![CDATA[<drools:rule-base name="policyPricingRules" dsl-file="policyPricing.dsl">
+<programlisting language="XML" role="XML"><![CDATA[<drools:rule-base name="policyPricingRules" dsl-file="policyPricing.dsl">
<drools:rule-files>
<value>policyPricingRules.drl</value>
</drools:rule-files>
@@ -37,7 +37,7 @@
If you want to register a custom consequence exception handler through the RuleBaseConfiguration, you need to write the handler. This is demonstrated in the following example:
</para>
-<programlisting role="JAVA"><![CDATA[@Scope(ScopeType.APPLICATION)
+<programlisting language="Java" role="JAVA">@Scope(ScopeType.APPLICATION)
@Startup
@Name("myConsequenceExceptionHandler")
public class MyConsequenceExceptionHandler
@@ -52,12 +52,11 @@
Exception exception) {
throw new ConsequenceException( exception, activation.getRule() );
}
-
-}]]></programlisting>
+}</programlisting>
<para>
and register it:
</para>
-<programlisting role="XML"><![CDATA[<drools:rule-base name="policyPricingRules"
+<programlisting language="XML" role="XML"><![CDATA[<drools:rule-base name="policyPricingRules"
dsl-file="policyPricing.dsl"
consequence-exception-handler=
"#{myConsequenceExceptionHandler}">
@@ -70,26 +69,26 @@
In most rules-driven applications, rules must be dynamically deployable. A Drools RuleAgent is useful to manage the RuleBase. The RuleAgent can connect to a Drools rule server (BRMS), or hot-deploy rules packages from a local file repository. The RulesAgent-managed RuleBase is also configurable via <filename>components.xml</filename>:
</para>
-<programlisting role="XML"><![CDATA[<drools:rule-agent name="insuranceRules"
+<programlisting language="XML" role="XML"><![CDATA[<drools:rule-agent name="insuranceRules"
configurationFile="/WEB-INF/deployedrules.properties" />]]>
</programlisting>
<para>
The properties file contains properties specific to the RulesAgent. The following is an example configuration file from the Drools example distribution:
</para>
-<programlisting><![CDATA[newInstance=true
+<programlisting language="Java" role="JAVA">newInstance=true
url=http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/
org.acme.insurance/fmeyer
localCacheDir=/Users/fernandomeyer/projects/jbossrules/drools-examples/
drools-examples-brms/cache
poll=30
-name=insuranceconfig]]>
+name=insuranceconfig
</programlisting>
<para>
It is also possible to configure the options on the component directly, bypassing the configuration file.
</para>
-<programlisting role="XML"><![CDATA[<drools:rule-agent name="insuranceRules"
+<programlisting language="XML" role="XML"><![CDATA[<drools:rule-agent name="insuranceRules"
url="http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/
package/org.acme.insurance/fmeyer"
local-cache-dir="/Users/fernandomeyer/projects/jbossrules/
@@ -101,7 +100,7 @@
Next, make an instance of <literal>org.drools.WorkingMemory</literal> available to each conversation. (Each <literal>WorkingMemory</literal> accumulates facts relating to the current conversation.)
</para>
-<programlisting role="XML"><![CDATA[<drools:managed-working-memory name="policyPricingWorkingMemory"
+<programlisting language="XML" role="XML"><![CDATA[<drools:managed-working-memory name="policyPricingWorkingMemory"
auto-create="true" rule-base="#{policyPricingRules}"/>]]>
</programlisting>
<para>
@@ -112,7 +111,7 @@
We can also add means to be notified of rule engine events, including, for example, rules firing or objects being asserted by adding event listeners to WorkingMemory.
</para>
-<programlisting role="XML"><![CDATA[
+<programlisting language="XML" role="XML"><![CDATA[
<drools:managed-working-memory name="policyPricingWorkingMemory"
auto-create="true"
rule-base="#{policyPricingRules}">
@@ -129,7 +128,7 @@
We can now inject our <literal>WorkingMemory</literal> into any Seam component, assert facts, and fire rules:
</para>
-<programlisting role="JAVA"><![CDATA[@In WorkingMemory policyPricingWorkingMemory;
+<programlisting language="Java" role="JAVA">@In WorkingMemory policyPricingWorkingMemory;
@In Policy policy;
@In Customer customer;
@@ -137,8 +136,7 @@
policyPricingWorkingMemory.insert(policy);
policyPricingWorkingMemory.insert(customer);
policyPricingWorkingMemory.fireAllRules();
-}]]>
-</programlisting>
+}</programlisting>
</section>
<section>
@@ -147,7 +145,7 @@
A rule base can act as a jBPM action, decision, or assignment handler in either a pageflow or a business process definition.
</para>
-<programlisting role="XML"><![CDATA[<decision name="approval">
+<programlisting language="XML" role="XML"><![CDATA[<decision name="approval">
<handler class="org.jboss.seam.drools.DroolsDecisionHandler">
<workingMemoryName>orderApprovalRulesWorkingMemory</workingMemoryName>
<assertObjects>
@@ -177,7 +175,7 @@
Using Drools for jBPM task assignments is also supported:
</para>
-<programlisting role="XML"><![CDATA[<task-node name="review">
+<programlisting language="XML" role="XML"><![CDATA[<task-node name="review">
<task name="review" description="Review Order">
<assignment handler="org.jboss.seam.drools.DroolsAssignmentHandler">
<workingMemoryName>
@@ -199,28 +197,26 @@
Certain objects are available as Drools globals — the jBPM <literal>Assignable</literal> is available as <literal>assignable</literal>, and the Seam <literal>Decision</literal> object is available as <literal>decision</literal>. Rules that handle decisions should call <literal>decision.setOutcome("result")</literal> to determine the decision result. Rules that perform assignments should set the actor ID with <literal>Assignable</literal>.
</para>
-<programlisting><![CDATA[package org.jboss.seam.examples.shop
+<programlisting language="Java" role="JAVA">package org.jboss.seam.examples.shop
import org.jboss.seam.drools.Decision
global Decision decision
rule "Approve Order For Loyal Customer"
when
Customer( loyaltyStatus == "GOLD" )
- Order( totalAmount <= 10000 )
+ Order( totalAmount <= 10000 )
then
decision.setOutcome("approved");
-end]]>
-</programlisting>
+end</programlisting>
-<programlisting><![CDATA[package org.jboss.seam.examples.shop
+<programlisting language="Java" role="JAVA">package org.jboss.seam.examples.shop
import org.jbpm.taskmgmt.exe.Assignable
global Assignable assignable
rule "Assign Review For Small Order"
when
- Order( totalAmount <= 100 )
+ Order( totalAmount <= 100 )
then
assignable.setPooledActors( new String[] {"reviewers"} );
-end]]>
-</programlisting>
+end </programlisting>
<note>
<para>
More information about Drools is available at <ulink url="http://www.drools.org"></ulink>.
More information about the jboss-cvs-commits
mailing list