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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jul 14 00:26:08 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-07-14 00:26:08 -0400 (Sat, 14 Jul 2007)
New Revision: 13486

Removed:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ConcurrentStatelessSession.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactHandleException.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactObjectException.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ReteConcurrentStatelessSession.java
Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Agenda.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/EventManager.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/FactException.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/InitialFact.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ObjectFilter.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Otherwise.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/PackageIntegrationException.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectFilter.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
Log:
-javadoc tidyups


Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Agenda.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Agenda.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Agenda.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,18 +1,50 @@
 package org.drools;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import org.drools.spi.Activation;
 import org.drools.spi.ActivationGroup;
 import org.drools.spi.AgendaGroup;
 import org.drools.spi.RuleFlowGroup;
 
+/**
+ * Agenda interface for the WorkingMemory
+ *
+ */
 public interface Agenda {
 
+    /**
+     * Returns the WorkignMemory for this Agenda
+     * @return
+     *      The WorkingMemory
+     */
     public WorkingMemory getWorkingMemory();
 
-    public org.drools.util.LinkedList getScheduledItems();
-
+    /**
+     * Sets the Agenda's focus to the specified AgendaGroup
+     * @param agendaGroup
+     * @return
+     */
     public boolean setFocus(AgendaGroup agendaGroup);
 
+    /**
+     * Sets the Agenda's focus to the specified AgendaGroup
+     * @param agendaGroup
+     * @return
+     */    
     public void setFocus(String name);
 
     public AgendaGroup getFocus();

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ConcurrentStatelessSession.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ConcurrentStatelessSession.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ConcurrentStatelessSession.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,14 +0,0 @@
-package org.drools;
-
-import java.util.List;
-
-import org.drools.event.AgendaEventListener;
-import org.drools.spi.AgendaFilter;
-import org.drools.spi.GlobalResolver;
-
-public interface ConcurrentStatelessSession {    
-    
-    void asyncExecute(Object object);
-    void asyncExecute(Object[] list);
-    void asyncExecute(List list);
-}

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/EventManager.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/EventManager.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/EventManager.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -26,6 +26,10 @@
 import org.drools.event.WorkingMemoryEventListener;
 import org.drools.event.WorkingMemoryEventSupport;
 
+/**
+ * The EventManager class is implemented by classes wishing to add,remove and get the various Drools EventListeners.
+ *
+ */
 public interface EventManager
     extends
     Serializable {

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/FactException.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/FactException.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/FactException.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -19,8 +19,6 @@
 /**
  * Base exception indicating an error in manipulating facts.
  * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  */
 public class FactException extends RuntimeDroolsException {
     /**

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/InitialFact.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/InitialFact.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/InitialFact.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -18,6 +18,10 @@
  * limitations under the License.
  */
 
+/**
+ * Initial fact, automatically put into the network. This fact is needed by 'not' CEs
+ * when they are the CEs in the rule.
+ */
 public interface InitialFact
     extends
     Serializable {

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactHandleException.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactHandleException.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactHandleException.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,75 +0,0 @@
-package org.drools;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Indicates an attempt to retract, update or retrieve a fact object that is no
- * longer present.
- * 
- * @see FactHandle
- * @see WorkingMemory#getFactHandle
- * 
- * @author <a href="mailto:simon at redhillconsulting.com.au">Simon Harris </a>
- * 
- * @version $Id: NoSuchFactObjectException.java,v 1.3 2003/11/19 21:31:09 bob
- *          Exp $
- */
-public class NoSuchFactHandleException extends FactException {
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -4900120393032700935L;
-    /** Invalid fact object. */
-    private final Object      object;
-
-    /**
-     * @see java.lang.Exception#Exception()
-     * 
-     * @param object
-     *            The invalid fact object.
-     */
-    public NoSuchFactHandleException(final Object object) {
-        super( createMessage( object ) );
-        this.object = object;
-    }
-
-    /**
-     * @see java.lang.Exception#Exception(Throwable cause)
-     * 
-     * @param object
-     *            The invalid fact object.
-     */
-    public NoSuchFactHandleException(final Object object,
-                                     final Throwable cause) {
-        super( createMessage( object ),
-               cause );
-        this.object = object;
-    }
-
-    /**
-     * Retrieve the invalid Object.
-     * 
-     * @return The invalid fact object.
-     */
-    public Object getObject() {
-        return this.object;
-    }
-
-    private static String createMessage(final Object object) {
-        return object == null ? "null fact object" : "no such fact handle for object:" + object;
-    }
-}
\ No newline at end of file

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactObjectException.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactObjectException.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/NoSuchFactObjectException.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,76 +0,0 @@
-package org.drools;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Indicates an attempt to retract, update or retrieve a fact object that is no
- * longer present.
- * 
- * @see FactHandle
- * @see WorkingMemory#assertObject
- * @see WorkingMemory#retractObject
- * @see WorkingMemory#getObject
- * 
- * @author <a href="mailto:bob at werken.com">bob mcwhirter </a>
- * 
- * @version $Id: NoSuchFactObjectException.java,v 1.3 2003/11/19 21:31:09 bob
- *          Exp $
- */
-public class NoSuchFactObjectException extends FactException {
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 400L;
-    /** Invalid fact handle. */
-    private final FactHandle  handle;
-
-    /**
-     * @see java.lang.Exception#Exception()
-     * 
-     * @param object
-     *            The invalid fact object.
-     */
-    public NoSuchFactObjectException(final FactHandle handle) {
-        super( createMessage( handle ) );
-        this.handle = handle;
-    }
-
-    /**
-     * @see java.lang.Exception#Exception()
-     * 
-     * @param object
-     *            The invalid fact object.
-     */
-    public NoSuchFactObjectException(final FactHandle handle,
-                                     final Throwable cause) {
-        super( createMessage( handle ) );
-        this.handle = handle;
-    }
-
-    /**
-     * Retrieve the invalid <code>FactHandle</code>.
-     * 
-     * @return The invalid fact handle.
-     */
-    public FactHandle getFactHandle() {
-        return this.handle;
-    }
-
-    private static String createMessage(final FactHandle handle) {
-        return handle == null ? "null fact object" : "no such fact object for handle:" + handle.toExternalForm();
-    }
-}
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ObjectFilter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ObjectFilter.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ObjectFilter.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,5 +1,16 @@
 package org.drools;
 
+/**
+ * ObjectFilter is used with WorkingMemories to filter out instances during Iteration
+ * @author mproctor
+ *
+ */
 public interface ObjectFilter {
+    
+    /**
+     * Returning true means the Iterator accepts, and thus returns, the current Object.
+     * @param object
+     * @return
+     */
     boolean accept(Object object);
 }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Otherwise.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Otherwise.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/Otherwise.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -4,7 +4,8 @@
  * This class is essentually a named fact that will be asserted when the engine
  * has not matched any rules.
  * 
- * @author Michael Neale
+ * This class is not currently used.
+ * 
  *
  */
 public class Otherwise {

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/PackageIntegrationException.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/PackageIntegrationException.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/PackageIntegrationException.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -25,10 +25,6 @@
  * @see RuleBase#addRule
  * @see RuleBase#addPackage
  * 
- * @author <a href="mailto:bob at eng.werken.com">bob mcwhirter </a>
- * 
- * @version $Id: RuleIntegrationException.java,v 1.6 2004/09/17 00:14:06
- *          mproctor Exp $
  */
 public class PackageIntegrationException extends IntegrationException {
     /**

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,4 +1,19 @@
 package org.drools;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.util.Map;
 

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,4 +1,19 @@
 package org.drools;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.util.HashMap;
 import java.util.Iterator;

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ReteConcurrentStatelessSession.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ReteConcurrentStatelessSession.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ReteConcurrentStatelessSession.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -1,63 +0,0 @@
-package org.drools;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.event.AgendaEventListener;
-import org.drools.spi.AgendaFilter;
-import org.drools.spi.GlobalResolver;
-import org.drools.util.concurrent.locks.BlockingQueue;
-import org.drools.util.concurrent.locks.LinkedBlockingQueue;
-import org.drools.util.concurrent.locks.Queue;
-
-public class ReteConcurrentStatelessSession implements ConcurrentStatelessSession {    
-    private BlockingQueue queue;
-    
-    public void asyncExecute(Object object) {
-        this.queue.offer( object );
-    }
-    
-    public void asyncExecute(Object[] list) {
-        this.queue.offer( list );
-    }
-    
-    public void asyncExecute(List list) {
-        this.queue.offer( list );
-    }
-    
- 
-    public class ProducerConsumer implements Runnable {
-        private WorkingMemory workingMemory;
-        private BlockingQueue queue;
-        
-        
-        public ProducerConsumer(WorkingMemory workingMemory, BlockingQueue queue) {
-            this.workingMemory = workingMemory;
-            this.queue = queue;
-        }
-
-        public void run() {
-            while (true) {
-                try {
-                    Object object = this.queue.take();
-                    if ( object instanceof Object[] ) {
-                        this.workingMemory.insert( object );
-                    } else if ( object instanceof List ) {
-                        List list = ( List ) object;
-                        for ( Iterator it = list.iterator(); it.hasNext(); ) {
-                            this.workingMemory.insert( it.next() );
-                        }
-                    } else {
-                        Object[] objects = ( Object[] ) object;
-                        for ( int i = 0, length = objects.length; i < length; i++ ) {
-                            this.workingMemory.insert( objects[i] );
-                        }
-                    }
-                    Thread.sleep( 100 );
-                } catch(InterruptedException e) {
-                    return;
-                }
-            }
-        }        
-    }
-}

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -33,10 +33,6 @@
  * </p>
  * 
  * @see WorkingMemory
- * 
- * @author <a href="mailto:bob at werken.com">bob mcwhirter </a>
- * 
- * @version $Id: RuleBase.java,v 1.2 2005/08/04 23:33:30 mproctor Exp $
  */
 public interface RuleBase
     extends

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemory.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -42,36 +42,52 @@
  */
 public interface WorkingMemory extends EventManager {
 
+    /**
+     * Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface 
+     * is more subject to change.
+     * @return
+     *         the Agenda
+     */
     public Agenda getAgenda();
 
     /**
-     * Set a specific piece of global in this working memory. Null values will return doing nothign
+     * Set a specific instance as a global in this working memory. Null values will return doing nothing.
+     * The global identifier and its type must be declared in the drl.
      * 
-     * @param name
-     *            the name under which to populate the data
+     * @param identifier
+     *            the identifier under which to populate the data
      * @param value
      *            the global value, cannot be null
      */
-    void setGlobal(String name,
+    void setGlobal(String identifier,
                    Object value);
 
     /**
-     * Retrieve a specific piece of global data by name
+     * Retrieve a specific instance of global data by identifier
      * 
-     * @return application data or null if nothing is set under this name
+     * @return application data or null if nothing is set under this identifier
      */
-    Object getGlobal(String name);
+    Object getGlobal(String identifier);
 
+    
     /**
-     * Delegate used to resolve any global names not found in the global map.
+     * Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver.
+     * Typcicaly a delegating GlobalResolver is created that first gets a reference to the current GlobalResolver,
+     * for delegating
+     * 
      * @param globalResolver
      */
     void setGlobalResolver(GlobalResolver globalResolver);
     
+    /**
+     * Returns the current GlobalResolver
+     * 
+     * @return
+     */
     GlobalResolver getGlobalResolver();
 
     /**
-     * Retrieve the <code>RuleBase</code> of this working memory.
+     * Retrieve the <code>RuleBase</code> for this working memory.
      * 
      * @return The <code>RuleBase</code>.
      */
@@ -81,7 +97,7 @@
      * Fire all items on the agenda until empty.
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void fireAllRules() throws FactException;
 
@@ -89,7 +105,7 @@
      * Fire all items on the agenda until empty, using the given AgendaFiler
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void fireAllRules(AgendaFilter agendaFilter) throws FactException;
       
@@ -97,7 +113,7 @@
      * Fire all items on the agenda until empty or at most 'fireLimit' rules have fired
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void fireAllRules( int fireLimit ) throws FactException;
 
@@ -106,54 +122,84 @@
      * until empty or at most 'fireLimit' rules have fired
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void fireAllRules(final AgendaFilter agendaFilter, int fireLimit ) throws FactException;
 
     /**
      * Retrieve the object associated with a <code>FactHandle</code>.
      * 
-     * @see #containsObject
      * 
      * @param handle
      *            The fact handle.
      * 
      * @return The associated object.
-     * 
-     * @throws NoSuchFactObjectException
-     *             If no object is known to be associated with the specified
-     *             handle.
      */
-    Object getObject(FactHandle handle) throws NoSuchFactObjectException;
+    Object getObject(FactHandle handle);
 
     /**
      * Retrieve the <code>FactHandle</code> associated with an Object.
      * 
-     * @see #containsObject
-     * 
      * @param object
      *            The object.
      * 
      * @return The associated fact handle.
-     * 
-     * @throws NoSuchFactHandleException
-     *             If no handle is known to be associated with the specified
-     *             object.
      */
-    FactHandle getFactHandle(Object object) throws NoSuchFactHandleException;
+    FactHandle getFactHandle(Object object);
 
+    /**
+     * Returns an Iterator for the Objects in the Working Memory. This Iterator is not thread safe.
+     * @return
+     *     the Iterator
+     */
     Iterator iterateObjects();
     
+    /**
+     *  Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out
+     *  any objects that the ObjectFilter does not accept. This Iterator is not thread safe.
+     *  
+     * @param filter
+     * 
+     * @return
+     *     the Iterator
+     */    
     Iterator iterateObjects(ObjectFilter filter);
 
+    /**
+     * Returns an Iterator for the FactHandles in the Working Memory. This Iterator is not thread safe.
+     * @return
+     *     the Iterator
+     */    
     Iterator iterateFactHandles();
     
+    /**
+     *  Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out
+     *  any objects that the ObjectFilter does not accept. This Iterator is not thread safe.
+     *  
+     * @param filter
+     * 
+     * @return
+     *     the Iterator
+     */        
     Iterator iterateFactHandles(ObjectFilter filter);    
     
+    /**
+     * Returns the AgendaGroup which has the current WorkingMemory focus. The AgendaGroup interface is subject to change.
+     * @return
+     *     the AgendaGroup
+     */
     public AgendaGroup getFocus();
 
+    /**
+     * Set the focus to the specified AgendaGroup
+     * @param focus
+     */
     void setFocus(String focus);
 
+    /**
+     * Set the focus to the specified AgendaGroup
+     * @param focus
+     */    
     void setFocus(AgendaGroup focus);
         
 
@@ -166,7 +212,7 @@
      * @return The new fact-handle associated with the object.
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     FactHandle insert(Object object) throws FactException;
 
@@ -184,10 +230,25 @@
      */
     public QueryResults getQueryResults(String query);
     
+    /**
+     * Retrieve the QueryResults of the specified query and arguments
+     *
+     * @param query
+     *            The name of the query.
+     *            
+     * @param arguments
+     *            The arguments used for the query
+     *
+     * @return The QueryResults of the specified query.
+     *         If no results match the query it is empty.
+     *         
+     * @throws IllegalArgumentException 
+     *         if no query named "query" is found in the rulebase         
+     */    
     public QueryResults getQueryResults(String query, Object[] arguments);
 
     /**
-     * Assert a fact registering JavaBean <code>PropertyChangeListeners</code>
+     * Insert a fact registering JavaBean <code>PropertyChangeListeners</code>
      * on the Object to automatically trigger <code>update</code> calls
      * if <code>dynamic</code> is <code>true</code>.
      * 
@@ -200,7 +261,7 @@
      * @return The new fact-handle associated with the object.
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     FactHandle insert(Object object,
                             boolean dynamic) throws FactException;
@@ -212,12 +273,13 @@
      *            The fact-handle associated with the fact to retract.
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void retract(FactHandle handle) throws FactException;
 
     /**
-     * Modify a fact.
+     * Inform the WorkingMemory that a Fact has been modified and that it
+     * should now update the network.
      * 
      * @param handle
      *            The fact-handle associated with the fact to modify.
@@ -225,13 +287,22 @@
      *            The new value of the fact.
      * 
      * @throws FactException
-     *             If an error occurs.
+     *             If a RuntimeException error occurs.
      */
     void update(FactHandle handle,
                       Object object) throws FactException;
     
+    /**
+     * 
+     * @param factHandle
+     */
     public void modifyRetract(final FactHandle factHandle);
     
+    /**
+     * 
+     * @param factHandle
+     * @param object
+     */
     public void modifyInsert(final FactHandle factHandle,
                              final Object object);    
 
@@ -244,13 +315,12 @@
     void setAsyncExceptionHandler(AsyncExceptionHandler handler);
 
     /**
-     * Clear the Agenda
-     * 
+     * Clear the Agenda. Iterates over each AgendaGroup cancalling all Activations.
      */
     void clearAgenda();
 
     /**
-     * Clear the Agenda Group
+     * Clear the Agenda Group, cancelling all its Activations.
      */
     public void clearAgendaGroup(String group);
 

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectFilter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectFilter.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectFilter.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -2,13 +2,27 @@
 
 import org.drools.ObjectFilter;
 
+/**
+ * Filters Objects by Class, only accepting Classes of the specified type
+ * @author mproctor
+ *
+ */
 public class ClassObjectFilter implements ObjectFilter {
     private Class clazz;
     
+    /** 
+     * The Allowed Class type
+     * @param clazz
+     */
     public ClassObjectFilter(Class clazz) {
         this.clazz = clazz;
     }
 
+    /**
+     * Returning true means the Iterator accepts, and thus returns, the current Object's Class type.
+     * @param object
+     * @return
+     */    
     public boolean accept(Object object) {
         return object.getClass().isAssignableFrom( this.clazz );
     }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -30,13 +30,12 @@
 import org.drools.Agenda;
 import org.drools.FactException;
 import org.drools.FactHandle;
-import org.drools.NoSuchFactHandleException;
-import org.drools.NoSuchFactObjectException;
 import org.drools.ObjectFilter;
 import org.drools.Otherwise;
 import org.drools.QueryResults;
 import org.drools.RuleBase;
 import org.drools.RuleBaseConfiguration;
+import org.drools.RuntimeDroolsException;
 import org.drools.WorkingMemory;
 import org.drools.RuleBaseConfiguration.AssertBehaviour;
 import org.drools.RuleBaseConfiguration.LogicalOverride;
@@ -309,25 +308,6 @@
         return this.handleFactory;
     }
 
-//    public void setGlobals(Map globals) {
-//        //this.globals = globals;
-//    }
-
-//    /**
-//     * @see WorkingMemory
-//     */
-//    public Map getGlobals() {
-//        try {
-//            this.lock.lock();
-//            return this.globals;
-//        } finally {
-//            this.lock.unlock();
-//        }
-//    }
-
-    /**
-     * @see WorkingMemory
-     */
     public void setGlobal(final String identifier,
                           final Object value) {
         // Cannot set null values
@@ -346,7 +326,7 @@
                 throw new RuntimeException( "Illegal class for global. " + "Expected [" + type.getName() + "], " + "found [" + value.getClass().getName() + "]." );
 
             } else {
-                this.globalResolver.setGlobal( identifier, 
+                this.globalResolver.setGlobal( identifier,
                                                value );
             }
         } finally {
@@ -362,7 +342,7 @@
             this.lock.unlock();
         }
     }
-    
+
     public GlobalResolver getGlobalResolver() {
         return this.globalResolver;
     }
@@ -371,9 +351,6 @@
         return this.id;
     }
 
-    /**
-     * @see WorkingMemory
-     */
     public Object getGlobal(final String identifier) {
         try {
             this.lock.lock();
@@ -383,33 +360,18 @@
         }
     }
 
-    /**
-     * Retrieve the rule-firing <code>Agenda</code> for this
-     * <code>WorkingMemory</code>.
-     * 
-     * @return The <code>Agenda</code>.
-     */
     public Agenda getAgenda() {
         return this.agenda;
     }
 
-    /**
-     * Clear the Agenda
-     */
     public void clearAgenda() {
         this.agenda.clearAgenda();
     }
 
-    /**
-     * Clear the Agenda Group
-     */
     public void clearAgendaGroup(final String group) {
         this.agenda.clearAgendaGroup( group );
     }
 
-    /**
-     * @see WorkingMemory
-     */
     public RuleBase getRuleBase() {
         return this.ruleBase;
     }
@@ -418,9 +380,6 @@
         this.halt = true;
     }
 
-    /**
-     * @see WorkingMemory
-     */
     public synchronized void fireAllRules() throws FactException {
         fireAllRules( null,
                       -1 );
@@ -469,10 +428,11 @@
                 }
             } finally {
                 this.firing = false;
-                if ( noneFired ) {
-                    doOtherwise( agendaFilter,
-                                 fireLimit );
-                }
+                // @todo (mproctor) disabling Otherwise management for now, not happy with the current implementation
+//                if ( noneFired ) {
+//                    doOtherwise( agendaFilter,
+//                                 fireLimit );
+//                }
 
             }
         }
@@ -755,7 +715,7 @@
                     // assert
                     handle = this.handleFactory.newFactHandle( object );
                     addHandleToMaps( handle );
-                    
+
                     key = new EqualityKey( handle );
                     handle.setEqualityKey( key );
                     this.tms.put( key );
@@ -801,7 +761,7 @@
                             handle.setEqualityKey( key );
                             key.addFactHandle( handle );
                             addHandleToMaps( handle );
-                            
+
                         }
 
                     } else {
@@ -809,7 +769,7 @@
                         addHandleToMaps( handle );
                         key.addFactHandle( handle );
                         handle.setEqualityKey( key );
-                        
+
                     }
 
                 } else {
@@ -834,7 +794,7 @@
                 }
                 handle = this.handleFactory.newFactHandle( object );
                 addHandleToMaps( handle );
