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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Aug 14 11:02:40 EDT 2010


Author: salaboy21
Date: 2010-08-14 11:02:39 -0400 (Sat, 14 Aug 2010)
New Revision: 34715

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/InsertObjectCommand.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DisconnectedWorkingMemoryEntryPoint.java
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnectorFactory.java
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/internal/GenericMessageHandlerImpl.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/DirectoryLookupProviderGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseProviderGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderProviderGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/StatefulKnowledgeSessionGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkItemManagerGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkingMemoryEntryPointGridClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-dir-rio/src/main/resources/org/drools/directoryNodeService.groovy
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/pom.xml
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/main/java/org/drools/grid/distributed/impl/DistributedRioNodeConnector.java
   labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/pom.xml
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/DirectoryLookupProviderRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseProviderRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderProviderRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/StatefulKnowledgeSessionRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-dir-mina/src/main/java/org/drools/grid/remote/directory/DirectoryServerMessageHandlerImpl.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/GridTopology.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/TaskServerInstanceByPrioritySelectionStrategy.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterMinaDirectoryTest.java
Log:
JBRULES-2618: Drools Grid Services - Improve and clean tests
	- Improve the way that the commands are executed

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/InsertObjectCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/InsertObjectCommand.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/InsertObjectCommand.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -16,7 +16,6 @@
 
 package org.drools.command.runtime.rule;
 
-import java.io.ObjectStreamException;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -27,6 +26,7 @@
 import org.drools.command.Context;
 import org.drools.command.impl.GenericCommand;
 import org.drools.command.impl.KnowledgeCommandContext;
+import org.drools.common.DefaultFactHandle;
 import org.drools.core.util.StringUtils;
 import org.drools.impl.StatefulKnowledgeSessionImpl;
 import org.drools.reteoo.ReteooWorkingMemory;
@@ -53,6 +53,8 @@
 	
 	@XmlAttribute(name="entry-point")
     private String entryPoint;
+      	@XmlAttribute(name="disconnected")
+    private boolean disconnected = false;
 	
     public InsertObjectCommand() {
         
@@ -62,6 +64,11 @@
         this.object = object;
     }
 
+    public InsertObjectCommand(Object object, boolean disconnected) {
+        this.object = object;
+        this.disconnected = disconnected;
+    }
+
     public InsertObjectCommand(Object object, String outIdentifier) {
 		super();
 		this.object = object;
@@ -88,7 +95,9 @@
             session.getExecutionResult().getFactHandles().put( this.outIdentifier,
                                                          factHandle );
         }
-
+        if ( disconnected ){
+            ((DefaultFactHandle)factHandle).disconnect();
+        }
         return factHandle;
     }
     

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -16,6 +16,7 @@
 
 package org.drools.common;
 
+import java.io.Serializable;
 import java.util.Arrays;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -27,7 +28,6 @@
 import org.drools.core.util.StringUtils;
 import org.drools.reteoo.LeftTuple;
 import org.drools.reteoo.RightTuple;
