[jboss-svn-commits] JBL Code SVN: r33338 - in labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US: Chapter-User_Guide and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 3 18:50:01 EDT 2010


Author: eaa
Date: 2010-06-03 18:50:00 -0400 (Thu, 03 Jun 2010)
New Revision: 33338

Modified:
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-User_Guide/Section-Deploying.xml
Log:
JBRULES-2535: Update Knowledge Agent incremental change set documentation
	- Updated documentation

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml	2010-06-03 22:02:40 UTC (rev 33337)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml	2010-06-03 22:50:00 UTC (rev 33338)
@@ -15,14 +15,12 @@
     Base. Quite often it's more desirable to do this via configuration. To
     facilitate this, Drools supports the "Changeset" feature. The file
     <filename>changeset.xml</filename> contains a list of resources, and it
-    may also point recursively to another changeset XML file. Currently the
-    changeset has only a single "add" element, but support for remove and
-    modify will be added in the future, for more powerful incremental changes
-    over time. Currently there is no XML schema for the changeset XML, but we
-    hope to add one soon. A few examples will be shown to give you the gist of
-    things. A resource approach is employed that uses a prefix to indicate the
-    protocol. All the protocols provided by <code>java.net.URL</code>, such as
-    "file" and "http", are supported, as well as an additional "classpath".
+    may also point recursively to another changeset XML file. Currently there is 
+    no XML schema for the changeset XML, but we hope to add one soon.
+    A few examples will be shown to give you the gist of things. A resource
+    approach is employed that uses a prefix to indicate the protocol. All the
+    protocols provided by <code>java.net.URL</code>, such as "file" and "http",
+    are supported, as well as an additional "classpath".
     Currently the type attribute must always be specified for a resource, as
     it is not inferred from the file name extension. Here is a simple example
     that points to a http location for some rules.</para>
@@ -95,13 +93,16 @@
 
     <para>A <code>KnowledgeAgent</code> object will continuously scan all the
     added resources, using a default polling interval of 60 seconds and, when
-    some last modification date is updated, it will rebuild the cached
-    Knowledge Base using the new resources. Note that the previous
+    some last modification date is updated, it will applied the changes into the
+    cached Knowledge Base using the new resources. Note that the previous
     <code>KnowledgeBase</code> reference will still exist and you'll have to
     call <code>getKnowledgeBase()</code> to access the newly built
     <code>KnowledgeBase</code>. If a directory is specified as part of the
     change set, the entire contents of that directory will be scanned for
-    changes.</para>
+    changes. The way modifications are applied depends on
+    <code>drools.agent.newInstance</code> property present in the
+    KnowledgeAgentConfiguration object passed to the agent.
+    </para>
 
     <para>For polling to occur, the polling and notifier services must be started: 
 <programlisting>ResourceFactory.getResourceChangeNotifierService().start();
@@ -109,6 +110,37 @@
     </para>
 
     <section>
+      <title>Incremental Change Set Processing</title>
+        <para>
+            Knowledge Agent can process change sets in two different ways:
+            recreating the knowledge base every time a new change set is
+            processed or applying the change set in the cached knowledge base
+            without destroying it.
+            This behavior is controlled by the "newInstance" property of the
+            KnowledgeAgentConfiguration object passed to the Agent's constructor.
+        </para>
+        <para>
+            When "newInstace" is set to true (the default value), the agent
+            will destroy the cached Knowledge Base it contains and populate a
+            new one containing the change set modifications. When "newInstance"
+            is set to "false" change sets are applied directly to the cached
+            Knowledge Base. The rule that were not modified in the change sets'
+            resources are not replaced in the Knowledge Base, the modified or
+            deleted rules are modified or deleted from the cached Knowledge Base.
+            Functions, Queries and Definition Types are always replaced in the
+            cached Knowledge Base whether they are modified or not.
+        </para>
+        <para>
+            The following code snippet creates a new Knowledge Agent with its
+            "newInstace" property set to false
+            <programlisting>KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
+aconf.setProperty("drools.agent.newInstance", "false");
+KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test agent", null, aconf);
+            </programlisting>
+        </para>
+    </section>
+
+    <section>
       <title>Remote HTTP resource caching</title>
       <para>A note on remote HTTP Url Resources: if your knowledge agent is
     "pulling" resources from a http(s) URL, then you might rightly be

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-User_Guide/Section-Deploying.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-User_Guide/Section-Deploying.xml	2010-06-03 22:02:40 UTC (rev 33337)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-User_Guide/Section-Deploying.xml	2010-06-03 22:50:00 UTC (rev 33338)
@@ -230,13 +230,12 @@
     <para>The following example constructs an agent that will build a new
     KnowledgeBase from the specified ChangeSet. (See section "Building" for
     more details on the ChangeSet format.) Note that the method can be called
-    iteratively to add new resources over time. At the moment the remove and
-    modify elements of the ChangeSet XML are not implemented, but future
-    versions will provide this as well, giving you more control over those
-    incremental changes.
+    iteratively to add new resources over time. 
     The Knowledge Agent polls the resources added from the ChangeSet 
     every 60 seconds, the default interval, to see if they are updated.
-    Whenever changes are found it will construct a new Knowledge Base.
+    Whenever changes are found it will construct a new Knowledge Base or apply
+    the modifications to the existing Knowledge Base according to its
+    configuration.
     If the change set specifies a resource that
     is a directory its contents will be scanned for changes, too.</para>
 
@@ -318,8 +317,8 @@
     <code>applyChangeSet()</code> method it will also add any directories to the scanning
     process. When the directory scan detects an additional file, it will be 
     added to the Knowledge Base; any removed file is removed from the
-    Knowledge Base, and modified files will, as usual, force the build of a
-    new Knowledge Base using the latest version.</para>
+    Knowledge Base, and modified files will be removed from the Knowledge Base.
+    </para>
 
     <example>
       <title>ChangeSet XML which adds a directories contents</title>



More information about the jboss-svn-commits mailing list