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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Aug 8 17:36:59 EDT 2010


Author: salaboy21
Date: 2010-08-08 17:36:58 -0400 (Sun, 08 Aug 2010)
New Revision: 34592

Added:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/grid/HumanTaskNode.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaConnectionNode.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaConnectionHumanTask.java
Removed:
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/strategies/StaticIncrementalDirectorySelectionStrategy.java
   labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/RemoteConnectionNode.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/ReturnFirstHumanTaskServiceSelectionStrategy.java
Modified:
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnection.java
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GridConnection.java
   labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/NodeFactory.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-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaNodeConnector.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/DirectoryInstance.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/ExecutionEnvironment.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/TaskServerInstance.java
   labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterDirectoryTest.java
   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/RegisterTaskTest.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandler.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceImpl.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceProviderRemoteClient.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaHumanTaskConnector.java
   labs/jbossrules/trunk/drools-grid/drools-grid-task/src/test/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandlerTest.java
Log:
JBRULES-2617: Drools Grid - Unify the HumanTask services with ExecutionEnvironments and DirectoryInstance
	- Unifying the HumanTaskNode, done

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/grid/HumanTaskNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/grid/HumanTaskNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/grid/HumanTaskNode.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -0,0 +1,71 @@
+/*
+ *  Copyright 2010 salaboy.
+ * 
+ *  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.
+ *  under the License.
+ */
+
+package org.drools.grid;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ *
+ * @author salaboy
+ */
+public class HumanTaskNode {
+    private String id;
+    private final Map<Class<?>, Object> services = new ConcurrentHashMap<Class<?>, Object>();
+
+    public HumanTaskNode() {
+        this.id = UUID.randomUUID().toString();
+    }
+
+    public HumanTaskNode(String id) {
+        this.id = id;
+    }
+
+    public <T> T get(Class<T> interfaceClass) {
+        synchronized (interfaceClass) {
+            Object service = services.get(interfaceClass);
+            if (service == null) {
+                try {
+                    Class<?> implementingClass = Class.forName(interfaceClass.getCanonicalName() + "Impl");
+
+                    service = implementingClass.newInstance();
+                    services.put(interfaceClass, service);
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            return interfaceClass.cast(service);
+        }
+    }
+
+    public <T> void set(Class<T> interfaceClass, T provider) {
+        synchronized (interfaceClass) {
+            services.put(interfaceClass, provider);
+        }
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnection.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnection.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GenericConnection.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -18,10 +18,9 @@
 
 import java.util.List;
 import org.drools.grid.strategies.NodeSelectionStrategy;
-import org.drools.grid.strategies.DirectorySelectionStrategy;
-import org.drools.grid.strategies.HumanTaskSelectionStrategy;
 
 
+
 /**
  *
  * @author salaboy
@@ -33,7 +32,7 @@
 
     public void addDirectoryNode(GenericNodeConnector directoryNodeConnector);
 
-    public void addHumanTaskNode(GenericHumanTaskConnector humanTaskNodeConnector);
+    public void addHumanTaskNode(GenericNodeConnector humanTaskNodeConnector);
 
     //Get ExecutionNode(s) with live connections
     public ExecutionNode getExecutionNode(NodeSelectionStrategy strategy) throws ConnectorException;
@@ -43,18 +42,18 @@
     public List<ExecutionNode> getExecutionNodes() throws ConnectorException;
 
     //Get DirectoryNode(s) with live connections
-    public DirectoryNode getDirectoryNode(DirectorySelectionStrategy directorySelectionStrategy) throws ConnectorException;
+    public DirectoryNode getDirectoryNode(NodeSelectionStrategy strategy) throws ConnectorException;
 
     public DirectoryNode getDirectoryNode() throws ConnectorException;
 
     public List<DirectoryNode> getDirectoryNodes() throws ConnectorException;
 
     //Get HumanTaskNode(s) with live connections
-    public HumanTaskNodeService getHumanTaskNode(HumanTaskSelectionStrategy humanTaskSelectionStrategy) throws ConnectorException;
+    public HumanTaskNode getHumanTaskNode(NodeSelectionStrategy strategy) throws ConnectorException;
 
-    public HumanTaskNodeService getHumanTaskNode() throws ConnectorException;
+    public HumanTaskNode getHumanTaskNode() throws ConnectorException;
 
-    public List<HumanTaskNodeService> getHumanTaskNodes() throws ConnectorException;
+    public List<HumanTaskNode> getHumanTaskNodes() throws ConnectorException;
 
     // Dispose all the live connections
     public void dispose() throws ConnectorException;

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GridConnection.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GridConnection.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/GridConnection.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -22,12 +22,11 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.drools.grid.strategies.DirectorySelectionStrategy;
-import org.drools.grid.strategies.HumanTaskSelectionStrategy;
+
 import org.drools.grid.strategies.NodeSelectionStrategy;
-import org.drools.grid.strategies.StaticIncrementalDirectorySelectionStrategy;
-import org.drools.grid.strategies.StaticIncrementalNodeSelectionStrategy;
+import org.drools.grid.strategies.ReturnAlwaysTheFirstSelectionStrategy;
 
+
 /**
  *
  * @author salaboy
@@ -36,12 +35,13 @@
 
     private List<GenericNodeConnector> executionNodeConnectors;
     private List<GenericNodeConnector> directoryNodeConnectors;
-    private List<GenericHumanTaskConnector> humanTaskNodeConnectors;
+    private List<GenericNodeConnector> humanTaskNodeConnectors;
+    private NodeSelectionStrategy defaultStrategy = new ReturnAlwaysTheFirstSelectionStrategy();
 
     public GridConnection() {
         this.executionNodeConnectors = new ArrayList<GenericNodeConnector>();
         this.directoryNodeConnectors = new ArrayList<GenericNodeConnector>();
-        this.humanTaskNodeConnectors = new ArrayList<GenericHumanTaskConnector>();
+        this.humanTaskNodeConnectors = new ArrayList<GenericNodeConnector>();
     }
 
     public void addExecutionNode(GenericNodeConnector execNodeConnector) {
@@ -53,7 +53,7 @@
 
     }
 
-    public void addHumanTaskNode(GenericHumanTaskConnector humanTaskNodeConnector) {
+    public void addHumanTaskNode(GenericNodeConnector humanTaskNodeConnector) {
         this.humanTaskNodeConnectors.add(humanTaskNodeConnector);
     }
 
@@ -64,13 +64,9 @@
     public ExecutionNode getExecutionNode(NodeSelectionStrategy strategy) throws ConnectorException {
         ExecutionNode node = null;
         GenericNodeConnector connector = null;
-        //if the strategy is null use the default one
-        if (strategy == null) {
-            connector = getBestNode(new StaticIncrementalNodeSelectionStrategy());
-        } else {
-            connector = getBestNode(strategy);
-        }
 
+        connector = getBestNode(strategy);
+        
         NodeConnectionType type;
         try {
             type = connector.getNodeConnectionType();
@@ -88,21 +84,18 @@
 
         return node;
     }
+    
+    public ExecutionNode getExecutionNode() throws ConnectorException{
+        return getExecutionNode(defaultStrategy);
+    }
 
-    public DirectoryNode getDirectoryNode(DirectorySelectionStrategy strategy) throws ConnectorException {
+    public DirectoryNode getDirectoryNode(NodeSelectionStrategy strategy) throws ConnectorException {
 
 
         GenericNodeConnector connector = null;
-        //if the strategy is null use the default one
-
-
-        if (strategy == null) {
-            connector = getBestDirectory(new StaticIncrementalDirectorySelectionStrategy());
-        } else {
-            connector = getBestDirectory(strategy);
-        }
-
-
+        
+        connector = getBestDirectory(strategy);
+ 
         NodeConnectionType type;
         DirectoryNode directoryNode = null;
         try {
@@ -122,32 +115,39 @@
         return directoryNode;
     }
 
-    public DirectoryNode getDirectoryNode() throws ConnectorException {
-        return getDirectoryNode(null);
+    public DirectoryNode getDirectoryNode() throws ConnectorException{
+        return getDirectoryNode(defaultStrategy);
     }
 
-    public ExecutionNode getExecutionNode() throws ConnectorException {
-        return getExecutionNode(null);
-    }
+    public HumanTaskNode getHumanTaskNode(NodeSelectionStrategy strategy) throws ConnectorException {
 
-    public HumanTaskNodeService getHumanTaskNode(HumanTaskSelectionStrategy humanTaskSelectionStrategy) throws ConnectorException {
-        if (humanTaskNodeConnectors.isEmpty()) {
-            return null;
+        GenericNodeConnector connector = null;
+
+        connector = getBestHumanTask(strategy);
+
+        NodeConnectionType type;
+        HumanTaskNode humanTaskNode = null;
+        try {
+            type = connector.getNodeConnectionType();
+
+            connector.connect();
+
+            type.setConnector(connector);
+            type.setConnection(this);
+
+            humanTaskNode = NodeFactory.newHumanTaskNode(type);
+        } catch (RemoteException ex) {
+            Logger.getLogger(GridConnection.class.getName()).log(Level.SEVERE, null, ex);
         }
-        // humanTaskSelectionStrategy.getBestHumanTask(humanTaskNodeConnectors);
-        GenericHumanTaskConnector connector = humanTaskNodeConnectors.get(0);
 
-        connector.connect();
 
-        HumanTaskNodeService humanTaskNode = connector.getHumanTaskNodeService();
-
         return humanTaskNode;
 
     }
 
-    public HumanTaskNodeService getHumanTaskNode() throws ConnectorException {
-        return getHumanTaskNode(null);
-    }
+   public HumanTaskNode getHumanTaskNode() throws ConnectorException {
+       return getHumanTaskNode(defaultStrategy);
+   }
 
     public List<ExecutionNode> getExecutionNodes() throws ConnectorException {
         List<ExecutionNode> executionNodes = new ArrayList<ExecutionNode>();
@@ -187,7 +187,7 @@
 
     }
 
-    public List<HumanTaskNodeService> getHumanTaskNodes() {
+    public List<HumanTaskNode> getHumanTaskNodes() {
         throw new UnsupportedOperationException("not Implemented yet!");
     }
 
@@ -206,8 +206,12 @@
                 Logger.getLogger(GridConnection.class.getName()).log(Level.SEVERE, null, ex);
             }
         }
-        for (GenericHumanTaskConnector connector : humanTaskNodeConnectors) {
-            connector.disconnect();
+        for (GenericNodeConnector connector : humanTaskNodeConnectors) {
+            try {
+                connector.disconnect();
+            } catch (RemoteException ex) {
+                Logger.getLogger(GridConnection.class.getName()).log(Level.SEVERE, null, ex);
+            }
         }
 
     }
@@ -216,11 +220,11 @@
         return nodeSelectionStrategy.getBestNode(this.executionNodeConnectors);
     }
 
-    private GenericNodeConnector getBestDirectory(DirectorySelectionStrategy directorySelectionStrategy) {
-        return directorySelectionStrategy.getBestDirectory(this.directoryNodeConnectors);
+    private GenericNodeConnector getBestDirectory(NodeSelectionStrategy directorySelectionStrategy) {
+        return directorySelectionStrategy.getBestNode(this.directoryNodeConnectors);
     }
 
-    private GenericHumanTaskConnector getBestHumanTask(HumanTaskSelectionStrategy humanTaskSelectionStrategy) {
-        return humanTaskSelectionStrategy.getBestHumanTask(this.humanTaskNodeConnectors);
+    private GenericNodeConnector getBestHumanTask(NodeSelectionStrategy humanTaskSelectionStrategy) {
+        return humanTaskSelectionStrategy.getBestNode(this.humanTaskNodeConnectors);
     }
 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/NodeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/NodeFactory.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/NodeFactory.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -16,7 +16,6 @@
  */
 
 package org.drools.grid;
-
 /**
  *
  * @author salaboy
@@ -38,5 +37,14 @@
         }
         return node;
     }
+
+    public static HumanTaskNode newHumanTaskNode(NodeConnectionType type){
+        type.init();
+        HumanTaskNode node = new HumanTaskNode();
+        for(Class serviceClass : type.getServicesKeys()){
+            node.set(serviceClass, type.getServiceImpl(serviceClass));
+        }
+        return node;
+    }
    
 }

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-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/internal/GenericMessageHandlerImpl.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -9,7 +9,7 @@
 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;

Deleted: labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/strategies/StaticIncrementalDirectorySelectionStrategy.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/strategies/StaticIncrementalDirectorySelectionStrategy.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-api/src/main/java/org/drools/grid/strategies/StaticIncrementalDirectorySelectionStrategy.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -1,40 +0,0 @@
-/*
- *  Copyright 2010 salaboy.
- * 
- *  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.
- *  under the License.
- */
-package org.drools.grid.strategies;
-
-import java.util.List;
-import org.drools.grid.GenericNodeConnector;
-
-/**
- *
- * @author salaboy
- */
-public class StaticIncrementalDirectorySelectionStrategy implements DirectorySelectionStrategy {
-
-    public static int counter = 0;
-
-    public GenericNodeConnector getBestDirectory(List<GenericNodeConnector> connectors) {
-        if(counter >= connectors.size()){
-            counter = 0;
-        }
-        GenericNodeConnector connector = connectors.get(counter);
-        StaticIncrementalDirectorySelectionStrategy.counter = counter + 1;
-        
-        return connector;
-        
-    }
-}

Deleted: labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/RemoteConnectionNode.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/RemoteConnectionNode.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/RemoteConnectionNode.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -1,79 +0,0 @@
-/*
- *  Copyright 2010 salaboy.
- * 
- *  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.
- *  under the License.
- */
-
-package org.drools.grid.remote;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import org.drools.KnowledgeBaseFactoryService;
-import org.drools.builder.DirectoryLookupFactoryService;
-import org.drools.builder.KnowledgeBuilderFactoryService;
-import org.drools.grid.ConnectorType;
-import org.drools.grid.GenericConnection;
-import org.drools.grid.GenericNodeConnector;
-import org.drools.grid.NodeConnectionType;
-
-/**
- *
- * @author salaboy 
- */
-public class RemoteConnectionNode implements NodeConnectionType {
-    private final Map<Class<?>, Object> services = new ConcurrentHashMap<Class<?>, Object>();
-    private GenericNodeConnector connector;
-    private GenericConnection connection;
-
-    public RemoteConnectionNode() {
-        
-    }
-
-    
-    public RemoteConnectionNode(GenericNodeConnector connector, GenericConnection connection) {
-        
-        this.connector = connector;
-        this.connection = connection;
-        
-    }
-
-    public void init(){
-        services.put(KnowledgeBuilderFactoryService.class, new KnowledgeBuilderProviderRemoteClient(connector));
-        services.put(KnowledgeBaseFactoryService.class, new KnowledgeBaseProviderRemoteClient(connector));
-        services.put(DirectoryLookupFactoryService.class, new DirectoryLookupProviderRemoteClient(connector, connection));
-    }
-
-
-    public Set<Class<?>> getServicesKeys() {
-        return services.keySet(); 
-    }
-
-    public <T> T getServiceImpl(Class<T> clazz) {
-        return (T) services.get(clazz);
-    }
-
-    public void setConnector(GenericNodeConnector connector) {
-        this.connector = connector;
-    }
-
-    public void setConnection(GenericConnection connection) {
-        this.connection = connection;
-    }
-
-    public ConnectorType getConnectorType() {
-        return ConnectorType.REMOTE;
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaConnectionNode.java (from rev 34588, labs/jbossrules/trunk/drools-grid/drools-grid-remote-api/src/main/java/org/drools/grid/remote/RemoteConnectionNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaConnectionNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaConnectionNode.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2010 salaboy.
+ * 
+ *  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.
+ *  under the License.
+ */
+
+package org.drools.grid.remote.mina;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.drools.KnowledgeBaseFactoryService;
+import org.drools.builder.DirectoryLookupFactoryService;
+import org.drools.builder.KnowledgeBuilderFactoryService;
+import org.drools.grid.ConnectorType;
+import org.drools.grid.GenericConnection;
+import org.drools.grid.GenericNodeConnector;
+import org.drools.grid.NodeConnectionType;
+import org.drools.grid.remote.DirectoryLookupProviderRemoteClient;
+import org.drools.grid.remote.KnowledgeBaseProviderRemoteClient;
+import org.drools.grid.remote.KnowledgeBuilderProviderRemoteClient;
+
+/**
+ *
+ * @author salaboy 
+ */
+public class RemoteMinaConnectionNode implements NodeConnectionType {
+    private final Map<Class<?>, Object> services = new ConcurrentHashMap<Class<?>, Object>();
+    private GenericNodeConnector connector;
+    private GenericConnection connection;
+
+    public RemoteMinaConnectionNode() {
+        
+    }
+
+    
+    public RemoteMinaConnectionNode(GenericNodeConnector connector, GenericConnection connection) {
+        
+        this.connector = connector;
+        this.connection = connection;
+        
+    }
+
+    public void init(){
+        services.put(KnowledgeBuilderFactoryService.class, new KnowledgeBuilderProviderRemoteClient(connector));
+        services.put(KnowledgeBaseFactoryService.class, new KnowledgeBaseProviderRemoteClient(connector));
+        services.put(DirectoryLookupFactoryService.class, new DirectoryLookupProviderRemoteClient(connector, connection));
+    }
+
+
+    public Set<Class<?>> getServicesKeys() {
+        return services.keySet(); 
+    }
+
+    public <T> T getServiceImpl(Class<T> clazz) {
+        return (T) services.get(clazz);
+    }
+
+    public void setConnector(GenericNodeConnector connector) {
+        this.connector = connector;
+    }
+
+    public void setConnection(GenericConnection connection) {
+        this.connection = connection;
+    }
+
+    public ConnectorType getConnectorType() {
+        return ConnectorType.REMOTE;
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaNodeConnector.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaNodeConnector.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-remote-mina/src/main/java/org/drools/grid/remote/mina/RemoteMinaNodeConnector.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -25,7 +25,6 @@
 import org.drools.grid.internal.MessageResponseHandler;
 import org.drools.grid.internal.responsehandlers.BlockingMessageResponseHandler;
 import org.drools.grid.GridConnection;
-import org.drools.grid.remote.RemoteConnectionNode;
 
 public class RemoteMinaNodeConnector
         implements
@@ -145,7 +144,7 @@
     }
 
     public NodeConnectionType getNodeConnectionType() throws ConnectorException {
-        return new RemoteConnectionNode();
+        return new RemoteMinaConnectionNode();
     }
 
     public ConnectorType getConnectorType() {

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/DirectoryInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/DirectoryInstance.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/DirectoryInstance.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -7,42 +7,68 @@
 import org.drools.grid.GenericConnection;
 import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.strategies.DirectorySelectionStrategy;
+import org.drools.grid.strategies.NodeSelectionStrategy;
+import org.drools.grid.strategies.ReturnAlwaysTheFirstSelectionStrategy;
 
 /**
  * @author salaboy
+ *
+ * The DirectoryInstance class represent a remote/distributed Directory Service.
+ * Depending on the underlaying implementation each DirectoryInstance can encapsulate
+ * one or a set of Directory Nodes.
+ *
  */
 public class DirectoryInstance {
+
     private String name;
     private GenericNodeConnector connector;
+    private NodeSelectionStrategy defaultStrategy = new ReturnAlwaysTheFirstSelectionStrategy();
 
+    /*
+     * Creates a new DirectoryInstance using a name associated with it and a
+     * GenericNodeConnector that will be used to establish the remote/distribtued
+     * communication.
+     * @param name
+     * @param connector
+     */
     public DirectoryInstance(String name, GenericNodeConnector connector) {
         this.name = name;
         this.connector = connector;
     }
 
-    public DirectoryNode getDirectoryService() throws ConnectorException {
-        GenericConnection connection = getConnector().getConnection();
-        return connection.getDirectoryNode();
+    /*
+     * Get a DirectoryNode based on the default NodeSelectionStrategy
+     */
+    public DirectoryNode getDirectoryNode() throws ConnectorException {
+        return getDirectoryNode(defaultStrategy);
     }
 
-    public DirectoryNode getDirectoryService(DirectorySelectionStrategy strategy) throws ConnectorException {
+    /*
+     * Get a DirectoryNode based on the provided NodeSelectionStrategy
+     */
+    public DirectoryNode getDirectoryNode(NodeSelectionStrategy strategy) throws ConnectorException {
         GenericConnection connection = getConnector().getConnection();
         return connection.getDirectoryNode(strategy);
     }
+    /*
+     * Get all the DirectoryNodes available from the DirectoryInstance. This can be
+     * expensive because it needs to be able to connect to all the services.
+     */
 
-    public List<DirectoryNode> getDirectoryServices() throws ConnectorException {
+    public List<DirectoryNode> getDirectoryNodes() throws ConnectorException {
         GenericConnection connection = getConnector().getConnection();
         return connection.getDirectoryNodes();
     }
-
-     public GenericNodeConnector getConnector(){
+    /*
+     * Get the DirectoryInstance connector
+     */
+    public GenericNodeConnector getConnector() {
         return this.connector;
     }
-
-
+    /*
+     * Get the DirectoryInstance name
+     */
     public String getName() {
         return name;
     }
-
-    
 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/ExecutionEnvironment.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/ExecutionEnvironment.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/ExecutionEnvironment.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -29,44 +29,69 @@
 /**
  *
  * @author salaboy
+ *
+ * This class represents a remote/distributed execution environment where we can
+ * create and execute our knowledge (remote/distributed knowledge sessions). The concept of
+ * ExecutionEnvironment encapsulate one or a set of executionNodes.
+ * Depending on the underlaying implementation the executionEnvironment will be able to
+ * create a connection to the remote/distributed ExecutionNode that we can use to
+ * create and execute knowledge.
+ *
  */
 public class ExecutionEnvironment  {
 
     private String name;
     private GenericNodeConnector  connector;
+    private NodeSelectionStrategy defaultStrategy = new ReturnAlwaysTheFirstSelectionStrategy();
 
-
+    /*
+     * Creates a new ExecutionEnvironment using a name and a GenericNodeConnector
+     */
     public ExecutionEnvironment(String name, GenericNodeConnector connector) {
         this.name = name;
         this.connector = connector;
     }
 
+    /*
+     * When we want a reference to a remote/distributed execution environment, we
+     * ask for an ExecutionNode. Based on the default strategy this method will return
+     * the selected execution node that can be used to create kbases, ksessions and execute
+     * rules remotely.
+     */
     public ExecutionNode getExecutionNode() throws ConnectorException {
-        GenericConnection connection = getConnector().getConnection();
-        return connection.getExecutionNode(new ReturnAlwaysTheFirstSelectionStrategy());
+        return getExecutionNode(defaultStrategy);
     }
 
+    /*
+     * Based on the provided NodeSelectionStrategy this method will choose one of the
+     * ExecutionNodes available and it will create a connection to it.
+     */
     public ExecutionNode getExecutionNode(NodeSelectionStrategy strategy) throws ConnectorException {
         GenericConnection connection = getConnector().getConnection();
         return connection.getExecutionNode(strategy);
     }
 
+    /*
+     * This method will create a connection to all the ExecutionNodes provided by this
+     * ExecutionEnvironments. This can be expensive, but it's useful for monitoring purposes.
+     */
     public List<ExecutionNode> getExecutionNodes() throws ConnectorException{
         GenericConnection connection = getConnector().getConnection();
         return connection.getExecutionNodes();
     }
 
+    /*
+     * Return the ExecutionEnvironment connector
+     */
     public GenericNodeConnector getConnector(){
         return this.connector;
     }
 
-    
-
+    /*
+     * Return the ExecutionEnvironment Name
+     */
     public String getName() {
         return name;
     }
-
-
-
     
 }

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-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/GridTopology.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -90,28 +90,20 @@
      *  6) Register the Execution Environment inside all the currently available Directory Instances
      */
     public void registerExecutionEnvironment(String name, GenericProvider provider) {
-        //Create the executionEnvironment using the provider
 
         ExecutionEnvironment environment = ExecutionEnvironmentFactory.newExecutionEnvironment(name, provider);
-        //Get the connector
         GenericNodeConnector connector = environment.getConnector();
-        //Get the connection
         GenericConnection connection = connector.getConnection();
-        //Adding the connector to the conection collection of connectors
         connection.addExecutionNode(connector);
-        //We need to add all the other exec envs connectors inside this connection
+
         for (ExecutionEnvironment e : executionEnvironments.values()) {
             connection.addExecutionNode(e.getConnector());
-            //I need to add this execution node to all the other EE
             e.getConnector().getConnection().addExecutionNode(connector);
         }
-        //We need to add all the other directory connectors inside this connection
         for (DirectoryInstance d : directoryInstances.values()) {
             connection.addDirectoryNode(d.getConnector());
-            //I need to add this execution node to all the other DI
             d.getConnector().getConnection().addExecutionNode(connector);
         }
-        //Adding the env to the local cache
         executionEnvironments.put(name, environment);
 
         try {
@@ -121,7 +113,6 @@
         } catch (RemoteException ex) {
             Logger.getLogger(GridTopology.class.getName()).log(Level.SEVERE, null, ex);
         }
-        //Register all the Execution Environments into the current directories
         registerResourceInDirectories(name, provider.getId());
 
     }
@@ -133,29 +124,29 @@
      *  1) Get the ExecutionEnvironment from the executionEnvironmentMap
      *  2) Get the ExecutionEnvironment connector
      *     2.1) Remove the ExecutionEnvironment from the executionEnvironmentByConnectorId map
-     *     2.2) Disconnect the connector
+     *     2.2) Dispose the connection that the connector contains
+     *     2.3) Disconnect the connector
      *  3) Remove the executionEnvironment from the executionEnvironmentMap
      *  4) Unregister the ExecutionEnvironment from the running Directory Instances
      *
      */
     public void unregisterExecutionEnvironment(String name) {
+
         ExecutionEnvironment ee = executionEnvironments.get(name);
         try {
 
             GenericNodeConnector connector = ee.getConnector();
+            executionEnvironmentsByConnectorId.remove(connector.getId());
             connector.getConnection().dispose();
-            executionEnvironmentsByConnectorId.remove(connector.getId());
             connector.disconnect();
+
         } catch (ConnectorException ex) {
             Logger.getLogger(GridTopology.class.getName()).log(Level.SEVERE, null, ex);
         } catch (RemoteException ex) {
             Logger.getLogger(GridTopology.class.getName()).log(Level.SEVERE, null, ex);
         }
 
-
-        //Remove Execution Environment
         executionEnvironments.remove(name);
-        //UnRegister EE from current Directories
         unregisterResourceFromDirectories(name);
 
     }
@@ -163,12 +154,14 @@
      * Get Execution Environment by Name
      * @param name: String Execution Environment Name
      */
+
     public ExecutionEnvironment getExecutionEnvironment(String name) {
         return executionEnvironments.get(name);
     }
 
     /*
      * Get ExecutionEnvironment by connector
+     * @param connector: using this connector id, this method will return an ExecutionEnvironment
      */
     public ExecutionEnvironment getExecutionEnvironment(GenericNodeConnector connector) {
         ExecutionEnvironment ee = null;
@@ -227,22 +220,19 @@
             connection.addExecutionNode(e.getConnector());
         }
         for (DirectoryInstance d : directoryInstances.values()) {
+            d.getConnector().getConnection().addDirectoryNode(connector);
             connection.addDirectoryNode(d.getConnector());
-            d.getConnector().getConnection().addDirectoryNode(connector);
         }
 
-
-        
-
         directoryInstances.put(name, directory);
+        registerResourceInDirectories(name, provider.getId());
 
-        registerResourceInDirectories(name, provider.getId());
-        
     }
     /*
      * Get the Best DirectoryInstance based on a DirectoryInstanceSelectionStrategy
      * @param strategy it's the strategy used to choose the best DirectoryInstance available
      */
+
     public DirectoryInstance getBestDirectoryInstance(DirectoryInstanceSelectionStrategy strategy) {
         return (DirectoryInstance) strategy.getBestDirectoryInstance(directoryInstances);
     }
@@ -268,14 +258,16 @@
      * a DirectoryInstance from the GridTopology:
      *  1) Get the Directory Instance from the directoryInstances Map
      *  2) Get the DirectoryInstance connector
-     *     2.1) Disconnect the connector
+     *     2.1) Dispose the internal connection from the connector
+     *     2.2) Disconnect the connector
      *  3) Unregister the DirectoryInstance from the running Directory Instances
      *  4) Remove the DirectoryInstance from the directoryInstances Map
      */
     public void unregisterDirectoryInstance(String name) {
+
         DirectoryInstance dir = directoryInstances.get(name);
         GenericNodeConnector connector = dir.getConnector();
-        
+
         try {
             connector.getConnection().dispose();
             connector.disconnect();
@@ -286,83 +278,152 @@
         }
 
         unregisterResourceFromDirectories(name);
-
         directoryInstances.remove(name);
 
     }
 