-                
+
             }
 
             if ( dynamic ) {
@@ -856,7 +816,7 @@
                         Object object,
                         Rule rule,
                         Activation activation) {
-        if( activation != null ) {
+        if ( activation != null ) {
             // release resources so that they can be GC'ed
             activation.getPropagationContext().releaseResources();
         }
@@ -908,7 +868,7 @@
                                   Object object,
                                   PropagationContext propagationContext) throws FactException;
 
-    protected void removePropertyChangeListener(final FactHandle handle) throws NoSuchFactObjectException {
+    protected void removePropertyChangeListener(final FactHandle handle) {
         Object object = null;
         try {
             object = getObject( handle );
@@ -921,20 +881,17 @@
                               this.addRemovePropertyChangeListenerArgs );
             }
         } catch ( final NoSuchMethodException e ) {
-            // The removePropertyChangeListener method on the class
-            // was not found so Drools will be unable to
-            // stop processing JavaBean PropertyChangeEvents
-            // on the retracted Object
+            throw new RuntimeDroolsException( "The removePropertyChangeListener method on the class was not found so Drools will be unable to stop processing JavaBean PropertyChangeEvents on the retracted Object." );
         } catch ( final IllegalArgumentException e ) {
-            System.err.println( "Warning: The removePropertyChangeListener method" + " on the class " + object.getClass() + " does not take" + " a simple PropertyChangeListener argument" + " so Drools will be unable to stop processing JavaBean"
+            throw new RuntimeDroolsException(  "Warning: The removePropertyChangeListener method on the class " + object.getClass() + " does not take a simple PropertyChangeListener argument so Drools will be unable to stop processing JavaBean"
                                 + " PropertyChangeEvents on the retracted Object" );
         } catch ( final IllegalAccessException e ) {
-            System.err.println( "Warning: The removePropertyChangeListener method" + " on the class " + object.getClass() + " is not public" + " so Drools will be unable to stop processing JavaBean" + " PropertyChangeEvents on the retracted Object" );
+            throw new RuntimeDroolsException(  "Warning: The removePropertyChangeListener method on the class " + object.getClass() + " is not public so Drools will be unable to stop processing JavaBean PropertyChangeEvents on the retracted Object" );
         } catch ( final InvocationTargetException e ) {
-            System.err.println( "Warning: The removePropertyChangeL istener method" + " on the class " + object.getClass() + " threw an InvocationTargetException" + " so Drools will be unable to stop processing JavaBean"
+            throw new RuntimeDroolsException(  "Warning: The removePropertyChangeL istener method on the class " + object.getClass() + " threw an InvocationTargetException so Drools will be unable to stop processing JavaBean"
                                 + " PropertyChangeEvents on the retracted Object: " + e.getMessage() );
         } catch ( final SecurityException e ) {
-            System.err.println( "Warning: The SecurityManager controlling the class " + object.getClass() + " did not allow the lookup of a" + " removePropertyChangeListener method" + " so Drools will be unable to stop processing JavaBean"
+            throw new RuntimeDroolsException(  "Warning: The SecurityManager controlling the class " + object.getClass() + " did not allow the lookup of a removePropertyChangeListener method so Drools will be unable to stop processing JavaBean"
                                 + " PropertyChangeEvents on the retracted Object: " + e.getMessage() );
         }
     }
@@ -967,7 +924,7 @@
             }
             removePropertyChangeListener( handle );
 
-            if( activation != null ) {
+            if ( activation != null ) {
                 // release resources so that they can be GC'ed
                 activation.getPropagationContext().releaseResources();
             }
@@ -1010,7 +967,6 @@
 
             removeHandleFromMaps( handle );
 
-
             this.handleFactory.destroyFactHandle( handle );
 
             if ( !this.actionQueue.isEmpty() ) {
@@ -1062,7 +1018,7 @@
             return;
         }
 
-        if( activation != null ) {
+        if ( activation != null ) {
             // release resources so that they can be GC'ed
             activation.getPropagationContext().releaseResources();
         }
@@ -1123,7 +1079,7 @@
 
             this.handleFactory.increaseFactHandleRecency( handle );
 
-            if( activation != null ) {
+            if ( activation != null ) {
                 // release resources so that they can be GC'ed
                 activation.getPropagationContext().releaseResources();
             }
@@ -1189,7 +1145,7 @@
                 return;
             }
 
-            if( activation != null ) {
+            if ( activation != null ) {
                 // release resources so that they can be GC'ed
                 activation.getPropagationContext().releaseResources();
             }
@@ -1344,8 +1300,6 @@
         try {
             update( getFactHandle( object ),
                     object );
-        } catch ( final NoSuchFactHandleException e ) {
-            // Not a fact so unable to process the chnage event
         } catch ( final FactException e ) {
             throw new RuntimeException( e.getMessage() );
         }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2007-07-14 04:25:58 UTC (rev 13485)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2007-07-14 04:26:08 UTC (rev 13486)
@@ -161,13 +161,6 @@
         item.cancel();
     }
 
-    /* (non-Javadoc)
-     * @see org.drools.common.AgendaI#getScheduledItems()
-     */
-    public org.drools.util.LinkedList getScheduledItems() {
-        return this.scheduledActivations;
-    }
-
     public void addAgendaGroup(final AgendaGroup agendaGroup) {
         this.agendaGroups.put( agendaGroup.getName(),
                                agendaGroup );




More information about the jboss-svn-commits mailing list