[jboss-svn-commits] JBL Code SVN: r34388 - labs/jbossrules/trunk/drools-docs/drools-docs-integration/src/main/docbook/en-US/Chapter-Spring.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 29 23:09:56 EDT 2010
Author: mark.proctor at jboss.com
Date: 2010-07-29 23:09:55 -0400 (Thu, 29 Jul 2010)
New Revision: 34388
Modified:
labs/jbossrules/trunk/drools-docs/drools-docs-integration/src/main/docbook/en-US/Chapter-Spring/Chapter-Spring.xml
Log:
-spring doc improvements
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-integration/src/main/docbook/en-US/Chapter-Spring/Chapter-Spring.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-integration/src/main/docbook/en-US/Chapter-Spring/Chapter-Spring.xml 2010-07-30 02:54:15 UTC (rev 34387)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-integration/src/main/docbook/en-US/Chapter-Spring/Chapter-Spring.xml 2010-07-30 03:09:55 UTC (rev 34388)
@@ -1,335 +1,450 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.0"
xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd http://www.w3.org/1999/xlink http://www.docbook.org/xml/5.0/xsd/xlink.xsd"
- xml:base="../" xmlns="http://docbook.org/ns/docbook" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ns="http://docbook.org/ns/docbook">
- <title>Spring Integration</title>
+ xml:base="../" xmlns="http://docbook.org/ns/docbook"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:ns="http://docbook.org/ns/docbook">
+ <title>Spring Integration</title>
- <section>
- <title>Integration with Drools Expert</title>
- <para>In this section we will explain the drools namespace.</para>
-
- <section>
- <title>Define a Resource</title>
-
- <para>Defines a resource to be referenced from other tags</para>
- <section>
- <title><![CDATA[<drools:resource>'s parameters as attributes:]]></title>
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>id</entry>
- <entry>Bean's <emphasis>id</emphasis> is the name to be reference from other beans.</entry>
- <entry>Yes, but can be omitted when this tag is nested.</entry>
- </row>
- <row>
- <entry>source</entry>
- <entry>The path to the file containing the actual resource.</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>type</entry>
- <entry>Type of the Resource as is defined in class <classname>ResourceType</classname>.</entry>
- <entry>No, default to DRL</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title><![CDATA[<drools:resource>'s parameters as nested elements:]]></title>
-
- <para>When configuring a <emphasis>decision table</emphasis> resource you can nest a
- <emphasis><![CDATA[<drools:decisiontable-conf>]]></emphasis> tag to configure the resource.
- </para>
-
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>input-type</entry>
- <entry>Decision Table input type: XLS or CSV</entry>
- <entry>No</entry>
- </row>
- <row>
- <entry>worksheet-name</entry>
- <entry>The worksheet name to be used in the when using an XLS</entry>
- <entry>No</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <example>
- <title>resource definition example</title>
- <programlisting>
- <![CDATA[
-<drools:resource source="classpath:org/drools/IntegrationExampleTest.xls"
- type="DTABLE">
- <drools:decisiontable-conf input-type="XLS" worksheet-name="Tables_2" />
-</drools:resource>]]>
- </programlisting>
- </example>
- </section>
-
- <section>
- <title>Define a KnowledgeBase</title>
-
- <section>
- <title><![CDATA[<drools:kbase>]]>'s parameters as attributes:</title>
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>id</entry>
- <entry>Bean's <emphasis>id</emphasis> is the name to be referenced from other beans.</entry>
- <entry>Yes</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title><![CDATA[<drools:kbase>'s parameters as nested elements:]]></title>
-
- <para>There are two ways to define the a resource inside a kbase. You
- can nest a <emphasis>drools:resource</emphasis>, or you can reference a previously
- defined resource using <emphasis>drools:resource-ref</emphasis>.
- Additionally, you can configure schema models that would be compiled to types
- inside the kbase using <emphasis><![CDATA[<drools:model >]]></emphasis>.
- </para>
-
- <example>
- <title>kbase definition example</title>
- <programlisting>
- <![CDATA[
-<drools:kbase id="kbase1" node="node1">
- <drools:resource
- source="classpath:org/drools/spring/IntegrationExampleTest.xls"
- type="DTABLE">
- <drools:decisiontable-conf input-type="XLS" worksheet-name="Table_2" />
- </drools:resource>
- <drools:resource-ref id="resource1"/>
- <drools:model
- source="classpath:org/drools/container/spring/model.xsd" />
-</drools:kbase>]]>
- </programlisting>
- </example>
- </section>
- </section>
-
- <section>
- <title>Define KnowledgeSessions</title>
-
- <section>
- <title><![CDATA[<drools:ksession>]]>'s parameters as attributes:</title>
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>id</entry>
- <entry>Bean's <emphasis>id</emphasis> is the name to be referenced from other beans.</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>type</entry>
- <entry>is the session <emphasis>stateful</emphasis> or <emphasis>stateless?</emphasis></entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>name</entry>
- <entry></entry>
- <entry>No; defaults to <emphasis>id</emphasis> when omitted.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <example>
- <title>ksession definition example</title>
- <programlisting>
- <![CDATA[
-<drools:ksession id="ksession1" type="stateless"
- name="stateless1" kbase="kbase1"/>
+ <section>
+ <title>Integration with Drools Expert</title>
-<drools:ksession id="ksession2" type="stateful"
- kbase="kbase1"/>]]>
- </programlisting>
- </example>
- </section>
- </section>
- </section>
-
- <section>
- <title>Define a KnowledgeBase</title>
-
- <section>
- <title><![CDATA[<drools:kbase>]]>'s parameters as attributes:</title>
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>id</entry>
- <entry>Bean's <emphasis>id</emphasis> is the name to be referenced from other beans.</entry>
- <entry>Yes</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title><![CDATA[<drools:kbase>'s parameters as nested elements:]]></title>
-
- <para>There are two ways to define the a resource inside a kbase. You
- can nest a <emphasis>drools:resource</emphasis>, or you can reference a previously
- defined resource using <emphasis>drools:resource-ref</emphasis>.
- Additionally, you can configure schema models that would be compiled to types
- inside the kbase using <emphasis><![CDATA[<drools:model >]]></emphasis>.
- </para>
-
- <example>
- <title>KnowledgeBase definition example</title>
- <programlisting>
- <![CDATA[
-<drools:kbase id="kbase1" node="node1">
- <drools:resource
- source="classpath:org/drools/spring/IntegrationExampleTest.xls"
- type="DTABLE">
- <drools:decisiontable-conf input-type="XLS" worksheet-name="Table_2" />
- </drools:resource>
- <drools:resource-ref id="resource1"/>
- <drools:model
- source="classpath:org/drools/container/spring/model.xsd" />
-</drools:kbase>]]>
- </programlisting>
- </example>
- </section>
- </section>
- </section>
+ <para>In this section we will explain the drools namespace.</para>
- <section>
- <title>Integration with Drools Flow</title>
-
- <section>
- <title>Define a JpaSessionServiceFactory</title>
-
- <section>
- <title><![CDATA[<drools:jpaSessionServiceFactory>]]>'s parameters as attributes:</title>
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>id</entry>
- <entry>Bean's <emphasis>id</emphasis> is the name to be referenced from other beans.</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>kbase</entry>
- <entry>A reference to an <emphasis>KnowledgeBase</emphasis>.</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>entityManagerFactory</entry>
- <entry>A reference to an EntityManagerFactory</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>transactionManager</entry>
- <entry>A reference to an <classname>org.springframework.orm.jpa.JpaTransactionManager</classname></entry>
- <entry>Yes</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title><![CDATA[<drools:jpaSessionServiceFactory>'s parameters as nested elements:]]></title>
-
- <para>You can configure custom <emphasis>Variable Peristers</emphasis> using the nested tag <![CDATA[<drools:variablePersisters>]]>
- </para>
-
- <table>
- <tgroup cols="3" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry align="center">Attribute</entry>
- <entry align="center">Description</entry>
- <entry align="center">Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>forClass</entry>
- <entry>The class or interface name that would be persisted using this persister.</entry>
- <entry>Yes</entry>
- </row>
- <row>
- <entry>implementation</entry>
- <entry>The persister implementation class name.</entry>
- <entry>Yes</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <example>
- <title>kbase definition example</title>
- <programlisting>
- <![CDATA[
-<drools:jpaSessionServiceFactory id="jpaSingleSessionCommandService" kbase="kbase1"
- entityManagerFactory="myEmf" transactionManager="txManager">
- <drools:variablePersisters>
- <drools:persister forClass="javax.persistence.Entity" implementation="org.drools.persistence.processinstance.persisters.JPAVariablePersister"/>
- <drools:persister forClass="java.lang.String" implementation="org.drools.container.spring.beans.persistence.StringVariablePersister"/>
- <drools:persister forClass="java.io.Serializable" implementation="org.drools.persistence.processinstance.persisters.SerializableVariablePersister"/>
- </drools:variablePersisters>
-</drools:jpaSessionServiceFactory>]]>
- </programlisting>
- </example>
- </section>
- </section>
- </section>
+ <section>
+ <title>Define a Resource</title>
+
+ <para>Defines a resource to be referenced from other tags</para>
+
+ <section>
+ <title><drools:resource>'s parameters as attributes:</title>
+
+ <table>
+ <tgroup align="left" cols="3" colsep="1" rowsep="1">
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+
+ <entry align="center">Description</entry>
+
+ <entry align="center">Required</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>id</entry>
+
+ <entry>Bean's <emphasis>id</emphasis> is the name to be
+ reference from other beans.</entry>
+
+ <entry>Yes, but can be omitted when this tag is
+ nested.</entry>
+ </row>
+
+ <row>
+ <entry>source</entry>
+
+ <entry>The path to the file containing the actual
+ resource.</entry>
+
+ <entry>Yes</entry>
+ </row>
+
+ <row>
+ <entry>type</entry>
+
+ <entry>Type of the Resource as is defined in class
+ <classname>ResourceType</classname>.</entry>
+
+ <entry>No, default to DRL</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title><drools:resource>'s parameters as nested
+ elements:</title>
+
+ <para>When configuring a <emphasis>decision table</emphasis> resource
+ you can nest a <emphasis><drools:decisiontable-conf></emphasis>
+ tag to configure the resource.</para>
+
+ <table>
+ <tgroup align="left" cols="3" colsep="1" rowsep="1">
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+
+ <entry align="center">Description</entry>
+
+ <entry align="center">Required</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>input-type</entry>
+
+ <entry>Decision Table input type: XLS or CSV</entry>
+
+ <entry>No</entry>
+ </row>
+
+ <row>
+ <entry>worksheet-name</entry>
+
+ <entry>The worksheet name to be used in the when using an
+ XLS</entry>
+
+ <entry>No</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <example>
+ <title>resource definition example</title>
+
+ <programlisting language="xml"><drools:resource source="classpath:org/drools/IntegrationExampleTest.xls"
+ type="DTABLE">
+ <drools:decisiontable-conf input-type="XLS" worksheet-name="Tables_2" />
+</drools:resource></programlisting>
+ </example>
+ </section>
+
+ <section>
+ <title>Define a KnowledgeBase</title>
+
+ <section>
+ <title><drools:kbase>'s parameters as attributes:</title>
+
+ <table>
+ <tgroup align="left" cols="3" colsep="1" rowsep="1">
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+
+ <entry align="center">Description</entry>
+
+ <entry align="center">Required</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>id</entry>
+
+ <entry>Bean's <emphasis>id</emphasis> is the name to be
+ referenced from other beans.</entry>
+
+ <entry>Yes</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title><drools:kbase>'s parameters as nested elements:</title>
+
+ <para>A Knowledge Base has a 0..n resources. Has two nested
+ elements, resources and configuratoins. Thoe resources can be inner
+ elements or references, using the "ref" attribute.</para>
+
+ <example>
+ <title>kbase definition example</title>
+
+ <programlisting language="xml"><drools:kbase id="kbase1" node="node1">
+ <drools:resources>
+ <drools:resource source="classpath:org/drools/spring/IntegrationExampleTest.xls"
+ type="DTABLE">
+ <drools:decisiontable-conf input-type="XLS" worksheet-name="Table_2" />
+ </drools:resource>
+
+ <drools:resource ref="resource1"/>
+
+ <drools:resource source="classpath:org/drools/container/spring/model.xsd" />
+ </drools:resources>
+
+ <drools:configuration>
+ <drools:mbeans enabled="true" />
+
+ <drools:accumulate-functions>
+ <drools:accumulate-function name="func1" ref="func1Instance" />
+ <drools:accumulate-function name="func1" ref="func2Instance" />
+ </drools:accumulate-functions>
+ </drools:configuration>
+
+</drools:kbase>
+</programlisting>
+ </example>
+
+ <figure>
+ <title>Knowledge Base Configuration Options</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>advanced-process-rule-integration</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>enabled = true : false</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>multithread </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>enabled = true : false</para>
+ </listitem>
+
+ <listitem>
+ <para>max-threads = 1..n</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>mbeans</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>enabled = true : false</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>event-processing-mode</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>mode = STREAM : CLOUD</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>accumulate-functions</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>accumulate-function 0..n</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>name = String</para>
+ </listitem>
+
+ <listitem>
+ <para>ref = String</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>evaluators</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>evaluator 0..n</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>name = String</para>
+ </listitem>
+
+ <listitem>
+ <para>ref = String</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>assert-behavior </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>mode = IDENTITY : EQUALITY</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </figure>
+ </section>
+ </section>
+
+ <section>
+ <title>Define KnowledgeSessions</title>
+
+ <section>
+ <title><drools:ksession>'s parameters as attributes:</title>
+
+ <table>
+ <tgroup align="left" cols="3" colsep="1" rowsep="1">
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+
+ <entry align="center">Description</entry>
+
+ <entry align="center">Required</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>id</entry>
+
+ <entry>Bean's <emphasis>id</emphasis> is the name to be
+ referenced from other beans.</entry>
+
+ <entry>Yes</entry>
+ </row>
+
+ <row>
+ <entry>type</entry>
+
+ <entry>is the session <emphasis>stateful</emphasis> or
+ <emphasis>stateless?</emphasis></entry>
+
+ <entry>Yes</entry>
+ </row>
+
+ <row>
+ <entry>name</entry>
+
+ <entry />
+
+ <entry>No; defaults to <emphasis>id</emphasis> when
+ omitted.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <example>
+ <title>ksession definition example</title>
+
+ <programlisting language="xml"><drools:ksession id="ksession1" type="stateless"
+ name="stateless1" kbase="kbase1"/>
+
+<drools:ksession id="ksession2" type="stateful" kbase="kbase1"/>
+
+<drools:ksession id="ksession3" type="stateful" kbase="kbase2>
+ <drools:configurations>
+ <drools:keep-reference enabled="false" />
+ <drools:clock-type type="PSEUDO" />
+ </drools:configurations>
+</drools:ksession>
+</programlisting>
+ </example>
+
+ <figure>
+ <title>Knowledge Session Configuration Options</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>keep-reference</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>enabled = true : false</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>clock-type</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>type = REALTIME : PSEUDO</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>jpa-persistence</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>transaction-manager</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>ref = String</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>entity-manager-factory</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>ref = String</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>variable-persisters</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>for-class = String</para>
+ </listitem>
+
+ <listitem>
+ <para>implementation = String</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </figure>
+
+ <example>
+ <title>ksession JPA configuraiton example</title>
+
+ <programlisting language="xml"><drools:kstore id="kstore" /> <!-- provides KnowledgeStoreService implementation -->
+
+<bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="dataSource" ref="ds" />
+ <property name="persistenceUnitName" value="org.drools.persistence.jpa.local" />
+</bean>
+
+<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="myEmf" />
+</bean>
+
+<drools:ksession id="jpaSingleSessionCommandService" type="stateful" kbase="kbProcessWorkItems">
+ <drools:configuration>
+ <drools:jpa-persistence>
+ <drools:transaction-manager ref="txManager" />
+ <drools:entity-manager-factory ref="myEmf" />
+ </drools:jpa-persistence>
+ </drools:configuration>
+</drools:ksession>
+</programlisting>
+ </example>
+ </section>
+ </section>
+ </section>
+ </section>
</chapter>
More information about the jboss-svn-commits
mailing list