-import org.drools.rule.EntryPoint;
 import org.drools.runtime.rule.WorkingMemoryEntryPoint;
 
 /**
@@ -39,7 +39,7 @@
 @XmlAccessorType(XmlAccessType.NONE)
 public class DefaultFactHandle
     implements
-    InternalFactHandle {
+    InternalFactHandle, Serializable {
     // ----------------------------------------------------------------------
     // Instance members
     // ----------------------------------------------------------------------

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DisconnectedWorkingMemoryEntryPoint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DisconnectedWorkingMemoryEntryPoint.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DisconnectedWorkingMemoryEntryPoint.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -1,12 +1,13 @@
 package org.drools.common;
 
+import java.io.Serializable;
 import java.util.Collection;
 
 import org.drools.runtime.ObjectFilter;
 import org.drools.runtime.rule.FactHandle;
 import org.drools.runtime.rule.WorkingMemoryEntryPoint;
 
-public class DisconnectedWorkingMemoryEntryPoint implements WorkingMemoryEntryPoint {
+public class DisconnectedWorkingMemoryEntryPoint implements WorkingMemoryEntryPoint, Serializable {
     
     private String id;
     

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnectorFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnectorFactory.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnectorFactory.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -311,7 +311,7 @@
 
             String[] connectorDetails = getConnectorDetails(connectorString);
             Class clazz = Class.forName(DISTRIBUTED_RIO_DIRECTORY_CONNECTOR_CLASS);
-            if(!"".equals(connectorDetails[3])){
+            if(connectorDetails.length > 3 && !"".equals(connectorDetails[3])){
                 Constructor constructor = clazz.getConstructor(String.class, SystemEventListener.class, String.class);
                 connector = (GenericNodeConnector) constructor.newInstance(connectorString,
                         SystemEventListenerFactory.getSystemEventListener(),

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/internal/GenericMessageHandlerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/internal/GenericMessageHandlerImpl.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/internal/GenericMessageHandlerImpl.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -9,13 +9,13 @@
 import org.drools.command.impl.GenericCommand;
 import org.drools.runtime.impl.ExecutionResultImpl;
 
-public class GenericMessageHandlerImpl implements GenericMessageHandler { 
+public class GenericMessageHandlerImpl implements GenericMessageHandler {
+
     private SystemEventListener systemEventListener;
+    private NodeData data;
 
-    private NodeData  data;
-
     public GenericMessageHandlerImpl(NodeData data,
-                                 SystemEventListener systemEventListener) {
+            SystemEventListener systemEventListener) {
         this.systemEventListener = systemEventListener;
         this.data = data;
     }
@@ -24,44 +24,51 @@
      * @see org.drools.vsm.GenericMessageHandler#messageReceived(org.drools.vsm.GenericIoWriter, org.drools.vsm.Message)
      */
     public void messageReceived(GenericIoWriter session,
-                                Message msg) throws Exception {
-        systemEventListener.debug( "Message receieved : " + msg );
+            Message msg) throws Exception {
+        systemEventListener.debug("Message receieved : " + msg);
 
 
         // we always need to process a List, for genericity, but don't force a List on the payload
-        List<GenericCommand> commands;
-        if ( msg.getPayload() instanceof List ) {
-            commands = (List<GenericCommand>) msg.getPayload();
-        } else {
-            commands = new ArrayList<GenericCommand>();
-            commands.add( (GenericCommand) msg.getPayload() );
-        }
+//        List<GenericCommand> commands;
+//        if ( msg.getPayload() instanceof List ) {
+//            commands = (List<GenericCommand>) msg.getPayload();
+//        } else {
+//            commands = new ArrayList<GenericCommand>();
+//            commands.add( (GenericCommand) msg.getPayload() );
+//        }
+        GenericCommand command = (GenericCommand) msg.getPayload();
 
         // Setup the evaluation context 
-        ContextImpl localSessionContext = new ContextImpl( "session_" + msg.getSessionId(),
-                                                           this.data.getContextManager(),
-                                                           this.data.getTemp() );        
+        ContextImpl localSessionContext = new ContextImpl("session_" + msg.getSessionId(),
+                this.data.getContextManager(),
+                this.data.getTemp());
         ExecutionResultImpl localKresults = new ExecutionResultImpl();
-        localSessionContext.set( "kresults_" + msg.getSessionId(),
-                                 localKresults );
-        
-        for ( GenericCommand cmd : commands ) {
-            // evaluate the commands
-            cmd.execute( localSessionContext );
-        }
+        localSessionContext.set("kresults_" + msg.getSessionId(),
+                localKresults);
 
-        if ( !msg.isAsync() && localKresults.getIdentifiers().isEmpty() ) {
-            // if it's not an async invocation and their are no results, just send a simple notification message
-            session.write( new Message( msg.getSessionId(),
-                                        msg.getResponseId(),
-                                        msg.isAsync(),
-                                        new FinishedCommand() ), null );
-        } else {
-            // return the payload
-            session.write( new Message( msg.getSessionId(),
-                                        msg.getResponseId(),
-                                        msg.isAsync(),
-                                        localKresults ), null );
-        }
+        //for ( GenericCommand cmd : commands ) {
+        // evaluate the commands
+            
+        Object result = command.execute(localSessionContext);
+        //}
+
+        session.write(new Message(msg.getSessionId(),
+                msg.getResponseId(),
+                msg.isAsync(),
+                result), null);
+
+//        if ( !msg.isAsync() && localKresults.getIdentifiers().isEmpty() ) {
+//            // if it's not an async invocation and their are no results, just send a simple notification message
+//            session.write( new Message( msg.getSessionId(),
+//                                        msg.getResponseId(),
+//                                        msg.isAsync(),
+//                                        new FinishedCommand() ), null );
+//        } else {
+//            // return the payload
+//            session.write( new Message( msg.getSessionId(),
+//                                        msg.getResponseId(),
+//                                        msg.isAsync(),
+//                                        localKresults ), null );
+//        }
     }
 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/DirectoryLookupProviderGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/DirectoryLookupProviderGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/DirectoryLookupProviderGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -23,7 +23,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.drools.builder.DirectoryLookupFactoryService;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.grid.DirectoryNode;
 import org.drools.grid.GenericConnection;