-     /*
+    /*
      * This method will register a new Task Server  based on the configured Provider.
      * The provider will contain all the information to be able to establish a connection with the Task Server.
      * The following steps are executed inside this method:
-     *  1) Create the new ExecutionEnvironment object that will represent a remote host for our knowledge sessions.
-     *  2) Each ExecutionEnvironment will have an underlaying connection to support remote/distribtued interactions
+     *  1) Create the new TaskServerInstance object that will represent a remote service to execute human tasks for
+     *     business processes.
+     *  2) Each TaskServiceInstance will have an underlaying connection to support remote/distribtued interactions
      *  3) for each Execution Environment registered in this topology
-     *     3.1) We need to inject the reference from the newly created Execution Enviroment to the existing ones
-     *     3.2) We need to inject the reference from all the existing Execution Environments to the newly created
+     *     3.1) We need to inject the reference from the newly created Task Server Instance to the existing ExecutionEnvironments
+     *     3.2) We need to inject the reference from all the existing Execution Environments to the newly created TaskServer Instance
      *  4) for each Directory Instance registered in this topology
-     *     4.1) We need to inject the reference from the newly created Execution Environment in each exisiting Directory
-     *     4.2) We need to inject a reference from each existing directory to the newly created Execution Environment
-     *  5) Add the newly created Execution Environment to the topology maps. We keep to maps for Execution Environments
-     *     to be able to look based on the underlaying connector and based on the defined Execution Environment name.
-     *  6) Register the Execution Environment inside all the currently available Directory Instances
+     *     4.1) We need to inject the reference from the newly created TaskServiceInstance in each exisiting Directory
+     *     4.2) We need to inject a reference from each existing directory to the newly created TaskServerInstance
+     *  5) Add the newly created TaskServerInstance to the topology maps.
+     *  6) Register the TaskServer Instance inside all the currently available Directory Instances
      */
     public void registerTaskServerInstance(String name, GenericProvider provider) {
 
         TaskServerInstance taskServer = TaskServerInstanceFactory.newTaskServerInstance(name, provider);
-        GenericHumanTaskConnector connector = taskServer.getConnector();
+        GenericNodeConnector connector = taskServer.getConnector();
         GenericConnection connection = connector.getConnection();
         connection.addHumanTaskNode(connector);
 
+        for (ExecutionEnvironment e : executionEnvironments.values()) {
+            e.getConnector().getConnection().addHumanTaskNode(connector);
+            connection.addExecutionNode(e.getConnector());
+        }
+        for (DirectoryInstance d : directoryInstances.values()) {
+            d.getConnector().getConnection().addHumanTaskNode(connector);
+            connection.addDirectoryNode(d.getConnector());
+        }
+
         taskServerInstances.put(name, taskServer);
         registerResourceInDirectories(name, provider.getId());
 
     }
 
