[jboss-svn-commits] JBL Code SVN: r20696 - in labs/jbossesb/trunk: product/lib/ext and 43 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jun 23 07:38:42 EDT 2008
Author: beve
Date: 2008-06-23 07:38:41 -0400 (Mon, 23 Jun 2008)
New Revision: 20696
Added:
labs/jbossesb/trunk/product/lib/ext/mvel-1.3.1-java1.4.jar
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/lib/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/processDefinition/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/http%3A%2F%2Flocalhost%3A8080%2Fdrools-jbrms%2Forg.drools.brms.JBRMS%2Fpackage%2Forg.jboss.soa.esb.services.rules%2FLATEST
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/insurancepolicy.jar
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/lib/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-4.0.7.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/mvel-1.3.1-java1.4.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/stax-api-1.0.1.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/xstream-1.2.2.jar
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.drl
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.properties
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.xls
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/testrules.pkg
Removed:
labs/jbossesb/trunk/product/lib/ext/mvel14-1.2rc4rv908.jar
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/lib/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/processDefinition/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/http%3A%2F%2Flocalhost%3A8080%2Fdrools-jbrms%2Forg.drools.brms.JBRMS%2Fpackage%2Forg.jboss.soa.esb.services.rules%2FLATEST
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/insurancepolicy.jar
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/lib/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/
labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-4.0.2.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-4.0.2.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-4.0.2.jar
labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-4.0.2.jar
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/
Modified:
labs/jbossesb/trunk/
labs/jbossesb/trunk/product/services/jbrules/build.xml
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedRouter.java
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBRules.drl
labs/jbossesb/trunk/product/services/jbrules/src/test/resources/log4j.xml
Log:
Work for JBESB-644, JBESB-645, JBESB-643. These are implemented with the new RuleService which is why this is one check-in instead of three seperate ones.
Drools is now at version 4.0.7.
Note that mvel has been upgraded in the main esb project aswell(product/lib/ext): from 1.2rc4rv908 to 1.3.1-java1.4
Property changes on: labs/jbossesb/trunk
___________________________________________________________________
Name: svnmerge-integrated
- /labs/jbossesb/workspace/dbevenius/ruleservice:1-20413
+ /labs/jbossesb/workspace/dbevenius/ruleservice:1-20693
Copied: labs/jbossesb/trunk/product/lib/ext/mvel-1.3.1-java1.4.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/lib/ext/mvel-1.3.1-java1.4.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/mvel14-1.2rc4rv908.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,3 +0,0 @@
-<Policy type="COMPREHENSIVE" >
- <Driver name="Bill Smith" age="30" priorClaims="0" locationRiskProfile="LOW" />
-</Policy>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/SampleDriver.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,3 @@
+<Policy type="COMPREHENSIVE" >
+ <Driver name="Bill Smith" age="30" priorClaims="0" locationRiskProfile="LOW" />
+</Policy>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,31 +0,0 @@
-<project name="Quickstart_business_ruleservice_ruleAgent" default="run" basedir=".">
-
- <description>
- ${ant.project.name}
- ${line.separator}
- </description>
-
- <property name="additional.deploys" value="ruleAgent/brmsdeployedrules.properties ruleAgent/package/org.jboss.soa.esb.services.rules.pkg smooks-res.xml"/>
-
- <target name="quickstart-specific-assemblies">
- <copy file="${basedir}/ruleAgent/brmsdeployedrules-unfiltered.properties" tofile="${basedir}/ruleAgent/brmsdeployedrules.properties" overwrite="true" filtering="true">
- <filterset>
- <filter token="quickstart.dir" value="${basedir}"/>
- </filterset>
- </copy>
- </target>
-
-
- <!-- Import the base Ant build script... -->
- <import file="../conf/base-build.xml"/>
-
-
- <target name="runtest" depends="compile"
- description="will receive JMS message to trigger the actions in the ESB">
- <echo>Runs Test JMS Sender</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.businessrules.test.SendJMSMessage" failonerror="true">
- <classpath refid="exec-classpath" />
- </java>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,31 @@
+<project name="Quickstart_business_ruleservice_ruleAgent" default="run" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="ruleAgent/brmsdeployedrules.properties ruleAgent/package/org.jboss.soa.esb.services.rules.pkg smooks-res.xml"/>
+
+ <target name="quickstart-specific-assemblies">
+ <copy file="${basedir}/ruleAgent/brmsdeployedrules-unfiltered.properties" tofile="${basedir}/ruleAgent/brmsdeployedrules.properties" overwrite="true" filtering="true">
+ <filterset>
+ <filter token="quickstart.dir" value="${basedir}"/>
+ </filterset>
+ </copy>
+ </target>
+
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+
+ <target name="runtest" depends="compile"
+ description="will receive JMS message to trigger the actions in the ESB">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.test.SendJMSMessage" failonerror="true">
+ <classpath refid="exec-classpath" />
+ </java>
+ </target>
+
+</project>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbossesb-deployment>
- <depends>jboss.esb:deployment=jbrules.esb</depends>
- <depends>jboss.esb:deployment=smooks.esb</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB</depends>
-<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify</depends>
-</jbossesb-deployment>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbrules.esb</depends>
+ <depends>jboss.esb:deployment=smooks.esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB</depends>
+<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify</depends>
+</jbossesb-deployment>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- </server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ </server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
-</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,68 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb
- xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
-
- <providers>
- <jms-provider name="JBossMQ"
- connection-factory="ConnectionFactory"
- jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-URL="localhost">
- <jms-bus busid="quickstartGwChannel">
- <jms-message-filter dest-type="QUEUE"
- dest-name="queue/quickstart_Business_Rules_Request_GW" />
- </jms-bus>
- <jms-bus busid="quickstartEsbChannel">
- <jms-message-filter dest-type="QUEUE"
- dest-name="queue/quickstart_Business_Rules_Request_ESB" />
- </jms-bus>
- </jms-provider>
- </providers>
-
- <services>
-
- <service category="PolicyPricingServices"
- name="PolicyPricingService" description="Prices the policy application">
- <listeners>
- <!-- Gateway -->
- <jms-listener name="TheGateway"
- busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
- <jms-listener name="TheESBChannel"
- busidref="quickstartEsbChannel" maxThreads="1">
- </jms-listener>
- </listeners>
-
- <actions mep="OneWay">
- <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="Message before transformation" />
- </action>
-
- <action name="transform"
- class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
- <property name="resource-config"
- value="/smooks-res.xml" />
- </action>
-
- <action name="fixUpMessage"
- class="org.jboss.soa.esb.samples.quickstart.businessrules.SetupMessage">
- </action>
-
- <!-- Use the BRP to calculate the policy price -->
- <action
- class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
- name="PolicyPricing">
- <property name="ruleSet"
- value="ruleAgent/brmsdeployedrules.properties" />
- <property name="object-paths">
- <object-path esb="body.Driver" />
- <object-path esb="body.Policy" />
- </property>
- </action>
-
- <action name="reviewMessage"
- class="org.jboss.soa.esb.samples.quickstart.businessrules.ReviewMessage">
- <property name="stuff" value="Sent notification: "/>
- </action>
- </actions>
- </service>
- </services>
-</jbossesb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,67 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+ <providers>
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost">
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter dest-type="QUEUE"
+ dest-name="queue/quickstart_Business_Rules_RuleAgent_Request_GW" />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE"
+ dest-name="queue/quickstart_Business_Rules_RuleAgent_Request_ESB" />
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="PolicyPricingServices"
+ name="PolicyPricingService" description="Prices the policy application">
+ <listeners>
+ <!-- Gateway -->
+ <jms-listener name="TheGateway"
+ busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
+ <jms-listener name="TheESBChannel"
+ busidref="quickstartEsbChannel" maxThreads="1">
+ </jms-listener>
+ </listeners>
+
+ <actions mep="OneWay">
+ <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message" value="Message before transformation" />
+ </action>
+
+ <action name="transform"
+ class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
+ <property name="resource-config"
+ value="/smooks-res.xml" />
+ </action>
+
+ <action name="fixUpMessage"
+ class="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.SetupMessage">
+ </action>
+
+ <!-- Use the BRP to calculate the policy price -->
+ <action
+ class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
+ name="PolicyPricing">
+ <property name="ruleAgentProperties" value="ruleAgent/brmsdeployedrules.properties" />
+ <property name="object-paths">
+ <object-path esb="body.Driver" />
+ <object-path esb="body.Policy" />
+ </property>
+ </action>
+
+ <action name="reviewMessage"
+ class="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.ReviewMessage">
+ <property name="stuff" value="Sent notification: "/>
+ </action>
+ </actions>
+ </service>
+ </services>
+</jbossesb>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- JBoss, Home of Professional Open Source
- Copyright 2006, JBoss Inc., and others contributors as indicated
- by the @authors tag. All rights reserved.
- See the copyright.txt in the distribution for a
- full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
- (C) 2005-2006,
- @author JBoss Inc.
--->
-<!-- $Id: jbossesb-unittest-properties.xml $ -->
-<!--
- These options are described in the JBossESB manual.
- Defaults are provided here for convenience only.
-
- Please read through this file prior to using the system, and consider
- updating the specified entries.
--->
-<esb
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
- <properties name="core">
- <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
- <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
- <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
- </properties>
- <properties name="registry">
- <property name="org.jboss.soa.esb.registry.queryManagerURI"
- value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
- <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
- value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
- <property name="org.jboss.soa.esb.registry.implementationClass"
- value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
- <property name="org.jboss.soa.esb.registry.factoryClass"
- value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
- <property name="org.jboss.soa.esb.registry.user"
- value="jbossesb"/>
- <property name="org.jboss.soa.esb.registry.password"
- value="password"/>
- <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
- <property name="org.jboss.soa.esb.scout.proxy.transportClass"
- value="org.apache.ws.scout.transport.RMITransport"/>
- </properties>
- <properties name="transports" depends="core">
- <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
- <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
- <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
- <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
- </properties>
- <properties name="connection">
- <property name="min-pool-size" value="5"/>
- <property name="max-pool=size" value="10"/>
- <property name="blocking-timeout-millis" value="5000"/>
- <property name="abandoned-connection-timeout" value="10000"/>
- <property name="abandoned-connection-time-interval" value="30000"/>
- </properties>
- <properties name="dbstore">
- <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
- <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
- <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
- <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
- <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
- <!--table managed by pool to test for valid connections - created by pool automatically -->
- <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
- <!-- # of milliseconds to timeout waiting for a connection from pool -->
- <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
- </properties>
- <properties name="messagerouting">
- <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
- </properties>
-</esb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jbossesb-properties.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,5 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-java.naming.factory.url.pkgs=org.jnp.interfaces
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/jndi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,69 +0,0 @@
-# jUDDI Registry Properties (used by RegistryServer)
-# see http://www.juddi.org for more information
-
-# The UDDI Operator Name
-juddi.operatorName = jUDDI.org
-
-# The i18n locale default codes
-juddi.i18n.languageCode = en
-juddi.i18n.countryCode = US
-
-# The UDDI DiscoveryURL Prefix
-juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
-
-# The UDDI Operator Contact Email Address
-juddi.operatorEmailAddress = admin at juddi.org
-
-# The maximum name size and maximum number
-# of name elements allows in several of the
-# FindXxxx and SaveXxxx UDDI functions.
-juddi.maxNameLength=255
-juddi.maxNameElementsAllowed=5
-
-# The maximum number of UDDI artifacts allowed
-# per publisher. A value of '-1' indicates any
-# number of artifacts is valid (These values can be
-# overridden at the individual publisher level).
-juddi.maxBusinessesPerPublisher=25
-juddi.maxServicesPerBusiness=20
-juddi.maxBindingsPerService=10
-juddi.maxTModelsPerPublisher=100
-
-# jUDDI Authentication module to use
-juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
-
-# jUDDI DataStore module currently to use
-juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
-
-# use a dataSource (if set to false a direct
-# jdbc connection will be used.
-juddi.isUseDataSource=false
-juddi.jdbcDriver=com.mysql.jdbc.Driver
-juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
-juddi.jdbcUsername=root
-juddi.jdbcPassword=admin
-# jUDDI DataSource to use
-# juddi.dataSource=java:comp/env/jdbc/MySqlDS
-
-# jUDDI UUIDGen implementation to use
-juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
-
-# jUDDI Cryptor implementation to use
-juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
-
-# jUDDI Validator to use
-juddi.validator=org.apache.juddi.validator.DefaultValidator
-
-# jUDDI Proxy Properties (used by RegistryProxy)
-juddi.proxy.adminURL = http://localhost:8080/juddi/admin
-juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
-juddi.proxy.publishURL = http://localhost:8080/juddi/publish
-juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
-juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
-juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
-
-# JNDI settings (used by RMITransport)
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/juddi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/lib (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/lib)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
-
-<!--
- | For more configuration infromation and examples see the Jakarta Log4j
- | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <!-- ============================== -->
- <!-- Append messages to the console -->
- <!-- ============================== -->
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="Target" value="System.out"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
- </layout>
- </appender>
-
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A size based file rolling appender -->
- <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="File" value="./listener.log"/>
- <param name="Append" value="false"/>
- <param name="MaxFileSize" value="500KB"/>
- <param name="MaxBackupIndex" value="1"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
- </layout>
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jboss">
- <priority value="WARN"/>
- </category>
- <category name="org.jboss.soa.esb">
- <priority value="WARN"/>
- </category>
- <category name="org.jboss.internal.soa.esb">
- <priority value="WARN"/>
- </category>
- <category name="org.apache">
- <priority value="ERROR"/>
- </category>
- <category name="org.milyn">
- <priority value="ERROR"/>
- </category>
-
- <category name="quickstarts">
- <priority value="WARN"/>
- </category>
-
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </root>
-
-</log4j:configuration>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/log4j.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./listener.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.milyn">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="quickstarts">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/processDefinition (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/processDefinition)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,55 +0,0 @@
-Overview:
-=========
- Demonstrates the use of the BusinessRulesProcessor which uses facts that are
- POJOs attached to an ESB Message. The example uses Rules to calculate the price
- of an automobile insurance policy. In particular, this example gets the rules from
- a rule package that is contained in the file system through the Drools RuleAgent.
- This rule package can also be retrieved from a URL created by the Drools BRMS.
-
- Make sure you have run simple_cbr, transformation_XML2POJO and fun_cbr
- quickstarts as their principles are used in this more complex example.
-
-Running this quickstart:
-========================
- Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
- and a more detailed descripton of the different ways to run the quickstarts.
-
- A comprehensive description of message transformation can be found in
- MessageTransformation.pdf, located in the docs/services folder.
-
- Notice the brmsdeployedrules.properties in the ruleAgent folder. This points
- the location of the rule package. It can specify a fully qualified file name,
- or just the directory (if there is only one package file in it). Modify one
- of these to match the path of your ESB installation.
-
-To Run standalone mode:
-=======================
- 1. In a command terminal window in the quickstart folder type
- 'ant deploy-jms-dests'.
- 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
- 3. Open another command terminal window in this folder ("Window2"), type
- 'ant runtest'.
- 4. Switch back to "Window1" to see the output from the ESB
- 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
- ("Window1"), type 'ant undeploy-jms-dests'.
-
-To Run '.esb' archive mode:
-===========================
- 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
- 2. Open another command terminal window in this folder ("Window2"), type
- 'ant runtest'.
- 3. Switch back to Application Server console to see the output from the ESB
- 4. In this folder ("Window1"), type 'ant undeploy'.
-
-What to look at in this Quickstart:
-===================================
-
- The SendJMSMessage will send a message with the SampleDriver.xml included as a string.
- A Transformation service will convert the XML to POJOs (Driver and Policy), and put
- these objects in the message. The message is then sent to the PolicyPricing service
- which uses the brmsdeployedrules.property to access the rule package, creates a new
- stateless session, inserts the Driver and Policy from the message, and executes the
- rules. The console will show the resulting price of the policy that is calculated
- from the rules.
-
-
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/readme.txt 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,55 @@
+Overview:
+=========
+ Demonstrates the use of the BusinessRulesProcessor which uses facts that are
+ POJOs attached to an ESB Message. The example uses Rules to calculate the price
+ of an automobile insurance policy. In particular, this example gets the rules from
+ a rule package that is contained in the file system through the Drools RuleAgent.
+ This rule package can also be retrieved from a URL created by the Drools BRMS.
+
+ Make sure you have run simple_cbr, transformation_XML2POJO and fun_cbr
+ quickstarts as their principles are used in this more complex example.
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+ A comprehensive description of message transformation can be found in
+ MessageTransformation.pdf, located in the docs/services folder.
+
+ Notice the brmsdeployedrules.properties in the ruleAgent folder. This points
+ the location of the rule package. It can specify a fully qualified file name,
+ or just the directory (if there is only one package file in it). Modify one
+ of these to match the path of your ESB installation.
+
+To Run standalone mode:
+=======================
+ 1. In a command terminal window in the quickstart folder type
+ 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB
+ 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
+ ("Window1"), type 'ant undeploy-jms-dests'.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+ 4. In this folder ("Window1"), type 'ant undeploy'.
+
+What to look at in this Quickstart:
+===================================
+
+ The SendJMSMessage will send a message with the SampleDriver.xml included as a string.
+ A Transformation service will convert the XML to POJOs (Driver and Policy), and put
+ these objects in the message. The message is then sent to the PolicyPricing service
+ which uses the brmsdeployedrules.property to access the rule package, creates a new
+ stateless session, inserts the Driver and Policy from the message, and executes the
+ rules. The console will show the resulting price of the policy that is calculated
+ from the rules.
+
+
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,11 +0,0 @@
-newInstance=true
-
-file=@quickstart.dir@/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
-#dir=/ruleAgent/package
-
-
-#url=http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.jboss.soa.esb.services.rules/LATEST
-#localCacheDir=/ruleAgent/cache
-poll=30
-
-name=insuranceconfig
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules-unfiltered.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,11 @@
+newInstance=true
+
+file=@quickstart.dir@/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
+#dir=/ruleAgent/package
+
+
+#url=http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.jboss.soa.esb.services.rules/LATEST
+#localCacheDir=/ruleAgent/cache
+poll=30
+
+name=insuranceconfig
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,11 +0,0 @@
-newInstance=true
-
-file=/opt/jboss/esb/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
-#dir=/ruleAgent/package
-
-
-#url=http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.jboss.soa.esb.services.rules/LATEST
-#localCacheDir=/ruleAgent/cache
-poll=30
-
-name=insuranceconfig
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/brmsdeployedrules.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,11 @@
+newInstance=true
+
+file=/opt/jboss/esb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
+#dir=/ruleAgent/package
+
+
+#url=http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.jboss.soa.esb.services.rules/LATEST
+#localCacheDir=/ruleAgent/cache
+poll=30
+
+name=insuranceconfig
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/http%3A%2F%2Flocalhost%3A8080%2Fdrools-jbrms%2Forg.drools.brms.JBRMS%2Fpackage%2Forg.jboss.soa.esb.services.rules%2FLATEST
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/http%3A%2F%2Flocalhost%3A8080%2Fdrools-jbrms%2Forg.drools.brms.JBRMS%2Fpackage%2Forg.jboss.soa.esb.services.rules%2FLATEST (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/cache/http%3A%2F%2Flocalhost%3A8080%2Fdrools-jbrms%2Forg.drools.brms.JBRMS%2Fpackage%2Forg.jboss.soa.esb.services.rules%2FLATEST)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/insurancepolicy.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/insurancepolicy.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/insurancepolicy.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,28 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <!-- Populate the Policy -->
- <resource-config selector="policy">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">Policy</param>
- <param name="beanClass">org.jboss.soa.esb.services.rules.Policy</param>
- <param name="bindings">
- <binding property="type" selector="policy @type" />
- </param>
- </resource-config>
-
- <!-- Populate the Driver -->
- <resource-config selector="policy driver">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">Driver</param>
- <param name="beanClass">org.jboss.soa.esb.services.rules.Driver</param>
- <param name="setOn">Policy</param>
- <param name="bindings">
- <binding property="name" selector="policy driver @name" />
- <binding property="age" selector="policy driver @age" type="Integer" />
- <binding property="priorClaims" selector="policy driver @priorClaims" type="Integer" />
- <binding property="locationRiskProfile" selector="policy driver @locationRiskProfile" />
- </param>
- </resource-config>
-
-</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/smooks-res.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,28 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <!-- Populate the Policy -->
+ <resource-config selector="policy">
+ <resource>org.milyn.javabean.BeanPopulator</resource>
+ <param name="beanId">Policy</param>
+ <param name="beanClass">org.jboss.soa.esb.services.rules.Policy</param>
+ <param name="bindings">
+ <binding property="type" selector="policy @type" />
+ </param>
+ </resource-config>
+
+ <!-- Populate the Driver -->
+ <resource-config selector="policy driver">
+ <resource>org.milyn.javabean.BeanPopulator</resource>
+ <param name="beanId">Driver</param>
+ <param name="beanClass">org.jboss.soa.esb.services.rules.Driver</param>
+ <param name="setOn">Policy</param>
+ <param name="bindings">
+ <binding property="name" selector="policy driver @name" />
+ <binding property="age" selector="policy driver @age" type="Integer" />
+ <binding property="priorClaims" selector="policy driver @priorClaims" type="Integer" />
+ <binding property="locationRiskProfile" selector="policy driver @locationRiskProfile" />
+ </param>
+ </resource-config>
+
+</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java 2008-06-19 08:15:46 UTC (rev 20635)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
-
-import java.util.HashMap;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.rules.Driver;
-import org.jboss.soa.esb.services.rules.Policy;
-
-public class ReviewMessage extends AbstractActionPipelineProcessor {
- private String input = "Sent Notification to:";
-
- public Message process(Message message) throws ActionProcessingException {
-
- Driver driver = (Driver) message.getBody().get("Driver");
- Policy policy = (Policy) message.getBody().get("Policy");
- System.out.println("{ ================ " + input);
- System.out.println("Name: " + driver.getName());
- System.out.println("Policy Price: " + policy.getBasePrice());
- System.out.println("} ================ " + input);
-
-
- return message;
- }
-
- public ReviewMessage(ConfigTree configTree) {
- input = configTree.getAttribute("stuff");
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.Driver;
+import org.jboss.soa.esb.services.rules.Policy;
+
+public class ReviewMessage extends AbstractActionPipelineProcessor {
+ private String input = "Sent Notification to:";
+
+ public Message process(Message message) throws ActionProcessingException {
+
+ Driver driver = (Driver) message.getBody().get("Driver");
+ Policy policy = (Policy) message.getBody().get("Policy");
+ System.out.println("{ ================ " + input);
+ System.out.println("Name: " + driver.getName());
+ System.out.println("Policy Price: " + policy.getBasePrice());
+ System.out.println("} ================ " + input);
+
+
+ return message;
+ }
+
+ public ReviewMessage(ConfigTree configTree) {
+ input = configTree.getAttribute("stuff");
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java 2008-06-19 08:15:46 UTC (rev 20635)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
-
-import java.util.HashMap;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.rules.Driver;
-import org.jboss.soa.esb.services.rules.Policy;
-import org.apache.log4j.Logger;
-
-public class SetupMessage extends AbstractActionPipelineProcessor {
- private Logger logger = Logger.getLogger(SetupMessage.class);
-
- public Message process(Message message) throws ActionProcessingException {
- HashMap transformedBeans = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
- if(transformedBeans != null) {
- Driver driver = (Driver) transformedBeans.get("Driver");
- Policy policy = (Policy) transformedBeans.get("Policy");
- message.getBody().add("Driver", driver);
- message.getBody().add("Policy", policy);
- logger.info("Moved the transformed driver and policy");
- }
- return message;
- }
-
- public SetupMessage(ConfigTree configTree) {
-
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.Driver;
+import org.jboss.soa.esb.services.rules.Policy;
+import org.apache.log4j.Logger;
+
+public class SetupMessage extends AbstractActionPipelineProcessor {
+ private Logger logger = Logger.getLogger(SetupMessage.class);
+
+ public Message process(Message message) throws ActionProcessingException {
+ HashMap transformedBeans = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
+ if(transformedBeans != null) {
+ Driver driver = (Driver) transformedBeans.get("Driver");
+ Policy policy = (Policy) transformedBeans.get("Policy");
+ message.getBody().add("Driver", driver);
+ message.getBody().add("Policy", policy);
+ logger.info("Moved the transformed driver and policy");
+ }
+ return message;
+ }
+
+ public SetupMessage(ConfigTree configTree) {
+
+ }
+
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java 2008-06-19 08:15:46 UTC (rev 20635)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.test;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.jms.JMSException;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.QueueSender;
-import javax.jms.ObjectMessage;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-public class SendJMSMessage {
- QueueConnection conn;
- QueueSession session;
- Queue que;
-
-
- public void setupConnection() throws JMSException, NamingException
- {
- InitialContext iniCtx = new InitialContext();
- Object tmp = iniCtx.lookup("ConnectionFactory");
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
- conn = qcf.createQueueConnection();
- que = (Queue) iniCtx.lookup("queue/quickstart_Business_Rules_RuleAgent_Request_GW");
- session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
- conn.start();
- System.out.println("Connection Started");
- }
-
- public void stop() throws JMSException
- {
- conn.stop();
- session.close();
- conn.close();
- }
-
- public void sendAMessage(String msg) throws JMSException {
-
- QueueSender send = session.createSender(que);
- ObjectMessage tm = session.createObjectMessage(msg);
- send.send(tm);
- send.close();
- }
- public String readAsciiFile(String fileName) throws IOException {
- FileReader fr = null;
- char[] thechars = null;
-
- try {
- File thefile = new File( fileName );
- fr = new FileReader( thefile );
- int size = (int) thefile.length();
- thechars = new char[size];
-
- int count, index = 0;
-
- // read in the bytes from the input stream
- while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
- size -= count;
- index += count;
- }
- } catch(Exception e) {
- System.out.println(e);
- }
- finally {
- if( fr != null )
- fr.close();
- }
- return new String(thechars);
-
- } // readAsciiFile
-
- public static void main(String args[]) throws Exception
- {
- SendJMSMessage sm = new SendJMSMessage();
- sm.setupConnection();
- String fileContent = sm.readAsciiFile("SampleDriver.xml");
- System.out.println("---------------------------------------------");
- System.out.println(fileContent);
- System.out.println("---------------------------------------------");
- sm.sendAMessage(fileContent);
- sm.stop();
-
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java (from rev 20635, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_Business_Rules_RuleAgent_Request_GW");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+ public String readAsciiFile(String fileName) throws IOException {
+ FileReader fr = null;
+ char[] thechars = null;
+
+ try {
+ File thefile = new File( fileName );
+ fr = new FileReader( thefile );
+ int size = (int) thefile.length();
+ thechars = new char[size];
+
+ int count, index = 0;
+
+ // read in the bytes from the input stream
+ while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+ size -= count;
+ index += count;
+ }
+ } catch(Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ if( fr != null )
+ fr.close();
+ }
+ return new String(thechars);
+
+ } // readAsciiFile
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ String fileContent = sm.readAsciiFile("SampleDriver.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+ sm.stop();
+
+ }
+
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,44 +0,0 @@
-package org.jboss.soa.esb.services.rules;
-
-import java.io.Serializable;
-
-/**
- * This represents obviously a driver who is applying for an insurance Policy.
- * @author Michael Neale
- *
- */
-public class Driver implements Serializable
-{
- private static final long serialVersionUID = 1L;
- private String name = "Mr Joe Blogs";
- private Integer age = new Integer(30);
- private Integer priorClaims = new Integer(0);
- private String locationRiskProfile = "LOW";
-
- public Integer getAge() {
- return age;
- }
- public void setAge(Integer age) {
- this.age = age;
- }
- public String getLocationRiskProfile() {
- return locationRiskProfile;
- }
- public void setLocationRiskProfile(String locationRiskProfile) {
- this.locationRiskProfile = locationRiskProfile;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public Integer getPriorClaims() {
- return priorClaims;
- }
- public void setPriorClaims(Integer priorClaims) {
- this.priorClaims = priorClaims;
- }
-
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Driver.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,44 @@
+package org.jboss.soa.esb.services.rules;
+
+import java.io.Serializable;
+
+/**
+ * This represents obviously a driver who is applying for an insurance Policy.
+ * @author Michael Neale
+ *
+ */
+public class Driver implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private String name = "Mr Joe Blogs";
+ private Integer age = new Integer(30);
+ private Integer priorClaims = new Integer(0);
+ private String locationRiskProfile = "LOW";
+
+ public Integer getAge() {
+ return age;
+ }
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+ public String getLocationRiskProfile() {
+ return locationRiskProfile;
+ }
+ public void setLocationRiskProfile(String locationRiskProfile) {
+ this.locationRiskProfile = locationRiskProfile;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Integer getPriorClaims() {
+ return priorClaims;
+ }
+ public void setPriorClaims(Integer priorClaims) {
+ this.priorClaims = priorClaims;
+ }
+
+
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,59 +0,0 @@
-package org.jboss.soa.esb.services.rules;
-
-import java.io.Serializable;
-
-/**
- * This represents a policy that a driver is applying for.
- *
- * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
- * some simple base price and discount that we can calculate with relatively simple rules !
- *
- * @author Michael Neale
- */
-public class Policy implements Serializable
-{
- private static final long serialVersionUID = 1L;
- private String type = "COMPREHENSIVE";
- private boolean approved = false;
- private int discountPercent = 0;
- private int basePrice;
- private Driver driver;
-
- public boolean isApproved() {
- return approved;
- }
- public void setApproved(boolean approved) {
- this.approved = approved;
- }
- public int getDiscountPercent() {
- return discountPercent;
- }
- public void setDiscountPercent(int discountPercent) {
- this.discountPercent = discountPercent;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void applyDiscount(int discount) {
- discountPercent += discount;
- }
- public int getBasePrice() {
- return basePrice;
- }
- public void setBasePrice(int basePrice) {
- this.basePrice = basePrice;
- }
- public Driver getDriver() {
- return driver;
- }
- public void setDriver(Driver driver) {
- this.driver = driver;
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/services/rules/Policy.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,59 @@
+package org.jboss.soa.esb.services.rules;
+
+import java.io.Serializable;
+
+/**
+ * This represents a policy that a driver is applying for.
+ *
+ * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
+ * some simple base price and discount that we can calculate with relatively simple rules !
+ *
+ * @author Michael Neale
+ */
+public class Policy implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private String type = "COMPREHENSIVE";
+ private boolean approved = false;
+ private int discountPercent = 0;
+ private int basePrice;
+ private Driver driver;
+
+ public boolean isApproved() {
+ return approved;
+ }
+ public void setApproved(boolean approved) {
+ this.approved = approved;
+ }
+ public int getDiscountPercent() {
+ return discountPercent;
+ }
+ public void setDiscountPercent(int discountPercent) {
+ this.discountPercent = discountPercent;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void applyDiscount(int discount) {
+ discountPercent += discount;
+ }
+ public int getBasePrice() {
+ return basePrice;
+ }
+ public void setBasePrice(int basePrice) {
+ this.basePrice = basePrice;
+ }
+ public Driver getDriver() {
+ return driver;
+ }
+ public void setDriver(Driver driver) {
+ this.driver = driver;
+ }
+
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,36 +0,0 @@
-#created on: Oct 22, 2007
-package org.jboss.soa.esb.services.rules
-
-#list any import classes here.
-import org.jboss.soa.esb.dvdstore.OrderHeader;
-import org.jboss.soa.esb.dvdstore.Customer;
-
-import org.jboss.soa.esb.message.Message;
-
-import java.util.Arrays;
-
-#declare any global variables here
-global org.jboss.soa.esb.message.Message message;
-
-
-rule "Apply 10% discount to customer if totalPrice of all their orders is over 100"
- dialect "mvel"
- when
- $c : Customer()
- $i : Number(intValue >= 100) from accumulate ( OrderHeader( customer.userName == $c.userName, $totalAmount : totalAmount),
- sum( $totalAmount ) );
- then
- $c.setOrderDiscount( 10 );
- System.out.println( "Customer " + $c.getUserName() + " now has a shopping total of " + $i );
-end
-
-rule "apply customer discount to latest order"
- when
- $c : Customer()
- $o : OrderHeader(customer.userName == $c.userName)
- then
- $o.setOrderDiscount($c.getOrderDiscount());
- System.out.println("set discount of " + $o.getOrderDiscount() +
- " on order " + $o.getOrderId() +
- " for customer " + $c.getUserName());
-end
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/OrderDiscountOnMultipleOrders.drl 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,36 @@
+#created on: Oct 22, 2007
+package org.jboss.soa.esb.services.rules
+
+#list any import classes here.
+import org.jboss.soa.esb.dvdstore.OrderHeader;
+import org.jboss.soa.esb.dvdstore.Customer;
+
+import org.jboss.soa.esb.message.Message;
+
+import java.util.Arrays;
+
+#declare any global variables here
+global org.jboss.soa.esb.message.Message message;
+
+
+rule "Apply 10% discount to customer if totalPrice of all their orders is over 100"
+ dialect "mvel"
+ when
+ $c : Customer()
+ $i : Number(intValue >= 100) from accumulate ( OrderHeader( customer.userName == $c.userName, $totalAmount : totalAmount),
+ sum( $totalAmount ) );
+ then
+ $c.setOrderDiscount( 10 );
+ System.out.println( "Customer " + $c.getUserName() + " now has a shopping total of " + $i );
+end
+
+rule "apply customer discount to latest order"
+ when
+ $c : Customer()
+ $o : OrderHeader(customer.userName == $c.userName)
+ then
+ $o.setOrderDiscount($c.getOrderDiscount());
+ System.out.println("set discount of " + $o.getOrderDiscount() +
+ " on order " + $o.getOrderId() +
+ " for customer " + $c.getUserName());
+end
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,12 +0,0 @@
-<Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0"
-netAmount="59.97" totalAmount="64.92" tax="4.95">
- <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
- <OrderLines>
- <OrderLine position="1" quantity="1">
- <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
- </OrderLine>
- <OrderLine position="2" quantity="1">
- <Product productId="299" title="Pulp Fiction" price="29.99"/>
- </OrderLine>
- </OrderLines>
-</Order>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder1.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,12 @@
+<Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0"
+netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="1">
+ <Product productId="299" title="Pulp Fiction" price="29.99"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,12 +0,0 @@
-<Order orderId="2" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="1"
-netAmount="59.97" totalAmount="64.92" tax="4.95">
- <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
- <OrderLines>
- <OrderLine position="1" quantity="1">
- <Product productId="473" title="Star Wars" price="29.98"/>
- </OrderLine>
- <OrderLine position="2" quantity="1">
- <Product productId="337" title="Fellowship of the Ring" price="29.99"/>
- </OrderLine>
- </OrderLines>
-</Order>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder2.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,12 @@
+<Order orderId="2" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="1"
+netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <Product productId="473" title="Star Wars" price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="1">
+ <Product productId="337" title="Fellowship of the Ring" price="29.99"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,12 +0,0 @@
-<Order orderId="3" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="2"
-netAmount="59.97" totalAmount="64.92" tax="4.95">
- <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
- <OrderLines>
- <OrderLine position="1" quantity="1">
- <Product productId="567" title="X-MEn" price="29.98"/>
- </OrderLine>
- <OrderLine position="2" quantity="1">
- <Product productId="499" title="X-Man 2" price="29.99"/>
- </OrderLine>
- </OrderLines>
-</Order>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/SampleOrder3.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,12 @@
+<Order orderId="3" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="2"
+netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <Product productId="567" title="X-MEn" price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="1">
+ <Product productId="499" title="X-Man 2" price="29.99"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/build.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,22 +0,0 @@
-<project name="Quickstart_business_ruleservice_stateful" default="run" basedir=".">
-
- <description>
- ${ant.project.name}
- ${line.separator}
- </description>
-
- <property name="additional.deploys" value="OrderDiscountOnMultipleOrders.drl smooks-res.xml"/>
-
- <!-- Import the base Ant build script... -->
- <import file="../conf/base-build.xml"/>
-
-
- <target name="runtest" depends="compile"
- description="willl receive JMS message to tigger the actions in the ESB">
- <echo>Runs Test JMS Sender</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.businessrules.test.SendJMSMessage" failonerror="true">
- <classpath refid="exec-classpath" />
- </java>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/build.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/build.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,22 @@
+<project name="Quickstart_business_ruleservice_stateful" default="run" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="OrderDiscountOnMultipleOrders.drl smooks-res.xml"/>
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+
+ <target name="runtest" depends="compile"
+ description="willl receive JMS message to tigger the actions in the ESB">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.businessrules.test.SendJMSMessage" failonerror="true">
+ <classpath refid="exec-classpath" />
+ </java>
+ </target>
+
+</project>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbossesb-deployment>
- <depends>jboss.esb:deployment=jbrules.esb</depends>
- <depends>jboss.esb:deployment=smooks.esb</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW</depends>
- <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB</depends>
-</jbossesb-deployment>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/deployment.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbrules.esb</depends>
+ <depends>jboss.esb:deployment=smooks.esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB</depends>
+</jbossesb-deployment>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
-</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbm-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB">
- <depends optional-attribute-name="DestinationManager">
- jboss.mq:service=DestinationManager
- </depends>
- </mbean>
-</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbmq-queue-service.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_GW">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Stateful_Request_ESB">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,75 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb
- xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
-
- <providers>
- <jms-provider name="JBossMQ"
- connection-factory="ConnectionFactory"
- jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-URL="localhost">
- <jms-bus busid="quickstartGwChannel">
- <jms-message-filter dest-type="QUEUE"
- dest-name="queue/quickstart_Business_Rules_Stateful_Request_GW" />
- </jms-bus>
- <jms-bus busid="quickstartEsbChannel">
- <jms-message-filter dest-type="QUEUE"
- dest-name="queue/quickstart_Business_Rules_Stateful_Request_ESB" />
- </jms-bus>
-
- </jms-provider>
- </providers>
-
- <services>
-
- <service category="OrderServices"
- name="OrderDiscountService" description="Calculates a discount based on past orders">
- <listeners>
- <!-- Gateway -->
- <jms-listener name="TheGateway"
- busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
- <jms-listener name="TheESBChannel"
- busidref="quickstartEsbChannel" maxThreads="1">
- </jms-listener>
- </listeners>
- <actions mep="OneWay">
- <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="Message before transformation" />
- </action>
-
- <action name="transform"
- class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
- <property name="resource-config"
- value="/smooks-res.xml" />
- </action>
-
- <action name="fixUpMessage"
- class="org.jboss.soa.esb.samples.quickstart.businessrules.SetupMessage">
- </action>
-
- <!-- Use the BRP to calculate the order discount -->
- <action
- class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
- name="OrderDiscountBasedOnCustomerHistory">
- <property name="ruleSet"
- value="OrderDiscountOnMultipleOrders.drl" />
- <property name="ruleReload" value="false" />
- <property name="stateful" value="true" />
- <property name="object-paths">
- <object-path esb="body.TheOrderHeader" />
- <object-path esb="body.TheCustomer" />
- </property>
- </action>
-
- <action name="reviewMessage"
- class="org.jboss.soa.esb.samples.quickstart.businessrules.ReviewMessage">
- <property name="stuff" value="After Order Discount"/>
- </action>
- </actions>
-
- </service>
-
-
-
-
- </services>
-</jbossesb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jboss-esb.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,75 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+ <providers>
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost">
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter dest-type="QUEUE"
+ dest-name="queue/quickstart_Business_Rules_Stateful_Request_GW" />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE"
+ dest-name="queue/quickstart_Business_Rules_Stateful_Request_ESB" />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="OrderServices"
+ name="OrderDiscountService" description="Calculates a discount based on past orders">
+ <listeners>
+ <!-- Gateway -->
+ <jms-listener name="TheGateway"
+ busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
+ <jms-listener name="TheESBChannel"
+ busidref="quickstartEsbChannel" maxThreads="1">
+ </jms-listener>
+ </listeners>
+ <actions mep="OneWay">
+ <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message" value="Message before transformation" />
+ </action>
+
+ <action name="transform"
+ class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
+ <property name="resource-config"
+ value="/smooks-res.xml" />
+ </action>
+
+ <action name="fixUpMessage"
+ class="org.jboss.soa.esb.samples.quickstart.businessrules.SetupMessage">
+ </action>
+
+ <!-- Use the BRP to calculate the order discount -->
+ <action
+ class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
+ name="OrderDiscountBasedOnCustomerHistory">
+ <property name="ruleSet"
+ value="OrderDiscountOnMultipleOrders.drl" />
+ <property name="ruleReload" value="false" />
+ <property name="stateful" value="true" />
+ <property name="object-paths">
+ <object-path esb="body.TheOrderHeader" />
+ <object-path esb="body.TheCustomer" />
+ </property>
+ </action>
+
+ <action name="reviewMessage"
+ class="org.jboss.soa.esb.samples.quickstart.businessrules.ReviewMessage">
+ <property name="stuff" value="After Order Discount"/>
+ </action>
+ </actions>
+
+ </service>
+
+
+
+
+ </services>
+</jbossesb>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- JBoss, Home of Professional Open Source
- Copyright 2006, JBoss Inc., and others contributors as indicated
- by the @authors tag. All rights reserved.
- See the copyright.txt in the distribution for a
- full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
- (C) 2005-2006,
- @author JBoss Inc.
--->
-<!-- $Id: jbossesb-unittest-properties.xml $ -->
-<!--
- These options are described in the JBossESB manual.
- Defaults are provided here for convenience only.
-
- Please read through this file prior to using the system, and consider
- updating the specified entries.
--->
-<esb
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
- <properties name="core">
- <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
- <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
- <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
- </properties>
- <properties name="registry">
- <property name="org.jboss.soa.esb.registry.queryManagerURI"
- value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
- <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
- value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
- <property name="org.jboss.soa.esb.registry.implementationClass"
- value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
- <property name="org.jboss.soa.esb.registry.factoryClass"
- value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
- <property name="org.jboss.soa.esb.registry.user"
- value="jbossesb"/>
- <property name="org.jboss.soa.esb.registry.password"
- value="password"/>
- <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
- <property name="org.jboss.soa.esb.scout.proxy.transportClass"
- value="org.apache.ws.scout.transport.RMITransport"/>
- </properties>
- <properties name="transports" depends="core">
- <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
- <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
- <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
- <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
- </properties>
- <properties name="connection">
- <property name="min-pool-size" value="5"/>
- <property name="max-pool=size" value="10"/>
- <property name="blocking-timeout-millis" value="5000"/>
- <property name="abandoned-connection-timeout" value="10000"/>
- <property name="abandoned-connection-time-interval" value="30000"/>
- </properties>
- <properties name="dbstore">
- <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
- <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
- <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
- <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
- <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
- <!--table managed by pool to test for valid connections - created by pool automatically -->
- <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
- <!-- # of milliseconds to timeout waiting for a connection from pool -->
- <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
- </properties>
- <properties name="messagerouting">
- <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
- </properties>
-</esb>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jbossesb-properties.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,5 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-java.naming.factory.url.pkgs=org.jnp.interfaces
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/jndi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,69 +0,0 @@
-# jUDDI Registry Properties (used by RegistryServer)
-# see http://www.juddi.org for more information
-
-# The UDDI Operator Name
-juddi.operatorName = jUDDI.org
-
-# The i18n locale default codes
-juddi.i18n.languageCode = en
-juddi.i18n.countryCode = US
-
-# The UDDI DiscoveryURL Prefix
-juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
-
-# The UDDI Operator Contact Email Address
-juddi.operatorEmailAddress = admin at juddi.org
-
-# The maximum name size and maximum number
-# of name elements allows in several of the
-# FindXxxx and SaveXxxx UDDI functions.
-juddi.maxNameLength=255
-juddi.maxNameElementsAllowed=5
-
-# The maximum number of UDDI artifacts allowed
-# per publisher. A value of '-1' indicates any
-# number of artifacts is valid (These values can be
-# overridden at the individual publisher level).
-juddi.maxBusinessesPerPublisher=25
-juddi.maxServicesPerBusiness=20
-juddi.maxBindingsPerService=10
-juddi.maxTModelsPerPublisher=100
-
-# jUDDI Authentication module to use
-juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
-
-# jUDDI DataStore module currently to use
-juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
-
-# use a dataSource (if set to false a direct
-# jdbc connection will be used.
-juddi.isUseDataSource=false
-juddi.jdbcDriver=com.mysql.jdbc.Driver
-juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
-juddi.jdbcUsername=root
-juddi.jdbcPassword=admin
-# jUDDI DataSource to use
-# juddi.dataSource=java:comp/env/jdbc/MySqlDS
-
-# jUDDI UUIDGen implementation to use
-juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
-
-# jUDDI Cryptor implementation to use
-juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
-
-# jUDDI Validator to use
-juddi.validator=org.apache.juddi.validator.DefaultValidator
-
-# jUDDI Proxy Properties (used by RegistryProxy)
-juddi.proxy.adminURL = http://localhost:8080/juddi/admin
-juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
-juddi.proxy.publishURL = http://localhost:8080/juddi/publish
-juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
-juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
-juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
-
-# JNDI settings (used by RMITransport)
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/juddi.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/lib (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/lib)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
-
-<!--
- | For more configuration infromation and examples see the Jakarta Log4j
- | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <!-- ============================== -->
- <!-- Append messages to the console -->
- <!-- ============================== -->
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="Target" value="System.out"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
- </layout>
- </appender>
-
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A size based file rolling appender -->
- <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
- <param name="File" value="./listener.log"/>
- <param name="Append" value="false"/>
- <param name="MaxFileSize" value="500KB"/>
- <param name="MaxBackupIndex" value="1"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
- </layout>
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jboss">
- <priority value="WARN"/>
- </category>
- <category name="org.jboss.soa.esb">
- <priority value="WARN"/>
- </category>
- <category name="org.jboss.internal.soa.esb">
- <priority value="WARN"/>
- </category>
- <category name="org.apache">
- <priority value="ERROR"/>
- </category>
- <category name="org.milyn">
- <priority value="ERROR"/>
- </category>
-
- <category name="quickstarts">
- <priority value="WARN"/>
- </category>
-
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </root>
-
-</log4j:configuration>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/log4j.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./listener.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.milyn">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="quickstarts">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/readme.txt 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,54 +0,0 @@
-Overview:
-=========
- Demonstrates the use of the BusinessRulesProcessor which allows for
- modification of the POJOs attached to an ESB Message. The example uses Rules
- to calculate the discount of an inbound order based on the customer's past
- history of orders. As such it is an example of a stateful rule service.
-
- Make sure you have run simple_cbr, transformation_XML2POJO, fun_cbr, and
- business_rules_service quickstarts as their principles are used in this
- more complex example.
-
-Running this quickstart:
-========================
- Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
- and a more detailed descripton of the different ways to run the quickstarts.
-
- A comprehensive description of message transformation can be found in
- MessageTransformation.pdf, located in the docs/services folder.
-
-To Run standalone mode:
-=======================
- 1. In a command terminal window in the quickstart folder type
- 'ant deploy-jms-dests'.
- 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
- 3. Open another command terminal window in this folder ("Window2"), type
- 'ant runtest'.
- 4. Switch back to "Window1" to see the output from the ESB
- 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
- ("Window1"), type 'ant undeploy-jms-dests'.
-
-To Run '.esb' archive mode:
-===========================
- 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
- 2. Open another command terminal window in this folder ("Window2"), type
- 'ant runtest'.
- 3. Switch back to Application Server console to see the output from the ESB
- 4. In this folder ("Window1"), type 'ant undeploy'.
-
-What to look at in this Quickstart:
-===================================
- Look at the jboss-esb.xml and notice how the stateful="true" is set on the
- BusinessRulesProcessor action of the OrderDiscountService. Review the
- OrderDiscountOnMultipleOrders.drl file to see how accumulation works.
-
- Stateful rule services must be told via message properties when to continue with
- the current stateful session and when to dispose of it. This is accomplished via
- the SetupMessage action based on the orderStatus provided with the inbound XML.
-
- Because there is no persistence in this example, the customer object created from
- each XML message is actually a different Java object (even though the values are
- all the same). These are separately inserted into the stateful session, and the
- rules treat them as different objects. A real life implementation would detect
- that the customer already existed, and only insert one customer object into the
- engine stateful session.
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/readme.txt)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/readme.txt 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,54 @@
+Overview:
+=========
+ Demonstrates the use of the BusinessRulesProcessor which allows for
+ modification of the POJOs attached to an ESB Message. The example uses Rules
+ to calculate the discount of an inbound order based on the customer's past
+ history of orders. As such it is an example of a stateful rule service.
+
+ Make sure you have run simple_cbr, transformation_XML2POJO, fun_cbr, and
+ business_rules_service quickstarts as their principles are used in this
+ more complex example.
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+ A comprehensive description of message transformation can be found in
+ MessageTransformation.pdf, located in the docs/services folder.
+
+To Run standalone mode:
+=======================
+ 1. In a command terminal window in the quickstart folder type
+ 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB
+ 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
+ ("Window1"), type 'ant undeploy-jms-dests'.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+ 4. In this folder ("Window1"), type 'ant undeploy'.
+
+What to look at in this Quickstart:
+===================================
+ Look at the jboss-esb.xml and notice how the stateful="true" is set on the
+ BusinessRulesProcessor action of the OrderDiscountService. Review the
+ OrderDiscountOnMultipleOrders.drl file to see how accumulation works.
+
+ Stateful rule services must be told via message properties when to continue with
+ the current stateful session and when to dispose of it. This is accomplished via
+ the SetupMessage action based on the orderStatus provided with the inbound XML.
+
+ Because there is no persistence in this example, the customer object created from
+ each XML message is actually a different Java object (even though the values are
+ all the same). These are separately inserted into the stateful session, and the
+ rules treat them as different objects. A real life implementation would detect
+ that the customer already existed, and only insert one customer object into the
+ engine stateful session.
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,58 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <!-- Populate the OrderHeader -->
- <resource-config selector="order">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">orderHeader</param>
- <param name="beanClass">org.jboss.soa.esb.dvdstore.OrderHeader</param>
- <param name="bindings">
- <binding property="orderId" selector="Order @orderId" />
- <binding property="orderDate" selector="Order @orderDate" type="LongDate"/>
- <binding property="statusCode" selector="Order @statusCode" type="Integer" />
- <binding property="netAmount" selector="Order @netAmount" type="Double" />
- <binding property="totalAmount" selector="Order @totalAmount" type="Double" />
- <binding property="tax" selector="Order @tax" type="Double" />
- </param>
- </resource-config>
-
- <!-- Populate the Customer -->
- <resource-config selector="order customer">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">customer</param>
- <param name="beanClass">org.jboss.soa.esb.dvdstore.Customer</param>
- <param name="setOn">orderHeader</param>
-
- <param name="bindings">
- <binding property="userName" selector="order customer @userName" />
- <binding property="firstName" selector="order customer @firstName" />
- <binding property="lastName" selector="order customer @lastName" />
- <binding property="state" selector="order customer @state" />
- </param>
- </resource-config>
-
- <!-- Populate the OrderItem list -->
- <resource-config selector="order orderlines orderline">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">orderItem</param>
- <param name="beanClass">org.jboss.soa.esb.dvdstore.OrderItem</param>
- <param name="addToList">true</param>
- <param name="bindings">
- <binding property="position" selector="order orderlines orderline @position" type="Integer" />
- <binding property="quantity" selector="order orderlines orderline @quantity" type="Integer" />
- <binding property="productId" selector="order orderlines orderline product @productId" />
- <binding property="title" selector="order orderlines orderline product @title" />
- <binding property="price" selector="order orderlines orderline product @price" type="Double" />
- </param>
- </resource-config>
-
- <!--resource-config selector="order orderlines orderline">
- <resource>/org/jboss/soa/esb/dvdstore/orderitem.st</resource>
- </resource-config-->
-
- <resource-config selector="decoder:LongDate">
- <resource>org.milyn.javabean.decoders.CalendarDecoder</resource>
- <param name="format">EEE MMM dd HH:mm:ss z yyyy</param>
- </resource-config>
-
-</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <!-- Populate the OrderHeader -->
+ <resource-config selector="order">
+ <resource>org.milyn.javabean.BeanPopulator</resource>
+ <param name="beanId">orderHeader</param>
+ <param name="beanClass">org.jboss.soa.esb.dvdstore.OrderHeader</param>
+ <param name="bindings">
+ <binding property="orderId" selector="Order @orderId" />
+ <binding property="orderDate" selector="Order @orderDate" type="LongDate"/>
+ <binding property="statusCode" selector="Order @statusCode" type="Integer" />
+ <binding property="netAmount" selector="Order @netAmount" type="Double" />
+ <binding property="totalAmount" selector="Order @totalAmount" type="Double" />
+ <binding property="tax" selector="Order @tax" type="Double" />
+ </param>
+ </resource-config>
+
+ <!-- Populate the Customer -->
+ <resource-config selector="order customer">
+ <resource>org.milyn.javabean.BeanPopulator</resource>
+ <param name="beanId">customer</param>
+ <param name="beanClass">org.jboss.soa.esb.dvdstore.Customer</param>
+ <param name="setOn">orderHeader</param>
+
+ <param name="bindings">
+ <binding property="userName" selector="order customer @userName" />
+ <binding property="firstName" selector="order customer @firstName" />
+ <binding property="lastName" selector="order customer @lastName" />
+ <binding property="state" selector="order customer @state" />
+ </param>
+ </resource-config>
+
+ <!-- Populate the OrderItem list -->
+ <resource-config selector="order orderlines orderline">
+ <resource>org.milyn.javabean.BeanPopulator</resource>
+ <param name="beanId">orderItem</param>
+ <param name="beanClass">org.jboss.soa.esb.dvdstore.OrderItem</param>
+ <param name="addToList">true</param>
+ <param name="bindings">
+ <binding property="position" selector="order orderlines orderline @position" type="Integer" />
+ <binding property="quantity" selector="order orderlines orderline @quantity" type="Integer" />
+ <binding property="productId" selector="order orderlines orderline product @productId" />
+ <binding property="title" selector="order orderlines orderline product @title" />
+ <binding property="price" selector="order orderlines orderline product @price" type="Double" />
+ </param>
+ </resource-config>
+
+ <!--resource-config selector="order orderlines orderline">
+ <resource>/org/jboss/soa/esb/dvdstore/orderitem.st</resource>
+ </resource-config-->
+
+ <resource-config selector="decoder:LongDate">
+ <resource>org.milyn.javabean.decoders.CalendarDecoder</resource>
+ <param name="format">EEE MMM dd HH:mm:ss z yyyy</param>
+ </resource-config>
+
+</smooks-resource-list>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.dvdstore;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class Customer implements Serializable {
-
- // <Customer userName="user1" firstName="Harry" lastName="Potter" state="SD"/>
- private String userName;
- private String firstName;
- private String lastName;
- private String state;
- private int status;
- private double orderDiscount;
-
- /**
- * @return Returns the firstName.
- */
- public String getFirstName() {
- return firstName;
- }
- /**
- * @param firstName The firstName to set.
- */
- public void setFirstName(String firstName) {
- //System.out.println("**** firstName: " + firstName);
- this.firstName = firstName;
- }
- /**
- * @return Returns the lastName.
- */
- public String getLastName() {
- return lastName;
- }
- /**
- * @param lastName The lastName to set.
- */
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- /**
- * @return Returns the state.
- */
- public String getState() {
- return state;
- }
- /**
- * @param state The state to set.
- */
- public void setState(String state) {
- this.state = state;
- }
- /**
- * @return Returns the userName.
- */
- public String getUserName() {
- return userName;
- }
- /**
- * @param userName The userName to set.
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return userName + "," + firstName + "," + lastName + "," + state + "," + status;
- }
-
- public int getStatus() {
- return status;
- }
- public void setStatus(int status) {
- this.status = status;
- }
-
- public double getOrderDiscount() {
- return this.orderDiscount;
- }
-
- public void setOrderDiscount(double orderDiscount) {
- this.orderDiscount = orderDiscount;
- }
-
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/Customer.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.dvdstore;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class Customer implements Serializable {
+
+ // <Customer userName="user1" firstName="Harry" lastName="Potter" state="SD"/>
+ private String userName;
+ private String firstName;
+ private String lastName;
+ private String state;
+ private int status;
+ private double orderDiscount;
+
+ /**
+ * @return Returns the firstName.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+ /**
+ * @param firstName The firstName to set.
+ */
+ public void setFirstName(String firstName) {
+ //System.out.println("**** firstName: " + firstName);
+ this.firstName = firstName;
+ }
+ /**
+ * @return Returns the lastName.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+ /**
+ * @param lastName The lastName to set.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+ /**
+ * @return Returns the state.
+ */
+ public String getState() {
+ return state;
+ }
+ /**
+ * @param state The state to set.
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+ /**
+ * @return Returns the userName.
+ */
+ public String getUserName() {
+ return userName;
+ }
+ /**
+ * @param userName The userName to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return userName + "," + firstName + "," + lastName + "," + state + "," + status;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public double getOrderDiscount() {
+ return this.orderDiscount;
+ }
+
+ public void setOrderDiscount(double orderDiscount) {
+ this.orderDiscount = orderDiscount;
+ }
+
+
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.dvdstore;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-
-/**
- * DVD Store action.
- * <p/>
- * This action uses bean value objects that were prepopulated by Smooks in an earlier action on the pipline.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class DVDStoreAction extends AbstractActionPipelineProcessor {
-
- public DVDStoreAction(ConfigTree configTree) {
-
- }
-
- public Message process(Message message) throws ActionProcessingException {
- HashMap beanHash = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
-
- StringBuffer results = new StringBuffer();
- if(beanHash != null) {
- OrderHeader header = (OrderHeader) beanHash.get("orderHeader");
- Customer customer = (Customer) beanHash.get("customer");
- List orderItems = (List) beanHash.get("orderItemList");
- results.append("Demonstrates Smooks ability to rip the XML into Objects\n");
- results.append("********* DVDStoreAction - Order Value Objects Populated *********\n");
- results.append("Header: " + header + "\n");
- results.append("Customer: " + customer + "\n");
- if(orderItems != null) {
- results.append("Order Items (" + orderItems.size() + "):\n");
- for(int i = 0; i < orderItems.size(); i++) {
- results.append("\t" + i + ": " + orderItems.get(i) + "\n");
- }
- }
- results.append("\n****************************************************************** ");
- } else {
- results.append("\n*** No beanhash found!");
- }
-
- // Take this "parsed" output and make it a new message
- message.getBody().setByteArray(results.toString().getBytes());
- return message;
- }
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/DVDStoreAction.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.dvdstore;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * DVD Store action.
+ * <p/>
+ * This action uses bean value objects that were prepopulated by Smooks in an earlier action on the pipline.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DVDStoreAction extends AbstractActionPipelineProcessor {
+
+ public DVDStoreAction(ConfigTree configTree) {
+
+ }
+
+ public Message process(Message message) throws ActionProcessingException {
+ HashMap beanHash = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
+
+ StringBuffer results = new StringBuffer();
+ if(beanHash != null) {
+ OrderHeader header = (OrderHeader) beanHash.get("orderHeader");
+ Customer customer = (Customer) beanHash.get("customer");
+ List orderItems = (List) beanHash.get("orderItemList");
+ results.append("Demonstrates Smooks ability to rip the XML into Objects\n");
+ results.append("********* DVDStoreAction - Order Value Objects Populated *********\n");
+ results.append("Header: " + header + "\n");
+ results.append("Customer: " + customer + "\n");
+ if(orderItems != null) {
+ results.append("Order Items (" + orderItems.size() + "):\n");
+ for(int i = 0; i < orderItems.size(); i++) {
+ results.append("\t" + i + ": " + orderItems.get(i) + "\n");
+ }
+ }
+ results.append("\n****************************************************************** ");
+ } else {
+ results.append("\n*** No beanhash found!");
+ }
+
+ // Take this "parsed" output and make it a new message
+ message.getBody().setByteArray(results.toString().getBytes());
+ return message;
+ }
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.dvdstore;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-import java.io.Serializable;
-import java.util.Calendar;
-
-public class OrderHeader implements Serializable {
-
- // <Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
- private String orderId;
- private Calendar orderDate;
- private int statusCode;
- private double netAmount;
- private double totalAmount;
- private double tax;
- private int orderPriority = 1;
- private double orderDiscount;
-
- private Customer customer;
-
- /**
- * @return Returns the netAmount.
- */
- public double getNetAmount() {
- return netAmount;
- }
- /**
- * @param netAmount The netAmount to set.
- */
- public void setNetAmount(double netAmount) {
- // System.out.println("**** netAmount: " + netAmount);
- this.netAmount = netAmount;
- }
- /**
- * @return Returns the orderDate.
- */
- public Calendar getOrderDate() {
- return orderDate;
- }
- /**
- * @param orderDate The orderDate to set.
- */
- public void setOrderDate(Calendar orderDate) {
- this.orderDate = orderDate;
- }
- /**
- * @return Returns the orderId.
- */
- public String getOrderId() {
- return orderId;
- }
- /**
- * @param orderId The orderId to set.
- */
- public void setOrderId(String orderId) {
- this.orderId = orderId;
- }
- /**
- * @return Returns the statusCode.
- */
- public int getStatusCode() {
- return statusCode;
- }
- /**
- * @param statusCode The statusCode to set.
- */
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
- /**
- * @return Returns the tax.
- */
- public double getTax() {
- return tax;
- }
- /**
- * @param tax The tax to set.
- */
- public void setTax(double tax) {
- this.tax = tax;
- }
- /**
- * @return Returns the totalAmount.
- */
- public double getTotalAmount() {
- return totalAmount;
- }
- /**
- * @param totalAmount The totalAmount to set.
- */
- public void setTotalAmount(double totalAmount) {
- this.totalAmount = totalAmount;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
- }
-
- public int getOrderPriority() {
- return this.orderPriority;
- }
-
- public void setOrderPriority(int orderPriority) {
- this.orderPriority = orderPriority;
- }
-
- public double getOrderDiscount() {
- return this.orderDiscount;
- }
-
- public void setOrderDiscount(double orderDiscount) {
- this.orderDiscount = orderDiscount;
- }
-
- public Customer getCustomer() {
- return this.customer;
- }
-
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderHeader.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.dvdstore;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+import java.io.Serializable;
+import java.util.Calendar;
+
+public class OrderHeader implements Serializable {
+
+ // <Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
+ private String orderId;
+ private Calendar orderDate;
+ private int statusCode;
+ private double netAmount;
+ private double totalAmount;
+ private double tax;
+ private int orderPriority = 1;
+ private double orderDiscount;
+
+ private Customer customer;
+
+ /**
+ * @return Returns the netAmount.
+ */
+ public double getNetAmount() {
+ return netAmount;
+ }
+ /**
+ * @param netAmount The netAmount to set.
+ */
+ public void setNetAmount(double netAmount) {
+ // System.out.println("**** netAmount: " + netAmount);
+ this.netAmount = netAmount;
+ }
+ /**
+ * @return Returns the orderDate.
+ */
+ public Calendar getOrderDate() {
+ return orderDate;
+ }
+ /**
+ * @param orderDate The orderDate to set.
+ */
+ public void setOrderDate(Calendar orderDate) {
+ this.orderDate = orderDate;
+ }
+ /**
+ * @return Returns the orderId.
+ */
+ public String getOrderId() {
+ return orderId;
+ }
+ /**
+ * @param orderId The orderId to set.
+ */
+ public void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
+ /**
+ * @return Returns the statusCode.
+ */
+ public int getStatusCode() {
+ return statusCode;
+ }
+ /**
+ * @param statusCode The statusCode to set.
+ */
+ public void setStatusCode(int statusCode) {
+ this.statusCode = statusCode;
+ }
+ /**
+ * @return Returns the tax.
+ */
+ public double getTax() {
+ return tax;
+ }
+ /**
+ * @param tax The tax to set.
+ */
+ public void setTax(double tax) {
+ this.tax = tax;
+ }
+ /**
+ * @return Returns the totalAmount.
+ */
+ public double getTotalAmount() {
+ return totalAmount;
+ }
+ /**
+ * @param totalAmount The totalAmount to set.
+ */
+ public void setTotalAmount(double totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
+ }
+
+ public int getOrderPriority() {
+ return this.orderPriority;
+ }
+
+ public void setOrderPriority(int orderPriority) {
+ this.orderPriority = orderPriority;
+ }
+
+ public double getOrderDiscount() {
+ return this.orderDiscount;
+ }
+
+ public void setOrderDiscount(double orderDiscount) {
+ this.orderDiscount = orderDiscount;
+ }
+
+ public Customer getCustomer() {
+ return this.customer;
+ }
+
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.dvdstore;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class OrderItem implements Serializable {
-
- // <OrderLine position="1" quantity="1">
- // <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
- // </OrderLine>
- private int position;
- private int quantity;
- private String productId;
- private String title;
- private double price;
-
- /**
- * @return Returns the position.
- */
- public int getPosition() {
- return position;
- }
- /**
- * @param position The position to set.
- */
- public void setPosition(int position) {
- //System.out.println("**** position: " + position);
- this.position = position;
- }
- /**
- * @return Returns the price.
- */
- public double getPrice() {
- return price;
- }
- /**
- * @param price The price to set.
- */
- public void setPrice(double price) {
- //System.out.println("**** price: " + price);
- this.price = price;
- }
- /**
- * @return Returns the productId.
- */
- public String getProductId() {
- return productId;
- }
- /**
- * @param productId The productId to set.
- */
- public void setProductId(String productId) {
- this.productId = productId;
- }
- /**
- * @return Returns the quantity.
- */
- public int getQuantity() {
- return quantity;
- }
- /**
- * @param quantity The quantity to set.
- */
- public void setQuantity(int quantity) {
- this.quantity = quantity;
- }
- /**
- * @return Returns the title.
- */
- public String getTitle() {
- return title;
- }
- /**
- * @param title The title to set.
- */
- public void setTitle(String title) {
- this.title = title;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return position + "," + quantity + "," + productId + "," + title + "," + price;
-
- }
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/dvdstore/OrderItem.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.dvdstore;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class OrderItem implements Serializable {
+
+ // <OrderLine position="1" quantity="1">
+ // <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ // </OrderLine>
+ private int position;
+ private int quantity;
+ private String productId;
+ private String title;
+ private double price;
+
+ /**
+ * @return Returns the position.
+ */
+ public int getPosition() {
+ return position;
+ }
+ /**
+ * @param position The position to set.
+ */
+ public void setPosition(int position) {
+ //System.out.println("**** position: " + position);
+ this.position = position;
+ }
+ /**
+ * @return Returns the price.
+ */
+ public double getPrice() {
+ return price;
+ }
+ /**
+ * @param price The price to set.
+ */
+ public void setPrice(double price) {
+ //System.out.println("**** price: " + price);
+ this.price = price;
+ }
+ /**
+ * @return Returns the productId.
+ */
+ public String getProductId() {
+ return productId;
+ }
+ /**
+ * @param productId The productId to set.
+ */
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+ /**
+ * @return Returns the quantity.
+ */
+ public int getQuantity() {
+ return quantity;
+ }
+ /**
+ * @param quantity The quantity to set.
+ */
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return position + "," + quantity + "," + productId + "," + title + "," + price;
+
+ }
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart)
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.businessrules;
-
-import java.util.HashMap;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.dvdstore.Customer;
-import org.jboss.soa.esb.dvdstore.OrderHeader;
-
-public class ReviewMessage extends AbstractActionPipelineProcessor {
- private String input = "Reviewer";
-
- public Message process(Message message) throws ActionProcessingException {
-
- OrderHeader order = (OrderHeader) message.getBody().get("TheOrderHeader");
- Customer customer = (Customer) message.getBody().get("TheCustomer");
- System.out.println("{ ================ " + input);
- System.out.println("Customer: " + customer);
- System.out.println("Order Priority: " + order.getOrderPriority());
- System.out.println("Order Discount: " + order.getOrderDiscount());
- System.out.println("Order Total: " + order.getTotalAmount());
- System.out.println("} ================ " + input);
- // System.out.println("Order: " + order);
-
- return message;
- }
-
- public ReviewMessage(ConfigTree configTree) {
- input = configTree.getAttribute("stuff");
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.dvdstore.Customer;
+import org.jboss.soa.esb.dvdstore.OrderHeader;
+
+public class ReviewMessage extends AbstractActionPipelineProcessor {
+ private String input = "Reviewer";
+
+ public Message process(Message message) throws ActionProcessingException {
+
+ OrderHeader order = (OrderHeader) message.getBody().get("TheOrderHeader");
+ Customer customer = (Customer) message.getBody().get("TheCustomer");
+ System.out.println("{ ================ " + input);
+ System.out.println("Customer: " + customer);
+ System.out.println("Order Priority: " + order.getOrderPriority());
+ System.out.println("Order Discount: " + order.getOrderDiscount());
+ System.out.println("Order Total: " + order.getTotalAmount());
+ System.out.println("} ================ " + input);
+ // System.out.println("Order: " + order);
+
+ return message;
+ }
+
+ public ReviewMessage(ConfigTree configTree) {
+ input = configTree.getAttribute("stuff");
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.businessrules;
-
-import java.util.HashMap;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.dvdstore.Customer;
-import org.jboss.soa.esb.dvdstore.OrderHeader;
-import org.apache.log4j.Logger;
-
-public class SetupMessage extends AbstractActionPipelineProcessor {
- private Logger logger = Logger.getLogger(SetupMessage.class);
- private int status = 0;
-
- public Message process(Message message) throws ActionProcessingException {
- HashMap transformedBeans = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
- if(transformedBeans != null) {
- OrderHeader header = (OrderHeader) transformedBeans.get("orderHeader");
- Customer customer = (Customer) transformedBeans.get("customer");
- message.getBody().add("TheOrderHeader", header);
- message.getBody().add("TheCustomer", customer);
-
- status = header.getStatusCode();
-
- if (status == 0 ) {
- message.getProperties().setProperty("dispose", false);
- message.getProperties().setProperty("continue", false);
-
- }
-
- if (status == 1 ) {
- message.getProperties().setProperty("dispose", false);
- message.getProperties().setProperty("continue", true);
- }
-
- if (status == 2 ) {
- message.getProperties().setProperty("dispose", true);
- message.getProperties().setProperty("continue", true);
- }
-
- logger.info("Moved the transformed Order Header and Customer");
- }
-
- return message;
- }
-
- public SetupMessage(ConfigTree configTree) {
- // status = Integer.parseInt(configTree.getAttribute("status"));
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/SetupMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.dvdstore.Customer;
+import org.jboss.soa.esb.dvdstore.OrderHeader;
+import org.apache.log4j.Logger;
+
+public class SetupMessage extends AbstractActionPipelineProcessor {
+ private Logger logger = Logger.getLogger(SetupMessage.class);
+ private int status = 0;
+
+ public Message process(Message message) throws ActionProcessingException {
+ HashMap transformedBeans = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
+ if(transformedBeans != null) {
+ OrderHeader header = (OrderHeader) transformedBeans.get("orderHeader");
+ Customer customer = (Customer) transformedBeans.get("customer");
+ message.getBody().add("TheOrderHeader", header);
+ message.getBody().add("TheCustomer", customer);
+
+ status = header.getStatusCode();
+
+ if (status == 0 ) {
+ message.getProperties().setProperty("dispose", false);
+ message.getProperties().setProperty("continue", false);
+
+ }
+
+ if (status == 1 ) {
+ message.getProperties().setProperty("dispose", false);
+ message.getProperties().setProperty("continue", true);
+ }
+
+ if (status == 2 ) {
+ message.getProperties().setProperty("dispose", true);
+ message.getProperties().setProperty("continue", true);
+ }
+
+ logger.info("Moved the transformed Order Header and Customer");
+ }
+
+ return message;
+ }
+
+ public SetupMessage(ConfigTree configTree) {
+ // status = Integer.parseInt(configTree.getAttribute("status"));
+ }
+
+}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test)
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.businessrules.test;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.jms.JMSException;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.QueueSender;
-import javax.jms.ObjectMessage;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-public class SendJMSMessage {
- QueueConnection conn;
- QueueSession session;
- Queue que;
-
-
- public void setupConnection() throws JMSException, NamingException
- {
- InitialContext iniCtx = new InitialContext();
- Object tmp = iniCtx.lookup("ConnectionFactory");
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
- conn = qcf.createQueueConnection();
- que = (Queue) iniCtx.lookup("queue/quickstart_Business_Rules_Stateful_Request_GW");
- session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
- conn.start();
- System.out.println("Connection Started");
- }
-
- public void stop() throws JMSException
- {
- conn.stop();
- session.close();
- conn.close();
- }
-
- public void sendAMessage(String msg) throws JMSException {
-
- QueueSender send = session.createSender(que);
- ObjectMessage tm = session.createObjectMessage(msg);
- send.send(tm);
- send.close();
- }
- public String readAsciiFile(String fileName) throws IOException {
- FileReader fr = null;
- char[] thechars = null;
-
- try {
- File thefile = new File( fileName );
- fr = new FileReader( thefile );
- int size = (int) thefile.length();
- thechars = new char[size];
-
- int count, index = 0;
-
- // read in the bytes from the input stream
- while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
- size -= count;
- index += count;
- }
- } catch(Exception e) {
- System.out.println(e);
- }
- finally {
- if( fr != null )
- fr.close();
- }
- return new String(thechars);
-
- } // readAsciiFile
-
- public static void main(String args[]) throws Exception
- {
- SendJMSMessage sm = new SendJMSMessage();
- sm.setupConnection();
- String fileContent = sm.readAsciiFile("SampleOrder1.xml");
- System.out.println("---------------------------------------------");
- System.out.println(fileContent);
- System.out.println("---------------------------------------------");
- sm.sendAMessage(fileContent);
-
- fileContent = sm.readAsciiFile("SampleOrder2.xml");
- System.out.println("---------------------------------------------");
- System.out.println(fileContent);
- System.out.println("---------------------------------------------");
- sm.sendAMessage(fileContent);
-
- fileContent = sm.readAsciiFile("SampleOrder3.xml");
- System.out.println("---------------------------------------------");
- System.out.println(fileContent);
- System.out.println("---------------------------------------------");
- sm.sendAMessage(fileContent);
-
- sm.stop();
-
- }
-
-}
Copied: labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrules/test/SendJMSMessage.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.businessrules.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_Business_Rules_Stateful_Request_GW");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+ public String readAsciiFile(String fileName) throws IOException {
+ FileReader fr = null;
+ char[] thechars = null;
+
+ try {
+ File thefile = new File( fileName );
+ fr = new FileReader( thefile );
+ int size = (int) thefile.length();
+ thechars = new char[size];
+
+ int count, index = 0;
+
+ // read in the bytes from the input stream
+ while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+ size -= count;
+ index += count;
+ }
+ } catch(Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ if( fr != null )
+ fr.close();
+ }
+ return new String(thechars);
+
+ } // readAsciiFile
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ String fileContent = sm.readAsciiFile("SampleOrder1.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+
+ fileContent = sm.readAsciiFile("SampleOrder2.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+
+ fileContent = sm.readAsciiFile("SampleOrder3.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+
+ sm.stop();
+
+ }
+
+}
Modified: labs/jbossesb/trunk/product/services/jbrules/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/build.xml 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/build.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -4,5 +4,15 @@
<!-- Import the base Ant build script... -->
<import file="${services.base.build}"/>
- <target name="test" depends="base.test"/>
+ <target name="test">
+ <copy todir="${basedir}/build/tests/classes" overwrite="true">
+ <fileset dir="${basedir}/src/test/resources">
+ <include name="*.xls"/>
+ <include name="*.drl"/>
+ <include name="*.properties"/>
+ <include name="*.pgk"/>
+ </fileset>
+ </copy>
+ <antcall target="base.test"/>
+ </target>
</project>
Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-4.0.7.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/drools-core-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/mvel-1.3.1-java1.4.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/mvel-1.3.1-java1.4.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/stax-api-1.0.1.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/stax-api-1.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbrules/lib/ext/xstream-1.2.2.jar (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/lib/ext/xstream-1.2.2.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -256,7 +256,7 @@
/**
* Register this MBean with JBoss.
*/
- protected void registerMBean() {
+ public void registerMBean() {
MBeanServer mbeanServer = null;
try {
mbeanServer = MBeanServerLocator.locateJBoss();
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -21,69 +21,32 @@
*/
package org.jboss.internal.soa.esb.services.routing.cbr;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
-import org.apache.log4j.Level;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.StatefulSession;
-import org.drools.compiler.DroolsParserException;
-import org.drools.compiler.PackageBuilder;
-import org.drools.compiler.PackageBuilderConfiguration;
-import org.drools.rule.Package;
-import org.jboss.internal.soa.esb.services.routing.cbr.JBRulesCounter;
+import org.jboss.internal.soa.esb.services.rules.RuleServiceCallHelper;
+import org.jboss.internal.soa.esb.services.rules.RuleServiceException;
import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.lifecycle.LifecyclePriorities;
-import org.jboss.soa.esb.lifecycle.LifecycleResource;
-import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
-import org.jboss.soa.esb.lifecycle.LifecycleResourceFactory;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.routing.MessageRouterException;
-import org.jboss.soa.esb.services.routing.cbr.CBRException;
import org.jboss.soa.esb.services.routing.cbr.ContentBasedRouter;
-import org.jboss.soa.esb.util.ClassUtil;
/**
- * The Implementation of a rule based Content Router. Here we use JBossRules. We
- * keep a HashMap of so called working memories for performance reasons.
- *
+ * The Implementation of a rule based Content Router. Here we use JBossRules.
+ * <p/>
+ * We keep a HashMap of so called working memories for performance reasons.
+ * <br><br>
* @author kstam at redhat.com
*
*/
public class JBossRulesRouter implements ContentBasedRouter
{
- /**
- * The lifecycle resource factory.
- */
- private static final LifecycleResourceFactory<Map<String, RuleBase>> lifecycleRuleBaseFactory = new LifecycleRuleBaseFactory() ;
- /**
- * Lifecycle couriers.
- */
- private static final LifecycleResource<Map<String, RuleBase>> lifecycleRuleBases =
- new LifecycleResource<Map<String,RuleBase>>(lifecycleRuleBaseFactory,
- LifecyclePriorities.RULE_BASE_PRIORITY) ;
- /**
- * The lifecycle resource factory.
- */
- private static final LifecycleResourceFactory<Map<String, String>> lifecycleRuleSetFactory = new LifecycleRuleSetFactory() ;
- /**
- * Lifecycle couriers.
- */
- private static final LifecycleResource<Map<String, String>> lifecycleRuleSets =
- new LifecycleResource<Map<String,String>>(lifecycleRuleSetFactory,
- LifecyclePriorities.RULE_BASE_PRIORITY) ;
-
private static Logger logger = Logger.getLogger(JBossRulesRouter.class);
- private JBRulesCounter rulesCounter = null;
+ private ConfigTree configTree;
/**
* Route the message with a reference to the ruleSets supplied in the message.
@@ -91,8 +54,7 @@
*
* @param message - Message that needs routing.
*/
- public List<String> route (Message message)
- throws MessageRouterException
+ public List<String> route (Message message) throws MessageRouterException
{
logger.error("Not implemented");
return null;
@@ -102,12 +64,25 @@
* Route the message, using the given ruleSet (drl).
*
* @param ruleSet -
- * Filename of the drl that will be used.
+ * String reference to a file which contains a ruleSet.
+ * @param ruleLanguage -
+ * String reference to a file which contains a custom rule language
+ * definition.
* @param message -
* Message that needs routing.
+ * @param objectList -
+ * List of objects that should be extracted from the message
+ * object and which will be inserted into the Drools working
+ * memory.
+ * @return List<String> -
+ * List of destinations
+ *
*/
- public List<String> route (String ruleSet, boolean ruleReload,
- Message message, List<Object> objectList) throws MessageRouterException
+ public List<String> route (
+ final String ruleSet,
+ final boolean ruleReload,
+ final Message message,
+ final List<Object> objectList) throws MessageRouterException
{
return route(ruleSet, null, ruleReload, message, objectList);
}
@@ -118,301 +93,45 @@
* now. However when the need arises, this is where it goes.
*
* @param ruleSet -
- * Filename of the drl that will be used.
+ * String reference to a file which contains a ruleSet.
* @param ruleLanguage -
- * Filename of the dsl that will be used.
+ * String reference to a file which contains a custom rule language
+ * definition.
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading the
+ * ruleSet.
* @param message -
* Message that needs routing.
+ * @param objectList -
+ * a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory.
+ * @return List<String> -
+ * List of Service destinations.
*/
- @SuppressWarnings("unchecked")
- public List<String> route (String ruleSet, String ruleLanguage,
- boolean ruleReload, Message message, List<Object> objectList) throws MessageRouterException
+ public List<String> route (
+ final String ruleSet,
+ final String ruleLanguage,
+ final boolean ruleReload,
+ Message message,
+ final List<Object> objectList ) throws MessageRouterException
{
- List<String> destinations = new ArrayList();
- long startTime = System.nanoTime();
-
- try {
- String newRuleSet = null;
- boolean isRulesChanged = false;
-
- final Map<String, String> ruleSets = lifecycleRuleSets.getLifecycleResource() ;
- if (ruleReload)
- {
- String currentRuleSet = ruleSets.get(ruleSet);
- newRuleSet = getRules(ruleSet, ruleLanguage);
- if (currentRuleSet == null || !currentRuleSet
- .equals(newRuleSet))
- {
- isRulesChanged = true;
- }
- }
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource() ;
- RuleBase ruleBase = ruleBases.get(ruleSet);
- if (ruleBase == null || isRulesChanged)
- {
- logger.log(Level.DEBUG,
- "Reading ruleSet from file=" + ruleSet);
- ruleBase = readRuleBase(ruleSet, ruleLanguage);
- if (ruleBase != null) ruleBases.put(ruleSet, ruleBase);
- if (newRuleSet == null)
- {
- newRuleSet = getRules(ruleSet, ruleLanguage);
- }
- if (ruleSet != null) ruleSets.put(ruleSet, newRuleSet);
- }
- StatefulSession workingMemory = ruleBase.newStatefulSession();
- logger.log(Level.DEBUG,
- "Obtained message=" + message + " with ruleSet=" + ruleSet);
- workingMemory.setGlobal("destinations", destinations);
- if (objectList!=null) {
- for (Object object : objectList) {
- workingMemory.insert(object);
- }
- }
- workingMemory.insert(message);
- logger.log(Level.DEBUG, "Fire the JBossRules Engine");
- workingMemory.fireAllRules();
- long procTime = System.nanoTime() - startTime;
- if (rulesCounter != null) {
- rulesCounter.update(procTime, ruleSet, JBRulesCounter.RULES_SUCCEED);
- }
-
- logger.log(Level.DEBUG,
- "Outgoing Destinations: " + destinations);
- workingMemory.dispose();
- return destinations;
- } catch (final LifecycleResourceException lre) {
- if (rulesCounter != null) {
- long procTime = System.nanoTime() - startTime;
- rulesCounter.update(procTime, ruleSet, JBRulesCounter.RULES_FAILED);
- }
- throw new MessageRouterException("Could not load lifecycle data. " + lre.getMessage(), lre);
- } catch (IOException ioe) {
- if (rulesCounter != null) {
- long procTime = System.nanoTime() - startTime;
- rulesCounter.update(procTime, ruleSet, JBRulesCounter.RULES_FAILED);
- }
- throw new MessageRouterException("Could not read the rules. " + ioe.getMessage(), ioe);
- } catch (DroolsParserException dpe) {
- if (rulesCounter != null) {
- long procTime = System.nanoTime() - startTime;
- rulesCounter.update(procTime, ruleSet, JBRulesCounter.RULES_FAILED);
- }
- throw new MessageRouterException("Could not parse the rules. " + dpe.getMessage(), dpe);
- } catch (CBRException cbre) {
- if (rulesCounter != null) {
- long procTime = System.nanoTime() - startTime;
- rulesCounter.update(procTime, ruleSet, JBRulesCounter.RULES_FAILED);
- }
- throw new MessageRouterException("Could not parse the rules. " + cbre.getMessage(), cbre);
- }
- }
-
- /**
- * Reading the rules and dsl from files. Note that we may want to allow
- * other ways to set the rule, but for now it's just files.
- */
- private static RuleBase readRuleBase (String rulesFile, String ruleLanguage)
- throws DroolsParserException, IOException, CBRException
- {
- // read in the rules
- logger.debug("Going to read the rule: " + rulesFile);
- InputStream inputStreamDrl = ClassUtil.getResourceAsStream(rulesFile.charAt(0) == '/' ? rulesFile : "/" + rulesFile, JBossRulesRouter.class);
- if (inputStreamDrl == null)
+ try
{
- logger.error("Could not find rulesFile: " + rulesFile);
- return null;
- }
- else
+ Map<String,Object> globals = new HashMap<String,Object>();
+ List<String> destinations = new ArrayList<String>();
+ globals.put( "destinations", destinations );
+ message = RuleServiceCallHelper.executeRulesService( ruleSet, ruleLanguage, ruleReload, message, objectList, globals, configTree );
+ return destinations;
+ }
+ catch (final RuleServiceException e)
{
- PackageBuilderConfiguration pkgBuilderCfg = new PackageBuilderConfiguration();
- //pkgBuilderCfg.setCompiler(PackageBuilderConfiguration.JANINO);
- PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
- try
- {
- Reader rules = new InputStreamReader(inputStreamDrl);
- // this wil parse and compile in one step
- if (ruleLanguage == null)
- {
- builder.addPackageFromDrl(rules);
- }
- else
- {
- logger.debug("Going to read the language: " + ruleLanguage);
- InputStream inputStreamDsl = ClassUtil.getResourceAsStream(ruleLanguage.charAt(0) == '/' ? ruleLanguage : "/" + ruleLanguage, JBossRulesRouter.class);
- if (inputStreamDsl == null)
- {
- logger.error("Could not find ruleLanguage: " + rulesFile);
- }
- else
- {
- try
- {
- Reader dsl = new InputStreamReader(inputStreamDsl);
- builder.addPackageFromDrl(rules, dsl);
- }
- finally
- {
- safeClose(inputStreamDsl);
- }
- }
- }
- }
- finally
- {
- safeClose(inputStreamDrl);
- }
- // get the compiled package (which is serializable)
- Package pkg = builder.getPackage();
- // add the package to a rulebase (deploy the rule package).
- try
- {
- RuleBase ruleBase = RuleBaseFactory.newRuleBase();
- ruleBase.addPackage(pkg);
- return ruleBase;
- } catch (Exception ex) {
- throw new CBRException(ex.getMessage(), ex);
- }
+ throw new MessageRouterException(e.getMessage(), e);
}
}
- /**
- * Reading the rules and dsl from files. Note that we may want to allow
- * other ways to set the rule, but for now it's just files.
- */
- private static String getRules (String rulesFile, String ruleLanguage)
- throws IOException
+ public void setConfigTree(final ConfigTree configTree)
{
- logger.debug("Going to hash the rule: " + rulesFile);
- InputStream inputStreamDrl = ClassUtil.getResourceAsStream(rulesFile.charAt(0) == '/' ? rulesFile : "/" + rulesFile, JBossRulesRouter.class);
- if (inputStreamDrl == null)
- {
- logger.error("Could not find rulesFile: " + rulesFile);
- return null;
- }
- else
- {
- final String rules ;
- try
- {
- rules = getString(inputStreamDrl);
- }
- finally
- {
- safeClose(inputStreamDrl);
- }
- String language = "";
- if (ruleLanguage != null)
- {
- logger.debug("Going to hash the language: " + ruleLanguage);
- InputStream inputStreamDsl = ClassUtil.getResourceAsStream(ruleLanguage.charAt(0) == '/' ? ruleLanguage : "/" + ruleLanguage, JBossRulesRouter.class);
- if (inputStreamDsl == null)
- {
- logger.error("Could not find language: " + ruleLanguage);
- }
- else
- {
- try
- {
- language = getString(inputStreamDsl);
- }
- finally
- {
- safeClose(inputStreamDsl);
- }
- }
- }
- return rules + language;
- }
-
+ this.configTree = configTree;
}
-
- private static void safeClose(final InputStream is)
- {
- try
- {
- is.close() ;
- }
- catch (final Throwable th) {} // ignore
- }
-
- private static String getString (InputStream in) throws IOException
- {
- StringBuffer stringBuffer = new StringBuffer();
- byte[] b = new byte[4096];
- for (int i; (i = in.read(b)) != -1;)
- {
- stringBuffer.append(new String(b, 0, i));
- }
- return stringBuffer.toString();
- }
-
- public void setConfigTree(ConfigTree configTree) {
- rulesCounter = new JBRulesCounter(configTree);
- rulesCounter.registerMBean();
- }
- /**
- * The lifecycle resource factory for rule sets.
- * @author kevin
- */
- public static class LifecycleRuleBaseFactory implements LifecycleResourceFactory<Map<String, RuleBase>>
- {
- /**
- * Create a resource object which will be associated with the specified lifecycle identity.
- * @param lifecycleIdentity The associated lifecycle identity.
- * @return The lifecycle resource
- * @throws LifecycleResourceException for errors during construction.
- */
- public Map<String, RuleBase> createLifecycleResource(final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- return new ConcurrentHashMap<String, RuleBase>() ;
- }
-
- /**
- * Destroy a resource object which is associated with the specified lifecycle identity.
- * @param resource The lifecycle resource.
- * @param lifecycleIdentity The associated lifecycle identity.
- * @return The lifecycle resource.
- * @throws LifecycleResourceException for errors during destroy.
- */
- public void destroyLifecycleResource(final Map<String, RuleBase> resource,
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- }
- }
-
- /**
- * The lifecycle resource factory for rule sets.
- * @author kevin
- */
- public static class LifecycleRuleSetFactory implements LifecycleResourceFactory<Map<String, String>>
- {
- /**
- * Create a resource object which will be associated with the specified lifecycle identity.
- * @param lifecycleIdentity The associated lifecycle identity.
- * @return The lifecycle resource
- * @throws LifecycleResourceException for errors during construction.
- */
- public Map<String, String> createLifecycleResource(final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- return new ConcurrentHashMap<String, String>() ;
- }
-
- /**
- * Destroy a resource object which is associated with the specified lifecycle identity.
- * @param resource The lifecycle resource.
- * @param lifecycleIdentity The associated lifecycle identity.
- * @return The lifecycle resource.
- * @throws LifecycleResourceException for errors during destroy.
- */
- public void destroyLifecycleResource(final Map<String, String> resource,
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- }
- }
}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules)
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,308 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.services.rules;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-
-import org.apache.log4j.Logger;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.agent.RuleAgent;
-import org.drools.compiler.DroolsParserException;
-import org.drools.compiler.PackageBuilder;
-import org.drools.compiler.PackageBuilderConfiguration;
-import org.drools.decisiontable.InputType;
-import org.drools.decisiontable.SpreadsheetCompiler;
-import org.drools.rule.Package;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.util.ClassUtil;
-
-/**
- * A helper class, it returns rulebases based on various methods of creating them.
- *
- * @author jdelong at redhat.com
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class DroolsRuleBaseHelper {
-
- private static Logger logger = Logger.getLogger(DroolsRuleBaseHelper.class);
-
- private DroolsRuleBaseHelper() {}
-
- /**
- * Factory method that returns an instance of this class.
- * </p>
- * The current implemenations returns a new instance of this
- * class for every call.
- *
- * @return {@link DroolsRuleBaseHelper}
- */
- public static DroolsRuleBaseHelper getInstance()
- {
- return new DroolsRuleBaseHelper();
- }
-
- /**
- * Creates a rulebase using rules and dsl from files
- * <p/>
- *
- * @param ruleFile -
- * file name which contains the Drools rules. Can be a file on the local
- * filesystem, a file on the classpath or an URL. Must not be null.
- * @param dsl -
- * file containing the Drools Domain Specific Language (dsl)
- * @throws DroolsParserException -
- * if an exception occurs during Drools package building
- * @throws IOException -
- * if an IOException occurs during Drools package building
- * @throws RuleServiceException -
- * if the ruleFile cannot be located or if it was not possible to
- * add the package to the RuleBase.
- */
- public RuleBase createRuleBaseFromRuleFiles(
- final String ruleFile,
- final String dsl)
- throws DroolsParserException, IOException, RuleServiceException
- {
- assertNotNull( ruleFile, "ruleFile" );
-
- logger.debug("Going to create a rulebase from the ruleFile: " + ruleFile);
- // read in the rules
- InputStream rulesInputStream = getRulesInputStream(ruleFile);
-
- Reader ruleReader = getRulesReader(rulesInputStream);
-
- PackageBuilder builder = new PackageBuilder(new PackageBuilderConfiguration());
- try
- {
- if ( dsl == null )
- {
- builder.addPackageFromDrl(ruleReader);
- }
- else
- {
- logger.debug("Going to read the dsl: " + dsl);
- InputStream dslInputStream = getRulesInputStream( dsl );
- Reader dslReader = getRulesReader( dslInputStream );
- if ( dslReader == null )
- {
- logger.error("Could not find dsl: " + ruleFile);
- }
- else
- {
- try
- {
- builder.addPackageFromDrl(ruleReader, dslReader);
- }
- finally
- {
- safeClose(dslInputStream);
- }
- }
- }
- }
- finally
- {
- safeClose(rulesInputStream);
- }
-
- // get the compiled package (which is serializable)
- Package pkg = builder.getPackage();
- // add the package to a rulebase
- try
- {
- RuleBase ruleBase = RuleBaseFactory.newRuleBase();
- ruleBase.addPackage(pkg);
- return ruleBase;
- }
- catch (final Exception ex)
- {
- throw new RuleServiceException(ex.getMessage(), ex);
- }
- }
-
- /**
- * Reads the rules and dsl from files and returning as a string
- *
- * @param ruleFile -
- * file name which contains the Drools rules. Can be a file on the local
- * filesystem, a file on the classpath or an URL. Must not be null.
- * @param dsl -
- * file containing the Drools Domain Specific Language (dsl)
- * @return String -
- * String representation of the rules
- * @throws IOException -
- * if an IOException occurs during Drools package building
- * @throws RuleServiceException -
- * if the ruleFile cannot be located or if it was not possible to
- * add the package to the RuleBase.
- * @throws RuleServiceException
- */
- public String getRulesAsString(
- final String ruleFile,
- final String dsl) throws IOException, RuleServiceException
- {
- assertNotNull( ruleFile, "rulefile" );
-
- final String rules = getFileContents( ruleFile );
- return dsl == null ? rules : rules + getFileContents( dsl );
- }
-
-
-
-
- /**
- * Reading the rules from a decision table.
- * <p/>
- * @param decisionTable -
- * file name which contains the Drools decision table. Can be a file on the local
- * filesystem, a file on the classpath or an URL. Must not be null.
- * @throws DroolsParserException -
- *
- * @throws IOException -
- *
- * @throws RuleServiceException -
- */
- public RuleBase createRuleBaseFromDecisionTable(
- final String decisionTable)
- throws DroolsParserException, IOException, RuleServiceException
- {
- assertNotNull( decisionTable, "decisionTable" );
-
- logger.debug("Going to read the decisionTable: " + decisionTable);
- String drl = getSpreadsheetRules(decisionTable);
- PackageBuilder builder = new PackageBuilder();
- builder.addPackageFromDrl( new StringReader(drl) );
- try
- {
- //add the package to a rulebase (deploy the rule package).
- RuleBase ruleBase = RuleBaseFactory.newRuleBase();
- ruleBase.addPackage(builder.getPackage());
- return ruleBase;
- }
- catch (Exception ex)
- {
- throw new RuleServiceException(ex.getMessage(), ex);
- }
- }
-
- /**
- * Reading the decision table and creating a drl
- * </p>
- * @throws RuleServiceException
- */
- public String getSpreadsheetRules(final String decisionTable) throws RuleServiceException
- {
- logger.debug("Going to read the decisionTable: " + decisionTable);
- String drl;
- InputStream inputStreamDT = getRulesInputStream(decisionTable);
- SpreadsheetCompiler compiler = new SpreadsheetCompiler();
-
- try
- {
- drl = compiler.compile(inputStreamDT, InputType.XLS);
- logger.debug("Compiled the decsionTable to a drl: " + drl);
- }
- finally
- {
- safeClose(inputStreamDT);
- }
- return drl;
- }
-
- /**
- * This shows how rules are loaded up from a deployed package.
- */
- public RuleBase loadRuleBaseFromRuleAgent(final String ruleAgentProperties) throws IOException, Exception
- {
- logger.debug("Going to read the ruleAgentProperties: " + ruleAgentProperties);
- RuleAgent agent = RuleAgent.newRuleAgent("/" + ruleAgentProperties);
- RuleBase rb = agent.getRuleBase();
-
- return rb;
- }
-
- private String getFileContents( final String fileName ) throws RuleServiceException
- {
- InputStream inputStream = getRulesInputStream( fileName );
- final String fileContents;
- try
- {
- fileContents = StreamUtils.readStreamString( inputStream, "UTF-8" );
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuleServiceException("Could not read from file [" + fileName + "].", e);
- }
- finally
- {
- safeClose( inputStream );
- }
- return fileContents;
- }
-
- // private instance methods
-
- private Reader getRulesReader(final InputStream inputStream)
- {
- return new InputStreamReader(inputStream);
- }
-
- private InputStream getRulesInputStream(final String rulesFile) throws RuleServiceException
- {
- InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + rulesFile, getClass() );
- if ( resourceAsStream == null )
- throw new RuleServiceException("Could not locate file [" + rulesFile + "], neither as a file on the local filesystem, on the classpath nor as a URL.");
- else
- return resourceAsStream;
- }
-
- // private static methods
-
- private static void safeClose( final InputStream is )
- {
- try
- {
- is.close();
- }
- catch (final IOException e)
- {
- logger.warn("Caught an IOException while trying to close as inputstream.", e );
- }
- }
-
- private static void assertNotNull( final String argumentValue, final String argumentName )
- {
- if( argumentValue == null )
- throw new NullPointerException("[" + argumentName + "] argument must not be null");
- }
-
-
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,303 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.internal.soa.esb.services.rules;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.agent.RuleAgent;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.decisiontable.InputType;
+import org.drools.decisiontable.SpreadsheetCompiler;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.util.ClassUtil;
+
+/**
+ * A helper class, it returns rulebases based on various methods of creating them.
+ * <p/>
+ *
+ * @author jdelong at redhat.com
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class DroolsRuleBaseHelper {
+
+ private static Logger logger = Logger.getLogger(DroolsRuleBaseHelper.class);
+
+ private DroolsRuleBaseHelper() {}
+
+ /**
+ * Factory method that returns an instance of this class.
+ * </p>
+ * The current implementation returns a new instance of this
+ * class for every call.
+ *
+ * @return {@link DroolsRuleBaseHelper}
+ */
+ public static DroolsRuleBaseHelper getInstance()
+ {
+ return new DroolsRuleBaseHelper();
+ }
+
+ /**
+ * Creates a rulebase using rules and dsl from files
+ * <p/>
+ *
+ * @param ruleFile -
+ * file name which contains the Drools rules. Can be a file on the local
+ * filesystem, a file on the classpath or an URL. Must not be null.
+ * @param dsl -
+ * file containing the Drools Domain Specific Language (dsl)
+ * @throws DroolsParserException -
+ * if an exception occurs during Drools package building
+ * @throws IOException -
+ * if an IOException occurs during Drools package building
+ * @throws RuleServiceException -
+ * if the ruleFile cannot be located or if it was not possible to
+ * add the package to the RuleBase.
+ */
+ public RuleBase createRuleBaseFromRuleFiles(
+ final String ruleFile,
+ final String dsl)
+ throws DroolsParserException, IOException, RuleServiceException, RuleServiceBuilderException
+ {
+ assertNotNull( ruleFile, "ruleFile" );
+
+ // read in the rules
+ InputStream rulesInputStream = getRulesInputStream( ruleFile );
+
+ Reader ruleReader = getRulesReader( rulesInputStream );
+
+ PackageBuilder builder = new PackageBuilder( new PackageBuilderConfiguration() );
+ try
+ {
+ if ( dsl == null )
+ {
+ builder.addPackageFromDrl(ruleReader);
+ }
+ else
+ {
+ InputStream dslInputStream = getRulesInputStream( dsl );
+ Reader dslReader = getRulesReader( dslInputStream );
+ if ( dslReader == null )
+ {
+ logger.error("Could not find dsl file [" + dsl + "]");
+ }
+ else
+ {
+ try
+ {
+ builder.addPackageFromDrl(ruleReader, dslReader);
+ }
+ finally
+ {
+ safeClose(dslInputStream);
+ }
+ }
+ }
+ }
+ finally
+ {
+ safeClose(rulesInputStream);
+ }
+
+ return getNewRuleBaseWithPackage( builder );
+ }
+
+
+
+ /**
+ * Reads the rules and dsl from files and returning as a string
+ *
+ * @param ruleFile -
+ * file name which contains the Drools rules. Can be a file on the local
+ * filesystem, a file on the classpath or an URL. Must not be null.
+ * @param dsl -
+ * file containing the Drools Domain Specific Language (dsl)
+ * @return String -
+ * String representation of the rules
+ * @throws IOException -
+ * if an IOException occurs during Drools package building
+ * @throws RuleServiceException -
+ * if the ruleFile cannot be located or if it was not possible to
+ * add the package to the RuleBase.
+ * @throws RuleServiceException
+ */
+ public String getRulesAsString(
+ final String ruleFile,
+ final String dsl) throws IOException, RuleServiceException
+ {
+ assertNotNull( ruleFile, "rulefile" );
+
+ final String rules = getFileContents( ruleFile );
+ return dsl == null ? rules : rules + getFileContents( dsl );
+ }
+
+ /**
+ * Reading the rules from a decision table.
+ * <p/>
+ * @param decisionTable -
+ * file name which contains the Drools decision table. Can be a file on the local
+ * filesystem, a file on the classpath or an URL. Must not be null.
+ * @throws DroolsParserException -
+ *
+ * @throws IOException -
+ *
+ * @throws RuleServiceException -
+ */
+ public RuleBase createRuleBaseFromDecisionTable(
+ final String decisionTable)
+ throws DroolsParserException, IOException, RuleServiceException, RuleServiceBuilderException
+ {
+ assertNotNull( decisionTable, "decisionTable" );
+
+ final String drl = getSpreadsheetRules(decisionTable);
+ PackageBuilder builder = new PackageBuilder();
+ builder.addPackageFromDrl( new StringReader(drl) );
+ return getNewRuleBaseWithPackage( builder );
+ }
+
+ /**
+ * Reading the decision table and creating a drl
+ * </p>
+ * @throws RuleServiceException
+ */
+ public String getSpreadsheetRules(final String decisionTable) throws RuleServiceException
+ {
+ InputStream inputStreamDT = getRulesInputStream(decisionTable);
+ try
+ {
+ return new SpreadsheetCompiler().compile(inputStreamDT, InputType.XLS);
+ }
+ finally
+ {
+ safeClose(inputStreamDT);
+ }
+ }
+
+ /**
+ * This shows how rules are loaded up from a deployed package.
+ */
+ public RuleBase loadRuleBaseFromRuleAgent(final String ruleAgentProperties) throws IOException, Exception
+ {
+ return RuleAgent.newRuleAgent( "/" + ruleAgentProperties ).getRuleBase();
+ }
+
+ public RuleBase loadRuleBaseFromRuleAgent(final Properties ruleAgentProperties) throws IOException, Exception
+ {
+ return RuleAgent.newRuleAgent( ruleAgentProperties ).getRuleBase();
+ }
+
+ /**
+ * This shows how rules are loaded up from a deployed package.
+ */
+ public RuleAgent createRuleAgent(final String ruleAgentProperties) throws IOException, Exception
+ {
+ return RuleAgent.newRuleAgent( "/" + ruleAgentProperties );
+ }
+
+ private String getFileContents( final String fileName ) throws RuleServiceException
+ {
+ InputStream inputStream = getRulesInputStream( fileName );
+ try
+ {
+ return StreamUtils.readStreamString( inputStream, "UTF-8" );
+ }
+ catch ( final UnsupportedEncodingException e)
+ {
+ throw new RuleServiceException("Could not read from file [" + fileName + "].", e);
+ }
+ finally
+ {
+ safeClose( inputStream );
+ }
+ }
+
+ // private instance methods
+
+ private Reader getRulesReader(final InputStream inputStream)
+ {
+ return new InputStreamReader( inputStream );
+ }
+
+ private InputStream getRulesInputStream(final String rulesFile) throws RuleServiceException
+ {
+ InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + rulesFile, getClass() );
+ if ( resourceAsStream == null )
+ throw new RuleServiceException("Could not locate file [" + rulesFile + "], neither as a file on the local filesystem, on the classpath nor as a URL.");
+ else
+ return resourceAsStream;
+ }
+
+ private RuleBase getNewRuleBaseWithPackage( final PackageBuilder builder ) throws RuleServiceException, RuleServiceBuilderException
+ {
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ try
+ {
+ ruleBase.addPackage( builder.getPackage() );
+ }
+ catch (final Exception ex)
+ // need to catch Exception as RuleBase.addPackage throws it
+ {
+ throw new RuleServiceException(ex.getMessage(), ex);
+ }
+
+ if ( builder.hasErrors() )
+ {
+ throw new RuleServiceBuilderException( "PackageBuilder generated errors: ", builder.getErrors() );
+ }
+
+ return ruleBase;
+ }
+
+ // private static methods
+
+ private static void safeClose( final InputStream is )
+ {
+ try
+ {
+ is.close();
+ }
+ catch (final IOException e)
+ {
+ logger.warn("Caught an IOException while trying to close as inputstream.", e );
+ }
+ }
+
+ private static void assertNotNull( final String argumentValue, final String argumentName )
+ {
+ if( argumentValue == null )
+ throw new NullPointerException("[" + argumentName + "] argument must not be null");
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,843 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.internal.soa.esb.services.rules;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.drools.RuleBase;
-import org.drools.StatefulSession;
-import org.drools.StatelessSession;
-import org.drools.WorkingMemory;
-import org.drools.compiler.DroolsParserException;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.services.routing.cbr.JBRulesCounter;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.lifecycle.LifecyclePriorities;
-import org.jboss.soa.esb.lifecycle.LifecycleResource;
-import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
-import org.jboss.soa.esb.lifecycle.LifecycleResourceFactory;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.rules.RuleService;
-
-/**
- * JBossRules (aka Drools) Implementation of a rule engine interface for rules services. Here we use
- * <p/>
- *
- * @author jdelong at redhat.com
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class DroolsRuleService implements RuleService {
-
- private static List<String> decisionTableSuffixes = Collections.unmodifiableList( Arrays.asList( new String[] { ".xls", ".csv" } ) );
- private static List<String> ruleAgentSuffixes = Collections.unmodifiableList( Arrays.asList( new String[] { ".properties" } ) );
- private static List<String> ruleFileSuffixes = Collections.unmodifiableList( Arrays.asList( new String[] { ".drl" } ) );
-
- /**
- * The lifecycle resource factory for RuleBases.
- */
- private static final LifecycleResourceFactory<Map<String, RuleBase>> lifecycleRuleBaseFactory = new LifecycleRuleBaseFactory();
- /**
- * The lifecycle resource bule bases.
- */
- private static final LifecycleResource<Map<String, RuleBase>> lifecycleRuleBases = new LifecycleResource<Map<String, RuleBase>>(
- lifecycleRuleBaseFactory, LifecyclePriorities.RULE_BASE_PRIORITY);
- /**
- * The lifecycle resource rule sets.
- */
- private static final LifecycleResourceFactory<Map<String, String>> lifecycleRuleSetFactory = new LifecycleRuleSetFactory();
- /**
- * Lifecycle couriers.
- */
- private static final LifecycleResource<Map<String, String>> lifecycleRuleSets = new LifecycleResource<Map<String, String>>(
- lifecycleRuleSetFactory, LifecyclePriorities.RULE_BASE_PRIORITY);
-
- /**
- * See {@link JBRulesCounter}
- */
- private JBRulesCounter rulesCounter = null;
-
- /**
- * Execute rules using a certain ruleSet and domain specific language using
- * the Stateless rule engine API
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param dsl -
- * String reference to a file which contains a custom rule
- * language definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList -
- * a list with additional objects (typically pulled from the
- * message) to be inserted into working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRules(
- final String ruleSet,
- final String dsl,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( ruleSet, "ruleSet" );
-
- final long startTime = System.nanoTime();
-
- try
- {
- RuleBase ruleBase = getRuleBaseForFileBasedRules(ruleSet, dsl, ruleReload);
- message = executeStatelessRules(ruleBase, message, globals, objectList);
-
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_SUCCEED );
- }
- catch (RuleServiceException ree)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + ree.getMessage(), ree);
- }
- return message;
- }
-
- /**
- * Execute rules from a decision table using the Stateless rule engine API
- *
- * @param decisionTable -
- * String reference to a file which contains a spreadsheet of rules
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRulesFromDecisionTable(
- final String decisionTable,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( decisionTable, "decisionTable" );
-
- final long startTime = System.nanoTime();
-
- try {
- RuleBase ruleBase = getRuleBaseForDecisionTable(decisionTable, ruleReload);
- message = executeStatelessRules(ruleBase, message, globals, objectList);
-
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_SUCCEED );
-
- return message;
-
- } catch (RuleServiceException ree) {
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + ree.getMessage(), ree);
- }
- }
-
- /**
- * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
- * using the Stateless rule engine API
- *
- * @param ruleAgentProperties -
- * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRulesFromRuleAgent(
- final String ruleAgentProperties,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( ruleAgentProperties, "ruleAgentProperties" );
-
- final long startTime = System.nanoTime();
- try
- {
- DroolsRuleBaseHelper rbHelper = DroolsRuleBaseHelper.getInstance();
- RuleBase ruleBase = rbHelper.loadRuleBaseFromRuleAgent(ruleAgentProperties);
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
- if (ruleBase != null)
- {
- ruleBases.put(ruleAgentProperties, ruleBase);
-
- message = executeStatelessRules(ruleBase, message, globals, objectList);
-
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_SUCCEED );
- }
-
- return message;
-
- }
- catch (IOException e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException( "Could not read the ruleAgentProperties. " + e.getMessage(), e);
- }
- catch (RuleServiceException e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- catch (Exception e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException( "RuleAgent could not get the RuleBase. " + e.getMessage(), e);
- }
- }
-
- /**
- * Execute rules using a certain ruleSet and domain specific language using the Stateful rule engine API
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param domainSpecificLanguage -
- * String reference to a file which contains a custom rule
- * language definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRules(
- final String ruleSet,
- final String dsl,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( ruleSet, "ruleSet" );
-
- final long startTime = System.nanoTime();
-
- try
- {
- RuleBase ruleBase = getRuleBaseForFileBasedRules(ruleSet, dsl, ruleReload);
- message = executeStatefulRules(ruleBase, false, message, globals, objectList);
-
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_SUCCEED);
- }
- catch (RuleServiceException e)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- return message;
- }
-
- /**
- * Execute rules from a decision table using the Stateful rule engine API
- *
- * @param decisionTable -
- * String reference to a file which contains a spreadsheet of rules
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRulesFromDecisionTable(
- final String decisionTable,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( decisionTable, "decisionTable" );
-
- final long startTime = System.nanoTime();
-
- try
- {
- RuleBase ruleBase = getRuleBaseForDecisionTable(decisionTable, ruleReload);
- message = executeStatefulRules(ruleBase, false, message, globals, objectList);
-
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_SUCCEED );
- }
- catch (RuleServiceException e)
- {
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- return message;
- }
-
- /**
- * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
- * using the Stateful rule engine API
- *
- * @param ruleAgentProperties -
- * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRulesFromRuleAgent(
- final String ruleAgentProperties,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( ruleAgentProperties, "ruleAgentProperties" );
-
- final long startTime = System.nanoTime();
- try
- {
- DroolsRuleBaseHelper rbHelper = DroolsRuleBaseHelper.getInstance();
- RuleBase ruleBase = rbHelper.loadRuleBaseFromRuleAgent(ruleAgentProperties);
-
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
- if (ruleBase != null)
- {
- ruleBases.put(ruleAgentProperties, ruleBase);
-
- message = executeStatefulRules(ruleBase, false, message, globals, objectList);
-
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_SUCCEED );
- }
- }
- catch (IOException e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException( "Could not read the ruleAgentProperties. " + e.getMessage(), e);
- }
- catch (RuleServiceException e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- catch (Exception e)
- {
- updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException( "RuleAgent could not get the RuleBase. " + e.getMessage(), e);
- }
- return message;
- }
-
- /**
- * Continue executing rules where the working memory already exists.
- *
- * @param rules -
- * String reference to a file, either the drl file, the decision table,
- * or the ruleAgentProperties. This is used to find the ruleBase.
- * @param dispose -
- * if set to true, working memory will be disposed after the rules are fired
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message continueStatefulRulesExecution(
- final String rules,
- final boolean dispose,
- Message message,
- Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- AssertArgument.isNotNullAndNotEmpty( rules, "rules" );
-
- final long startTime = System.nanoTime();
-
- try
- {
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
- final RuleBase ruleBase = ruleBases.get(rules);
-
- message = executeStatefulRules(ruleBase, dispose, message, globals, objectList);
-
- updateJBRulesCounter( startTime, rules, JBRulesCounter.RULES_SUCCEED );
-
- return message;
-
- }
- catch (Exception e)
- {
- updateJBRulesCounter( startTime, rules, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException( "Could not continue rule execution. " + e.getMessage(), e);
- }
- }
-
- public void setConfigTree( final ConfigTree configTree )
- {
- rulesCounter = new JBRulesCounter( configTree );
- rulesCounter.registerMBean();
- }
-
- private void updateJBRulesCounter( final long startTime , final String rules, final String result )
- {
- if (rulesCounter != null)
- {
- long procTime = System.nanoTime() - startTime;
- rulesCounter.update(procTime, rules, result );
- }
- }
-
- public boolean acceptsDecisionTable( final String fileName )
- {
- return decisionTableSuffixes.contains( getSuffix( fileName ) );
- }
-
-
- public boolean acceptsRuleAgent( final String fileName )
- {
- return ruleAgentSuffixes.contains( getSuffix( fileName ) );
- }
-
- public boolean acceptsRuleFile( final String fileName )
- {
- return ruleFileSuffixes.contains( getSuffix( fileName ) );
- }
-
-
- public List<String> getSupportedDecsionTableSuffixes()
- {
- return decisionTableSuffixes;
- }
-
- public List<String> getSupportedRuleAgentSuffixes()
- {
- return ruleAgentSuffixes;
- }
-
- public List<String> getSupportedRuleFileSuffixes()
- {
- return ruleFileSuffixes;
- }
-
- /**
- * Determine if file based rules need reloading and return the rulebase
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param dsl -
- * String reference to a file which contains a custom rule language
- * definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading the
- * ruleSet.
- *
- * @return Message with updated objects.
- */
- RuleBase getRuleBaseForFileBasedRules(
- final String ruleSet,
- final String dsl,
- final boolean ruleReload) throws RuleServiceException
- {
-
- final long startTime = System.nanoTime();
-
- try
- {
- final DroolsRuleBaseHelper rbHelper = DroolsRuleBaseHelper.getInstance();
-
- String newRuleSet = null;
- boolean isRulesChanged = false;
-
- final Map<String, String> ruleSets = lifecycleRuleSets.getLifecycleResource();
- if ( ruleReload )
- {
- String currentRuleSet = ruleSets.get( ruleSet );
- newRuleSet = rbHelper.getRulesAsString( ruleSet, dsl );
- if ( currentRuleSet == null || !currentRuleSet.equals(newRuleSet) )
- {
- isRulesChanged = true;
- }
- }
- final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
- RuleBase ruleBase = ruleBases.get(ruleSet);
- if ( ruleBase == null || isRulesChanged )
- {
- ruleBase = rbHelper.createRuleBaseFromRuleFiles(ruleSet, dsl);
- if (ruleBase != null)
- ruleBases.put(ruleSet, ruleBase);
- if (newRuleSet == null)
- newRuleSet = rbHelper.getRulesAsString(ruleSet, dsl);
- if (ruleSet != null)
- ruleSets.put(ruleSet, newRuleSet);
- }
-
- return ruleBase;
-
- }
- catch (final LifecycleResourceException e)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not load lifecycle data. " + e.getMessage(), e);
- }
- catch (final IOException e)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not read the rules. " + e.getMessage(), e);
- }
- catch (final DroolsParserException e)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- catch (final RuleServiceException e)
- {
- updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- }
-
- /**
- * Determine if decision table need reloading and return the rulebase
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param dsl -
- * String reference to a file which contains a custom rule language
- * definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading the
- * ruleSet.
- *
- * @return Message with updated objects.
- */
- RuleBase getRuleBaseForDecisionTable(
- final String decisionTable,
- final boolean ruleReload ) throws RuleServiceException {
-
- final long startTime = System.nanoTime();
- try
- {
- DroolsRuleBaseHelper rbHelper = DroolsRuleBaseHelper.getInstance();
- RuleBase ruleBase;
- if ( ruleReload )
- {
- String drl = rbHelper.getSpreadsheetRules(decisionTable);
- ruleBase = getRuleBaseForFileBasedRules(drl, null, ruleReload);
- }
- else
- {
- ruleBase = rbHelper.createRuleBaseFromDecisionTable(decisionTable);
- }
- return ruleBase;
- }
- catch (IOException e)
- {
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not read the rules. " + e.getMessage(), e);
- }
- catch (DroolsParserException e)
- {
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- catch (RuleServiceException e)
- {
- updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
- throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
- }
- }
-
- /**
- * Execute rules using using the Stateless API
- *
- * @param rulebase -
- * the rulebase to use
- * @param message -
- * Message that is updated with the results.
- * @param objectList -
- * a list with additional objects (typically pulled from the message)
- * to be inserted into working memory
- * @param globals -
- * Map of globals variables that should be set in the working memory
- *
- * @return Message -
- * with updated objects.
- */
- Message executeStatelessRules(
- final RuleBase ruleBase,
- final Message message,
- final Map<String,Object> globals,
- final List<Object> objectList)
- {
-
- final StatelessSession statelessSession = ruleBase.newStatelessSession();
- final List<Object> facts = getFacts( message, objectList );
- addGlobalsVariables( statelessSession, globals );
- statelessSession.execute(facts);
- return message;
- }
-
- /**
- * Execute rules using using the Stateful API
- *
- * @param rulebase -
- * the rulebase to use
- * @param dispose -
- * if true the working memory will be dereferenced.
- * @param message -
- * Message that is updated with the results.
- * @param globals -
- * Map of globals variables that should be set in the working memory
- * @param objectList -
- * a list with additional objects to be inserted into working memory
- *
- * @return Message -
- * a possibly updated Message object. The message object is available
- * to Rules and my be updated by them.
- */
- Message executeStatefulRules(
- final RuleBase ruleBase,
- final boolean dispose,
- final Message message,
- final Map<String,Object> globals,
- final List<Object> objectList)
- {
- final StatefulSession statefulSession = getStatefulSession( ruleBase );
- try
- {
- addGlobalsVariables( statefulSession, globals );
- final List<Object> facts = getFacts( message, objectList );
- insertObjectsIntoWorkingMemory( facts, statefulSession );
- statefulSession.fireAllRules();
- }
- finally
- {
- if ( dispose )
- {
- for ( StatefulSession session : ruleBase.getStatefulSessions())
- {
- session.dispose();
- }
- }
- }
-
- return message;
- }
-
- private List<Object> getFacts(final Message message, final List<Object> objectList )
- {
- final List<Object> facts = new ArrayList<Object>();
- facts.add( message );
- if ( objectList != null )
- facts.addAll( objectList );
- return facts;
- }
-
- /*
- * Checks whether the ruleBase has an existing session, and returns
- * that session, otherwise a new session is created.
- */
- private StatefulSession getStatefulSession( final RuleBase ruleBase )
- {
- final StatefulSession[] statefulSessions = ruleBase.getStatefulSessions();
- boolean existingSession = statefulSessions != null && statefulSessions.length > 0;
- return existingSession ? statefulSessions[0] : ruleBase.newStatefulSession();
- }
-
- /*
- * Will set the passed-in elements in the globals Map as global
- * variables.
- */
- private void addGlobalsVariables( final StatelessSession statelessSession, final Map<String,Object> globals )
- {
- if ( globals != null )
- {
- Set<Entry<String, Object>> entrySet = globals.entrySet();
- for ( Entry<String, Object> entry : entrySet )
- statelessSession.setGlobal( entry.getKey(), entry.getValue() );
- }
- }
-
- /*
- * Will set the passed-in elements in the globals Map as global
- * variables.
- */
- private void addGlobalsVariables( final StatefulSession statefulSession, final Map<String,Object> globals )
- {
- if ( globals != null )
- {
- Set<Entry<String, Object>> entrySet = globals.entrySet();
- for ( Entry<String, Object> entry : entrySet )
- {
- statefulSession.setGlobal( entry.getKey(), entry.getValue() );
- }
- }
- }
-
- /**
- * The lifecycle resource factory for rule sets.
- *
- * @author kevin
- */
- public static class LifecycleRuleBaseFactory implements
- LifecycleResourceFactory<Map<String, RuleBase>> {
- /**
- * Create a resource object which will be associated with the
- * specified lifecycle identity.
- *
- * @param lifecycleIdentity
- * The associated lifecycle identity.
- * @return The lifecycle resource
- * @throws LifecycleResourceException
- * for errors during construction.
- */
- public Map<String, RuleBase> createLifecycleResource(
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- return new ConcurrentHashMap<String, RuleBase>();
- }
-
- /**
- * Destroy a resource object which is associated with the specified
- * lifecycle identity.
- *
- * @param resource
- * The lifecycle resource.
- * @param lifecycleIdentity
- * The associated lifecycle identity.
- * @return The lifecycle resource.
- * @throws LifecycleResourceException
- * for errors during destroy.
- */
- public void destroyLifecycleResource(
- final Map<String, RuleBase> resource,
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- // NoOp
- }
- }
-
- /**
- * The lifecycle resource factory for rule sets.
- *
- * @author kevin
- */
- public static class LifecycleRuleSetFactory implements
- LifecycleResourceFactory<Map<String, String>>
- {
- /**
- * Create a resource object which will be associated with the
- * specified lifecycle identity.
- *
- * @param lifecycleIdentity
- * The associated lifecycle identity.
- * @return The lifecycle resource
- * @throws LifecycleResourceException
- * for errors during construction.
- */
- public Map<String, String> createLifecycleResource(
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- return new ConcurrentHashMap<String, String>();
- }
-
- /**
- * Destroy a resource object which is associated with the specified
- * lifecycle identity.
- *
- * @param resource
- * The lifecycle resource.
- * @param lifecycleIdentity
- * The associated lifecycle identity.
- * @return The lifecycle resource.
- * @throws LifecycleResourceException
- * for errors during destroy.
- */
- public void destroyLifecycleResource(
- final Map<String, String> resource,
- final String lifecycleIdentity)
- throws LifecycleResourceException
- {
- // NoOp
- }
- }
-
- private void insertObjectsIntoWorkingMemory(final List<Object> objectList, final WorkingMemory workingMemory)
- {
- if (objectList != null)
- {
- for (Object object : objectList)
- {
- workingMemory.insert(object);
- }
- }
- }
-
-
-
- private String getSuffix ( final String fileName )
- {
- if ( fileName == null )
- throw new NullPointerException("[fileName] argument was null");
-
- return fileName.substring( fileName.lastIndexOf( '.' ) );
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,847 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.internal.soa.esb.services.rules;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.drools.RuleBase;
+import org.drools.StatefulSession;
+import org.drools.StatelessSession;
+import org.drools.WorkingMemory;
+import org.drools.agent.RuleAgent;
+import org.drools.compiler.DroolsParserException;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.services.routing.cbr.JBRulesCounter;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.lifecycle.LifecyclePriorities;
+import org.jboss.soa.esb.lifecycle.LifecycleResource;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceFactory;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.RuleService;
+
+/**
+ * JBossRules (aka Drools) Implementation of a rule engine interface for rules services. Here we use
+ * <p/>
+ *
+ * @author jdelong at redhat.com
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class DroolsRuleService implements RuleService
+{
+ /**
+ * The lifecycle resource factory for RuleBases.
+ */
+ private static final LifecycleResourceFactory<Map<String, RuleBase>> lifecycleRuleBaseFactory = new LifecycleRuleBaseFactory();
+
+ private static final LifecycleResourceFactory<Map<String, RuleAgent>> lifecycleRuleAgentFactory = new LifecycleRuleAgentFactory();
+ /**
+ * The lifecycle resource rule bases.
+ */
+ private static final LifecycleResource<Map<String, RuleBase>> lifecycleRuleBases = new LifecycleResource<Map<String, RuleBase>>(
+ lifecycleRuleBaseFactory, LifecyclePriorities.RULE_BASE_PRIORITY);
+ /**
+ * RuleAgents cache
+ */
+ private static final LifecycleResource<Map<String, RuleAgent>> lifecycleRuleAgents = new LifecycleResource<Map<String, RuleAgent>>(
+ lifecycleRuleAgentFactory, LifecyclePriorities.RULE_BASE_PRIORITY);
+ /**
+ * The lifecycle resource rule sets.
+ */
+ private static final LifecycleResourceFactory<Map<String, String>> lifecycleRuleSetFactory = new LifecycleRuleSetFactory();
+ /**
+ * Lifecycle couriers.
+ */
+ private static final LifecycleResource<Map<String, String>> lifecycleRuleSets = new LifecycleResource<Map<String, String>>(
+ lifecycleRuleSetFactory, LifecyclePriorities.RULE_BASE_PRIORITY);
+
+ /**
+ * See {@link JBRulesCounter}
+ */
+ private JBRulesCounter rulesCounter = null;
+
+ /**
+ * Execute rules using a certain ruleSet and domain specific language using
+ * the Stateless rule engine API
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param dsl -
+ * String reference to a file which contains a custom rule
+ * language definition
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList -
+ * a list with additional objects (typically pulled from the
+ * message) to be inserted into working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRules(
+ final String ruleSet,
+ final String dsl,
+ final boolean ruleReload,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( ruleSet, "ruleSet" );
+
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ RuleBase ruleBase = getRuleBaseForFileBasedRules(ruleSet, dsl, ruleReload);
+ message = executeStatelessRules(ruleBase, message, globals, objectList);
+
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch (RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ return message;
+ }
+
+ /**
+ * Execute rules from a decision table using the Stateless rule engine API
+ *
+ * @param decisionTable -
+ * String reference to a file which contains a spreadsheet of rules
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRulesFromDecisionTable(
+ final String decisionTable,
+ final boolean ruleReload,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( decisionTable, "decisionTable" );
+
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ RuleBase ruleBase = getRuleBaseForDecisionTable( decisionTable, ruleReload );
+ message = executeStatelessRules( ruleBase, message, globals, objectList );
+
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch (RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ return message;
+ }
+
+ /**
+ * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
+ * using the Stateless rule engine API
+ *
+ * @param ruleAgentProperties -
+ * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRulesFromRuleAgent(
+ final String ruleAgentProperties,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( ruleAgentProperties, "ruleAgentProperties" );
+
+ final long startTime = System.nanoTime();
+ try
+ {
+ final RuleBase ruleBase = getRuleBaseForRuleAgent( ruleAgentProperties ) ;
+ message = executeStatelessRules(ruleBase, message, globals, objectList);
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch ( final IOException e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException( "Could not read the ruleAgentProperties file [" + ruleAgentProperties + "]", e);
+ }
+ catch ( final RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ catch ( final Exception e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException( "RuleAgent could not get the RuleBase. " + e.getMessage(), e);
+ }
+ return message;
+ }
+
+ /**
+ * Execute rules using a certain ruleSet and domain specific language using the Stateful rule engine API
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param dsl -
+ * String reference to a file which contains a custom rule
+ * language definition(Domain Specific Language)
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRules(
+ final String ruleSet,
+ final String dsl,
+ final boolean ruleReload,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( ruleSet, "ruleSet" );
+
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ RuleBase ruleBase = getRuleBaseForFileBasedRules( ruleSet, dsl, ruleReload );
+ message = executeStatefulRules( ruleBase, false, message, globals, objectList );
+
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_SUCCEED);
+ }
+ catch (final RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ return message;
+ }
+
+ /**
+ * Execute rules from a decision table using the Stateful rule engine API
+ *
+ * @param decisionTable -
+ * String reference to a file which contains a spreadsheet of rules
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRulesFromDecisionTable(
+ final String decisionTable,
+ final boolean ruleReload,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( decisionTable, "decisionTable" );
+
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ final RuleBase ruleBase = getRuleBaseForDecisionTable(decisionTable, ruleReload);
+
+ message = executeStatefulRules(ruleBase, false, message, globals, objectList);
+
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch (RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ return message;
+ }
+
+ /**
+ * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
+ * using the Stateful rule engine API
+ *
+ * @param ruleAgentProperties -
+ * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRulesFromRuleAgent(
+ final String ruleAgentProperties,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( ruleAgentProperties, "ruleAgentProperties" );
+
+ final long startTime = System.nanoTime();
+ try
+ {
+ final RuleBase ruleBase = getRuleBaseForRuleAgent( ruleAgentProperties ) ;
+
+ message = executeStatefulRules(ruleBase, false, message, globals, objectList);
+
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch (IOException e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException( "Could not read the ruleAgentProperties. " + e.getMessage(), e);
+ }
+ catch (RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ catch (Exception e)
+ {
+ updateJBRulesCounter( startTime, ruleAgentProperties, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException( "RuleAgent could not get the RuleBase. " + e.getMessage(), e);
+ }
+ return message;
+ }
+
+ /**
+ * Continue executing rules where the working memory already exists.
+ *
+ * @param rules -
+ * String reference to a file, either the drl file, the decision table,
+ * or the ruleAgentProperties. This is used to find the ruleBase.
+ * @param dispose -
+ * if set to true, working memory will be disposed after the rules are fired
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message continueStatefulRulesExecution(
+ final String rules,
+ final boolean dispose,
+ Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList) throws RuleServiceException
+ {
+ AssertArgument.isNotNullAndNotEmpty( rules, "rules" );
+
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
+ final RuleBase ruleBase = ruleBases.get( rules );
+
+ message = executeStatefulRules( ruleBase, dispose, message, globals, objectList );
+
+ updateJBRulesCounter( startTime, rules, JBRulesCounter.RULES_SUCCEED );
+ }
+ catch (Exception e)
+ {
+ updateJBRulesCounter( startTime, rules, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException( "Could not continue rule execution. " + e.getMessage(), e);
+ }
+ return message;
+ }
+
+ public void setConfigTree( final ConfigTree configTree )
+ {
+ rulesCounter = new JBRulesCounter( configTree );
+ rulesCounter.registerMBean();
+ }
+
+ // private methods
+
+ private void updateJBRulesCounter( final long startTime , final String rules, final String result )
+ {
+ if (rulesCounter != null)
+ {
+ long procTime = System.nanoTime() - startTime;
+ rulesCounter.update(procTime, rules, result );
+ }
+ }
+
+ // package protected methods
+
+ /**
+ * Determine if file based rules need reloading and return the rulebase
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param dsl -
+ * String reference to a file which contains a custom rule language
+ * definition
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading the
+ * ruleSet.
+ *
+ * @return Message with updated objects.
+ */
+ RuleBase getRuleBaseForFileBasedRules(
+ final String ruleSet,
+ final String dsl,
+ final boolean ruleReload) throws RuleServiceException
+ {
+ final long startTime = System.nanoTime();
+
+ try
+ {
+ final DroolsRuleBaseHelper rbHelper = DroolsRuleBaseHelper.getInstance();
+
+ String newRuleSet = null;
+ boolean isRulesChanged = false;
+
+ final Map<String, String> ruleSets = lifecycleRuleSets.getLifecycleResource();
+ if ( ruleReload )
+ {
+ String currentRuleSet = ruleSets.get( ruleSet );
+ newRuleSet = rbHelper.getRulesAsString( ruleSet, dsl );
+ if ( currentRuleSet == null || !currentRuleSet.equals(newRuleSet) )
+ {
+ isRulesChanged = true;
+ }
+ }
+ final Map<String, RuleBase> ruleBases = lifecycleRuleBases.getLifecycleResource();
+ RuleBase ruleBase = ruleBases.get( ruleSet );
+ if ( ruleBase == null || isRulesChanged )
+ {
+ ruleBase = rbHelper.createRuleBaseFromRuleFiles(ruleSet, dsl);
+ if (ruleBase != null)
+ ruleBases.put(ruleSet, ruleBase);
+ if (newRuleSet == null)
+ newRuleSet = rbHelper.getRulesAsString(ruleSet, dsl);
+ if (ruleSet != null)
+ ruleSets.put(ruleSet, newRuleSet);
+ }
+
+ return ruleBase;
+
+ }
+ catch (final LifecycleResourceException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Could not load lifecycle data. " + e.getMessage(), e);
+ }
+ catch (final IOException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Could not read the rules. " + e.getMessage(), e);
+ }
+ catch (final DroolsParserException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Could not parse the rules. " + e.getMessage(), e);
+ }
+ catch (final RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, ruleSet, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ }
+
+ /**
+ * Determine if decision table need reloading and return the rulebase
+ *
+ * @param decisionTable -
+ * String reference to a file which contains a decision table.
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading the
+ * ruleSet.
+ *
+ * @return Message with updated objects.
+ */
+ RuleBase getRuleBaseForDecisionTable(
+ final String decisionTable,
+ final boolean ruleReload ) throws RuleServiceException {
+
+ final long startTime = System.nanoTime();
+ try
+ {
+ RuleBase ruleBase = getCachedRuleBases().get( decisionTable );
+ if ( ruleReload || ruleBase == null )
+ {
+ ruleBase = DroolsRuleBaseHelper.getInstance().createRuleBaseFromDecisionTable(decisionTable);
+ getCachedRuleBases().put( decisionTable, ruleBase );
+ }
+ return ruleBase;
+ }
+ catch (final IOException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Could not read the rules from [" + decisionTable + "]", e);
+ }
+ catch (final DroolsParserException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Could not parse the rules in [" + decisionTable + "]", e);
+ }
+ catch (final RuleServiceException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw e;
+ }
+ catch (final LifecycleResourceException e)
+ {
+ updateJBRulesCounter( startTime, decisionTable, JBRulesCounter.RULES_FAILED );
+ throw new RuleServiceException("Caught a LifecycleResourceException :", e);
+ }
+ }
+
+ /**
+ * Execute rules using using the Stateless API
+ *
+ * @param rulebase -
+ * the rulebase to use
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList -
+ * a list with additional objects (typically pulled from the message)
+ * to be inserted into working memory
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ *
+ * @return Message -
+ * with updated objects.
+ */
+ Message executeStatelessRules(
+ final RuleBase ruleBase,
+ final Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList)
+ {
+
+ final StatelessSession statelessSession = ruleBase.newStatelessSession();
+ final List<Object> facts = getFacts( message, objectList );
+ addGlobalsVariables( statelessSession, globals );
+ statelessSession.execute(facts);
+ return message;
+ }
+
+ /**
+ * Execute rules using using the Stateful API
+ *
+ * @param rulebase -
+ * the rulebase to use
+ * @param dispose -
+ * if true the working memory will be dereferenced.
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList -
+ * a list with additional objects to be inserted into working memory
+ *
+ * @return Message -
+ * a possibly updated Message object. The message object is available
+ * to Rules and my be updated by them.
+ */
+ Message executeStatefulRules(
+ final RuleBase ruleBase,
+ final boolean dispose,
+ final Message message,
+ final Map<String,Object> globals,
+ final List<Object> objectList)
+ {
+ final StatefulSession statefulSession = getStatefulSession( ruleBase );
+ try
+ {
+ addGlobalsVariables( statefulSession, globals );
+ final List<Object> facts = getFacts( message, objectList );
+ insertObjectsIntoWorkingMemory( facts, statefulSession );
+ statefulSession.fireAllRules();
+ }
+ finally
+ {
+ if ( dispose )
+ {
+ for ( StatefulSession session : ruleBase.getStatefulSessions())
+ {
+ session.dispose();
+ }
+ }
+ }
+
+ return message;
+ }
+
+ private List<Object> getFacts(final Message message, final List<Object> objectList )
+ {
+ final List<Object> facts = new ArrayList<Object>();
+ facts.add( message );
+ if ( objectList != null )
+ facts.addAll( objectList );
+ return facts;
+ }
+
+ /*
+ * Checks whether the ruleBase has an existing session, and returns
+ * that session, otherwise a new session is created.
+ */
+ private StatefulSession getStatefulSession( final RuleBase ruleBase )
+ {
+ final StatefulSession[] statefulSessions = ruleBase.getStatefulSessions();
+ boolean existingSession = statefulSessions != null && statefulSessions.length > 0;
+ return existingSession ? statefulSessions[0] : ruleBase.newStatefulSession();
+ }
+
+ /*
+ * Will set the passed-in elements in the globals Map as global
+ * variables.
+ */
+ private void addGlobalsVariables( final StatelessSession statelessSession, final Map<String,Object> globals )
+ {
+ if ( globals != null )
+ {
+ Set<Entry<String, Object>> entrySet = globals.entrySet();
+ for ( Entry<String, Object> entry : entrySet )
+ statelessSession.setGlobal( entry.getKey(), entry.getValue() );
+ }
+ }
+
+ /*
+ * Will set the passed-in elements in the globals Map as global
+ * variables.
+ */
+ private void addGlobalsVariables( final StatefulSession statefulSession, final Map<String,Object> globals )
+ {
+ if ( globals != null )
+ {
+ Set<Entry<String, Object>> entrySet = globals.entrySet();
+ for ( Entry<String, Object> entry : entrySet )
+ {
+ statefulSession.setGlobal( entry.getKey(), entry.getValue() );
+ }
+ }
+ }
+
+ private void insertObjectsIntoWorkingMemory(final List<Object> objectList, final WorkingMemory workingMemory)
+ {
+ if (objectList != null)
+ {
+ for (Object object : objectList)
+ {
+ workingMemory.insert(object);
+ }
+ }
+ }
+
+ RuleBase getRuleBaseForRuleAgent( final String ruleAgentProperties ) throws IOException, Exception
+ {
+ Map<String, RuleAgent> ruleAgents = getCachedRuleAgents();
+ RuleAgent ruleAgent = ruleAgents.get( ruleAgentProperties );
+ if ( ruleAgent == null )
+ {
+ ruleAgent = DroolsRuleBaseHelper.getInstance().createRuleAgent( ruleAgentProperties );
+ ruleAgents.put( ruleAgentProperties, ruleAgent );
+ }
+
+ RuleBase currentRuleBase = ruleAgent.getRuleBase();
+ // always update the cache as the rulebase might have been updated.
+ getCachedRuleBases().put( ruleAgentProperties, currentRuleBase );
+ return currentRuleBase;
+ }
+
+ Map<String, RuleAgent> getCachedRuleAgents() throws LifecycleResourceException
+ {
+ return lifecycleRuleAgents.getLifecycleResource();
+ }
+
+ Map<String, RuleBase> getCachedRuleBases() throws LifecycleResourceException
+ {
+ return lifecycleRuleBases.getLifecycleResource();
+ }
+
+ /**
+ * The lifecycle resource factory for rule sets.
+ *
+ * @author kevin
+ */
+ public static class LifecycleRuleBaseFactory implements
+ LifecycleResourceFactory<Map<String, RuleBase>> {
+ /**
+ * Create a resource object which will be associated with the
+ * specified lifecycle identity.
+ *
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource
+ * @throws LifecycleResourceException
+ * for errors during construction.
+ */
+ public Map<String, RuleBase> createLifecycleResource(
+ final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ return new ConcurrentHashMap<String, RuleBase>();
+ }
+
+ /**
+ * Destroy a resource object which is associated with the specified
+ * lifecycle identity.
+ *
+ * @param resource
+ * The lifecycle resource.
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource.
+ * @throws LifecycleResourceException
+ * for errors during destroy.
+ */
+ public void destroyLifecycleResource(
+ final Map<String, RuleBase> resource,
+ final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ // NoOp
+ }
+ }
+
+ public static class LifecycleRuleAgentFactory implements LifecycleResourceFactory<Map<String, RuleAgent>> {
+ /**
+ * Create a resource object which will be associated with the
+ * specified lifecycle identity.
+ *
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource
+ * @throws LifecycleResourceException
+ * for errors during construction.
+ */
+ public Map<String, RuleAgent> createLifecycleResource( final String lifecycleIdentity) throws LifecycleResourceException
+ {
+ return new ConcurrentHashMap<String, RuleAgent>();
+ }
+
+ /**
+ * Destroy a resource object which is associated with the specified
+ * lifecycle identity.
+ *
+ * @param resource
+ * The lifecycle resource.
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource.
+ * @throws LifecycleResourceException
+ * for errors during destroy.
+ */
+ public void destroyLifecycleResource( final Map<String, RuleAgent> resource, final String lifecycleIdentity) throws LifecycleResourceException
+ {
+ // NoOp
+ }
+ }
+
+ /**
+ * The lifecycle resource factory for rule sets.
+ *
+ * @author kevin
+ */
+ public static class LifecycleRuleSetFactory implements
+ LifecycleResourceFactory<Map<String, String>>
+ {
+ /**
+ * Create a resource object which will be associated with the
+ * specified lifecycle identity.
+ *
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource
+ * @throws LifecycleResourceException
+ * for errors during construction.
+ */
+ public Map<String, String> createLifecycleResource(
+ final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ return new ConcurrentHashMap<String, String>();
+ }
+
+ /**
+ * Destroy a resource object which is associated with the specified
+ * lifecycle identity.
+ *
+ * @param resource
+ * The lifecycle resource.
+ * @param lifecycleIdentity
+ * The associated lifecycle identity.
+ * @return The lifecycle resource.
+ * @throws LifecycleResourceException
+ * for errors during destroy.
+ */
+ public void destroyLifecycleResource(
+ final Map<String, String> resource,
+ final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ // NoOp
+ }
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.services.rules;
-
-import org.drools.compiler.PackageBuilderErrors;
-
-/**
- * RuleServiceBuilderException adds {@link PackageBuilderErrors}.
- * <p/>
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class RuleServiceBuilderException extends RuleServiceException
-{
- private static final long serialVersionUID = 1L;
-
- private PackageBuilderErrors builderErrors;
-
- public RuleServiceBuilderException()
- {
- super();
- }
-
- public RuleServiceBuilderException(String msg, Throwable cause)
- {
- super( msg, cause );
- }
-
- public RuleServiceBuilderException(String msg)
- {
- super( msg );
- }
-
- public RuleServiceBuilderException(Throwable cause)
- {
- super( cause );
- }
-
- public RuleServiceBuilderException(String msg, PackageBuilderErrors builderErrors)
- {
- super( msg );
- this.builderErrors = builderErrors;
- }
-
- public RuleServiceBuilderException(String msg, Throwable cause, PackageBuilderErrors builderErrors)
- {
- super( msg, cause );
- this.builderErrors = builderErrors;
- }
-
- public PackageBuilderErrors getBuilderErrors()
- {
- return builderErrors;
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.internal.soa.esb.services.rules;
+
+import org.drools.compiler.PackageBuilderErrors;
+
+/**
+ * RuleServiceBuilderException adds {@link PackageBuilderErrors}.
+ * <p/>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class RuleServiceBuilderException extends RuleServiceException
+{
+ private static final long serialVersionUID = 1L;
+
+ private PackageBuilderErrors builderErrors;
+
+ public RuleServiceBuilderException()
+ {
+ super();
+ }
+
+ public RuleServiceBuilderException(String msg, Throwable cause)
+ {
+ super( msg, cause );
+ }
+
+ public RuleServiceBuilderException(String msg)
+ {
+ super( msg );
+ }
+
+ public RuleServiceBuilderException(Throwable cause)
+ {
+ super( cause );
+ }
+
+ public RuleServiceBuilderException(String msg, PackageBuilderErrors builderErrors)
+ {
+ super( msg );
+ this.builderErrors = builderErrors;
+ }
+
+ public RuleServiceBuilderException(String msg, Throwable cause, PackageBuilderErrors builderErrors)
+ {
+ super( msg, cause );
+ this.builderErrors = builderErrors;
+ }
+
+ public PackageBuilderErrors getBuilderErrors()
+ {
+ return builderErrors;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.internal.soa.esb.services.rules;
-
-import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.DISPOSE;
-import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.IMPL_CLASS;
-import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.STATEFUL;
-import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.CONTINUE;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.rules.RuleService;
-
-/**
- * RuleServiceCallHelper is a util class for calling
- * methods on a {@link RuleService} implementation.
- * </p>
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class RuleServiceCallHelper
-{
- private RuleServiceCallHelper()
- {
- throw new AssertionError();
- }
-
- /**
- *
- * @param ruleSet
- * @param ruleLanguage
- * @param ruleReload
- * @param message
- * @param objectList
- * @param globals
- * @param configTree
- * @return
- * @throws RuleServiceException
- */
- public static Message executeRulesService(
- final String ruleSet,
- final String ruleLanguage,
- final boolean ruleReload,
- Message message,
- final List<Object> objectList,
- final Map<String, Object> globals,
- final ConfigTree configTree ) throws RuleServiceException
- {
- final String ruleServiceImpl = configTree.getAttribute( IMPL_CLASS.getTagName(), "org.jboss.internal.soa.esb.services.rules.DroolsRuleService" );
- final RuleService ruleService = RuleServiceFactory.getRuleService( ruleServiceImpl );
- ruleService.setConfigTree( configTree );
-
- final Boolean continueStateful = (Boolean) message.getProperties().getProperty( CONTINUE.getTagName(), Boolean.FALSE );
- if ( continueStateful )
- {
- return ruleService.continueStatefulRulesExecution( ruleSet, getDisposeProperty( message ), message, globals, objectList );
- }
-
- final boolean stateful = Boolean.valueOf( configTree.getAttribute( STATEFUL.getTagName()) );
-
- if ( stateful )
- {
- return executeStatefulRules( ruleService, ruleSet, ruleLanguage, ruleReload, message, globals, objectList );
- }
- else
- {
- return executeStatelessRules( ruleService, ruleSet, ruleLanguage, ruleReload, message, globals, objectList );
- }
- }
-
- // private static methods
-
- private static Message executeStatefulRules(
- RuleService ruleService,
- final String ruleSet,
- final String dsl,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- if ( ruleService.acceptsDecisionTable( ruleSet ) )
- {
- message = ruleService.executeStatefulRulesFromDecisionTable( ruleSet, ruleReload, message, globals, objectList );
- }
- else if ( ruleService.acceptsRuleAgent( ruleSet ) )
- {
- message = ruleService.executeStatefulRulesFromRuleAgent( ruleSet, message, globals, objectList );
- }
- else if ( ruleService.acceptsRuleFile( ruleSet ) )
- {
- message = ruleService.executeStatefulRules( ruleSet, dsl, ruleReload, message, globals, objectList );
- }
- return message;
- }
-
- private static Message executeStatelessRules(
- RuleService ruleService,
- final String ruleSet,
- final String dsl,
- final boolean ruleReload,
- Message message,
- final Map<String,Object> globals,
- final List<Object> objectList) throws RuleServiceException
- {
- if ( ruleService.acceptsDecisionTable( ruleSet ) )
- {
- message = ruleService.executeStatelessRulesFromDecisionTable( ruleSet, ruleReload, message, globals, objectList );
- }
- else if ( ruleService.acceptsRuleAgent( ruleSet ) )
- {
- message = ruleService.executeStatelessRulesFromRuleAgent( ruleSet, message, globals, objectList );
- }
- else if ( ruleService.acceptsRuleFile( ruleSet ) )
- {
- message = ruleService.executeStatelessRules( ruleSet, dsl, ruleReload, message, globals, objectList );
- }
- else
- {
- throwRuleExceptionWithSupportedSuffixes( ruleService, ruleSet );
- }
-
- return message;
- }
-
- private static void throwRuleExceptionWithSupportedSuffixes( final RuleService ruleService , final String fileName ) throws RuleServiceException
- {
- String lineSeparator = System.getProperty( "line.separator" );
- throw new RuleServiceException(
- "The RuleService does not recognize the type of file : [" + fileName + "]." +
- "The RuleService accepts the following decision table type(s): " + ruleService.getSupportedDecsionTableSuffixes() +
- lineSeparator +
- ", and these rule agent type(s) " + ruleService.getSupportedRuleAgentSuffixes() +
- lineSeparator +
- ", and these rule file types(s) : " + ruleService.getSupportedRuleFileSuffixes());
- }
-
- private static boolean getDisposeProperty( final Message message ) throws RuleServiceException
- {
- Object dispose = message.getProperties().getProperty( DISPOSE.getTagName() );
- if ( dispose == null )
- {
- throw new RuleServiceException("The property [" + DISPOSE.getTagName() + "] must be specified when [" +
- CONTINUE.getTagName() + "] is true. This is required as it is important that the rules working memory "+
- " be disposed or memory leaks can occur.");
- }
- return (Boolean)dispose;
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.internal.soa.esb.services.rules;
+
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.CONTINUE;
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.DECISION_TABLE;
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.RULE_AGENT_PROPERTIES;
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.DISPOSE;
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.IMPL_CLASS;
+import static org.jboss.soa.esb.services.rules.RuleServicePropertiesNames.STATEFUL;
+import java.util.List;
+import java.util.Map;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.RuleService;
+
+/**
+ * RuleServiceCallHelper is a util class for calling
+ * methods on a {@link RuleService} implementation.
+ * </p>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class RuleServiceCallHelper
+{
+ private RuleServiceCallHelper()
+ {
+ throw new AssertionError();
+ }
+
+ /**
+ * This helper method delegates to the configured RuleService implementation.
+ * <p/>
+ * If the message object instance has a property 'continue' set to true, this method
+ * will invoke {@link RuleService#continueStatefulRulesExecution(String, boolean, Message, Map, List)}.
+ * This will continue an existing stateful session.
+ * <br>
+ * <br>
+ * Otherwise this method will delete one of the stateless or stateful methods in RuleService
+ * depending on the configuration property 'stateful' is true or false. Default is stateless.
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param ruleLanguage -
+ * String reference to a file which contains a custom rule
+ * language definition
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList -
+ * a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param configTree -
+ * configuration instance to access properties from jboss-esb.xml
+ * @return Message -
+ * the ESB Message object which might have been updated.
+ * @throws RuleServiceException
+ */
+ public static Message executeRulesService(
+ String ruleSet,
+ final String ruleLanguage,
+ final boolean ruleReload,
+ Message message,
+ final List<Object> objectList,
+ final Map<String, Object> globals,
+ final ConfigTree configTree ) throws RuleServiceException
+ {
+ final String ruleServiceImpl = configTree.getAttribute( IMPL_CLASS.getTagName(), "org.jboss.internal.soa.esb.services.rules.DroolsRuleService" );
+ final RuleService ruleService = RuleServiceFactory.getRuleService( ruleServiceImpl );
+ ruleService.setConfigTree( configTree );
+
+ final String decisionTable = configTree.getAttribute( DECISION_TABLE.getTagName() );
+ final String ruleAgent = configTree.getAttribute( RULE_AGENT_PROPERTIES.getTagName() );
+
+ final Boolean continueStateful = (Boolean) message.getProperties().getProperty( CONTINUE.getTagName(), Boolean.FALSE );
+ if ( continueStateful )
+ {
+ // ruleSet can be a rule file, decisiontable or a ruleAgent properties file for continueStatefulRules
+ if ( ruleSet == null )
+ ruleSet = decisionTable != null ? decisionTable : ruleAgent;
+
+ message = ruleService.continueStatefulRulesExecution( ruleSet, getDisposeProperty( message ), message, globals, objectList );
+ }
+ else
+ {
+ final boolean stateful = Boolean.valueOf( configTree.getAttribute( STATEFUL.getTagName()) );
+
+ if ( stateful )
+ {
+ if ( ruleSet != null )
+ message = ruleService.executeStatefulRules( ruleSet, ruleLanguage, ruleReload, message, globals, objectList );
+ else if ( decisionTable != null )
+ message = ruleService.executeStatefulRulesFromDecisionTable( decisionTable, ruleReload, message, globals, objectList );
+ else if ( ruleAgent != null )
+ message = ruleService.executeStatefulRulesFromRuleAgent( ruleAgent, message, globals, objectList );
+ else
+ throwRuleServiceException();
+ }
+ else
+ {
+ if ( ruleSet != null )
+ message = ruleService.executeStatelessRules( ruleSet, ruleLanguage, ruleReload, message, globals, objectList );
+ else if ( decisionTable != null )
+ message = ruleService.executeStatelessRulesFromDecisionTable( decisionTable, ruleReload, message, globals, objectList );
+ else if ( ruleAgent != null )
+ message = ruleService.executeStatelessRulesFromRuleAgent( ruleAgent, message, globals, objectList );
+ else
+ throwRuleServiceException();
+ }
+ }
+ return message;
+ }
+
+ // private static methods
+
+ private static void throwRuleServiceException() throws RuleServiceException
+ {
+ throw new RuleServiceException( "One of '" + ListenerTagNames.RULE_SET_TAG + "', '" + DECISION_TABLE.getTagName() + "', or ' " + RULE_AGENT_PROPERTIES.getTagName() + "'must be specified as properties in jboss-esb.xml");
+ }
+
+ private static boolean getDisposeProperty( final Message message ) throws RuleServiceException
+ {
+ Object dispose = message.getProperties().getProperty( DISPOSE.getTagName() );
+ if ( dispose == null )
+ {
+ throw new RuleServiceException("The property [" + DISPOSE.getTagName() + "] must be specified when [" +
+ CONTINUE.getTagName() + "] is true. This is required as it is important that the rules working memory "+
+ " be disposed or memory leaks can occur.");
+ }
+ return (Boolean)dispose;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.services.rules;
-
-/**
- * @author jdelong at redhat.com
- *
- */
-public class RuleServiceException extends Exception {
- private static final long serialVersionUID = 1L;
-
- public RuleServiceException() {
- super();
- }
-
- public RuleServiceException(String msg) {
- super(msg);
- }
-
- public RuleServiceException(Throwable cause) {
- super(cause);
- }
-
- public RuleServiceException(String msg, Throwable cause) {
- super(msg, cause);
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.internal.soa.esb.services.rules;
+
+/**
+ * @author jdelong at redhat.com
+ *
+ */
+public class RuleServiceException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public RuleServiceException() {
+ super();
+ }
+
+ public RuleServiceException(String msg) {
+ super(msg);
+ }
+
+ public RuleServiceException(Throwable cause) {
+ super(cause);
+ }
+
+ public RuleServiceException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.services.rules;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.services.rules.RuleService;
-import org.jboss.soa.esb.util.ClassUtil;
-/**
- * Returns an instance of the RuleService.
- *
- * @author jdelong at redhat.com
- *
- */
-public class RuleServiceFactory {
- private static Logger logger = Logger.getLogger(RuleServiceFactory.class);
-
- /**
- * This factory returns a ruleService
- *
- * @author jdelong at redhat.com
- *
- */
- public static RuleService getRuleService(String className)
- throws RuleServiceException {
- RuleService rs = null;
- logger.log(Level.DEBUG, "Going to load " + className);
- try {
- // instruct class loader to load the RuleService Implementation
- Class rsClass = ClassUtil.forName(className,
- RuleServiceFactory.class);
- // Try to get an instance of the RS
- rs = (RuleService) rsClass.newInstance();
- } catch (ClassNotFoundException cnfex) {
- throw new RuleServiceException("RuleService Implementation="
- + className + " not found", cnfex);
- } catch (Exception e) {
- throw new RuleServiceException(className + " invocation problem. "
- + e.getLocalizedMessage(), e);
- }
- return rs;
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.internal.soa.esb.services.rules;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.services.rules.RuleService;
+import org.jboss.soa.esb.util.ClassUtil;
+/**
+ * Returns an instance of the RuleService.
+ *
+ * @author jdelong at redhat.com
+ *
+ */
+public class RuleServiceFactory {
+ private static Logger logger = Logger.getLogger(RuleServiceFactory.class);
+
+ /**
+ * This factory returns a ruleService
+ *
+ * @author jdelong at redhat.com
+ *
+ */
+ public static RuleService getRuleService(String className)
+ throws RuleServiceException {
+ RuleService rs = null;
+ logger.log(Level.DEBUG, "Going to load " + className);
+ try {
+ // instruct class loader to load the RuleService Implementation
+ Class rsClass = ClassUtil.forName(className,
+ RuleServiceFactory.class);
+ // Try to get an instance of the RS
+ rs = (RuleService) rsClass.newInstance();
+ } catch (ClassNotFoundException cnfex) {
+ throw new RuleServiceException("RuleService Implementation="
+ + className + " not found", cnfex);
+ } catch (Exception e) {
+ throw new RuleServiceException(className + " invocation problem. "
+ + e.getLocalizedMessage(), e);
+ }
+ return rs;
+ }
+}
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -27,8 +27,12 @@
*/
package org.jboss.soa.esb.actions;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.jboss.internal.soa.esb.services.rules.RuleServiceCallHelper;
+import org.jboss.internal.soa.esb.services.rules.RuleServiceException;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
@@ -36,16 +40,50 @@
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
+/**
+ * BusinessRulesProcessor extends {@link ContentBasedRouter} but does not perform any routing, it only
+ * executes the business rules.
+ * <p/>
+ *
+ * Configuration Example:
+ *<pre>{@code
+ *
+ *<action class="org.jboss.soa.esb.actions.BusinessRulesProcessor" name="YourCBRName">
+ * <property name="ruleSet" value="OrderDiscountOnMultipleOrders.drl" />
+ * <property name="ruleReload" value="false" />
+ * <property name="stateful" value="true" />
+ * <property name="object-paths">
+ * <object-path esb="body.TheOrderHeader" />
+ * <object-path esb="body.TheCustomer" />
+ * </property>
+ *</action>
+ *
+ * As this class extends {@link ContentBasedRouter} please see its javadoc for
+ * configuration descriptions that are common to both classes.
+ *
+ * Property description:
+ * <lu>
+ * <li> <i> class </i> action class, org.jboss.soa.esb.actions.BusinessRulesProcessor
+ * <li> <i> stateful </i> Optional property which tells the RuleService to use a stateful session where facts will be remembered between invokations.
+ * </lu>
+ * </br>
+ *
+ *
+ * @author John Doe
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
public class BusinessRulesProcessor extends ContentBasedRouter
{
+ private ConfigTree configTree;
+
public BusinessRulesProcessor(ConfigTree config) throws ConfigurationException, RegistryException, MessageRouterException
{
super(config);
+ this.configTree = config;
}
/**
* Inspect the content of the message using a rule set
- * Router the message to one or more destinations, using the ContentBasedRouter to figure out
- * to which destinations it is going to be routed too.
*
* @param message
* @return Message
@@ -53,16 +91,34 @@
*/
public Message process(Message message) throws ActionProcessingException
{
- try {
+ try
+ {
List<Object> objectList = _mapper.createObjectList(message, _messagePathList);
- _cbr.route(_ruleSet, _ruleLanguage, _ruleReload, message, objectList);
- } catch (ObjectMappingException ome) {
- throw new ActionProcessingException(ome.getMessage(), ome);
- } catch (MessageRouterException mre) {
- throw new ActionProcessingException(mre.getMessage(), mre);
+ message = executeRulesService( message, objectList );
+ }
+ catch (final ObjectMappingException e)
+ {
+ throw new ActionProcessingException( e.getMessage(), e);
+ }
+ catch (final RuleServiceException e)
+ {
+ throw new ActionProcessingException( e.getMessage(), e);
}
return message;
}
+
+ /**
+ *
+ * @param message
+ * @param objectList
+ * @throws RuleServiceException
+ * @throws MessageRouterException
+ */
+ Message executeRulesService( final Message message, final List<Object> objectList) throws RuleServiceException
+ {
+ Map<String,Object> globals = new HashMap<String,Object>();
+ globals.put( "message", message );
+ return RuleServiceCallHelper.executeRulesService( _ruleSet, _ruleLanguage, _ruleReload, message, objectList, globals, configTree ) ;
+ }
-
}
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedRouter.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedRouter.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedRouter.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -28,10 +28,16 @@
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
/**
- * The CBR action that drives the CBR implementation dynamically.
+ * ContentBasedRouter implements the Content Based Routing pattern.
+ * It routes a message to one or more destination services based on the message content
+ * and the rule set it is evaluating it against.
+ * <p/>
+ * For configuration details see
*
* @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
* @author kstam at jboss.com
+ *
+ * @see ContentBasedWiretap
*
*/
public class ContentBasedRouter extends ContentBasedWiretap
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -44,10 +44,56 @@
import org.jboss.soa.esb.services.routing.cbr.ContentBasedRouterFactory;
/**
- * @author <a
- * href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * ContentBasedWirtap implements the WireTap pattern.
+ * The WireTap is an Enterprise Integration Pattern (EIP) where a copy of the message is
+ * sent to a control channel.
+ * <br>
+ * The CBRWT is identical in functionality to the ContentBasedRouter,
+ * however it does not terminate the pipeline which makes it suitable to be used as a WireTap.
+ * <p/>
+ *
+ * Configuration Example:
+ *<pre>{@code
+ *
+ *<action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="OrderDiscountBasedOnCustomerHistory">
+ * <property name="ruleSet" value="OrderDiscountOnMultipleOrders.drl" />
+ * <property name="ruleReload" value="false" />
+ * <property name="stateful" value="true" />
+ * <property name="object-paths">
+ * <object-path esb="body.TheOrderHeader" />
+ * <object-path esb="body.TheCustomer" />
+ * </property>
+ * <property name="destinations">
+ * <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />
+ * <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />
+ * <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />
+ * </property>
+ *</action>
+ *
+ * }</pre>
+ * Property description:
+ * <lu>
+ * <li> <i>class</i> action class, one of : org.jboss.soa.esb.actions.ContentBasedRouter, org.jboss.soa.esb.actions.ContentBasedWireTap,<br>
+ * or org.jboss.soa.esb.actions.MessageFilter
+ * <li> <i>ruleSet</i> Name of the filename containing the Drools ruleSet.
+ * <li> <i>ruleLanguage</i> Optional reference to a file containing the definition of a Domain Specific Language to be used for evaluating
+ * the rule set.
+ * <li> <i>ruleReload</i> Optional property which can be to true to enable 'hot' redeployment of rule sets.
+ * <li> <i>stateful</i> Optional property which tells the RuleService to use a stateful session where facts will be
+ * remembered between invokations.
+ * <li> <i>object-paths</i> Optional property to pass Message objects into Rule Services WorkingMemory.
+ * <li> <i>destinations</i> A set of route-to properties each containing the logical name
+ * of the destination along with the Service category and name
+ * as referenced in the registry.<br> The logical name is the name
+ * which should be used in the rule set.
+ * </lu>
+ * </br>
+ *
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
* @author kstam at jboss.com
* @author kevin.conner at jboss.com
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
*/
public class ContentBasedWiretap extends AbstractActionPipelineProcessor {
@@ -157,25 +203,19 @@
* @throws ConfigurationException
*/
protected void checkMyParms() throws ConfigurationException {
- if (_config.getAttribute(ListenerTagNames.RULE_SET_TAG) == null) {
- _logger.error("Required attribute " + ListenerTagNames.RULE_SET_TAG
- + " not found in " + _config.getName() + ".");
+ _ruleSet = _config.getAttribute(ListenerTagNames.RULE_SET_TAG);
+ /* now longer a required attribute
+ if (_ruleSet == null) {
throw new ConfigurationException("Required attribute "
+ ListenerTagNames.RULE_SET_TAG + " not found.");
- } else {
- _ruleSet = _config.getAttribute(ListenerTagNames.RULE_SET_TAG);
- if (_ruleSet == null) {
- throw new ConfigurationException("Required attribute "
- + ListenerTagNames.RULE_SET_TAG + " not found.");
- }
- _ruleLanguage = _config
- .getAttribute(ListenerTagNames.RULE_LANGUAGE_TAG);
- String ruleReload = _config
- .getAttribute(ListenerTagNames.RULE_RELOAD_TAG);
- if (ruleReload != null && "true".equals(ruleReload)) {
- _ruleReload = true;
- }
}
+ */
+ _ruleLanguage = _config.getAttribute(ListenerTagNames.RULE_LANGUAGE_TAG);
+ String ruleReload = _config.getAttribute(ListenerTagNames.RULE_RELOAD_TAG);
+ if (ruleReload != null && "true".equals(ruleReload)) {
+ _ruleReload = true;
+ }
+
if (_config.getAttribute(ListenerTagNames.CBR_CLASS) != null) {
_cbrClass = _config.getAttribute(ListenerTagNames.CBR_CLASS);
} else {
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services)
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules)
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,250 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.services.rules;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.internal.soa.esb.services.rules.RuleServiceException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-
-import org.jboss.soa.esb.message.Message;
-
-/**
- * RulesEngine Interface. Separates implementation from the runtime, allowing
- * the ESB to support different implementations of rule engines.
- *
- * @author jdelong at redhat.com
- *
- */
-public interface RuleService {
-
- public void setConfigTree(ConfigTree configTree);
-
- /**
- * Execute rules using a certain ruleSet and domain specific language using the Stateless rule engine API
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param dsl -
- * String reference to a file which contains a custom rule
- * language definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRules(
- String ruleSet,
- String dsl,
- boolean ruleReload,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Execute rules from a decision table using the Stateless rule engine API
- *
- * @param decisionTable -
- * String reference to a file which contains a spreadsheet of rules
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRulesFromDecisionTable(
- String decisionTable,
- boolean ruleReload,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
- * using the Stateless rule engine API
- *
- * @param ruleAgentProperties -
- * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatelessRulesFromRuleAgent(
- String ruleAgentProperties,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Execute rules using a certain ruleSet and domain specific language using the Stateful rule engine API
- *
- * @param ruleSet -
- * String reference to a file which contains a ruleSet.
- * @param dsl -
- * String reference to a file which contains a custom rule
- * language definition
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param dispose -
- * if set to true, working memory will be disposed after the rules are fired
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRules(
- String ruleSet,
- String dsl,
- boolean ruleReload,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Execute rules from a decision table using the Stateful rule engine API
- *
- * @param decisionTable -
- * String reference to a file which contains a spreadsheet of rules
- * @param ruleReload -
- * if set to true, a ruleSet update should result in reloading
- * the ruleSet.
- * @param dispose -
- * if set to true, working memory will be disposed after the rules are fired
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRulesFromDecisionTable(
- String decisionTable,
- boolean ruleReload,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
- * using the Stateful rule engine API
- *
- * @param ruleAgentProperties -
- * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
- * @param dispose -
- * if set to true, working memory will be disposed after the rules are fired
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message)t o be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message executeStatefulRulesFromRuleAgent(
- String ruleAgentProperties,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Continue executing rules where the working memory already exists.
- *
- * @param rules -
- * String reference to a file, either the drl file, the decision table,
- * or the ruleAgentProperties. This is used to find the ruleBase.
- * @param dispose -
- * if set to true, working memory will be disposed after the rules are fired
- * @param message -
- * Message that is updated with the results.
- * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
- * working memory
- *
- * @return Message with updated objects.
- */
- public Message continueStatefulRulesExecution(
- String rules,
- boolean dispose,
- Message message,
- Map<String,Object> globals,
- List<Object> objectList) throws RuleServiceException;
-
- /**
- * Determines whether this RuleService can process file of passed in type.
- *
- * @param fileName - rule file to be processed
- * @return true if this RuleService can process files of the passed in type
- */
- public boolean acceptsDecisionTable( String fileName );
-
- /**
- * Get the supported decision tables suffixes
- *
- * @return List<String> containing all the supported suffixes by this RuleService
- */
- public List<String> getSupportedDecsionTableSuffixes();
-
- /**
- * Determines whether this RuleService can process file of passed in type.
- *
- * @param fileName - rule file to be processed
- * @return true if this RuleService can process files of the passed in type
- */
- public boolean acceptsRuleAgent( String fileName );
-
- /**
- * Get the supported rule agent suffixes
- *
- * @return List<String> containing all the supported suffixes by this RuleService
- */
- public List<String> getSupportedRuleAgentSuffixes();
-
- /**
- * Determines whether this RuleService can process file of passed in type.
- *
- * @param fileName - rule file to be processed
- * @return true if this RuleService can process files of the passed in type
- */
- public boolean acceptsRuleFile( String fileName );
-
- /**
- * Get the supported rule agent suffixes
- *
- * @return List<String> containing all the supported suffixes by this RuleService
- */
- public List<String> getSupportedRuleFileSuffixes();
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,208 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.rules;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.internal.soa.esb.services.rules.RuleServiceException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * RulesEngine Interface. Separates implementation from the runtime, allowing
+ * the ESB to support different implementations of rule engines.
+ *
+ * @author jdelong at redhat.com
+ *
+ */
+public interface RuleService {
+
+ public void setConfigTree(ConfigTree configTree);
+
+ /**
+ * Execute rules using a certain ruleSet and domain specific language using the Stateless rule engine API
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param dsl -
+ * String reference to a file which contains a custom rule
+ * language definition
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRules(
+ String ruleSet,
+ String dsl,
+ boolean ruleReload,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Execute rules from a decision table using the Stateless rule engine API
+ *
+ * @param decisionTable -
+ * String reference to a file which contains a spreadsheet of rules
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRulesFromDecisionTable(
+ String decisionTable,
+ boolean ruleReload,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
+ * using the Stateless rule engine API
+ *
+ * @param ruleAgentProperties -
+ * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatelessRulesFromRuleAgent(
+ String ruleAgentProperties,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Execute rules using a certain ruleSet and domain specific language using the Stateful rule engine API
+ *
+ * @param ruleSet -
+ * String reference to a file which contains a ruleSet.
+ * @param dsl -
+ * String reference to a file which contains a custom rule
+ * language definition
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param dispose -
+ * if set to true, working memory will be disposed after the rules are fired
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRules(
+ String ruleSet,
+ String dsl,
+ boolean ruleReload,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Execute rules from a decision table using the Stateful rule engine API
+ *
+ * @param decisionTable -
+ * String reference to a file which contains a spreadsheet of rules
+ * @param ruleReload -
+ * if set to true, a ruleSet update should result in reloading
+ * the ruleSet.
+ * @param dispose -
+ * if set to true, working memory will be disposed after the rules are fired
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRulesFromDecisionTable(
+ String decisionTable,
+ boolean ruleReload,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Execute rules using a rule package retrieved via the Rule Agent from a URL of local file system
+ * using the Stateful rule engine API
+ *
+ * @param ruleAgentProperties -
+ * String reference to a file which contains properties used by the RuleAgent to locate a rule package.
+ * @param dispose -
+ * if set to true, working memory will be disposed after the rules are fired
+ * @param message -
+ * Message that is updated with the results.
+ * @param objectList - a list with additional objects (typically pulled from the message)t o be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message executeStatefulRulesFromRuleAgent(
+ String ruleAgentProperties,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+ /**
+ * Continue executing rules where the working memory already exists.
+ *
+ * @param rules -
+ * String reference to a file, either the drl file, the decision table,
+ * or the ruleAgentProperties. This is used to find the ruleBase.
+ * @param dispose -
+ * if set to true, working memory will be disposed after the rules are fired
+ * @param message -
+ * Message that is updated with the results.
+ * @param globals -
+ * Map of globals variables that should be set in the working memory
+ * @param objectList - a list with additional objects (typically pulled from the message) to be inserted into
+ * working memory
+ *
+ * @return Message with updated objects.
+ */
+ public Message continueStatefulRulesExecution(
+ String rules,
+ boolean dispose,
+ Message message,
+ Map<String,Object> globals,
+ List<Object> objectList) throws RuleServiceException;
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.services.rules;
-/**
- * This enum contains properties specific for a RuleService.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public enum RuleServicePropertiesNames {
-
- IMPL_CLASS ( "rulsServiceImplClass" ),
- RULE_SET ( "ruleSet" ),
- RULE_LANGUAGE ("ruleLanguage"),
- RULE_RELOAD ( "ruleReload" ),
- DECISION_TABLE ( "decisionTable" ),
- RULE_AGENT_PROPERTIES ( "ruleAgentProperties" ),
- DISPOSE ( "dispose" ),
- CONTINUE ( "continue" ),
- STATEFUL ( "stateful") ;
-
- private final String tagName;
-
- private RuleServicePropertiesNames( final String tagName )
- {
- this.tagName = tagName;
- }
-
- public String getTagName()
- {
- return tagName;
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.services.rules;
+/**
+ * This enum contains properties specific for a RuleService.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public enum RuleServicePropertiesNames {
+
+ IMPL_CLASS ( "rulsServiceImplClass" ),
+ DECISION_TABLE ( "decisionTable" ),
+ RULE_AGENT_PROPERTIES ( "ruleAgentProperties" ),
+ DISPOSE ( "dispose" ),
+ CONTINUE ( "continue" ),
+ STATEFUL ( "stateful") ;
+
+ private final String tagName;
+
+ private RuleServicePropertiesNames( final String tagName )
+ {
+ this.tagName = tagName;
+ }
+
+ public String getTagName()
+ {
+ return tagName;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.internal.soa.esb.services.routing.cbr;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.message.mapping.ObjectMapper;
-import org.jboss.soa.esb.message.mapping.ObjectMappingException;
-import org.jboss.soa.esb.services.routing.MessageRouterException;
-import org.junit.Test;
-
-/**
- *
- * @author kurt.stam at redhat.com
- *
- */
-public class BusinessProcessorRoutingUnitTest
-{
- @Test
- public void discount() throws ObjectMappingException
- {
- //new messages
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- Order order = new Order();
- order.setQuantity(20);
- order.setUnitPrice(new BigDecimal("20.0"));
- message.getBody().add("Order", order);
- //extract the order from the message, so the drl can process it
- List<String> messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- ObjectMapper mapper = new ObjectMapper();
- List<Object> objectList = mapper.createObjectList(message, messagePathList);
- //Now send to the rules engine
- JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
- try {
- List<String> destinations = jbossRulesRouter.route("JBossESBPricingRoutingRules.drl", false, message, objectList);
- assertEquals(order.getDiscount(),10.0);
- assertEquals("10%",message.getBody().get("DiscountObject"));
- String shippingDestination = destinations.iterator().next();
- System.out.println(shippingDestination);
- assertEquals("express-shipping-destination", shippingDestination);
-
- } catch (MessageRouterException mre) {
- System.out.println("Exception was thrown.");
- mre.printStackTrace();
- assertTrue(false);
- }
- }
-
- @Test
- public void nodiscount() throws ObjectMappingException
- {
- //new messages
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- Order order = new Order();
- order.setQuantity(2);
- order.setUnitPrice(new BigDecimal("20.0"));
- message.getBody().add("Order", order);
-// extract the order from the message, so the drl can process it
- List<String> messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- ObjectMapper mapper = new ObjectMapper();
- List<Object> objectList = mapper.createObjectList(message, messagePathList);
- //Now send to the rules engine
- JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
- try {
- List<String> destinations = jbossRulesRouter.route("JBossESBPricingRoutingRules.drl", false, message, objectList);
- assertEquals(order.getDiscount(),0.0);
- assertEquals("0%",message.getBody().get("DiscountObject"));
- String shippingDestination = destinations.iterator().next();
- System.out.println(shippingDestination);
- assertEquals("normal-shipping-destination", shippingDestination);
-
- } catch (MessageRouterException mre) {
- System.out.println("Exception was thrown.");
- mre.printStackTrace();
- assertTrue(false);
- }
- }
-
- public static junit.framework.Test suite() {
- return new JUnit4TestAdapter(BusinessProcessorRoutingUnitTest.class);
- }
-
-}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.internal.soa.esb.services.routing.cbr;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.message.mapping.ObjectMapper;
-import org.jboss.soa.esb.message.mapping.ObjectMappingException;
-import org.jboss.soa.esb.services.routing.MessageRouterException;
-import org.junit.Test;
-
-/**
- *
- * @author kurt.stam at redhat.com
- *
- */
-public class BusinessProcessorUnitTest
-{
- @Test
- public void discount() throws ObjectMappingException
- {
- //new messages
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- Order order = new Order();
- order.setQuantity(20);
- order.setUnitPrice(new BigDecimal("20.0"));
- message.getBody().add("Order", order);
-// extract the order from the message, so the drl can process it
- List<String> messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- ObjectMapper mapper = new ObjectMapper();
- List<Object> objectList = mapper.createObjectList(message, messagePathList);
- //Now send to the rules engine
- JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
- try {
- jbossRulesRouter.route("JBossESBPricingRules.drl", false, message, objectList);
- assertEquals(order.getDiscount(),10.0);
- assertEquals("10%",message.getBody().get("DiscountObject"));
-
- } catch (MessageRouterException mre) {
- System.out.println("Exception was thrown.");
- mre.printStackTrace();
- assertTrue(false);
- }
- }
-
- public static junit.framework.Test suite() {
- return new JUnit4TestAdapter(BusinessProcessorUnitTest.class);
- }
-
-}
Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -22,56 +22,266 @@
package org.jboss.internal.soa.esb.services.routing.cbr;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.ArrayList;
import java.util.List;
import junit.framework.JUnit4TestAdapter;
+import org.jboss.soa.esb.actions.CBRConfigTreeBuilder;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
import org.jboss.soa.esb.services.routing.MessageRouterException;
+import org.jboss.soa.esb.services.routing.cbr.ContentBasedRouterFactory;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
+ * Tests for {@link JBossRulesRouter}.
*
* @author kurt.stam at redhat.com
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
*
*/
public class JBossRulesRouterUnitTest
{
+ // instance under test
+ private JBossRulesRouter jbrRouter;
+
@Test
- public void routeSerializedMessage()
+ public void routeSerializedMessage() throws MessageRouterException
{
+ Message message = createMessage( MessageType.JAVA_SERIALIZED );
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route("JBossESBRules.drl",false,message,null);
+ assertNotNull(destinationServices);
+ assertTrue(destinationServices.size()>0);
+ assertEquals(destinationServices.iterator().next(),"serialized-destination");
+ }
+
+ @Test
+ public void routeSerializedMessageDecisionTableStateless() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JAVA_SERIALIZED );
+
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).decisionTable( "RuleBaseHelper.xls").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route( null, false, message, null);
+
+ assertNotNull( destinationServices );
+ assertTrue( "One destination should have been added by Drools", destinationServices.size() == 1 );
+ assertEquals( "serialized-destination", destinationServices.get(0).toString() );
+ }
+
+ @Test
+ public void routeSerializedMessageDecisionTableStateful() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JAVA_SERIALIZED );
+
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).decisionTable( "RuleBaseHelper.xls").stateful( true ).build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route( null, false, message, null);
+
+ assertNotNull( destinationServices );
+ assertTrue( "One destination should have been added by Drools", destinationServices.size() == 1 );
+ assertEquals( "serialized-destination", destinationServices.get(0).toString() );
+ }
+
+ @Test
+ public void routeXMLMessage() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JBOSS_XML);
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+ List<String> destinationServices = jbrRouter.route("JBossESBRules.drl",false,message,null);
+ assertEquals(destinationServices.iterator().next(),"xml-destination");
+ }
+
+ @Test
+ public void routeXMLMessageUsingXPathMatch() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JBOSS_XML);
+ message.getBody().add(("<jbossesb>TEST BODY</jbossesb>").getBytes());
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
+ assertEquals(destinationServices.iterator().next(),"XML_XPath_Destination");
+ }
+
+ @Test
+ public void routeXMLMessageUsingXPathEquals() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JBOSS_XML );
+ message.getBody().add(("<Dave>rocks</Dave>").getBytes());
+
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
+ assertEquals(destinationServices.iterator().next(),"XML_XPath_Dave_Destination");
+ }
+
+ @Test
+ public void routeXMLMessageUsingXPathGreaterThen() throws MessageRouterException
+ {
+ Message message = createMessage( MessageType.JBOSS_XML );
+ message.getBody().add(("<price>1.55</price>").getBytes());
+
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
+ assertEquals(destinationServices.iterator().next(),"XML_XPath_GreaterThan_Destination");
+ }
+
+ @Test
+ public void routeXMLMessageUsingXPathLessThen()
+ {
+ try {
+ //add new messages
+ Message message = MessageFactory.getInstance().getMessage( MessageType.JBOSS_XML );
+ //set the body inside the Message
+ message.getBody().add(("<price>0.55</price>").getBytes());
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ List<String> destinationServices = jbrRouter.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
+ assertEquals(destinationServices.iterator().next(),"XML_XPath_LessThan_Destination");
+ } catch (MessageRouterException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test ( expected = MessageRouterException.class )
+ public void shouldThrowIfNoRuleSetIsSupplied() throws MessageRouterException
+ {
+ //add new messages
+ Message message = MessageFactory.getInstance().getMessage( MessageType.JBOSS_XML );
+ ConfigTree configTree = new ConfigTree("bad-config");
+ jbrRouter.setConfigTree( configTree );
+
+ jbrRouter.route( null ,"XPathLanguage.dsl",false,message,null);
+ }
+
+ @Test ( expected = MessageRouterException.class )
+ public void shouldThrowIfRuleServiceImplIsInvalid() throws MessageRouterException
+ {
+ //add new messages
+ Message message = MessageFactory.getInstance().getMessage( MessageType.JBOSS_XML );
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleServiceImpl( "bad.Class" ).ruleFile( "JBossESBRules.drl").build();
+ jbrRouter.setConfigTree( configTree );
+
+ jbrRouter.route( null, "XPathLanguage.dsl", false, message, null);
+ }
+
+ // Moved into this class from BusinessProcessRoutingUnitTest
+ // as that class also used JBossRulesRouter as you can see below
+ @Test
+ public void discount() throws ObjectMappingException
+ {
//new messages
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- //set some properties inside the Message
- message.getProperties().setProperty("prop1", "val1");
- message.getProperties().setProperty("prop2", "val2");
- //set the body inside the Message
- message.getBody().add(("TEST BODY").getBytes());
- //set some object attachments inside the Message
- message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
- message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
-
+ Message message = createMessage( MessageType.JAVA_SERIALIZED );
+ Order order = new Order();
+ order.setQuantity(20);
+ order.setUnitPrice(new BigDecimal("20.0"));
+ message.getBody().add("Order", order);
+ //extract the order from the message, so the drl can process it
+ List<String> messagePathList = new ArrayList<String>();
+ messagePathList.add("body.Order");
+ ObjectMapper mapper = new ObjectMapper();
+ List<Object> objectList = mapper.createObjectList(message, messagePathList);
+ //Now send to the rules engine
JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRoutingRules.drl").build();
+ jbossRulesRouter.setConfigTree( configTree );
try {
- List<String> destinationServices = jbossRulesRouter.route("JBossESBRules.drl", false, message, null);
- assertEquals(destinationServices.iterator().next(),"serialized-destination");
- System.out.println(message.getBody().get());
+ List<String> destinations = jbossRulesRouter.route("JBossESBPricingRoutingRules.drl", false, message, objectList);
+ assertEquals(order.getDiscount(),10.0);
+ assertEquals("10%",message.getBody().get("DiscountObject"));
+ String shippingDestination = destinations.iterator().next();
+ System.out.println(shippingDestination);
+ assertEquals("express-shipping-destination", shippingDestination);
+
} catch (MessageRouterException mre) {
System.out.println("Exception was thrown.");
mre.printStackTrace();
assertTrue(false);
}
}
+
+ // Moved into this class from BusinessProcessRoutingUnitTest
+ // as that class also used JBossRulesRouter as you can see befinal low
+ @Test
+ public void nodiscount() throws ObjectMappingException
+ {
+ //new messages
+ Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ Order order = new Order();
+ order.setQuantity(2);
+ order.setUnitPrice(new BigDecimal("20.0"));
+ message.getBody().add("Order", order);
+// extract the order from the message, so the drl can process it
+ List<String> messagePathList = new ArrayList<String>();
+ messagePathList.add("body.Order");
+ ObjectMapper mapper = new ObjectMapper();
+ List<Object> objectList = mapper.createObjectList(message, messagePathList);
+ //Now send to the rules engine
+ JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRoutingRules.drl").build();
+ jbossRulesRouter.setConfigTree( configTree );
+ try {
+ List<String> destinations = jbossRulesRouter.route("JBossESBPricingRoutingRules.drl", false, message, objectList);
+ assertEquals(order.getDiscount(),0.0);
+ assertEquals("0%",message.getBody().get("DiscountObject"));
+ String shippingDestination = destinations.iterator().next();
+ System.out.println(shippingDestination);
+ assertEquals("normal-shipping-destination", shippingDestination);
+
+ } catch (MessageRouterException mre) {
+ System.out.println("Exception was thrown.");
+ mre.printStackTrace();
+ assertTrue(false);
+ }
+ }
- @Test
- public void routeXMLMessage()
+ @Before
+ public void setup() throws MessageRouterException
{
- //add new messages
- Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ jbrRouter = (JBossRulesRouter) ContentBasedRouterFactory.getRouter(org.jboss.soa.esb.actions.ContentBasedRouter.DEFAULT_CBR_CLASS);
+ jbrRouter.setConfigTree( new ConfigTree("dummy" ));
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests() throws Exception
+ {
+ try {
+ TestEnvironmentUtil.setESBPropertiesFileToUse();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't any config properties");
+ assertTrue(false);
+ }
+ }
+
+ private Message createMessage( final URI type )
+ {
+ //new messages
+ Message message = MessageFactory.getInstance().getMessage( type );
//set some properties inside the Message
message.getProperties().setProperty("prop1", "val1");
message.getProperties().setProperty("prop2", "val2");
@@ -80,16 +290,7 @@
//set some object attachments inside the Message
message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
-
- JBossRulesRouter jbossRulesRouter = new JBossRulesRouter();
- try {
- List<String> destinationServices = jbossRulesRouter.route("JBossESBRules.drl", false, message, null);
- assertEquals(destinationServices.iterator().next(),"xml-destination");
- } catch (MessageRouterException mre) {
- System.out.println("Exception was thrown.");
- mre.printStackTrace();
- assertTrue(false);
- }
+ return message;
}
public static junit.framework.Test suite() {
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules)
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of individual
- * contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-package org.jboss.internal.soa.esb.services.rules;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.drools.RuleBase;
-import org.drools.compiler.DroolsParserException;
-import org.junit.Test;
-
-/**
- * Unit test for {@link DroolsRuleBaseHelper}
- * <p/>
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class DroolsRuleBaseHelperUnitTest
-{
- // instance under test
- private DroolsRuleBaseHelper helper = DroolsRuleBaseHelper.getInstance();
-
- // rule file shared by multiple tests methods
- private final static String RULE_FILE = "RuleBaseHelper.drl";
-
- // decision table file shared by multiple test methods
- private final static String DECISION_TABLE_FILE = "RuleBaseHelper.xls";
-
- private final static String NULL_DSL_FILE = null;
- private final static String NULL_RULE_FILE = null;
- private final static String NULL_DECISION_TABLE_FILE = null;
-
- @Test ( expected = NullPointerException.class )
- public void shouldThrowIfRuleFileIsNull() throws DroolsParserException, IOException, RuleServiceException
- {
- helper.createRuleBaseFromRuleFiles( NULL_RULE_FILE, NULL_DSL_FILE );
- }
-
- @Test
- public void createRuleBaseFromRuleFiles() throws DroolsParserException, IOException, RuleServiceException
- {
- RuleBase ruleBase = helper.createRuleBaseFromRuleFiles( RULE_FILE, NULL_DSL_FILE );
-
- assertNotNull( ruleBase );
- assertTrue( ruleBase.getPackages().length > 0 );
- assertEquals( "org.jboss.internal.soa.esb.rules" , ruleBase.getPackages()[0].getName());
- }
-
- @Test ( expected = NullPointerException.class )
- public void shouldThrowIfDecisionTableIsNull() throws DroolsParserException, IOException, RuleServiceException
- {
- helper.createRuleBaseFromDecisionTable( NULL_DECISION_TABLE_FILE );
- }
-
- @Test
- public void createRuleBaseFromDecisionTable() throws DroolsParserException, IOException, RuleServiceException
- {
- RuleBase ruleBase = helper.createRuleBaseFromDecisionTable( DECISION_TABLE_FILE );
- assertNotNull( ruleBase );
- assertEquals( "org.jboss.internal.soa.esb.rules", ruleBase.getPackages()[0].getName());
- }
-
- @Test ( expected = NullPointerException.class )
- public void getRuleAsStringShouldThrowIfRuleFileIsNull() throws IOException, RuleServiceException
- {
- String rulesAsString = helper.getRulesAsString( NULL_RULE_FILE, NULL_DSL_FILE );
- assertNotNull( rulesAsString );
- }
-
- @Test
- public void getRuleFileAsString() throws IOException, RuleServiceException
- {
- String rulesAsString = helper.getRulesAsString( RULE_FILE, NULL_DSL_FILE );
- assertNotNull( rulesAsString );
- }
-
- @Test
- public void getSpreadSheetRules() throws IOException, RuleServiceException
- {
- String spreadSheetAsString = helper.getSpreadsheetRules( DECISION_TABLE_FILE );
- assertNotNull( spreadSheetAsString );
- }
-
- @Test
- public void loadRuleBaseFromRuleAgent() throws Exception
- {
- RuleBase ruleBase = helper.loadRuleBaseFromRuleAgent( "RuleBaseHelper.properties" );
- assertNotNull( ruleBase );
- assertEquals( "org.jboss.internal.soa.esb.rules", ruleBase.getPackages()[0].getName());
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( DroolsRuleBaseHelperUnitTest.class );
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.internal.soa.esb.services.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.io.IOException;
+
+import junit.framework.JUnit4TestAdapter;
+import org.drools.RuleBase;
+import org.drools.compiler.DroolsParserException;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link DroolsRuleBaseHelper}
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class DroolsRuleBaseHelperUnitTest
+{
+ // instance under test
+ private DroolsRuleBaseHelper helper = DroolsRuleBaseHelper.getInstance();
+
+ private final static String NULL_DSL_FILE = null;
+ private final static String NULL_RULE_FILE = null;
+ private final static String NULL_DECISION_TABLE_FILE = null;
+
+ @Test ( expected = NullPointerException.class )
+ public void shouldThrowIfRuleFileIsNull() throws DroolsParserException, IOException, RuleServiceException
+ {
+ helper.createRuleBaseFromRuleFiles( NULL_RULE_FILE, NULL_DSL_FILE );
+ }
+
+ @Test
+ public void createRuleBaseFromRuleFiles() throws DroolsParserException, IOException, RuleServiceException
+ {
+ RuleBase ruleBase = helper.createRuleBaseFromRuleFiles( "RuleBaseHelper.drl", NULL_DSL_FILE );
+
+ assertNotNull( ruleBase );
+ assertTrue( ruleBase.getPackages().length > 0 );
+ assertEquals( "org.jboss.internal.soa.esb.rules" , ruleBase.getPackages()[0].getName());
+ }
+
+ @Test ( expected = NullPointerException.class )
+ public void shouldThrowIfDecisionTableIsNull() throws DroolsParserException, IOException, RuleServiceException
+ {
+ helper.createRuleBaseFromDecisionTable( NULL_DECISION_TABLE_FILE );
+ }
+
+ @Test
+ public void createRuleBaseFromDecisionTable() throws DroolsParserException, IOException, RuleServiceException
+ {
+ RuleBase ruleBase = helper.createRuleBaseFromDecisionTable( "RuleBaseHelper.xls" );
+ assertNotNull( ruleBase );
+ assertEquals( "org.jboss.internal.soa.esb.rules", ruleBase.getPackages()[0].getName());
+ }
+
+ @Test ( expected = NullPointerException.class )
+ public void getRuleAsStringShouldThrowIfRuleFileIsNull() throws IOException, RuleServiceException
+ {
+ String rulesAsString = helper.getRulesAsString( NULL_RULE_FILE, NULL_DSL_FILE );
+ assertNotNull( rulesAsString );
+ }
+
+ @Test
+ public void getRuleFileAsString() throws IOException, RuleServiceException
+ {
+ String rulesAsString = helper.getRulesAsString( "RuleBaseHelper.drl", NULL_DSL_FILE );
+ assertNotNull( rulesAsString );
+ }
+
+ @Test
+ public void getSpreadSheetRules() throws IOException, RuleServiceException
+ {
+ String spreadSheetAsString = helper.getSpreadsheetRules( "RuleBaseHelper.xls" );
+ assertNotNull( spreadSheetAsString );
+ }
+
+ /*
+ This test is currently disabled as the file property that exists in RuleBaseHelper.properties
+ accesses a file on the local file system. This causes problems with the integration build as
+ the working dir is not the same and when run from eclipse or ant in this modules directory.
+ The issue here could be fixed by using the dir property in base-build.xml, but that caused
+ the other modules to fail. Leaving this for now as v5.0 will clean this up./Daniel
+ @Test
+ */
+ public void loadRuleBaseFromRuleAgent() throws Exception
+ {
+ RuleBase ruleBase = helper.loadRuleBaseFromRuleAgent( "RuleBaseHelper.properties" );
+ assertNotNull( ruleBase );
+ assertEquals( "org.jboss.internal.soa.esb.rules", ruleBase.getPackages()[0].getName());
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( DroolsRuleBaseHelperUnitTest.class );
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,271 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.services.rules;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.drools.RuleBase;
-import org.jboss.internal.soa.esb.services.routing.cbr.Order;
-import org.jboss.soa.esb.actions.Counter;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.message.mapping.ObjectMapper;
-import org.jboss.soa.esb.message.mapping.ObjectMappingException;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Unit test for {@link DroolsRuleService}
- * <p/>
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class DroolsRuleServiceUnitTest
-{
- private static final String DRL_FILE = "JBossESBRules.drl";
-
- private static final String DESTINATIONS = "destinations";
-
- private DroolsRuleService ruleService = new DroolsRuleService();
-
- private RuleBase ruleBase;
- private Message message;
-
- private Order order;
-
- private ArrayList<String> messagePathList;
-
- @Test
- public void executeStatefulRules() throws RuleServiceException
- {
- Map<String,Object> globals = getGlobalsWithDestAndMessage();
- message = ruleService.executeStatefulRules( ruleBase, true, message , globals, null );
- ArrayList<String> destinations = getDistinations( globals );
- assertTrue( destinations.size() == 1 );
- }
-
- @Test
- public void executeStatefulRulesDrl() throws RuleServiceException
- {
- Map<String,Object> globals = getGlobalsWithDestAndMessage();
- message = ruleService.executeStatefulRules( DRL_FILE, null, true, message, globals, null );
- ArrayList<String> destinations = getDistinations( globals );
- assertTrue( destinations.size() == 1 );
- }
-
- @Test
- public void executeStatelessRules()
- {
- Map<String,Object> globals = getGlobalsWithDestAndMessage();
- message = ruleService.executeStatelessRules( ruleBase, message , globals, null );
- ArrayList<String> destinations = getDistinations( globals );
- assertTrue( destinations.size() == 1 );
- }
-
- @Test
- public void executeStatefulRulesContinueSession() throws RuleServiceException, ObjectMappingException
- {
- Message message = createMessageWithOrder( order );
- Map<String,Object> globals = getGlobalsWithMessage( message );
- ArrayList<String> messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- messagePathList.add("body.Counter");
-
- List<Object> objectList = new ObjectMapper().createObjectList(message, messagePathList);
-
- // process message
- message = ruleService.executeStatefulRules( "JBossESBPricingRulesStateful.drl", null, true, message, globals, objectList );
- assertEquals( 20.0, order.getDiscount() );
- assertEquals( "20%" ,message.getBody().get("DiscountObject"));
-
- // process message again with a counter instance
- objectList = new ObjectMapper().createObjectList(message, messagePathList);
- //message = ruleService.executeStatefulRules( "JBossESBPricingRulesStateful.drl", null, false, false, message, globals, objectList );
- message = ruleService.continueStatefulRulesExecution( "JBossESBPricingRulesStateful.drl", true, message, globals, objectList );
-
- Counter counter = (Counter) message.getBody().get("Counter");
- System.out.println(counter.getCounter());
-
- assertEquals( 2 , counter.getCounter() );
-
- }
-
- @Test
- public void executeStatefulRulesFromRuleAgent() throws RuleServiceException
- {
- Map<String,Object> globals = getGlobalsWithDest();
-
- message = ruleService.executeStatefulRulesFromRuleAgent( "RuleBaseHelper.properties", message , globals, null );
-
- ArrayList<String> destinations = getDistinations( globals );
- assertTrue( destinations.size() == 1 );
-
- // execute a second time. This should reuse the same session
- message = ruleService.executeStatefulRules( ruleBase, true, message , globals, null );
- assertTrue( "Should have added a second destination to the existing global", destinations.size() == 2 );
- }
-
- @Test
- public void getSupportedDecsionTableSuffixes()
- {
- List<String> suffixes = ruleService.getSupportedDecsionTableSuffixes();
- assertNotNull ( suffixes );
- assertEquals ( 2 , suffixes.size() );
- try
- {
- suffixes.add( ".xxx" );
- }
- catch (Exception e )
- {
- assertTrue( e instanceof UnsupportedOperationException );
- }
- }
-
- @Test
- public void getSupportedRuleAgentSuffixes()
- {
- List<String> suffixes = ruleService.getSupportedRuleAgentSuffixes();
- assertNotNull ( suffixes );
- assertEquals ( 1 , suffixes.size() );
- try
- {
- suffixes.add( ".xxx" );
- }
- catch (Exception e )
- {
- assertTrue( e instanceof UnsupportedOperationException );
- }
- }
-
- @Test
- public void getSupportedRuleFileSuffixes()
- {
- List<String> suffixes = ruleService.getSupportedRuleFileSuffixes();
- assertNotNull ( suffixes );
- assertEquals ( 1 , suffixes.size() );
- try
- {
- suffixes.add( ".xxx" );
- }
- catch (Exception e )
- {
- assertTrue( e instanceof UnsupportedOperationException );
- }
- }
-
- @Test
- public void acceptsDecisionTable( )
- {
- assertTrue ( ruleService.acceptsDecisionTable( "Helper.xls" ) );
- assertTrue ( ruleService.acceptsDecisionTable( "Helper.csv" ) );
- assertFalse ( ruleService.acceptsDecisionTable( "Helper.cvs" ) );
- }
-
- @Test
- public void acceptsRuleAgentTable( )
- {
- assertTrue ( ruleService.acceptsRuleAgent( "Helper.properties" ) );
- assertFalse ( ruleService.acceptsRuleAgent( "Helper.csv" ) );
- }
-
- @Test
- public void acceptsRuleFileTable( )
- {
- assertTrue ( ruleService.acceptsRuleFile( "Helper.drl" ) );
- assertFalse ( ruleService.acceptsRuleFile( "Helper.csv" ) );
- }
-
- // Test setup methods
-
- @Before
- public void setup() throws RuleServiceException
- {
- ruleBase = ruleService.getRuleBaseForFileBasedRules( DRL_FILE, null, true );
- message = MessageFactory.getInstance().getMessage();
-
- order = new Order();
- order.setQuantity(20);
- order.setUnitPrice( new BigDecimal("20.0") );
-
- messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- messagePathList.add("body.Counter");
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( DroolsRuleServiceUnitTest.class );
- }
-
- // private methods
-
- @SuppressWarnings("unchecked")
- private ArrayList<String> getDistinations( final Map<String,Object> globals )
- {
- return (ArrayList<String>) globals.get( DESTINATIONS );
- }
-
- private Map<String,Object> getGlobalsWithDestAndMessage()
- {
- Map<String,Object> globals = new HashMap<String,Object>();
- ArrayList<String> destinations = new ArrayList<String>();
- globals.put(DESTINATIONS, destinations );
- globals.put("message", message );
- return globals;
- }
-
- private Map<String,Object> getGlobalsWithDest()
- {
- Map<String,Object> globals = new HashMap<String,Object>();
- ArrayList<String> destinations = new ArrayList<String>();
- globals.put(DESTINATIONS, destinations );
- return globals;
- }
-
- private Map<String,Object> getGlobalsWithMessage( final Message message )
- {
- Map<String,Object> globals = new HashMap<String,Object>();
- globals.put("message", message );
- return globals;
- }
-
- private Message createMessageWithOrder( final Order order )
- {
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add("Order", order);
- return message;
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.internal.soa.esb.services.rules;
+
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import junit.framework.JUnit4TestAdapter;
+import org.drools.RuleBase;
+import org.drools.agent.RuleAgent;
+import org.jboss.internal.soa.esb.services.routing.cbr.Order;
+import org.jboss.soa.esb.actions.Counter;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link DroolsRuleService}
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class DroolsRuleServiceUnitTest
+{
+ private DroolsRuleService ruleService = new DroolsRuleService();
+
+ private RuleBase ruleBase;
+ private Message message;
+
+ private Order order;
+
+ private ArrayList<String> messagePathList;
+
+ @Test
+ public void executeStatelessRules()
+ {
+ Map<String,Object> globals = getGlobalsWithDestAndMessage();
+ message = ruleService.executeStatelessRules( ruleBase, message , globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatelessRulesFromDecisionTableReload() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+ final String decisionTable = "RuleBaseHelper.xls";
+ message = ruleService.executeStatelessRulesFromDecisionTable( decisionTable, true, message, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatelessRulesFromDecisionTable() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+ final String decisionTable = "RuleBaseHelper.xls";
+ message = ruleService.executeStatelessRulesFromDecisionTable( decisionTable, false, message, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatfulRulesFromDecisionTableReload() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+ final String decisionTable = "RuleBaseHelper.xls";
+ message = ruleService.executeStatefulRulesFromDecisionTable( decisionTable, true, message, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatfulRulesFromDecisionTable() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+ final String decisionTable = "RuleBaseHelper.xls";
+ message = ruleService.executeStatefulRulesFromDecisionTable( decisionTable, false, message, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatefulRules() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDestAndMessage();
+ message = ruleService.executeStatefulRules( ruleBase, true, message , globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatefulRulesDrl() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDestAndMessage();
+ message = ruleService.executeStatefulRules( "JBossESBRules.drl", null, true, message, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+ }
+
+ @Test
+ public void executeStatefulRulesContinueSession() throws RuleServiceException, ObjectMappingException
+ {
+ Message message = createMessageWithOrder( order );
+ Map<String,Object> globals = getGlobalsWithMessage( message );
+ ArrayList<String> messagePathList = new ArrayList<String>();
+ messagePathList.add("body.Order");
+ messagePathList.add("body.Counter");
+
+ List<Object> objectList = new ObjectMapper().createObjectList(message, messagePathList);
+
+ // process message
+ message = ruleService.executeStatefulRules( "JBossESBPricingRulesStateful.drl", null, true, message, globals, objectList );
+ assertEquals( 20.0, order.getDiscount() );
+ assertEquals( "20%" ,message.getBody().get("DiscountObject"));
+
+ // process message again with a counter instance
+ objectList = new ObjectMapper().createObjectList(message, messagePathList);
+ message = ruleService.continueStatefulRulesExecution( "JBossESBPricingRulesStateful.drl", true, message, globals, objectList );
+
+ Counter counter = (Counter) message.getBody().get("Counter");
+
+ assertEquals( 2 , counter.getCounter() );
+ }
+
+ /*
+ This test is currently disabled as the file property that exists in RuleBaseHelper.properties
+ accesses a file on the local file system. This causes problems with the integration build as
+ the working dir is not the same and when run from eclipse or ant in this modules directory.
+ The issue here could be fixed by using the dir property in base-build.xml, but that caused
+ the other modules to fail. Leaving this for now as v5.0 will clean this up./Daniel
+ @Test
+ */
+ public void executeStatefulRulesFromRuleAgent() throws RuleServiceException
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+
+ message = ruleService.executeStatefulRulesFromRuleAgent( "RuleBaseHelper.properties", message , globals, null );
+
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+
+ message = ruleService.executeStatefulRules( ruleBase, true, message , globals, null );
+ assertTrue( destinations.size() == 2 );
+ }
+
+ /*
+ Commented out for the same reason as the previous test.
+ @Test
+ */
+ public void executeStatefulRulesCheckCached() throws RuleServiceException, LifecycleResourceException
+ {
+ ruleService.getCachedRuleBases().clear();
+ final String ruleAgentProperites = "RuleBaseHelper.properties";
+ Map<String,Object> globals = getGlobalsWithDest();
+ ruleService.executeStatefulRulesFromRuleAgent( ruleAgentProperites, message , globals, null );
+
+ Map<String, RuleAgent> ruleAgents = ruleService.getCachedRuleAgents();
+ assertEquals( 1, ruleAgents.size() );
+ RuleAgent ruleAgent = ruleAgents.get( ruleAgentProperites );
+ assertNotNull( ruleAgent );
+
+ RuleBase rBase = ruleAgent.getRuleBase();
+ assertEquals ( rBase, ruleService.getCachedRuleBases().get( ruleAgentProperites ) );
+
+ for ( int i = 0 ; i < 10 ; i++ )
+ ruleService.executeStatefulRulesFromRuleAgent( ruleAgentProperites, message , globals, null );
+
+ assertEquals( 1, ruleAgents.size() );
+ assertEquals( 1, ruleService.getCachedRuleBases().size() );
+ assertEquals ( rBase, ruleService.getCachedRuleBases().get( ruleAgentProperites ) );
+ }
+
+
+ // Test setup methods
+
+ @Before
+ public void setup() throws RuleServiceException
+ {
+ ruleBase = ruleService.getRuleBaseForFileBasedRules( "JBossESBRules.drl", null, true );
+ message = MessageFactory.getInstance().getMessage();
+
+ order = new Order();
+ order.setQuantity(20);
+ order.setUnitPrice( new BigDecimal("20.0") );
+
+ messagePathList = new ArrayList<String>();
+ messagePathList.add("body.Order");
+ messagePathList.add("body.Counter");
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( DroolsRuleServiceUnitTest.class );
+ }
+
+ // private methods
+
+ @SuppressWarnings("unchecked")
+ private ArrayList<String> getDistinations( final Map<String,Object> globals )
+ {
+ return (ArrayList<String>) globals.get( "destinations" );
+ }
+
+ private Map<String,Object> getGlobalsWithDestAndMessage()
+ {
+ Map<String,Object> globals = getGlobalsWithDest();
+ globals.putAll( getGlobalsWithMessage( message ));
+ return globals;
+ }
+
+ private Map<String,Object> getGlobalsWithDest()
+ {
+ Map<String,Object> globals = new HashMap<String,Object>();
+ ArrayList<String> destinations = new ArrayList<String>();
+ globals.put("destinations", destinations );
+ return globals;
+ }
+
+ private Map<String,Object> getGlobalsWithMessage( final Message message )
+ {
+ Map<String,Object> globals = new HashMap<String,Object>();
+ globals.put("message", message );
+ return globals;
+ }
+
+ private Message createMessageWithOrder( final Order order )
+ {
+ Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add("Order", order);
+ return message;
+ }
+}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions)
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions;
-
-import static org.junit.Assert.assertEquals;
-
-import java.math.BigDecimal;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.internal.soa.esb.services.routing.cbr.Order;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.message.mapping.ObjectMappingException;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.routing.MessageRouterException;
-import org.jboss.soa.esb.services.rules.RuleServicePropertiesNames;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class BusinessRulesProcessorUnitTest
-{
- private Order order;
- private ArrayList<String> messagePathList;
-
- @Test
- public void processDiscount() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
- {
- Message message = createMessageWithOrder( order );
- ConfigTree configTree = new CBRConfigTreeBuilder( "JBossESBPricingRulesStateful.drl", "true" ).messagePaths(messagePathList).build();
- BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
-
- processor.process( message );
-
- assertEquals( 20.0, order.getDiscount() );
- assertEquals( "20%" ,message.getBody().get("DiscountObject"));
- }
-
- @Test
- public void processDiscountStateful() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
- {
- Message message = createMessageWithOrder( order );
- ConfigTree configTree = new CBRConfigTreeBuilder( "JBossESBPricingRulesStateful.drl", "true" ).messagePaths(messagePathList).stateful( true ).build();
- BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
-
- // process message
- processor.process( message );
- assertEquals( 20.0, order.getDiscount() );
- assertEquals( "20%" ,message.getBody().get("DiscountObject"));
-
- // now dispose after this call
- message.getProperties().setProperty( RuleServicePropertiesNames.DISPOSE.getTagName(), Boolean.TRUE );
- message.getProperties().setProperty( RuleServicePropertiesNames.CONTINUE.getTagName(), Boolean.TRUE );
- processor.process( message );
-
- // counter is inserted into the working memory by the first rules execution
- // from the above process call.
- Counter counter = (Counter) message.getBody().get("Counter");
- assertEquals( 2 , counter.getCounter() );
- }
-
- @Test ( expected = ActionProcessingException.class )
- public void shouldThrowIfDisposePropertyIsNotSet() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
- {
- Message message = createMessageWithOrder( order );
- ConfigTree configTree = new CBRConfigTreeBuilder( "JBossESBPricingRulesStateful.drl", "true" ).messagePaths(messagePathList).stateful( true ).build();
- BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
-
- // process message
- processor.process( message );
- assertEquals( 20.0, order.getDiscount() );
- assertEquals( "20%" ,message.getBody().get("DiscountObject"));
-
- // We don't set 'dispose' which should cause an exception to be thrown...
- message.getProperties().setProperty( RuleServicePropertiesNames.CONTINUE.getTagName(), Boolean.TRUE );
- processor.process( message );
- }
-
- @Test ( expected = ActionProcessingException.class )
- public void throwIfFileTypeIsNotValid() throws ActionProcessingException, ConfigurationException, RegistryException, MessageRouterException
- {
- Message message = createMessageWithOrder( order );
- ConfigTree configTree = new CBRConfigTreeBuilder( "test.bla", "true" ).messagePaths(messagePathList).build();
- BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
-
- processor.process( message );
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(BusinessRulesProcessorUnitTest.class);
- }
-
- @Before
- public void setup()
- {
- order = new Order();
- order.setQuantity(20);
- order.setUnitPrice( new BigDecimal("20.0") );
-
- messagePathList = new ArrayList<String>();
- messagePathList.add("body.Order");
- messagePathList.add("body.Counter");
- }
-
- @BeforeClass
- public static void setupMockRegistry() throws URISyntaxException
- {
- MockRegistry.install();
- }
-
- private Message createMessageWithOrder( final Order order )
- {
- Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add("Order", order);
- return message;
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions;
+
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigDecimal;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.internal.soa.esb.services.routing.cbr.Order;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.routing.MessageRouterException;
+import org.jboss.soa.esb.services.rules.RuleServicePropertiesNames;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link BusinessRulesProcessor}
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class BusinessRulesProcessorUnitTest
+{
+ private Order order;
+ private ArrayList<String> messagePathList;
+
+ @Test
+ public void processDiscount() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
+ {
+ Message message = createMessageWithOrder( order );
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRulesStateful.drl" ).messagePaths(messagePathList).build();
+ BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
+
+ processor.process( message );
+
+ assertEquals( 20.0, order.getDiscount() );
+ assertEquals( "20%" ,message.getBody().get("DiscountObject"));
+ }
+
+ @Test
+ public void processDiscountStateful() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
+ {
+ Message message = createMessageWithOrder( order );
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRulesStateful.drl" ).stateful( true ).messagePaths(messagePathList).build();
+ BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
+
+ // process message
+ processor.process( message );
+ assertEquals( 20.0, order.getDiscount() );
+ assertEquals( "20%" ,message.getBody().get("DiscountObject"));
+
+ // now dispose after this call
+ message.getProperties().setProperty( RuleServicePropertiesNames.DISPOSE.getTagName(), Boolean.TRUE );
+ message.getProperties().setProperty( RuleServicePropertiesNames.CONTINUE.getTagName(), Boolean.TRUE );
+ processor.process( message );
+
+ // counter is inserted into the working memory by the first rules execution
+ // from the above process call.
+ Counter counter = (Counter) message.getBody().get("Counter");
+ assertEquals( 2 , counter.getCounter() );
+ }
+
+ @Test ( expected = ActionProcessingException.class )
+ public void shouldThrowIfDisposePropertyIsNotSet() throws ObjectMappingException, ConfigurationException, RegistryException, MessageRouterException, ActionProcessingException
+ {
+ Message message = createMessageWithOrder( order );
+ ConfigTree configTree = new CBRConfigTreeBuilder( true ).ruleFile( "JBossESBPricingRulesStateful.drl" ).messagePaths(messagePathList).stateful( true ).build();
+ BusinessRulesProcessor processor = new BusinessRulesProcessor( configTree );
+
+ // process message
+ processor.process( message );
+ assertEquals( 20.0, order.getDiscount() );
+ assertEquals( "20%" ,message.getBody().get("DiscountObject"));
+
+ // We don't set 'dispose' which should cause an exception to be thrown...
+ message.getProperties().setProperty( RuleServicePropertiesNames.CONTINUE.getTagName(), Boolean.TRUE );
+ processor.process( message );
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(BusinessRulesProcessorUnitTest.class);
+ }
+
+ @Before
+ public void setup()
+ {
+ order = new Order();
+ order.setQuantity(20);
+ order.setUnitPrice( new BigDecimal("20.0") );
+
+ messagePathList = new ArrayList<String>();
+ messagePathList.add("body.Order");
+ messagePathList.add("body.Counter");
+ }
+
+ @BeforeClass
+ public static void setupMockRegistry() throws URISyntaxException
+ {
+ MockRegistry.install();
+ }
+
+ private Message createMessageWithOrder( final Order order )
+ {
+ Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add("Order", order);
+ return message;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of individual
- * contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions;
-
-import java.util.List;
-
-import org.jboss.soa.esb.actions.ContentBasedWiretap;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.services.rules.RuleServicePropertiesNames;
-
-/**
- * Builder for CBR ConfigTree instances.
- * </p>
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public class CBRConfigTreeBuilder
-{
- // mandatory
- private String ruleFile;
- private String reload;
-
- // optional
- private List<String> messagePathList;
- private boolean stateful;
-
-
- public CBRConfigTreeBuilder( final String ruleFile, final String reload )
- {
- this.ruleFile = ruleFile;
- this.reload = reload;
- }
-
- public CBRConfigTreeBuilder messagePaths( List<String> messagePathList )
- {
- this.messagePathList = messagePathList;
- return this;
- }
-
- public CBRConfigTreeBuilder stateful( final boolean stateful )
- {
- this.stateful = stateful;
- return this;
- }
-
- public ConfigTree build()
- {
- ConfigTree configTree = new ConfigTree("cbr-config");
- configTree.setAttribute( ListenerTagNames.RULE_SET_TAG, ruleFile );
- configTree.setAttribute( ListenerTagNames.RULE_RELOAD_TAG, reload );
-
- if ( messagePathList != null )
- {
- for (String messagePath : messagePathList)
- {
- ConfigTree objectPath = new ConfigTree( ContentBasedWiretap.OBJECT_PATH_TAG, configTree );
- objectPath.setAttribute( ContentBasedWiretap.OBJECT_PATH, messagePath );
- }
- }
- if ( stateful )
- configTree.setAttribute( RuleServicePropertiesNames.STATEFUL.getTagName(), Boolean.toString( stateful ) );
-
- return configTree;
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions;
+
+import java.util.List;
+
+import org.jboss.soa.esb.actions.ContentBasedWiretap;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.services.rules.RuleServicePropertiesNames;
+
+/**
+ * Builder for CBR ConfigTree instances.
+ * </p>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class CBRConfigTreeBuilder
+{
+ // mandatory
+ private boolean reload;
+
+ // optional
+ private String ruleFile;
+ private List<String> messagePathList;
+ private boolean stateful;
+ private String decisionTable;
+ private String ruleAgent;
+ private String ruleServiceImpl;
+
+
+ public CBRConfigTreeBuilder( final boolean reload )
+ {
+ this.reload = reload;
+ }
+
+ public CBRConfigTreeBuilder ruleFile( final String ruleFile )
+ {
+ this.ruleFile = ruleFile;
+ return this;
+ }
+
+ public CBRConfigTreeBuilder decisionTable( final String decisionTable )
+ {
+ this.decisionTable = decisionTable;
+ return this;
+ }
+
+ public CBRConfigTreeBuilder ruleAgent( final String ruleAgent )
+ {
+ this.ruleAgent = ruleAgent;
+ return this;
+ }
+
+ public CBRConfigTreeBuilder messagePaths( List<String> messagePathList )
+ {
+ this.messagePathList = messagePathList;
+ return this;
+ }
+
+ public CBRConfigTreeBuilder ruleServiceImpl( String ruleServiceImpl )
+ {
+ this.ruleServiceImpl = ruleServiceImpl;
+ return this;
+ }
+
+ public CBRConfigTreeBuilder stateful( final boolean stateful )
+ {
+ this.stateful = stateful;
+ return this;
+ }
+
+ public ConfigTree build()
+ {
+ ConfigTree configTree = new ConfigTree("cbr-config");
+
+ configTree.setAttribute( ListenerTagNames.RULE_RELOAD_TAG, Boolean.toString( reload ) );
+
+ if ( ruleFile != null )
+ configTree.setAttribute( ListenerTagNames.RULE_SET_TAG, ruleFile );
+ else if ( decisionTable != null )
+ configTree.setAttribute( RuleServicePropertiesNames.DECISION_TABLE.getTagName(), decisionTable );
+ else if ( ruleAgent != null )
+ configTree.setAttribute( RuleServicePropertiesNames.RULE_AGENT_PROPERTIES.getTagName(), ruleAgent );
+ else
+ throw new IllegalStateException("One of ruleFile, decisionTable or ruleAgent must be set");
+
+
+ if ( messagePathList != null )
+ {
+ for (String messagePath : messagePathList)
+ {
+ ConfigTree objectPath = new ConfigTree( ContentBasedWiretap.OBJECT_PATH_TAG, configTree );
+ objectPath.setAttribute( ContentBasedWiretap.OBJECT_PATH, messagePath );
+ }
+ }
+
+ if ( stateful )
+ configTree.setAttribute( RuleServicePropertiesNames.STATEFUL.getTagName(), Boolean.toString( stateful ) );
+
+ if ( ruleServiceImpl != null )
+ configTree.setAttribute( RuleServicePropertiesNames.IMPL_CLASS.getTagName(), ruleServiceImpl );
+
+ return configTree;
+ }
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.ContentBasedRouter;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class ContentBasedRouterUnitTest
-{
- static Logger _logger = Logger.getLogger(ContentBasedRouterUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ContentBasedRouterUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", ContentBasedRouterUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- ContentBasedRouter cbr = new ContentBasedRouter(actions[2]);
- cbr.process(message);
- //no destination matches, expecting error, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- assertTrue(true);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.ContentBasedRouter;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class ContentBasedRouterUnitTest
+{
+ static Logger _logger = Logger.getLogger(ContentBasedRouterUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ContentBasedRouterUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", ContentBasedRouterUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ ContentBasedRouter cbr = new ContentBasedRouter(actions[2]);
+ cbr.process(message);
+ //no destination matches, expecting error, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.ContentBasedWiretap;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class ContentBasedWiretapUnitTest
-{
- static Logger _logger = Logger.getLogger(ContentBasedWiretapUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ContentBasedWiretapUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedWiretapUnitTest.xml", ContentBasedWiretapUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, no message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNotNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- ContentBasedWiretap cbr = new ContentBasedWiretap(actions[2]);
- cbr.process(message);
- //no destination matches, expecting error, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- assertTrue(true);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.ContentBasedWiretap;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class ContentBasedWiretapUnitTest
+{
+ static Logger _logger = Logger.getLogger(ContentBasedWiretapUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ContentBasedWiretapUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedWiretapUnitTest.xml", ContentBasedWiretapUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, no message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNotNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ ContentBasedWiretap cbr = new ContentBasedWiretap(actions[2]);
+ cbr.process(message);
+ //no destination matches, expecting error, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.ContentBasedWiretap" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,25 +0,0 @@
-package org.jboss.soa.esb.actions;
-
-import java.io.Serializable;
-
-public class Counter implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- int counter;
-
- public Counter() {}
- public Counter(int counter) { this.counter = counter; }
-
- public int getCounter()
- {
- return counter;
- }
- public void setCounter( int counter )
- {
- this.counter = counter;
- }
-
-
-
-}
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,25 @@
+package org.jboss.soa.esb.actions;
+
+import java.io.Serializable;
+
+public class Counter implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ int counter;
+
+ public Counter() {}
+ public Counter(int counter) { this.counter = counter; }
+
+ public int getCounter()
+ {
+ return counter;
+ }
+ public void setCounter( int counter )
+ {
+ this.counter = counter;
+ }
+
+
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.MockCourier;
-import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
-import org.jboss.internal.soa.esb.services.registry.MockRegistry;
-import org.jboss.soa.esb.actions.MessageFilter;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the jBPM command interpreter class
- *
- * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
- */
-
-
-public class MessageFilterUnitTest
-{
- static Logger _logger = Logger.getLogger(MessageFilterUnitTest.class);
- static Message message = null;
-
- private static EPR epr1;
- private static EPR epr2;
- private static EPR epr3;
- private static MockCourier courier1;
- private static MockCourier courier2;
- private static MockCourier courier3;
-
- private static ConfigTree[] actions;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(MessageFilterUnitTest.class);
- }
-
-
- @BeforeClass
- public static void before() throws Exception {
- MockCourierFactory.install();
- MockRegistry.install();
-
- epr1 = new EPR(new URI("test1"));
- epr2 = new EPR(new URI("test2"));
- epr3 = new EPR(new URI("DLS"));
- courier1 = new MockCourier(true);
- courier2 = new MockCourier(true);
- courier3 = new MockCourier(true);
-
- MockRegistry.register("test", "java", epr1, courier1);
- MockRegistry.register("test", "xml", epr2, courier2);
- MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
-
- message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
- message.getBody().add(("Hello CBR"));
-
- InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", MessageFilterUnitTest.class);
- String xml = FileUtil.readStream(in);
- actions = ConfigTree.fromXml(xml).getChildren("action");
- }
-
- @Test
- public void wrongDestinationName()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[0]);
- cbr.process(message);
- //the config is wrong so we should error here, and try to send the message to the DLS
- assertTrue(false);
- } catch (Exception e) {
- /* As it can't send the message to the DLS the log should say:
- ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
- ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
- */
- assertTrue(true);
- }
- }
-
- @Test
- public void correctDestinationName()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[1]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-
- @Test
- public void noDestinationMatches()
- {
- try {
- MessageFilter cbr = new MessageFilter(actions[2]);
- Message returnMessage = cbr.process(message);
- //the cbr should return a null message, message should be filtered with no errors.
- assertNull(returnMessage);
- } catch (Exception e) {
- assertTrue(false);
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.actions.MessageFilter;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the jBPM command interpreter class
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ */
+
+
+public class MessageFilterUnitTest
+{
+ static Logger _logger = Logger.getLogger(MessageFilterUnitTest.class);
+ static Message message = null;
+
+ private static EPR epr1;
+ private static EPR epr2;
+ private static EPR epr3;
+ private static MockCourier courier1;
+ private static MockCourier courier2;
+ private static MockCourier courier3;
+
+ private static ConfigTree[] actions;
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(MessageFilterUnitTest.class);
+ }
+
+
+ @BeforeClass
+ public static void before() throws Exception {
+ MockCourierFactory.install();
+ MockRegistry.install();
+
+ epr1 = new EPR(new URI("test1"));
+ epr2 = new EPR(new URI("test2"));
+ epr3 = new EPR(new URI("DLS"));
+ courier1 = new MockCourier(true);
+ courier2 = new MockCourier(true);
+ courier3 = new MockCourier(true);
+
+ MockRegistry.register("test", "java", epr1, courier1);
+ MockRegistry.register("test", "xml", epr2, courier2);
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, epr3, courier3);
+
+ message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
+ message.getBody().add(("Hello CBR"));
+
+ InputStream in = ClassUtil.getResourceAsStream("ContentBasedRouterUnitTest.xml", MessageFilterUnitTest.class);
+ String xml = FileUtil.readStream(in);
+ actions = ConfigTree.fromXml(xml).getChildren("action");
+ }
+
+ @Test
+ public void wrongDestinationName()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[0]);
+ cbr.process(message);
+ //the config is wrong so we should error here, and try to send the message to the DLS
+ assertTrue(false);
+ } catch (Exception e) {
+ /* As it can't send the message to the DLS the log should say:
+ ERROR [main][ContentBasedWiretap] Destination serialized-destination does not exist your configuration
+ ERROR [main][ContentBasedWiretap] No rule destination(s) were matched, [serialized, xml]. Please fix your configuration and/or routing rules.
+ */
+ assertTrue(true);
+ }
+ }
+
+ @Test
+ public void correctDestinationName()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[1]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void noDestinationMatches()
+ {
+ try {
+ MessageFilter cbr = new MessageFilter(actions[2]);
+ Message returnMessage = cbr.process(message);
+ //the cbr should return a null message, message should be filtered with no errors.
+ assertNull(returnMessage);
+ } catch (Exception e) {
+ assertTrue(false);
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-06-18 09:44:52 UTC (rev 20575)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -1,23 +0,0 @@
-<testActions>
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="WrongDestinion"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized" service-category="test" service-name="java" />
- <route-to destination-name="xml" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="Correct"
- ruleSet="JBossESBRules.drl"
- >
- <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
- <action class="org.jboss.soa.esb.actions.MessageFilter" name="MyType"
- ruleSet="JBossESBRulesNoMatch.drl"
- >
- <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
- <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
- </action>
-
-</testActions>
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,23 @@
+<testActions>
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="WrongDestinion"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized" service-category="test" service-name="java" />
+ <route-to destination-name="xml" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="Correct"
+ ruleSet="JBossESBRules.drl"
+ >
+ <route-to destination-name="serialized-destination" service-category="test" service-name="java" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="MyType"
+ ruleSet="JBossESBRulesNoMatch.drl"
+ >
+ <route-to destination-name="mytype-destination" service-category="test" service-name="mytype" />
+ <route-to destination-name="xml-destination" service-category="test" service-name="xml" />
+ </action>
+
+</testActions>
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,46 @@
+package com.jboss.soa.esb.routing.cbr
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.internal.soa.esb.services.routing.cbr.Order;
+import org.jboss.soa.esb.actions.Counter;
+
+global Message message;
+
+rule "Pricing Rule - low quantity"
+
+ when
+ m : Message ()
+ order : Order( quantity < 10)
+ then
+ #System.out.println("low volume");
+ order.setDiscount(0);
+ m.getBody().add("DiscountObject","0%");
+end
+
+rule "Prioriting Rule - high quantity"
+ when
+ m : Message ()
+ order : Order( quantity >= 10)
+ Order( discount == 0 )
+ not Counter()
+ then
+ System.out.println("high volume");
+ order.setDiscount( 20 );
+ insert( new Counter(1) );
+ m.getBody().add("DiscountObject","20%");
+end
+
+rule "Continue Rule - high quantity"
+ no-loop
+ when
+ $counter : Counter()
+ m : Message ()
+ then
+ System.out.println("Continue high quantity. Int value == " + $counter.getCounter());
+ Integer inc = $counter.getCounter();
+ inc++;
+ $counter.setCounter( inc );
+ m.getBody().add( "Counter", $counter );
+ System.out.println("Continue high quantity. Inc value == " + $counter.getCounter());
+end
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBRules.drl
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBRules.drl 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/resources/JBossESBRules.drl 2008-06-23 11:38:41 UTC (rev 20696)
@@ -7,6 +7,7 @@
#declare any global variables here
global java.util.List destinations;
+global Message message;
rule "Routing Rule - Serialized based message"
@@ -14,7 +15,7 @@
when
Message( type == MessageType.JAVA_SERIALIZED)
then
- System.out.println("Serialized");
+ System.out.println("Message Type : Serialized");
destinations.add("serialized-destination");
end
@@ -24,6 +25,6 @@
when
Message( type == MessageType.JBOSS_XML)
then
- System.out.println("JBoss_XML");
+ System.out.println("MessageType : JBoss_XML");
destinations.add("xml-destination");
end
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.drl (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/resources/RuleBaseHelper.drl)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.drl (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.drl 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,29 @@
+#created on: Oct 30, 2006
+package org.jboss.internal.soa.esb.rules
+
+#list any import classes here.
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+
+#declare any global variables here
+global java.util.List destinations;
+
+
+rule "Routing Rule - Serialized based message"
+
+ when
+ Message( type == MessageType.JAVA_SERIALIZED)
+ then
+ System.out.println("Serialized");
+ destinations.add("serialized-destination");
+
+end
+
+rule "Routing Rule - XML based message"
+
+ when
+ Message( type == MessageType.JBOSS_XML)
+ then
+ System.out.println("JBoss_XML");
+ destinations.add("xml-destination");
+end
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.properties (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/resources/RuleBaseHelper.properties)
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.properties (rev 0)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.properties 2008-06-23 11:38:41 UTC (rev 20696)
@@ -0,0 +1,8 @@
+##
+## RuleAgent configuration file example
+##
+
+newInstance=true
+file=src/test/resources/testrules.pkg
+poll=30
+name=MyConfig
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/RuleBaseHelper.xls (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/resources/RuleBaseHelper.xls)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/resources/log4j.xml 2008-06-23 11:38:03 UTC (rev 20695)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/resources/log4j.xml 2008-06-23 11:38:41 UTC (rev 20696)
@@ -43,18 +43,27 @@
<category name="org.jboss">
<priority value="WARN"/>
</category>
- <category name="org.jboss.soa.esb">
+ <category name="org.jboss.soa.esb.actions">
<priority value="ERROR"/>
</category>
<category name="org.jboss.internal.soa.esb">
<priority value="ERROR"/>
</category>
+ <category name="org.jboss.internal.soa.esb.services.rules">
+ <priority value="ERROR"/>
+ </category>
<category name="org.apache">
<priority value="ERROR"/>
</category>
<category name="org.jboss.soa.esb.services.jbpm">
<priority value="DEBUG"/>
</category>
+
+ <category name="com.jboss.soa.esb.routing.cbr">
+ <priority value="DEBUG"/>
+ </category>
+
+
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
Copied: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/testrules.pkg (from rev 20575, labs/jbossesb/workspace/dbevenius/ruleservice/product/services/jbrules/src/test/resources/testrules.pkg)
===================================================================
(Binary files differ)
More information about the jboss-svn-commits
mailing list