@@ -65,7 +65,11 @@
             } else {
                 throw new IllegalArgumentException("Type is not supported for registration");
             }
-            Message msg = new Message(messageSession.getSessionId(), messageSession.getCounter().incrementAndGet(), false, new KnowledgeContextResolveFromContextCommand(new RegisterCommand(identifier, ((StatefulKnowledgeSessionGridClient) executor).getInstanceId(), type), null, null, null, null));
+            Message msg = new Message(messageSession.getSessionId(), 
+                                            messageSession.getCounter().incrementAndGet(),
+                                            false, new KnowledgeContextResolveFromContextCommand(
+                                                    new RegisterCommand(identifier, ((StatefulKnowledgeSessionGridClient) executor)
+                                                                        .getInstanceId(), type), null, null, null, null));
 
             for (DirectoryNode directory : connection.getDirectoryNodes()) {
                 try {
@@ -81,9 +85,9 @@
             }
             try {
                 Object object = currentConnector.write(msg).getPayload();
-                if (!(object instanceof FinishedCommand)) {
-                    throw new RuntimeException("Response was not correctly ended");
-                }
+//                if (!(object instanceof FinishedCommand)) {
+//                    throw new RuntimeException("Response was not correctly ended");
+//                }
             } catch (Exception e) {
                 throw new RuntimeException("Unable to execute message", e);
             }
@@ -132,7 +136,7 @@
                 if (object == null) {
                     throw new RuntimeException("Response was not correctly received");
                 }
-                String value = (String) ((ExecutionResults) object).getValue(commandId);
+                String value = (String) object;
                 String type = String.valueOf(value.charAt(0));
                 String instanceId = value.substring(2);
 

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -87,13 +87,14 @@
 
 
         // we always need to process a List, for genericity, but don't force a List on the payload
-        List<GenericCommand> commands;
-        if ( msg.getPayload() instanceof List ) {
-            commands = (List<GenericCommand>) msg.getPayload();
-        } else {
-            commands = new ArrayList<GenericCommand>();
-            commands.add( (GenericCommand) msg.getPayload() );
-        }
+//        List<GenericCommand> commands;
+//        if ( msg.getPayload() instanceof List ) {
+//            commands = (List<GenericCommand>) msg.getPayload();
+//        } else {
+//            commands = new ArrayList<GenericCommand>();
+//            commands.add( (GenericCommand) msg.getPayload() );
+//        }
+        GenericCommand command = (GenericCommand) msg.getPayload();
 
         // Setup the evaluation context 
         ContextImpl localSessionContext = new ContextImpl( "session_" + msg.getSessionId(),
@@ -105,31 +106,40 @@
         //@TODO: replace with Environment ?? this needs to change..
         localSessionContext.set("registry", directory);
         
-        for ( GenericCommand cmd : commands ) {
-            // evaluate the commands
-            cmd.execute( localSessionContext );
-        }
+//        for ( GenericCommand cmd : commands ) {
+//            // evaluate the commands
+//            cmd.execute( localSessionContext );
+//        }
 
+        Object result = command.execute( localSessionContext );
+
+
         if(localSessionContext.get("kbase") != null){
             session.write( new Message( msg.getSessionId(),
                                         msg.getResponseId(),
                                         msg.isAsync(),
                                         localSessionContext.get("kbase") ), null );
-        
-        } else if ( !msg.isAsync() && localKresults.getIdentifiers().isEmpty() ) {
-            // if it's not an async invocation and their are no results, just send a simple notification message
-            session.write( new Message( msg.getSessionId(),
+            return;
+        }
+        session.write( new Message( msg.getSessionId(),
                                         msg.getResponseId(),
                                         msg.isAsync(),
-                                        new FinishedCommand() ), null );
+                                        result ), null );
 
-
-        }  else{
-            // return the payload
-            session.write( new Message( msg.getSessionId(),
-                                        msg.getResponseId(),
-                                        msg.isAsync(),
-                                        localKresults ), null );
-        }
+//        else if ( !msg.isAsync() && localKresults.getIdentifiers().isEmpty() ) {
+//            // if it's not an async invocation and their are no results, just send a simple notification message
+//            session.write( new Message( msg.getSessionId(),
+//                                        msg.getResponseId(),
+//                                        msg.isAsync(),
+//                                        new FinishedCommand() ), null );
+//
+//
+//        }  else{
+//            // return the payload
+//            session.write( new Message( msg.getSessionId(),
+//                                        msg.getResponseId(),
+//                                        msg.isAsync(),
+//                                        localKresults ), null );
+//        }
     }
 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -11,7 +11,7 @@
 import java.util.UUID;
 
 import org.drools.KnowledgeBase;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeBaseAddKnowledgePackagesCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.command.SetVariableCommand;
