[jboss-svn-commits] JBL Code SVN: r28979 - labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 19 01:35:04 EDT 2009
Author: michael.neale at jboss.com
Date: 2009-08-19 01:35:03 -0400 (Wed, 19 Aug 2009)
New Revision: 28979
Modified:
labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml
Log:
added a note for how to turn on transparent http url caching
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 2009-08-18 22:38:37 UTC (rev 28978)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Quick_Start/Section-More_On_Building_And_Deploying.xml 2009-08-19 05:35:03 UTC (rev 28979)
@@ -6,31 +6,28 @@
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
+ <title>More on building and deploying</title>
- <title>More on building and deploying</title>
+ <section>
+ <title>Knowledge Base by Configuration Using Changesets</title>
+ <para>So far, the programmatic API has been used to build a Knowledge
+ 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".
+ 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>
- <section>
- <title>Knowledge Base by Configuration Using Changesets</title>
-
- <para>So far, the programmatic API has been used to build a
- Knowledge 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". 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>
-
- <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
+ <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' >
<add>
@@ -39,22 +36,23 @@
</change-set>
</programlisting>
- <para>To use the above XML, the code is almost identical as before,
- except we change the resource type to <code>CHANGE_SET</code>.</para>
+ <para>To use the above XML, the code is almost identical as before, except
+ we change the resource type to <code>CHANGE_SET</code>.</para>
- <programlisting>KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ <programlisting>KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClasspathResource( "myChangeSet.xml", getClass() ),
ResourceType.CHANGE_SET );
if ( kbuilder.hasErrors() ) {
System.err.println( builder.getErrors().toString() );
}</programlisting>
- <para>Changesets can include any number of resources, and they even support
- additional configuration information, which currently is only needed for
- decision tables. The example below is expanded to load the rules from a
- http URL location, and an Excel decision table from the classpath.</para>
+ <para>Changesets can include any number of resources, and they even
+ support additional configuration information, which currently is only
+ needed for decision tables. The example below is expanded to load the
+ rules from a http URL location, and an Excel decision table from the
+ classpath.</para>
- <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
+ <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
<add>
@@ -66,12 +64,11 @@
</change-set>
</programlisting>
- <para>It is also possible to specify a directory, to add the contents of
- that directory. It is expected that all the files are
- of the specified type, since type is not yet inferred from the file name
- extensions.</para>
+ <para>It is also possible to specify a directory, to add the contents of
+ that directory. It is expected that all the files are of the specified
+ type, since type is not yet inferred from the file name extensions.</para>
- <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
+ <programlisting> <change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
<add>
@@ -79,32 +76,47 @@
</add>
</change-set>
</programlisting>
- </section>
+ </section>
- <section>
- <title>Knowledge Agent</title>
+ <section>
+ <title>Knowledge Agent</title>
- <para>The Knowlege Agent provides automatic loading, caching and
- re-loading of resources and is configured from a properties files. The
- Knowledge Agent can update or rebuild this Knowlege Base as the resources
- it uses are changed. The strategy for this is determined by the
- configuration given to the factory, but it is typically pull-based using
- regular polling. We hope to add push-based updates and rebuilds in
- future versions.</para>
+ <para>The Knowlege Agent provides automatic loading, caching and
+ re-loading of resources and is configured from a properties files. The
+ Knowledge Agent can update or rebuild this Knowlege Base as the resources
+ it uses are changed. The strategy for this is determined by the
+ configuration given to the factory, but it is typically pull-based using
+ regular polling. We hope to add push-based updates and rebuilds in future
+ versions.</para>
- <programlisting>KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
+ <programlisting>KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
KnowledgeBase kbase = kagent.getKnowledgeBase();</programlisting>
- <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
- <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>
- </section>
-
+ <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
+ <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>
+
+ <para>A not on remote HTTP Url Resources: if your knowledge agent is
+ "pulling" resources from a http(s) URL, then you might rightly be
+ concerned if that resource (remote web server) suddenly disappears. To
+ survive a restart when a resource is no longer available remotely (eg the
+ remote server is being restarted) then you can set a System Property:
+ drools.resource.urlcache to a directory that has write permissions for the
+ application: the Knowledge Agent will cache copies of the remote resources
+ in that local directory. </para>
+
+ <para>For example, using the java command line:
+ -Ddrools.resource.urlcache=/users/someone/KnowledgeCache - will keep local
+ copies of the resources (rules, packages etc) in that directory, for the
+ agent to use should it be restarted (when a remote resource becomes
+ available, and is updated, it will automatically update the local cache
+ copy). </para>
+ </section>
</section>
More information about the jboss-svn-commits
mailing list