[jboss-svn-commits] JBL Code SVN: r13488 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: concurrent and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 14 00:43:47 EDT 2007
Author: mark.proctor at jboss.com
Date: 2007-07-14 00:43:47 -0400 (Sat, 14 Jul 2007)
New Revision: 13488
Modified:
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/RuleBaseFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/CommandExecutor.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExecutorService.java
Log:
-javadoc tidyups
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:26:12 UTC (rev 13487)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java 2007-07-14 04:43:47 UTC (rev 13488)
@@ -37,23 +37,53 @@
this.queryResults = queryResults;
}
+ /**
+ * Return a map of Declarations where the key is the identifier and the value
+ * is the Declaration.
+ *
+ * @return
+ * The Map of Declarations.
+ */
public Map getDeclarations() {
return this.queryResults.getDeclarations();
}
+ /**
+ * Returns the Object for int position in the Tuple
+ *
+ * @param i
+ * @return
+ * The Object
+ */
public Object get(final int i) {
//adjust for the DroolsQuery object
return getObject( this.tuple.get( i + 1 ));
}
+ /**
+ * Return the Object for the given Declaration identifer.
+ * @param identifier
+ * @return
+ * The Object
+ */
public Object get(final String identifier) {
return get( (Declaration) this.queryResults.getDeclarations().get( identifier ) );
}
+ /**
+ * Return the Object for the given Declaration.
+ * @param identifier
+ * @return
+ * The Object
+ */
public Object get(final Declaration declaration) {
return declaration.getValue( (InternalWorkingMemory) workingMemory, getObject( this.tuple.get( declaration ) ) );
}
+ /**
+ * Return the FactHandles for the Tuple.
+ * @return
+ */
public FactHandle[] getFactHandles() {
// Strip the DroolsQuery fact
final FactHandle[] src = this.tuple.getFactHandles();
@@ -66,12 +96,22 @@
return dst;
}
+ /**
+ * The size of the Tuple; i.e. the number of columns (FactHandles) in this row result.
+ * @return
+ */
public int size() {
// Adjust for the DroolsQuery object
return this.tuple.getFactHandles().length - 1;
}
- private Object getObject(InternalFactHandle handle) {
+ /**
+ * Get the Object for the given FactHandle
+ * @param handle
+ * @return
+ */
+ private Object getObject(FactHandle factHandle) {
+ InternalFactHandle handle = ( InternalFactHandle ) factHandle;
if ( handle.isShadowFact() ) {
return ((ShadowProxy) handle.getObject()).getShadowedObject();
} else {
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:26:12 UTC (rev 13487)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java 2007-07-14 04:43:47 UTC (rev 13488)
@@ -25,6 +25,11 @@
import org.drools.rule.Query;
import org.drools.spi.Tuple;
+/**
+ * Returned QueryResults instance for a requested named query. from here you can iterate the returned data, or
+ * get a specific row. All the available Declarations used in the query can also be accessed.
+ *
+ */
public class QueryResults {
private Query query;
@@ -50,10 +55,22 @@
this );
}
+ /**
+ * Returns an Iterator for the results.
+ *
+ * @return
+ */
public Iterator iterator() {
return new QueryResultsIterator( this.results.iterator() );
}
+ /**
+ * Return a map of Declarations where the key is the identifier and the value
+ * is the Declaration.
+ *
+ * @return
+ * The Map of Declarations.
+ */
public Map getDeclarations() {
final Declaration[] declarations = this.query.getDeclarations();
@@ -67,11 +84,15 @@
return this.declarations;
}
+ /**
+ * The results size
+ * @return
+ */
public int size() {
return this.results.size();
}
- class QueryResultsIterator
+ private class QueryResultsIterator
implements
Iterator {
private Iterator iterator;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java 2007-07-14 04:26:12 UTC (rev 13487)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java 2007-07-14 04:43:47 UTC (rev 13488)
@@ -21,7 +21,6 @@
/**
* This is a utility to create rule bases based on the type of engine you wish to use.
*
- * @author Michael Neale
*/
public class RuleBaseFactory {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/CommandExecutor.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/CommandExecutor.java 2007-07-14 04:26:12 UTC (rev 13487)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/CommandExecutor.java 2007-07-14 04:43:47 UTC (rev 13488)
@@ -9,6 +9,12 @@
import org.drools.util.concurrent.locks.BlockingQueue;
import org.drools.util.concurrent.locks.LinkedBlockingQueue;
+/**
+ * The CommandExecutor is a Producer/Consumer style classes that provides a queue of Commands
+ * in a LinkedBlockingQueue. This the run() method loops for continously until shutdown() is
+ * called.
+ *
+ */
public class CommandExecutor implements Runnable, Serializable {
private WorkingMemory workingMemory;
private BlockingQueue queue;
@@ -21,10 +27,22 @@
this.queue = new LinkedBlockingQueue();
}
+ /**
+ * Allows the looping run() method to execute.
+ *
+ */
public void shutdown() {
this.run = false;
}
+ /**
+ * Submit a Command for execution
+ *
+ * @param command
+ *
+ * @return
+ * return the Future
+ */
public Future submit(Command command) {
this.queue.offer( command );
// we know our commands also implement Future
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExecutorService.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExecutorService.java 2007-07-14 04:26:12 UTC (rev 13487)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExecutorService.java 2007-07-14 04:43:47 UTC (rev 13488)
@@ -6,10 +6,36 @@
import java.io.Serializable;
-
+/**
+ * This class instance is configed by the RuleBaseConfiguration and is responsible for thread management
+ * of the async services.
+ *
+ */
public interface ExecutorService extends Serializable {
+
+ /**
+ * The CommandExecutor is a producer/consumer style class that handles the queue and execution
+ * of the async actions
+ * @param executor
+ */
public void setCommandExecutor(CommandExecutor executor);
+
+ /**
+ * Submit a command for execution, adds it ot the commandExecutor's queue
+ * @param command
+ * @return
+ */
Future submit(Command command);
+
+ /**
+ * Shutdown this ExecutorService
+ *
+ */
void shutDown();
+
+ /**
+ * Startup this ExecutorService, typically called on first submit for lazy startup.
+ *
+ */
void startUp();
}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list