@@ -87,9 +87,9 @@
         try {
             Object object = connector.write(msg).getPayload();
 
-            if (!(object instanceof FinishedCommand)) {
-                throw new RuntimeException("Response was not correctly ended");
-            }
+//            if (!(object instanceof FinishedCommand)) {
+//                throw new RuntimeException("Response was not correctly ended");
+//            }
 
         } catch (Exception e) {
             throw new RuntimeException("Unable to execute message",
@@ -149,9 +149,9 @@
         try {
             Object object = connector.write(msg).getPayload();
 
-            if (!(object instanceof FinishedCommand)) {
-                throw new RuntimeException("Response was not correctly ended");
-            }
+//            if (!(object instanceof FinishedCommand)) {
+//                throw new RuntimeException("Response was not correctly ended");
+//            }
 
         } catch (Exception e) {
             throw new RuntimeException("Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseProviderGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseProviderGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBaseProviderGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -9,7 +9,7 @@
 import org.drools.KnowledgeBaseFactory;
 import org.drools.KnowledgeBaseFactoryService;
 
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.NewKnowledgeBaseCommand;
 import org.drools.command.SetVariableCommand;
 import org.drools.grid.GenericConnection;
@@ -33,8 +33,6 @@
         
         this.connection = connection;
         this.messageSession = new MessageSession();
-        //this.connector = new DistributedRioNodeConnector("client 1", SystemEventListenerFactory.getSystemEventListener(),
-        //                                    ((DistributedRioNodeConnector)connector).getExecutionNodeService());
         this.connector = connector;
 
     }
@@ -64,9 +62,9 @@
         try {
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -8,14 +8,13 @@
 import org.drools.builder.KnowledgeBuilderErrors;
 import org.drools.builder.ResourceConfiguration;
 import org.drools.builder.ResourceType;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.command.builder.KnowledgeBuilderAddCommand;
 import org.drools.command.builder.KnowledgeBuilderGetErrorsCommand;
 import org.drools.command.builder.KnowledgeBuilderHasErrorsCommand;
 import org.drools.definition.KnowledgePackage;
 import org.drools.io.Resource;
-import org.drools.runtime.ExecutionResults;
 import org.drools.grid.internal.CollectionClient;
 import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.internal.Message;
@@ -63,9 +62,9 @@
         try {
             Object object = client.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
@@ -94,7 +93,7 @@
                 throw new RuntimeException( "Response was not correctly received" );
             }
 
-            return (KnowledgeBuilderErrors) ((ExecutionResults) object).getValue( commandId );            
+            return (KnowledgeBuilderErrors)  object;            
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
@@ -127,7 +126,7 @@
                 throw new RuntimeException( "Response was not correctly received" );
             }
 
-            return (Boolean) ((ExecutionResults) object).getValue( commandId );
+            return (Boolean) object;
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderProviderGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderProviderGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/KnowledgeBuilderProviderGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -14,7 +14,7 @@
 import org.drools.builder.KnowledgeBuilder;
 import org.drools.builder.KnowledgeBuilderConfiguration;
 import org.drools.builder.KnowledgeBuilderFactoryService;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.SetVariableCommand;
 import org.drools.command.builder.NewKnowledgeBuilderCommand;
 import org.drools.grid.GenericConnection;
@@ -34,8 +34,6 @@
 
     public KnowledgeBuilderProviderGridClient(GenericNodeConnector connector, GenericConnection connection) {
             this.messageSession = new MessageSession();
-            //client = new DistributedRioNodeConnector("client 1", SystemEventListenerFactory.getSystemEventListener(),
-              //                                      ((DistributedRioNodeConnector)connector).getExecutionNodeService());
             this.connector = connector;
         
     }
@@ -58,9 +56,9 @@
         try {
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/StatefulKnowledgeSessionGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/StatefulKnowledgeSessionGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/StatefulKnowledgeSessionGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -7,7 +7,7 @@
 import org.drools.KnowledgeBase;
 import org.drools.command.Command;
 import org.drools.command.ExecuteCommand;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.command.runtime.GetGlobalCommand;
 import org.drools.command.runtime.SetGlobalCommand;
@@ -226,9 +226,9 @@
                 throw new RuntimeException( "Response was not correctly received = null" );
             }
 
-            if ( !(result instanceof FinishedCommand)) {
-                throw new RuntimeException( "Response was not correctly received" );
-            }
+//            if ( !(result instanceof FinishedCommand)) {
+//                throw new RuntimeException( "Response was not correctly received" );
+//            }
 
             
         } catch ( Exception e ) {
@@ -371,7 +371,7 @@
                                                                                    kresultsId ) );
          try {
              Object payload = connector.write( msg ).getPayload();
-             WorkItemManager workItemManager = (WorkItemManager) ((ExecutionResults) payload).getValue( "workItemManager" );
+             WorkItemManager workItemManager = (WorkItemManager)  payload;
              ((WorkItemManagerGridClient)workItemManager).setClient(connector);
              ((WorkItemManagerGridClient)workItemManager).setMessageSession(messageSession);
              ((WorkItemManagerGridClient)workItemManager).setInstanceId(instanceId);
@@ -430,7 +430,7 @@
                 throw new RuntimeException( "Response was not correctly received" );
             }
 
-            return (ProcessInstance) ((ExecutionResults) object).getValue( processId );
+            return (ProcessInstance) object;
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
                                         e );

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkItemManagerGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkItemManagerGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkItemManagerGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -22,8 +22,8 @@
 
 	private static final long serialVersionUID = 1L;
 	