+    /*
+     * Get TaskServer Instance by name
+     * @param name: it's the name used to register a specific task server instance
+     */
     public TaskServerInstance getTaskServerInstance(String name) {
         return taskServerInstances.get(name);
     }
 
+    /*
+     * Get the best task server instance available based on a strategy
+     * @param strategy: a TaskServerInstanceSelectionStrategy it's used to retrieve the best instance
+     * currently available
+     */
     public TaskServerInstance getBestTaskServerInstance(TaskServerInstanceSelectionStrategy strategy) {
         return (TaskServerInstance) strategy.getBestTaskServerInstance(taskServerInstances);
     }
 
+    /*
+     * Get the best task server instance based on the default selection strategy
+     */
     public TaskServerInstance getBestTaskServerInstance() {
         return DEFAULT_TASK_STRATEGY.getBestTaskServerInstance(taskServerInstances);
     }
 
+    /*
+     * 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
+     * a TaskServerInstance from the GridTopology:
+     *  1) Get the TaskServer Instance from the taskServerInstances Map
+     *  2) Get the TaskServer Instance connector
+     *     2.1) Dispose the internal connection from the connector
+     *     2.2) Disconnect the connector
+     *  3) Remove the TaskServerInstance from the directoryInstances Map
+     *  4) Unregister the TaskServer Instance from the running DirectoryInstances
+     */
     public void unregisterTaskServerInstance(String name) {
-        //Remove Task Server Instance
+
+        TaskServerInstance taskServer = taskServerInstances.get(name);
+        GenericNodeConnector connector = taskServer.getConnector();
+
+        try {
+            connector.getConnection().dispose();
+            connector.disconnect();
+        } catch (RemoteException ex) {
+            Logger.getLogger(GridTopology.class.getName()).log(Level.SEVERE, null, ex);
+
+        } catch (ConnectorException ex) {
+            Logger.getLogger(GridTopology.class.getName()).log(Level.SEVERE, null, ex);
+        }
+
         taskServerInstances.remove(name);
-        //UnRegister task Server instance from current Directories
         unregisterResourceFromDirectories(name);
 
-
     }
 
