[jboss-svn-commits] JBL Code SVN: r32518 - in labs/jbossrules/trunk/drools-grid: drools-grid-rio and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Apr 12 10:28:08 EDT 2010
Author: salaboy21
Date: 2010-04-12 10:28:07 -0400 (Mon, 12 Apr 2010)
New Revision: 32518
Added:
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/drools/
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/drools/executionNodeService.groovy
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.bak.groovy
Removed:
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.groovy
Modified:
labs/jbossrules/trunk/drools-grid/drools-grid-rio/
labs/jbossrules/trunk/drools-grid/drools-grid-rio/pom.xml
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GridConnection.java
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/DirectoryNodeServiceImpl.java
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/ExecutionNodeServiceImpl.java
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java
labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ITGridExecutionTest.java
labs/jbossrules/trunk/drools-grid/pom.xml
Log:
JBRULES-2446: Drools Services API
- drools-grid-grid little modifications in tests
Property changes on: labs/jbossrules/trunk/drools-grid/drools-grid-rio
___________________________________________________________________
Name: svn:ignore
+ target
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/pom.xml 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/pom.xml 2010-04-12 14:28:07 UTC (rev 32518)
@@ -80,7 +80,7 @@
<artifactId>maven-rio-plugin</artifactId>
<extensions>true</extensions>
<configuration>
- <opstring>src/test/resources/org/drools/executionNodeService.groovy</opstring>
+ <opstring>src/main/resources/org/drools/executionNodeService.groovy</opstring>
<createJar>
<classifier>dl</classifier>
<ins>
@@ -91,6 +91,7 @@
<topclass>org.drools.grid.ExecutionNodeService</topclass>
<topclass>org.drools.grid.DirectoryNodeService</topclass>
<topclass>org.drools.grid.distributed.util.IDEntry</topclass>
+ <topclass>org.drools.grid.distributed.command.NewStatefulKnowledgeSessionGridCommand</topclass>
<topclass>org.drools.impl.SystemEventListenerServiceImpl</topclass>
<topclass>org.rioproject.gnostic.Gnostic</topclass>
</topclasses>
@@ -124,7 +125,7 @@
<property>
<name>opstring</name>
- <value>src/test/resources/org/drools/executionNodeService.groovy</value>
+ <value>src/main/resources/org/drools/executionNodeService.groovy</value>
</property>
<property>
<name>org.rioproject.test.config</name>
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GenericMessageGridHandlerImpl.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -28,58 +28,58 @@
private SystemEventListener systemEventListener;
private NodeData data;
- private DirectoryNodeService registry;
+ private DirectoryNodeService directory;
public GenericMessageGridHandlerImpl(NodeData data,
SystemEventListener systemEventListener) {
this.systemEventListener = systemEventListener;
this.data = data;
- Class[] classes = new Class[]{org.drools.grid.DirectoryNodeService.class};
- ServiceTemplate tmpl = new ServiceTemplate(null, classes,null);
+// Class[] classes = new Class[]{org.drools.grid.DirectoryNodeService.class};
+// ServiceTemplate tmpl = new ServiceTemplate(null, classes,null);
+//
+// LookupDiscoveryManager lookupDiscovery = null;
+// try {
+// lookupDiscovery = new LookupDiscoveryManager(LookupDiscoveryManager.ALL_GROUPS, null, null);
+// } catch (IOException ex) {
+// Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
+// }
+//
+// System.out.println("Discovering Manager service ...");
+//
+// ServiceDiscoveryManager serviceDiscovery = null;
+// try {
+// serviceDiscovery = new ServiceDiscoveryManager(lookupDiscovery, new LeaseRenewalManager());
+// } catch (IOException ex) {
+// Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
+// }
+//
+// /* Wait no more then 10 seconds to discover the service */
+// ServiceItem item = null;
+// try {
+// try {
+// item = serviceDiscovery.lookup(tmpl, null, 1000);
+// } catch (RemoteException ex) {
+// Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
+// }
+// } catch (InterruptedException ex) {
+// Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
+// }
+// serviceDiscovery.terminate();
+//
+// if(item != null) {
+// System.out.println("Discovered Registry service");
+// if(item.service instanceof DirectoryNodeService){
+// registry = (DirectoryNodeService)item.service;
+//
+// }
+//
+//
+// } else {
+// System.out.println("Registry service not discovered, make sure the"+
+// "service is deployed");
+// }
- LookupDiscoveryManager lookupDiscovery = null;
- try {
- lookupDiscovery = new LookupDiscoveryManager(LookupDiscoveryManager.ALL_GROUPS, null, null);
- } catch (IOException ex) {
- Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
- }
-
- System.out.println("Discovering Manager service ...");
-
- ServiceDiscoveryManager serviceDiscovery = null;
- try {
- serviceDiscovery = new ServiceDiscoveryManager(lookupDiscovery, new LeaseRenewalManager());
- } catch (IOException ex) {
- Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
- }
-
- /* Wait no more then 10 seconds to discover the service */
- ServiceItem item = null;
- try {
- try {
- item = serviceDiscovery.lookup(tmpl, null, 1000);
- } catch (RemoteException ex) {
- Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
- }
- } catch (InterruptedException ex) {
- Logger.getLogger(GenericMessageGridHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);
- }
- serviceDiscovery.terminate();
-
- if(item != null) {
- System.out.println("Discovered Registry service");
- if(item.service instanceof DirectoryNodeService){
- registry = (DirectoryNodeService)item.service;
-
- }
-
-
- } else {
- System.out.println("Registry service not discovered, make sure the"+
- "service is deployed");
- }
-
}
@@ -112,7 +112,7 @@
localSessionContext.set( "kresults_" + msg.getSessionId(),
localKresults );
//@TODO: replace with Environment ?? this needs to change..
- localSessionContext.set("registry", registry);
+ localSessionContext.set("registry", directory);
for ( GenericCommand cmd : commands ) {
// evaluate the commands
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GridConnection.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GridConnection.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/GridConnection.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -16,22 +16,28 @@
*/
package org.drools.grid.distributed;
+import java.io.IOException;
+import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
+import java.security.Permission;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.drools.grid.DirectoryNodeService;
import org.drools.builder.DirectoryLookupFactoryService;
import java.util.ArrayList;
import java.util.List;
+import net.jini.discovery.DiscoveryGroupManagement;
import org.drools.KnowledgeBaseFactoryService;
import org.drools.builder.KnowledgeBuilderFactoryService;
import org.drools.grid.ExecutionNode;
+import org.drools.grid.ExecutionNodeService;
import org.drools.grid.NodeSelectionStrategy;
import org.drools.grid.generic.GenericConnection;
import org.drools.grid.generic.GenericNodeConnector;
import org.drools.grid.strategies.DirectoryServiceSelectionStrategy;
import org.drools.grid.strategies.StaticIncrementalSelectionStrategy;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+import org.rioproject.associations.AssociationDescriptor;
+import org.rioproject.associations.AssociationMgmt;
/**
*
@@ -39,6 +45,15 @@
*/
public class GridConnection implements GenericConnection {
+ static {
+ System.setSecurityManager(new RMISecurityManager() {
+
+ @Override
+ public void checkPermission(Permission perm) {
+ }
+ });
+
+ }
//Cached Services
private List<GenericNodeConnector> nodeConnectors;
//Cached Directories
@@ -61,17 +76,47 @@
// In real scenarios this method will be in charge of populating
// all the ExecutionNodeService and DirectoryServices
- public void connect() {
- throw new NotImplementedException();
+ public boolean connect() throws IOException, RemoteException, InterruptedException {
+ Logger.getLogger("org.rioproject.associations").setLevel(Level.FINEST);
+ AssociationDescriptor descriptorExecutionNode = AssociationDescriptor.create("ExecutionNodeService",
+ "nodeConnectorsInj",
+ org.drools.grid.ExecutionNodeService.class,
+ DiscoveryGroupManagement.ALL_GROUPS);
+ AssociationDescriptor descriptorDirectoryNode = AssociationDescriptor.create("DirectoryNodeService",
+ "directoriesInj",
+ org.drools.grid.DirectoryNodeService.class,
+ DiscoveryGroupManagement.ALL_GROUPS);
+ /*
+ * Create and configure association management. Make sure to set
+ * the backend, this is the object that has the setter method provided
+ * above. For our case its "this".
+ */
+ AssociationMgmt aMgr = new AssociationMgmt();
+ aMgr.setBackend(this);
+ aMgr.addAssociationDescriptors(descriptorExecutionNode, descriptorDirectoryNode);
+
+
+ long waited = 0;
+ while (nodeConnectors.size() == 0 && waited < 30000) {
+ Thread.sleep(500);
+ waited += 500;
+ }
+
+ if (nodeConnectors.size() > 0 && directories.size() > 0) {
+ return true;
+ }
+
+
+
+ return false;
}
-
@Override
public ExecutionNode getExecutionNode(NodeSelectionStrategy strategy) {
ExecutionNode node = null;
GenericNodeConnector currentNode = null;
try {
-
+
//if the strategy is null use the default one
if (strategy == null) {
currentNode = getBestNode(new StaticIncrementalSelectionStrategy(this));
@@ -81,42 +126,74 @@
}
if (currentNode.connect()) {
node = new ExecutionNode();
- node.set(KnowledgeBuilderFactoryService.class, new KnowledgeBuilderProviderGridClient(currentNode, this));
+ node.set(KnowledgeBuilderFactoryService.class,
+ new KnowledgeBuilderProviderGridClient(currentNode, this));
node.set(KnowledgeBaseFactoryService.class, new KnowledgeBaseProviderGridClient(currentNode, this));
node.set(DirectoryLookupFactoryService.class, new DirectoryLookupProviderGridClient(currentNode, this));
}
-
+
} catch (RemoteException ex) {
Logger.getLogger(GridConnection.class.getName()).log(Level.SEVERE, null, ex);
}
return node;
}
-
-
-
public GenericNodeConnector getBestNode(NodeSelectionStrategy nodeSelectionStrategy) {
return nodeSelectionStrategy.getBestNode();
+
+
}
+ public void setNodeConnectorsInj(Iterable<ExecutionNodeService> nodes) {
+ for (ExecutionNodeService node : nodes) {
+ addNodeConnector(node);
+ }
+
+
+ }
+
+ public void setDirectoriesInj(Iterable<DirectoryNodeService> nodes) {
+ for (DirectoryNodeService node : nodes) {
+ addDirectoryNode(node);
+ }
+
+
+ }
+
public List<DirectoryNodeService> getDirectories() {
- return directories;
+ return (List<DirectoryNodeService>) directories;
+
+
}
public void setDirectories(List<DirectoryNodeService> directories) {
this.directories = directories;
+
+
}
public List<GenericNodeConnector> getNodeConnectors() {
return nodeConnectors;
+
+
}
- public void setServices(List<GenericNodeConnector> services) {
+ public void setNodeConnectors(List<GenericNodeConnector> services) {
this.nodeConnectors = services;
+
+
}
@Override
public DirectoryNodeService getDirectoryNode(DirectoryServiceSelectionStrategy directorySelectionStrategy) {
- return directories.get(0);
+ return ((List<DirectoryNodeService>) directories).get(0);
+
+
}
+
+ @Override
+ public ExecutionNode getExecutionNode() {
+ return getExecutionNode(null);
+
+ }
}
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/DirectoryNodeServiceImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/DirectoryNodeServiceImpl.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/DirectoryNodeServiceImpl.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -43,6 +43,11 @@
public void register(String sessionId, String sessionServiceId) throws RemoteException {
System.out.println("Registering: "+ sessionId + " -- "+sessionServiceId);
directoryMap.put(sessionId, sessionServiceId);
+ for(ExecutionNodeService node : nodeServices){
+ if(node.getId().equals(sessionServiceId)){
+ node.incrementKsessionCounter();
+ }
+ }
}
@Override
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/ExecutionNodeServiceImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/ExecutionNodeServiceImpl.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/java/org/drools/grid/distributed/impl/ExecutionNodeServiceImpl.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -31,6 +31,7 @@
import org.drools.grid.distributed.util.IDEntry;
import org.rioproject.core.jsb.ServiceBeanContext;
+import org.rioproject.watch.CounterWatch;
import org.rioproject.watch.GaugeWatch;
/**
@@ -42,6 +43,7 @@
private GenericMessageHandler handler;
private String id;
private GaugeWatch loadWatch;
+ private CounterWatch ksessionCounter;
private Long instanceID;
public ExecutionNodeServiceImpl() {
@@ -78,7 +80,9 @@
public void setServiceBeanContext(ServiceBeanContext context) {
context.addAttribute(new IDEntry(this.id));
loadWatch = new GaugeWatch("load");
+ ksessionCounter = new CounterWatch("ksessionCounter");
context.getWatchRegistry().register(loadWatch);
+ context.getWatchRegistry().register(ksessionCounter);
instanceID = context.getServiceBeanConfig().getInstanceID();
}
@@ -124,5 +128,25 @@
loadWatch.getThresholdManager().getThresholdCrossed());
}
+
+ public double getKsessionCounter() throws RemoteException {
+ return ksessionCounter.getLastCalculableValue();
+ }
+
+
+ public void incrementKsessionCounter() throws RemoteException {
+ double last = ksessionCounter.getLastCalculableValue();
+ ksessionCounter.increment();
+
+ System.err.println(System.currentTimeMillis() + " "+
+ "---> ["+instanceID+"] was [" + ksessionCounter.getLastCalculableValue() +
+ "], " +
+ "breached=" +
+ ksessionCounter.getThresholdManager().getThresholdCrossed());
+
+ }
+
+
+
}
Added: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/drools/executionNodeService.groovy
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/drools/executionNodeService.groovy (rev 0)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/main/resources/org/drools/executionNodeService.groovy 2010-04-12 14:28:07 UTC (rev 32518)
@@ -0,0 +1,80 @@
+import org.rioproject.config.Constants
+import java.util.logging.Level
+
+import org.rioproject.resources.servicecore.Service
+
+deployment(name:'executionNodeService', debug: 'true') {
+
+ logging {
+ logger 'org.rioproject.resolver', Level.FINE
+ logger 'org.rioproject.associsations' , Level.FINE
+ }
+ /* Configuration for the discovery group that the service should join.
+ * This first checks if the org.rioproject.groups property is set, if not
+ * the user name is used */
+ groups System.getProperty(Constants.GROUPS_PROPERTY_NAME,
+ System.getProperty('user.name'))
+
+ /* Declares the artifacts required for deployment. Note the 'dl'
+ * classifier used for the 'download' jar */
+ artifact id:'service', 'org.drools:drools-grid-rio:5.1.0.SNAPSHOT'
+ artifact id:'service-dl', 'org.drools:drools-grid-rio:dl:5.1.0.SNAPSHOT'
+
+ /*
+ * Declare the service to be deployed. The number of instances deployed
+ * defaults to 1. If you require > 1 instances change as needed
+ */
+ service(name: 'ExecutionNodeService') {
+ interfaces {
+ classes 'org.drools.grid.ExecutionNodeService'
+ artifact ref:'service-dl'
+ }
+ implementation(class:'org.drools.grid.distributed.impl.ExecutionNodeServiceImpl') {
+ artifact ref:'service'
+ }
+ /*sla(id:'load', low:10, high: 30) {
+ rule resource: 'ScalingRuleHandler', max:5
+ }*/
+ sla(id:'ksessionCounter', low:1, high: 4) {
+ rule resource: 'ScalingRuleHandlerCounter', max:5
+ }
+ maintain 1
+ }
+ service(name: 'DirectoryNodeService') {
+ interfaces {
+ classes 'org.drools.grid.DirectoryNodeService'
+ artifact ref:'service-dl'
+ }
+ implementation(class:'org.drools.grid.distributed.impl.DirectoryNodeServiceImpl') {
+ artifact ref:'service'
+ }
+
+ association (name:'ExecutionNodeService', type:'uses', property:'nodeServices')
+
+ maintain 1
+ }
+
+ service(name: 'Gnostic') {
+ interfaces {
+ classes 'org.rioproject.gnostic.Gnostic'
+ artifact ref: 'service-dl'
+ }
+ implementation(class: 'org.rioproject.gnostic.GnosticImpl') {
+ artifact ref: 'service'
+ }
+
+ parameters {
+ parameter name: "create-core-associations", value: "yes"
+ }
+
+ associations {
+ ['ExecutionNodeService'].each {
+ association name: "$it",
+ type: 'uses', property: 'service',
+ serviceType: Service.name
+ }
+ }
+ maintain 1
+ }
+
+}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ExecutionNodeBaseTest.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -313,30 +313,30 @@
}
- @Test
- public void scalingUp(){
- for(int i=1; i<20; i++) {
- List<GenericNodeConnector> services = connection.getNodeConnectors();
- for(GenericNodeConnector serviceConnector : services) {
- if(serviceConnector instanceof ExecutionNodeService){
- Throwable thrown = null;
- try {
- double d = ((ExecutionNodeService)serviceConnector).getLoad();
- if(d<80)
- ((ExecutionNodeService)serviceConnector).setLoad(d+10);
- else
- ((ExecutionNodeService)serviceConnector).setLoad(d);
- Thread.sleep(5000);
- } catch (Exception e) {
- thrown = e;
- }
- Assert.assertNull(thrown);
- }
- }
- }
+// @Test
+// public void scalingUp(){
+// for(int i=1; i<20; i++) {
+// List<GenericNodeConnector> services = connection.getNodeConnectors();
+// for(GenericNodeConnector serviceConnector : services) {
+// if(serviceConnector instanceof ExecutionNodeService){
+// Throwable thrown = null;
+// try {
+// double d = ((ExecutionNodeService)serviceConnector).getLoad();
+// if(d<80)
+// ((ExecutionNodeService)serviceConnector).setLoad(d+10);
+// else
+// ((ExecutionNodeService)serviceConnector).setLoad(d);
+// Thread.sleep(5000);
+// } catch (Exception e) {
+// thrown = e;
+// }
+// Assert.assertNull(thrown);
+// }
+// }
+// }
+//
+// }
- }
-
}
Modified: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ITGridExecutionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ITGridExecutionTest.java 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/java/org/drools/grid/distributed/ITGridExecutionTest.java 2010-04-12 14:28:07 UTC (rev 32518)
@@ -49,7 +49,7 @@
}
//Get an execution node using the default/round robin strategy
- node = connection.getExecutionNode(null);
+ node = connection.getExecutionNode();
System.out.println("Node = "+ node);
Copied: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.bak.groovy (from rev 32467, labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.groovy)
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.bak.groovy (rev 0)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.bak.groovy 2010-04-12 14:28:07 UTC (rev 32518)
@@ -0,0 +1,79 @@
+import org.rioproject.config.Constants
+import java.util.logging.Level
+
+import org.rioproject.resources.servicecore.Service
+
+deployment(name:'executionNodeService', debug: 'true') {
+
+ logging {
+ logger 'org.rioproject.resolver', Level.FINE
+ }
+ /* Configuration for the discovery group that the service should join.
+ * This first checks if the org.rioproject.groups property is set, if not
+ * the user name is used */
+ groups System.getProperty(Constants.GROUPS_PROPERTY_NAME,
+ System.getProperty('user.name'))
+
+ /* Declares the artifacts required for deployment. Note the 'dl'
+ * classifier used for the 'download' jar */
+ artifact id:'service', 'org.drools:drools-grid-rio:5.1.0.SNAPSHOT'
+ artifact id:'service-dl', 'org.drools:drools-grid-rio:dl:5.1.0.SNAPSHOT'
+
+ /*
+ * Declare the service to be deployed. The number of instances deployed
+ * defaults to 1. If you require > 1 instances change as needed
+ */
+ service(name: 'ExecutionNodeService') {
+ interfaces {
+ classes 'org.drools.grid.ExecutionNodeService'
+ artifact ref:'service-dl'
+ }
+ implementation(class:'org.drools.grid.distributed.impl.ExecutionNodeServiceImpl') {
+ artifact ref:'service'
+ }
+ sla(id:'load', low:10, high: 30) {
+ rule resource: 'ScalingRuleHandler', max:5
+ }
+ sla(id:'ksessionCounter', low:0, high: 2) {
+ rule resource: 'ScalingRuleHandler', max:5
+ }
+ maintain 1
+ }
+ service(name: 'DirectoryNodeService') {
+ interfaces {
+ classes 'org.drools.grid.DirectoryNodeService'
+ artifact ref:'service-dl'
+ }
+ implementation(class:'org.drools.grid.distributed.impl.DirectoryNodeServiceImpl') {
+ artifact ref:'service'
+ }
+
+ association (name:'ExecutionNodeService', type:'uses', property:'nodeServices')
+
+ maintain 1
+ }
+
+ service(name: 'Gnostic') {
+ interfaces {
+ classes 'org.rioproject.gnostic.Gnostic'
+ artifact ref: 'service-dl'
+ }
+ implementation(class: 'org.rioproject.gnostic.GnosticImpl') {
+ artifact ref: 'service'
+ }
+
+ parameters {
+ parameter name: "create-core-associations", value: "yes"
+ }
+
+ associations {
+ ['ExecutionNodeService'].each {
+ association name: "$it",
+ type: 'uses', property: 'service',
+ serviceType: Service.name
+ }
+ }
+ maintain 1
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.groovy
===================================================================
--- labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.groovy 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/drools-grid-rio/src/test/resources/org/drools/executionNodeService.groovy 2010-04-12 14:28:07 UTC (rev 32518)
@@ -1,76 +0,0 @@
-import org.rioproject.config.Constants
-import java.util.logging.Level
-
-import org.rioproject.resources.servicecore.Service
-
-deployment(name:'executionNodeService', debug: 'true') {
-
- logging {
- logger 'org.rioproject.resolver', Level.FINE
- }
- /* Configuration for the discovery group that the service should join.
- * This first checks if the org.rioproject.groups property is set, if not
- * the user name is used */
- groups System.getProperty(Constants.GROUPS_PROPERTY_NAME,
- System.getProperty('user.name'))
-
- /* Declares the artifacts required for deployment. Note the 'dl'
- * classifier used for the 'download' jar */
- artifact id:'service', 'org.drools:drools-grid-rio:5.1.0.SNAPSHOT'
- artifact id:'service-dl', 'org.drools:drools-grid-rio:dl:5.1.0.SNAPSHOT'
-
- /*
- * Declare the service to be deployed. The number of instances deployed
- * defaults to 1. If you require > 1 instances change as needed
- */
- service(name: 'ExecutionNodeService') {
- interfaces {
- classes 'org.drools.grid.ExecutionNodeService'
- artifact ref:'service-dl'
- }
- implementation(class:'org.drools.grid.distributed.impl.ExecutionNodeServiceImpl') {
- artifact ref:'service'
- }
- sla(id:'load', low:10, high: 30) {
- rule resource: 'ScalingRuleHandler', max:5
- }
- maintain 2
- }
- service(name: 'DirectoryNodeService') {
- interfaces {
- classes 'org.drools.grid.DirectoryNodeService'
- artifact ref:'service-dl'
- }
- implementation(class:'org.drools.grid.distributed.impl.DirectoryNodeServiceImpl') {
- artifact ref:'service'
- }
-
- association (name:'ExecutionNodeService', type:'uses', property:'nodeServices')
-
- maintain 1
- }
-
- service(name: 'Gnostic') {
- interfaces {
- classes 'org.rioproject.gnostic.Gnostic'
- artifact ref: 'service-dl'
- }
- implementation(class: 'org.rioproject.gnostic.GnosticImpl') {
- artifact ref: 'service'
- }
-
- parameters {
- parameter name: "create-core-associations", value: "yes"
- }
-
- associations {
- ['ExecutionNodeService'].each {
- association name: "$it",
- type: 'uses', property: 'service',
- serviceType: Service.name
- }
- }
- maintain 1
- }
-
-}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-grid/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-grid/pom.xml 2010-04-12 14:06:26 UTC (rev 32517)
+++ labs/jbossrules/trunk/drools-grid/pom.xml 2010-04-12 14:28:07 UTC (rev 32518)
@@ -7,7 +7,7 @@
<groupId>org.drools</groupId>
<version>5.1.0.SNAPSHOT</version>
</parent>
-
+
<artifactId>drools-grid</artifactId>
<packaging>pom</packaging>
<name>Drools :: Grid</name>
@@ -17,10 +17,10 @@
<module>drools-grid-task</module>
<!-- You need JDK 1.6 and a special branch of the RIO project to work with this -->
<!-- This will be updated soon to be used with RIO trunk -->
- <!-- For building this module with Hudson, we need to have installed a RIO runtime/RIO trunk inside
- the Hudson Machine and compile everything with JDK 1.6. Also you need to export the RIO_HOME
+ <!-- For building this module with Hudson, we need to have installed a RIO runtime/RIO trunk inside
+ the Hudson Machine and compile everything with JDK 1.6. Also you need to export the RIO_HOME
env variable -->
<!--module>drools-grid-rio</module-->
</modules>
-
+
</project>
More information about the jboss-svn-commits
mailing list