-	//private GridExecutionNodeConnection nodeConnection;
-        private GenericNodeConnector client;
+	
+        private GenericNodeConnector connector;
         private MessageSession messageSession;
 	private String instanceId;
 
@@ -42,7 +42,7 @@
                                                                                   instanceId,
                                                                                   kresultsId ) );
         try {
-            client.write( msg );
+            connector.write( msg );
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message", e );
         }
@@ -53,7 +53,7 @@
 	}
 
         public void setClient(GenericNodeConnector client) {
-            this.client = client;
+            this.connector = client;
         }
 
         public void setMessageSession(MessageSession messageSession) {

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkingMemoryEntryPointGridClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkingMemoryEntryPointGridClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-api/src/main/java/org/drools/grid/distributed/WorkingMemoryEntryPointGridClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -21,15 +21,11 @@
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.WorkingMemoryEntryPoint;
-import org.drools.command.ExecuteCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
-import org.drools.command.runtime.rule.InsertObjectCommand;
 import org.drools.command.runtime.rule.InsertObjectInEntryPointCommand;
-import org.drools.common.DisconnectedFactHandle;
 import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.internal.Message;
 import org.drools.grid.internal.MessageSession;
-import org.drools.runtime.ExecutionResults;
 import org.drools.runtime.ObjectFilter;
 
 /**
@@ -38,12 +34,12 @@
  */
 public class WorkingMemoryEntryPointGridClient implements WorkingMemoryEntryPoint{
 
-     private GenericNodeConnector     client;
+     private GenericNodeConnector     connector;
     private MessageSession              messageSession;
     private String                      instanceId;
 
-    public WorkingMemoryEntryPointGridClient(String instanceId, GenericNodeConnector client, MessageSession messageSession) {
-        this.client = client;
+    public WorkingMemoryEntryPointGridClient(String instanceId, GenericNodeConnector connector, MessageSession messageSession) {
+        this.connector = connector;
         this.messageSession = messageSession;
         this.instanceId = instanceId;
     }
@@ -64,13 +60,13 @@
                                                                                   kresultsId ) );
 
         try {
-            Object result = client.write( msg ).getPayload();
+            Object result = connector.write( msg ).getPayload();
             if ( object == null ) {
                 throw new RuntimeException( "Response was not correctly received" );
             }
-            FactHandle handle = new DisconnectedFactHandle(((ExecutionResults) result).getFactHandle( String.valueOf(object.hashCode()) ).toString()) ;
+             
             
-            return  handle;
+            return (FactHandle) result;
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
                                         e );

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-dir-rio/src/main/resources/org/drools/directoryNodeService.groovy
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-dir-rio/src/main/resources/org/drools/directoryNodeService.groovy	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-dir-rio/src/main/resources/org/drools/directoryNodeService.groovy	2010-08-14 15:02:39 UTC (rev 34715)
@@ -19,9 +19,8 @@
      * classifier used for the 'download' jar */
     artifact id:'service-dir', 'org.drools:drools-grid-distributed-dir-rio:5.2.0.SNAPSHOT'
     artifact id:'service-dir-dl', 'org.drools:drools-grid-distributed-dir-rio:dl:5.2.0.SNAPSHOT'
-    artifact id:'service', 'org.drools:drools-grid-distributed-rio:5.2.0.SNAPSHOT'
-    artifact id:'service-dl', 'org.drools:drools-grid-distributed-rio:dl:5.2.0.SNAPSHOT'
-
+   // artifact id:'service', 'org.drools:drools-grid-distributed-rio:5.2.0.SNAPSHOT'
+   // artifact id:'service-dl', 'org.drools:drools-grid-distributed-rio:dl:5.2.0.SNAPSHOT'
     /*
      * Declare the service to be deployed. The number of instances deployed
      * defaults to 1. If you require > 1 instances change as needed

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/pom.xml	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/pom.xml	2010-08-14 15:02:39 UTC (rev 34715)
@@ -36,13 +36,11 @@
         <dependency>
             <groupId>org.drools</groupId>
             <artifactId>drools-grid-api</artifactId>
-            <version>5.2.0.SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>org.drools</groupId>
             <artifactId>drools-grid-distributed-api</artifactId>
-            <version>5.2.0.SNAPSHOT</version>
         </dependency>
 
         <dependency>
@@ -138,7 +136,7 @@
 
                         <property>
                             <name>opstring</name>
-                            <value>src/main/resources/org/drools/executionNodeService.groovy</value>
+                            <value>src/test/resources/org/drools/executionNodeServiceTest.groovy</value>
                         </property>
                         <property>
                             <name>org.rioproject.test.config</name>

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/main/java/org/drools/grid/distributed/impl/DistributedRioNodeConnector.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/main/java/org/drools/grid/distributed/impl/DistributedRioNodeConnector.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/main/java/org/drools/grid/distributed/impl/DistributedRioNodeConnector.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -75,6 +75,7 @@
 
     
     public Message write(Message msg) throws ConnectorException, RemoteException {
+        connect();
         if (executionNodeService != null) {
 
 

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-distributed-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -279,7 +279,7 @@
 
         System.out.println("Let's go for the Second ksession");
         //Switching to another node
-        node = connection.getExecutionNode(null);
+        node = connection.getExecutionNode();
 
         KnowledgeBuilder kbuilder2 = node.get(KnowledgeBuilderFactoryService.class).newKnowledgeBuilder();
         Assert.assertNotNull(kbuilder2);

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/pom.xml	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/pom.xml	2010-08-14 15:02:39 UTC (rev 34715)
@@ -30,7 +30,6 @@
         <dependency>
             <groupId>org.drools</groupId>
             <artifactId>drools-grid-api</artifactId>
-            <version>5.2.0.SNAPSHOT</version>
         </dependency>
 
          <!-- REMOVE -->

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/DirectoryLookupProviderRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/DirectoryLookupProviderRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/DirectoryLookupProviderRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -22,7 +22,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.drools.builder.DirectoryLookupFactoryService;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.grid.DirectoryNodeService;
 import org.drools.runtime.CommandExecutor;
@@ -86,9 +86,9 @@
             try {
                 connector.connect();
                 Object object = connector.write(msg).getPayload();
-                if (!(object instanceof FinishedCommand)) {
-                    throw new RuntimeException("Response was not correctly ended");
-                }
+//                if (!(object instanceof FinishedCommand)) {
+//                    throw new RuntimeException("Response was not correctly ended");
+//                }
                 connector.disconnect();
             } catch (Exception e) {
                 throw new RuntimeException("Unable to execute message", e);
@@ -131,7 +131,7 @@
                 if (object == null) {
                     throw new RuntimeException("Response was not correctly received");
                 }
-                String value = (String) ((ExecutionResults) object).getValue(commandId);
+                String value = (String)  object;
                 String type = String.valueOf(value.charAt(0));
                 String instanceId = value.substring(2);
                 CommandExecutor executor = null;
@@ -202,9 +202,9 @@
             try {
                 connector.connect();
                 Object object = connector.write(msg).getPayload();
-                if (!(object instanceof FinishedCommand)) {
-                    throw new RuntimeException("Response was not correctly ended");
-                }
+//                if (!(object instanceof FinishedCommand)) {
+//                    throw new RuntimeException("Response was not correctly ended");
+//                }
                 connector.disconnect();
             } catch (Exception e) {
                 throw new RuntimeException("Unable to execute message", e);

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseProviderRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseProviderRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseProviderRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -10,7 +10,7 @@
 import org.drools.KnowledgeBaseConfiguration;
 import org.drools.KnowledgeBaseFactory;
 import org.drools.KnowledgeBaseFactoryService;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.NewKnowledgeBaseCommand;
 import org.drools.command.SetVariableCommand;
 import org.drools.grid.ConnectorException;
@@ -56,9 +56,9 @@
             connector.connect();
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
             connector.disconnect();
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
@@ -107,9 +107,9 @@
             connector.connect();
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
             connector.disconnect();
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
@@ -150,9 +150,9 @@
             connector.connect();
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
             connector.disconnect();
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBaseRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -4,7 +4,7 @@
 import java.util.UUID;
 
 import org.drools.KnowledgeBase;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeBaseAddKnowledgePackagesCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.command.NewStatefulKnowledgeSessionCommand;
@@ -56,9 +56,9 @@
             connector.connect();
             Object object = connector.write(msg).getPayload();
 
-            if (!(object instanceof FinishedCommand)) {
-                throw new RuntimeException("Response was not correctly ended");
-            }
+//            if (!(object instanceof FinishedCommand)) {
+//                throw new RuntimeException("Response was not correctly ended");
+//            }
             connector.disconnect();
         } catch (Exception e) {
             throw new RuntimeException("Unable to execute message",
@@ -119,9 +119,9 @@
             connector.connect();
             Object object = connector.write(msg).getPayload();
 
-            if (!(object instanceof FinishedCommand)) {
-                throw new RuntimeException("Response was not correctly ended");
-            }
+//            if (!(object instanceof FinishedCommand)) {
+//                throw new RuntimeException("Response was not correctly ended");
+//            }
             connector.disconnect();
         } catch (Exception e) {
             throw new RuntimeException("Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderProviderRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderProviderRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderProviderRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -13,7 +13,7 @@
 import org.drools.builder.KnowledgeBuilder;
 import org.drools.builder.KnowledgeBuilderConfiguration;
 import org.drools.builder.KnowledgeBuilderFactoryService;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.SetVariableCommand;
 import org.drools.command.builder.NewKnowledgeBuilderCommand;
 import org.drools.grid.GenericNodeConnector;
@@ -51,9 +51,9 @@
             connector.connect();
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
             connector.disconnect();
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/KnowledgeBuilderRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -7,7 +7,7 @@
 import org.drools.builder.KnowledgeBuilderErrors;
 import org.drools.builder.ResourceConfiguration;
 import org.drools.builder.ResourceType;
-import org.drools.command.FinishedCommand;
+//import org.drools.command.FinishedCommand;
 import org.drools.command.KnowledgeContextResolveFromContextCommand;
 import org.drools.command.builder.KnowledgeBuilderAddCommand;
 import org.drools.command.builder.KnowledgeBuilderGetErrorsCommand;
@@ -60,9 +60,9 @@
             connector.connect();
             Object object = connector.write( msg ).getPayload();
 
-            if ( !(object instanceof FinishedCommand) ) {
-                throw new RuntimeException( "Response was not correctly ended" );
-            }
+//            if ( !(object instanceof FinishedCommand) ) {
+//                throw new RuntimeException( "Response was not correctly ended" );
+//            }
             connector.disconnect();
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",
@@ -126,7 +126,8 @@
                 throw new RuntimeException( "Response was not correctly received" );
             }
             connector.disconnect();
-            return (Boolean) ((ExecutionResults) object).getValue( commandId );
+            //return (Boolean) ((ExecutionResults) object).getValue( commandId );
+            return (Boolean) object;
 
         } catch ( Exception e ) {
             throw new RuntimeException( "Unable to execute message",

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/StatefulKnowledgeSessionRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/StatefulKnowledgeSessionRemoteClient.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/StatefulKnowledgeSessionRemoteClient.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -12,6 +12,7 @@
 import org.drools.command.runtime.GetGlobalCommand;
 import org.drools.command.runtime.SetGlobalCommand;
 import org.drools.command.runtime.rule.InsertObjectCommand;
+import org.drools.common.DefaultFactHandle;
 import org.drools.common.DisconnectedFactHandle;
 import org.drools.grid.internal.commands.RegisterRemoteWorkItemHandlerCommand;
 import org.drools.event.process.ProcessEventListener;
@@ -95,7 +96,8 @@
                 throw new RuntimeException("Response was not correctly received");
             }
             connector.disconnect();
-            return (Integer) ((ExecutionResults) object).getValue(commandId);
+            //return (Integer) ((ExecutionResults) object).getValue(commandId);
+            return (Integer)  object;
         } catch (Exception e) {
             throw new RuntimeException("Unable to execute message",
                     e);
@@ -332,7 +334,7 @@
         Message msg = new Message(messageSession.getSessionId(),
                 messageSession.counter.incrementAndGet(),
                 false,
-                new KnowledgeContextResolveFromContextCommand(new InsertObjectCommand(object, String.valueOf(object.hashCode())),
+                new KnowledgeContextResolveFromContextCommand(new InsertObjectCommand(object, true),
                 null,
                 null,
                 instanceId,
@@ -344,7 +346,8 @@
             if (object == null) {
                 throw new RuntimeException("Response was not correctly received");
             }
-            FactHandle handle = new DisconnectedFactHandle(((ExecutionResults) result).getFactHandle(String.valueOf(object.hashCode())).toString());
+            DefaultFactHandle handle = (DefaultFactHandle) result;
+            
             connector.disconnect();
             return handle;
         } catch (Exception e) {

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-dir-mina/src/main/java/org/drools/grid/remote/directory/DirectoryServerMessageHandlerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-dir-mina/src/main/java/org/drools/grid/remote/directory/DirectoryServerMessageHandlerImpl.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-dir-mina/src/main/java/org/drools/grid/remote/directory/DirectoryServerMessageHandlerImpl.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -63,11 +63,11 @@
                     directory.unregister(executorId);
                     
 
-                    SimpleCommand resultsCmnd = new SimpleCommand(cmd.getId(), SimpleCommandName.OperationResponse, null);
-                    session.write(new Message( msg.getSessionId(),
-                                        msg.getResponseId(),
-                                        msg.isAsync(),
-                                        resultsCmnd ), null);
+//                    SimpleCommand resultsCmnd = new SimpleCommand(cmd.getId(), SimpleCommandName.OperationResponse, null);
+//                    session.write(new Message( msg.getSessionId(),
+//                                        msg.getResponseId(),
+//                                        msg.isAsync(),
+//                                        resultsCmnd ), null);
 
                     break;
                 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/GridTopology.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/GridTopology.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/GridTopology.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -74,6 +74,8 @@
     }
 
     /*
+     * @param name: name associated to this ExecutionEnvironment
+     * @param provider: used to create a new ExecutionEnvironment instance
      * This method will register a new Execution Environment based on the configured Provider.
      * The provider will contain all the information to be able to establish a connection with it.
      * The following steps are executed inside this method:
@@ -118,6 +120,7 @@
     }
 
     /*
+     * @param name: of the ExecutionEnvironment to unregister
      * This method unregister the Execution Environment from this running instance of the grid topology
      * based on the name. The following steps are executed in order to unregister
      * an ExecutionEnvironment from the GridTopology:
@@ -344,6 +347,7 @@
     }
 
     /*
+     * @param name: of the TaskServiceInstance that we want to unregister
      * Unregister a TaskServer Instance from this running GridTopology
      * This method unregister the TaskServer Instance from this running instance of the grid topology
      * based on the name. The following steps are executed in order to unregister
@@ -438,6 +442,8 @@
     }
 
     /*
+     * @param name: that will be associated with the resource id
+     * @param resourceId: Id of the resource that we want to associate with the name
      * Register the resource id (ExecutionEnvironment, DirectoryInstance, TaskServerInstance)
      * inside all the current available directory instances.
      */
@@ -464,6 +470,7 @@
         }
     }
     /*
+     * @param name: of the resource that we want to unregister from current Directories
      * Unregister a resource (ExecutionEnvironment, DirectoryInstance, TaskServerInstance)
      * from all the current available directory instances.
      */

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/TaskServerInstanceByPrioritySelectionStrategy.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/TaskServerInstanceByPrioritySelectionStrategy.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/TaskServerInstanceByPrioritySelectionStrategy.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -17,19 +17,14 @@
 
 package org.drools.grid.services.strategies;
 
-import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.drools.grid.ConnectorException;
 
 import org.drools.grid.ConnectorType;
-import org.drools.grid.services.DirectoryInstance;
 import org.drools.grid.services.TaskServerInstance;
 
 

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterMinaDirectoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterMinaDirectoryTest.java	2010-08-13 23:03:59 UTC (rev 34714)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterMinaDirectoryTest.java	2010-08-14 15:02:39 UTC (rev 34715)
@@ -154,7 +154,6 @@
 
         Assert.assertEquals(3, dirMap.size());
 
-        System.out.println("dir.getDirectoryMap() = " + dirMap);
 
         Assert.assertEquals(3, dirMap.size());
         Assert.assertEquals(0, serverNode.getCurrentSessions());
@@ -279,6 +278,7 @@
 
         node.get(DirectoryLookupFactoryService.class).register("sessionName", ksession);
 
+        //We disconnect the grid in order to close all the active connections to remote services
         grid.disconnect();
 
         DirectoryInstance directoryInstance = grid.getDirectoryInstance();



More information about the jboss-svn-commits mailing list