+    /*
+     * Close and Dispose all connections and connectors to remote services
+     * without removing/unregister the references from those services
+     */
     public void disconnect() throws ConnectorException, RemoteException {
+        disconnectExecutionEnvironments();
+        disconnectDirectoryInstances();
+        disconnectTaskServerInstances();
+    }
 
-        for (String key : executionEnvironments.keySet()) {
-            ExecutionEnvironment ee = executionEnvironments.get(key);
-            GenericNodeConnector connector = ee.getConnector();
+    /*
+     * Disconnect all the taskServerInstances ongoing connections
+     */
+    private void disconnectTaskServerInstances() throws ConnectorException, RemoteException {
+        for (String key : taskServerInstances.keySet()) {
+            TaskServerInstance taskServer = taskServerInstances.get(key);
+            GenericNodeConnector connector = taskServer.getConnector();
             connector.getConnection().dispose();
             connector.disconnect();
         }
+    }
+    /*
+     * Disconnect all the directoryInstances ongoing connections
+     */
+
+    private void disconnectDirectoryInstances() throws RemoteException, ConnectorException {
         for (String key : directoryInstances.keySet()) {
             DirectoryInstance dir = directoryInstances.get(key);
             GenericNodeConnector connector = dir.getConnector();
             connector.getConnection().dispose();
             connector.disconnect();
         }
-        for (String key : taskServerInstances.keySet()) {
-            TaskServerInstance taskServer = taskServerInstances.get(key);
-            GenericHumanTaskConnector connector = taskServer.getConnector();
+    }
+
+    /*
+     * Disconnect all the executionEnvironments ongoing connections
+     */
+    private void disconnectExecutionEnvironments() throws ConnectorException, RemoteException {
+        for (String key : executionEnvironments.keySet()) {
+            ExecutionEnvironment ee = executionEnvironments.get(key);
+            GenericNodeConnector connector = ee.getConnector();
             connector.getConnection().dispose();
             connector.disconnect();
         }
     }
 
-
+    /*
+     * Clean the GridTopology object to be disposed
+     */
     public void dispose() throws ConnectorException, RemoteException {
 
         for (String key : executionEnvironments.keySet()) {
@@ -376,11 +437,15 @@
         }
     }
 
+    /*
+     * Register the resource id (ExecutionEnvironment, DirectoryInstance, TaskServerInstance)
+     * inside all the current available directory instances.
+     */
     private void registerResourceInDirectories(String name, String resourceId) {
         for (DirectoryInstance directory : directoryInstances.values()) {
 
             try {
-                DirectoryNodeService directoryNode = directory.getDirectoryService().get(DirectoryNodeService.class);
+                DirectoryNodeService directoryNode = directory.getDirectoryNode().get(DirectoryNodeService.class);
                 if (directoryNode != null) {
                     try {
                         directoryNode.register(name, resourceId);
@@ -398,12 +463,16 @@
             }
         }
     }
+    /*
+     * Unregister a resource (ExecutionEnvironment, DirectoryInstance, TaskServerInstance)
+     * from all the current available directory instances.
+     */
 
     private void unregisterResourceFromDirectories(String name) {
         for (DirectoryInstance directory : directoryInstances.values()) {
 
             try {
-                DirectoryNodeService directoryNode = directory.getDirectoryService().get(DirectoryNodeService.class);
+                DirectoryNodeService directoryNode = directory.getDirectoryNode().get(DirectoryNodeService.class);
                 if (directoryNode != null) {
                     try {
                         directoryNode.unregister(name);

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/TaskServerInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/TaskServerInstance.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/TaskServerInstance.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -1,48 +1,56 @@
 package org.drools.grid.services;
 
 import java.util.List;
-import org.drools.grid.services.strategies.ReturnFirstHumanTaskServiceSelectionStrategy;
 import org.drools.grid.ConnectorException;
 import org.drools.grid.GenericConnection;
-import org.drools.grid.GenericHumanTaskConnector;
-import org.drools.grid.strategies.HumanTaskSelectionStrategy;
-import org.drools.grid.task.HumanTaskService;
+import org.drools.grid.GenericNodeConnector;
+import org.drools.grid.HumanTaskNode;
+import org.drools.grid.strategies.NodeSelectionStrategy;
+import org.drools.grid.strategies.ReturnAlwaysTheFirstSelectionStrategy;
+
 /**
  * @author salaboy
+ *
+ * This class represent a remote/distributed Task Server service that will let us
+ * execute and manage Human Tasks associated with business processes.
+ * As ExecutionEnvironment and DirectoryInstance this class can encapsulate one
+ * or a set of HumanTaskNodes based on the underlaying implementation.
+ *
  */
 public class TaskServerInstance {
 
     private String name;
-    private GenericHumanTaskConnector connector;
+    private GenericNodeConnector connector;
+    private NodeSelectionStrategy defaultStrategy = new ReturnAlwaysTheFirstSelectionStrategy();
 
-    public TaskServerInstance(String name, GenericHumanTaskConnector connector) {
+    /*
+     * Creates a new TaskServer Instance that will be associated to a name using the
+     * GenericNodeConnector provided.
+     */
+    public TaskServerInstance(String name, GenericNodeConnector connector) {
         this.name = name;
         this.connector = connector;
     }
 
-    public HumanTaskService getTaskClient() throws ConnectorException {
-        GenericConnection connection = getConnector().getConnection();
-        HumanTaskService htService = (HumanTaskService) connection.getHumanTaskNode(new ReturnFirstHumanTaskServiceSelectionStrategy(1, getConnector()));
-        
-        return htService;
+    public HumanTaskNode getHumanTaskNode() throws ConnectorException {
+        return getHumanTaskNode(defaultStrategy);
     }
 
-     public HumanTaskService getTaskClient(HumanTaskSelectionStrategy strategy) throws ConnectorException {
+    public HumanTaskNode getHumanTaskNode(NodeSelectionStrategy strategy) throws ConnectorException{
         GenericConnection connection = getConnector().getConnection();
-        HumanTaskService htService = (HumanTaskService) connection.getHumanTaskNode(strategy);
-        return htService;
+        return connection.getHumanTaskNode(strategy);
     }
 
-    public List<HumanTaskService> getTaskClients() {
+    public List<HumanTaskNode> getHumanTaskNodes() throws ConnectorException{
         GenericConnection connection = getConnector().getConnection();
-        return null;
+        return connection.getHumanTaskNodes();
     }
 
-    public GenericHumanTaskConnector getConnector(){
+
+    public GenericNodeConnector getConnector(){
         return this.connector;
     }
 
-
     public String getName() {
         return name;
     }

Deleted: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/ReturnFirstHumanTaskServiceSelectionStrategy.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/ReturnFirstHumanTaskServiceSelectionStrategy.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/main/java/org/drools/grid/services/strategies/ReturnFirstHumanTaskServiceSelectionStrategy.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -1,49 +0,0 @@
-/*
- *  Copyright 2010 salaboy.
- * 
- *  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.
- *  under the License.
- */
-
-package org.drools.grid.services.strategies;
-
-import java.util.List;
-import org.drools.grid.GenericHumanTaskConnector;
-import org.drools.grid.HumanTaskNodeService;
-import org.drools.grid.strategies.HumanTaskSelectionStrategy;
-import org.drools.grid.task.HumanTaskServiceImpl;
-
-/**
- *
- * @author salaboy
- */
-public class ReturnFirstHumanTaskServiceSelectionStrategy implements HumanTaskSelectionStrategy{
-    private final int sessionId; 
-    private final GenericHumanTaskConnector connector;
-
-
-    public ReturnFirstHumanTaskServiceSelectionStrategy(int sessionId, GenericHumanTaskConnector connector) {
-        this.sessionId = sessionId;
-        this.connector = connector;
-
-    }
-
-    public HumanTaskNodeService getBestHumanTaskService(){
-        return new HumanTaskServiceImpl(connector, 1);
-    }
-
-    public GenericHumanTaskConnector getBestHumanTask(List<GenericHumanTaskConnector> connectors) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterDirectoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterDirectoryTest.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterDirectoryTest.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -85,7 +85,7 @@
         DirectoryInstance directory = grid.getBestDirectoryInstance(new DirectoryInstanceByPrioritySelectionStrategy());
         Assert.assertNotNull("Directory Instance null", directory);
 
-        DirectoryNodeService dir = directory.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService dir = directory.getDirectoryNode().get(DirectoryNodeService.class);
         directory.getConnector().disconnect();
 
         Assert.assertNotNull("Dir Null", dir);
@@ -119,7 +119,7 @@
         DirectoryInstance directory = grid.getDirectoryInstance("MyLocalDir");
         Assert.assertNotNull("DirInstance is null!", directory);
 
-        DirectoryNodeService dir = directory.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService dir = directory.getDirectoryNode().get(DirectoryNodeService.class);
         ;
         Assert.assertNotNull("Dir is null!", dir);
         //This assertion is not deterministic
@@ -128,7 +128,7 @@
         DirectoryInstance directory2 = grid.getDirectoryInstance("MyLocalDir2");
         Assert.assertNotNull("DirInstance 2 is null!", directory2);
 
-        DirectoryNodeService dir2 = directory2.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService dir2 = directory2.getDirectoryNode().get(DirectoryNodeService.class);
         ;
         Assert.assertNotNull("Dir 2 is null!", dir2);
         //This assertion is not deterministic
@@ -208,7 +208,7 @@
         DirectoryInstance directory = grid.getBestDirectoryInstance(new DirectoryInstanceByPrioritySelectionStrategy());
         Assert.assertNotNull("Directory Instance null", directory);
 
-        DirectoryNodeService dirService = directory.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService dirService = directory.getDirectoryNode().get(DirectoryNodeService.class);
 
         kbase = dirService.lookupKBase("DoctorsKBase");
         Assert.assertNotNull(kbase);

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-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterMinaDirectoryTest.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -119,8 +119,8 @@
     @After
     public void tearDown() throws InterruptedException, ConnectorException, RemoteException {
 
+        Thread.sleep(3000);
         
-        
         Assert.assertEquals(0, serverNode.getCurrentSessions());
         serverNode.stop();
         System.out.println("Execution Server Stopped!");
@@ -149,7 +149,7 @@
         DirectoryInstance directory = grid.getBestDirectoryInstance(new DirectoryInstanceByPrioritySelectionStrategy());
         Assert.assertNotNull(directory);
 
-        DirectoryNodeService dir = directory.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService dir = directory.getDirectoryNode().get(DirectoryNodeService.class);
         Assert.assertNotNull(dir);
         Map<String, String> dirMap = dir.getExecutorsMap();
         
@@ -297,7 +297,7 @@
         grid.disconnect();
 
         DirectoryInstance directoryInstance = grid.getDirectoryInstance();
-        DirectoryNodeService directory = directoryInstance.getDirectoryService().get(DirectoryNodeService.class);
+        DirectoryNodeService directory = directoryInstance.getDirectoryNode().get(DirectoryNodeService.class);
         GenericNodeConnector connector = directory.lookup("sessionName");
         
         directoryInstance.getConnector().disconnect();

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterTaskTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterTaskTest.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-services/src/test/java/org/drools/services/RegisterTaskTest.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -215,7 +215,7 @@
     }
 
     @Test
-    public void MinaTaskTest() throws InterruptedException, ConnectorException {
+    public void MinaTaskTest() throws InterruptedException, ConnectorException, RemoteException {
 
         GridTopologyConfiguration gridTopologyConfiguration = new GridTopologyConfiguration("MyTopology");
         gridTopologyConfiguration.addTaskServerInstance(new TaskServerInstanceConfiguration("MyMinaTask", new MinaProvider("127.0.0.1", 9123)));
@@ -234,7 +234,7 @@
 
         Assert.assertNotNull(taskServer);
 
-        client = (HumanTaskService) taskServer.getTaskClient();
+        client = taskServer.getHumanTaskNode().get(HumanTaskService.class);
         Assert.assertNotNull(client);
 
 

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandler.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandler.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.drools.grid.task;
 
 import java.io.ByteArrayInputStream;
@@ -21,6 +20,7 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -32,7 +32,7 @@
 import org.drools.eventmessaging.EventKey;
 import org.drools.eventmessaging.Payload;
 import org.drools.grid.ConnectorException;
-import org.drools.grid.GenericHumanTaskConnector;
+import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.internal.Message;
 import org.drools.grid.task.TaskClientMessageHandlerImpl.AddTaskMessageResponseHandler;
 import org.drools.grid.task.TaskClientMessageHandlerImpl.GetContentMessageResponseHandler;
@@ -68,13 +68,11 @@
  * @author Lucas Amador
  *
  */
-
 public class CommandBasedServicesWSHumanTaskHandler implements WorkItemHandler {
 
     private String ipAddress = "127.0.0.1";
     private int port = 9124;
-
-    private GenericHumanTaskConnector connector;
+    private GenericNodeConnector connector;
     private HumanTaskServiceImpl client;
     private KnowledgeRuntime session;
     private Map<Long, Long> idMapping = new HashMap<Long, Long>();
@@ -84,12 +82,13 @@
         this.session = session;
 
     }
-    public void setAddress(String ipAddress, int port){
+
+    public void setAddress(String ipAddress, int port) {
         this.ipAddress = ipAddress;
         this.port = port;
     }
 
-    public void connect() throws ConnectorException {
+    public void connect() throws ConnectorException, RemoteException {
         if (connector == null) {
             connector = new RemoteMinaHumanTaskConnector("client ht",
                     ipAddress, port,
@@ -103,9 +102,12 @@
     public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
         try {
             connect();
-		} catch (ConnectorException ex) {
+        } catch (RemoteException ex) {
             Logger.getLogger(CommandBasedServicesWSHumanTaskHandler.class.getName()).log(Level.SEVERE, null, ex);
-		    return;
+
+        } catch (ConnectorException ex) {
+            Logger.getLogger(CommandBasedServicesWSHumanTaskHandler.class.getName()).log(Level.SEVERE, null, ex);
+            return;
         }
         Task task = new Task();
         String taskName = (String) workItem.getParameter("TaskName");
@@ -211,7 +213,7 @@
         client.addTask(task, content, taskResponseHandler);
     }
 
-    public void dispose() throws ConnectorException  {
+    public void dispose() throws ConnectorException, RemoteException {
         if (connector != null) {
             connector.disconnect();
         }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceImpl.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceImpl.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -20,10 +20,12 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.drools.eventmessaging.EventKey;
 import org.drools.grid.ConnectorException;
-import org.drools.grid.GenericHumanTaskConnector;
+import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.internal.Message;
 import org.drools.grid.task.TaskClientMessageHandlerImpl.AddAttachmentMessageResponseHandler;
 import org.drools.grid.task.TaskClientMessageHandlerImpl.AddCommentMessageResponseHandler;
@@ -53,12 +55,12 @@
  */
 public class HumanTaskServiceImpl implements HumanTaskService {
 
-    private final GenericHumanTaskConnector client;
+    private final GenericNodeConnector client;
     private final AtomicInteger counter;
     private int sessionId;
     private String clientName;
 
-    public HumanTaskServiceImpl(GenericHumanTaskConnector client, int sessionId) {
+    public HumanTaskServiceImpl(GenericNodeConnector client, int sessionId) {
         this.client = client;
         this.counter = new AtomicInteger();
         this.clientName = String.valueOf(sessionId);
@@ -69,8 +71,12 @@
 
 
     public void disconnect() throws ConnectorException {
+        try {
             this.client.disconnect();
+        } catch (RemoteException ex) {
+            Logger.getLogger(HumanTaskServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
         }
+        }
 
     public void addTask(Task task, ContentData content, AddTaskMessageResponseHandler responseHandler) {
         List<Object> args = new ArrayList<Object>(2);

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceProviderRemoteClient.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceProviderRemoteClient.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/HumanTaskServiceProviderRemoteClient.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -13,13 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.drools.grid.task;
 
+import java.rmi.RemoteException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.drools.grid.ConnectorException;
 import org.drools.grid.GenericHumanTaskConnector;
+import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.HumanTaskNodeService;
 
 /**
@@ -28,22 +29,22 @@
  */
 public class HumanTaskServiceProviderRemoteClient implements HumanTaskFactoryService {
 
-    private GenericHumanTaskConnector connector;
+    private GenericNodeConnector connector;
     private int id;
 
     public HumanTaskServiceProviderRemoteClient() {
     }
 
-    public HumanTaskServiceProviderRemoteClient(GenericHumanTaskConnector connector, int id) {
+    public HumanTaskServiceProviderRemoteClient(GenericNodeConnector connector, int id) {
         this.connector = connector;
         this.id = id;
     }
 
-    public GenericHumanTaskConnector getConnector() {
+    public GenericNodeConnector getConnector() {
         return connector;
     }
 
-    public void setConnector(GenericHumanTaskConnector connector) {
+    public void setConnector(GenericNodeConnector connector) {
         this.connector = connector;
     }
 
@@ -58,16 +59,15 @@
     public HumanTaskNodeService newHumanTaskService() {
         HumanTaskServiceImpl humanTaskServiceImpl = null;
         try {
+
             this.connector.connect();
-            humanTaskServiceImpl = new HumanTaskServiceImpl(this.connector, this.id);
+        } catch (RemoteException ex) {
+            Logger.getLogger(HumanTaskServiceProviderRemoteClient.class.getName()).log(Level.SEVERE, null, ex);
+
         } catch (ConnectorException ex) {
             Logger.getLogger(HumanTaskServiceProviderRemoteClient.class.getName()).log(Level.SEVERE, null, ex);
-    }
+        }
+        humanTaskServiceImpl = new HumanTaskServiceImpl(this.connector, this.id);
         return humanTaskServiceImpl;
     }
-
-    
-
-
-
 }

Added: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaConnectionHumanTask.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaConnectionHumanTask.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaConnectionHumanTask.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -0,0 +1,75 @@
+/*
+ *  Copyright 2010 salaboy.
+ * 
+ *  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.
+ *  under the License.
+ */
+
+package org.drools.grid.task;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.drools.grid.ConnectorType;
+import org.drools.grid.GenericConnection;
+import org.drools.grid.GenericNodeConnector;
+import org.drools.grid.NodeConnectionType;
+
+/**
+ *
+ * @author salaboy 
+ */
+public class RemoteMinaConnectionHumanTask implements NodeConnectionType {
+    private final Map<Class<?>, Object> services = new ConcurrentHashMap<Class<?>, Object>();
+    private GenericNodeConnector connector;
+    private GenericConnection connection;
+
+    public RemoteMinaConnectionHumanTask() {
+        
+    }
+
+    
+    public RemoteMinaConnectionHumanTask(GenericNodeConnector connector, GenericConnection connection) {
+        
+        this.connector = connector;
+        this.connection = connection;
+        
+    }
+
+    public void init(){
+        services.put(HumanTaskService.class, new HumanTaskServiceImpl(connector, connector.getSessionId()));
+        
+    }
+
+
+    public Set<Class<?>> getServicesKeys() {
+        return services.keySet(); 
+    }
+
+    public <T> T getServiceImpl(Class<T> clazz) {
+        return (T) services.get(clazz);
+    }
+
+    public void setConnector(GenericNodeConnector connector) {
+        this.connector = connector;
+    }
+
+    public void setConnection(GenericConnection connection) {
+        this.connection = connection;
+    }
+
+    public ConnectorType getConnectorType() {
+        return ConnectorType.REMOTE;
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaHumanTaskConnector.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaHumanTaskConnector.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/main/java/org/drools/grid/task/RemoteMinaHumanTaskConnector.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -2,6 +2,7 @@
 
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
+import java.rmi.RemoteException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -9,6 +10,7 @@
 import org.apache.mina.core.future.ConnectFuture;
 import org.apache.mina.core.future.IoFuture;
 import org.apache.mina.core.future.IoFutureListener;
+import org.apache.mina.core.session.IdleStatus;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
@@ -19,8 +21,9 @@
 import org.drools.grid.ConnectorException;
 import org.drools.grid.ConnectorType;
 import org.drools.grid.GenericConnection;
-import org.drools.grid.GenericHumanTaskConnector;
+import org.drools.grid.GenericNodeConnector;
 import org.drools.grid.HumanTaskNodeService;
+import org.drools.grid.NodeConnectionType;
 
 import org.drools.grid.internal.Message;
 import org.drools.grid.internal.MessageResponseHandler;
@@ -30,7 +33,7 @@
 
 public class RemoteMinaHumanTaskConnector
         implements
-        GenericHumanTaskConnector {
+        GenericNodeConnector {
 
     protected IoSession session;
     protected final String name;
@@ -148,11 +151,19 @@
         return this.connection;
     }
 
-    public HumanTaskNodeService getHumanTaskNodeService() throws ConnectorException {
-        return new HumanTaskServiceImpl(this, (int) this.session.getId());
-    }
-
     public ConnectorType getConnectorType() {
         return ConnectorType.REMOTE;
     }
+
+    public NodeConnectionType getNodeConnectionType() throws ConnectorException, RemoteException {
+        return new RemoteMinaConnectionHumanTask();
+    }
+
+    public int getSessionId() {
+        return (int) session.getId();
+    }
+
+    public AtomicInteger getCounter() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
 }

Modified: labs/jbossrules/trunk/drools-grid/drools-grid-task/src/test/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandlerTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-task/src/test/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandlerTest.java	2010-08-08 19:56:59 UTC (rev 34591)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-task/src/test/java/org/drools/grid/task/CommandBasedServicesWSHumanTaskHandlerTest.java	2010-08-08 21:36:58 UTC (rev 34592)
@@ -70,7 +70,7 @@
     
     protected static TaskService taskService;
     protected TaskServiceSession taskSession;
-    protected GenericHumanTaskConnector htMinaClient;
+    protected GenericNodeConnector htMinaClient;
     protected GenericNodeConnector minaClient;
     @Before
     public void setUpTaskService() throws Exception {



More information about the jboss-svn-commits mailing list