[jboss-svn-commits] JBL Code SVN: r26104 - in labs/jbossrules/trunk/drools-api/src/main/java/org/drools: agent and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Apr 17 08:03:02 EDT 2009


Author: mark.proctor at jboss.com
Date: 2009-04-17 08:03:02 -0400 (Fri, 17 Apr 2009)
New Revision: 26104

Modified:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/agent/KnowledgeAgentFactory.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilder.java
Log:
-javadocs fix

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java	2009-04-17 11:48:30 UTC (rev 26103)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java	2009-04-17 12:03:02 UTC (rev 26104)
@@ -8,21 +8,16 @@
  * <p>
  * This class is used to provide a ChangeSet info to a ResourceChangeNotifier. It should be used when you implement the ResourceChangeMonitor interface.
  * Each method provides a Collection of removed, added and modified resources, and determined by the monitor. Drools currently only provides the
- * ResourceChangeScanner, which scans the local disk for changes. 
+ * ResourceChangeScanner, which scans the local disk for changes. The scanning only works with the ChangeSet is applied to a KnowledgeAgent, and not a KnowledgeBase. 
  * </p>
  * 
  * <p>
- * This interface, as well as ResourceChangeMonitor, ResourceChangeNotifier, ResourceChangeScanner and ResourceChangeListener are still considered subject to change. 
- * Use the XML format change-set, as
- * part of the ResourceType api when adding to KnowledgeBuilder, which is considered stable. KnowledgeBuilder currently ignored Added/Modified xml elements,
- * the KnowledgeAgent will use them, when rebuilding the KnowledgeBase.
+ * The xml format has a root level <change-set> element and then it can contain &lt;add&gt;, &lt;modified&gt;, &lt;removed&gt; elements - each one can only be used once.
+ * add, modified, removed then contain a list of &lt;resource&gt; elements. Resources may take a configuration, currently only decision table resources use that.
  * </p>
+ *
+ * <p>KnowledgeBuilder currently ignores Added/Modified xml elements, the KnowledgeAgent will use them, when rebuilding the KnowledgeBase.</p>
  * 
- * <p>
- * the xml format has a root level <change-set> element and then it can contain <add>, <modified>, <removed> elements - each one can only be used once.
- * add, modified, removed then contain a list of <resource> elements. Resources may take a configuration, currently only decision table resources use that.
- * </p>
- * 
  * <pre>
  * &lt;change-set xmlns='http://drools.org/drools-5.0/change-set'
  *             xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
@@ -37,7 +32,35 @@
  * &lt;/change-set&gt;
  * </pre>
  * 
+ * <p>Notice that each resource defines a protocol for it's source, this is because when using a ChangeSet all resource elements are turned into a URL instance, so it
+ * obeys the format as provided by the JDK URL class. There is one exception which is the classpath protocol, which is handled separately. Here the resource is loaded
+ * from the classpath, where it uses the default ClassLoader of the KnowledgeBase.<p>
  * 
+ * <p>A path, when using file based protocols, can point to a folder. In such a situation all the resources in that folder will be added. When used with a KnowledgeAgent,
+ * which is also set to scan directories, it will continue to scan the directory for new or removed resources.</p>
+ * 
+ * <p>
+ * The ChangeSet can be used as a ResourceType with the KnowledgeBuilder or applied directly to a KnowledgeAgent.
+ * </p>
+ * 
+ * <p>Example showing a changeset being used with a KnowledgeBuilder:</p>
+ * <pre>
+ * KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ * kbuilder.add( ResourceFactory.newUrlResource( url ),
+ *               ResourceType.ChangeSet );
+ * </pre>
+ * 
+ * <p>Example showing a changeset being applied to a KnowledgeAgent:</p>
+ * <pre>
+ * KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
+ * kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
+ * KnowledgeBase kbase = kagent.getKnowledgeBase();
+ * </pre>
+ * 
+ * <p>
+ * This interface, as well as ResourceChangeMonitor, ResourceChangeNotifier, ResourceChangeScanner and ResourceChangeListener are still considered subject to change. 
+ * Use the XML format change-set, as part of the ResourceType api when adding to KnowledgeBuilder, which is considered stable.
+ * </p>
  */
 public interface ChangeSet {
     /**

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/agent/KnowledgeAgentFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/agent/KnowledgeAgentFactory.java	2009-04-17 11:48:30 UTC (rev 26103)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/agent/KnowledgeAgentFactory.java	2009-04-17 12:03:02 UTC (rev 26104)
@@ -17,8 +17,8 @@
  * 
  * <p>
  * The Following example constructs an agent that will build a new KnowledgeBase from the files specified in the path String.
- * It will poll those files every 60 seconds, which is the default, to see if they are updated. If new files are found it will construct a new 
- * KnowledgeBase. If the change set specifies a resource that is a directory it's contents will be scanned for changes  too.
+ * It will poll those files every 60 seconds, which is the default when polling is enabled and the service started, to see if they are updated. 
+ * If new files are found it will construct a new KnowledgeBase. If the change set specifies a resource that is a directory it's contents will be scanned for changes  too.
  * </p>
  * 
  * <pre>

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilder.java	2009-04-17 11:48:30 UTC (rev 26103)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilder.java	2009-04-17 12:03:02 UTC (rev 26104)
@@ -71,7 +71,8 @@
  * </pre>     
  * 
  * <p>
- * The KnowledgeBuilder can also be built from configuration using the xml change-set format and the ResourceType.ChangeSet value. While change-set
+ * The KnowledgeBuilder can also be built from configuration using the xml change-set format and the ResourceType.ChangeSet value. 
+ * There is no .xsd schema yet for this XML, but hte format is very simple. While change-set
  * supports add, remove, modify as elements. KnowledgeBuilder will only process add. If the resource element provided points to a directory, all
  * files found in that directory will be added. Currently the knowledge type is not derived from the .ext extension of the file and must be explicitely
  * set in the XML for the resource. It is expected that all resources in the directory, when the directory is a given resource, are all of the specified
@@ -80,7 +81,7 @@
  * <pre>
  * &lt;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' &gt;
+ *             xs:schemaLocation='change-set drools-change-set-5.0.xsd' &gt;
  *  &lt;add&gt;
  *       &lt;resource source='http:org/domain/myrules.drl' type='DRL' /&gt;
  *       &lt;resource source='classpath:data/IntegrationExampleTest.xls' type="DTABLE"&gt;
@@ -92,9 +93,9 @@
  * </pre>
  * 
  * <pre>
- * KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- * kbuilder.add( ResourceFactory.newUrlResource( url ),
- *               ResourceType.ChangeSet );
+ * KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent", // the name of the agent
+ *                                                                  kaconf );
+ * kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) ); // resource to the change-set xml for the resources to add
  * </pre>
  * 
  */




More information about the jboss-svn-commits mailing list