[jboss-svn-commits] JBL Code SVN: r23991 - in labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2: product/docs/services and 89 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 20 10:13:50 EST 2008
Author: kevin.conner at jboss.com
Date: 2008-11-20 10:13:49 -0500 (Thu, 20 Nov 2008)
New Revision: 23991
Added:
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/lib/ext/mvel-1.3.1-java1.4.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractScheduledManagedLifecycle.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJobListener.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerResource.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/AbstractRegistryInterceptor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryInterceptor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JMSRouterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceInvokerCallUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-core-4.0.7.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/stax-api-1.0.1.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/xstream-1.2.2.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelperUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KBNS_message.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KB_message.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.properties
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.xls
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDsl.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDslNS.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/testrules.pkg
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/postgresql.properties
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/mysql/management-ds.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
Removed:
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/lib/ext/mvel14-1.2rc4rv908.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/dvdstore/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-compiler-4.0.2.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-core-4.0.2.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-decisiontables-4.0.2.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-jsr94-4.0.2.jar
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/jbrules/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
Modified:
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build-distr.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/docs/services/Registry.odt
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/docs/services/Registry.pdf
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/conf/jbossesb-properties.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/http/HttpClientFactory.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateGatewayListener.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleState.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/quartz.properties
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistryUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/scheduled-listener-config-configtree.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRules.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRulesDiscount.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyRoutingRules.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/jboss-esb.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/readme.txt
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/smooks-res.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Mapping.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/resources/XPathLanguage.dsl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBRules.drl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/MANAGEMENT-README.txt
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/db.properties
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/hsqldb/management-ds.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/oracle/management-ds.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/build.xml
labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/jbossesb-properties.xml
Log:
Merge 4.2.1 CP4 to SOA branch
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build-distr.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build-distr.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build-distr.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -8,6 +8,7 @@
<property file="${org.jboss.esb.properties}"/>
<property name="build.dir" value="build"/>
+ <property name="aoplib.dir" value="build/aoplib"/>
<property name="lib.ext.dir" value="lib/ext"/>
<property name="services.dir" value="services"/>
<property name="build.lib.dir" value="${build.dir}/jbossesb/lib"/>
@@ -82,6 +83,8 @@
<fileset dir="${installation.files.dir}/jUDDI-registry">
<include name="juddi-ds.xml"/>
</fileset>
+ <!-- We use AOP on scout to get around an issue -->
+ <fileset dir="${build.dir}" includes="rosetta.aop"/>
</copy>
<mkdir dir="${build.dir}/jbossesb.sar/juddi-sql"/>
@@ -95,12 +98,19 @@
<copy todir="${build.dir}/jbossesb.sar/lib">
<fileset dir="${lib.ext.dir}" includes="jbossts-common.jar"/>
<fileset dir="${build.lib.dir}" includes="jbossesb*.jar"/>
+ <!-- We use AOP on scout to get around an issue, use the modified jar for now
+ <fileset dir="${lib.ext.dir}" includes="scout-*.jar"/>
+ -->
<!-- scout -->
- <fileset dir="${lib.ext.dir}" includes="scout-1.0rc1.jar"/>
+ <fileset dir="${aoplib.dir}" includes="scout-*.jar"/>
<!-- xbean for reading/marchalling xml for configuration, and scout -->
<fileset dir="${lib.ext.dir}" includes="xbean.jar,stax-api-1.0.1.jar,xmlpublic.jar"/>
<!-- jUDDI Registry, we're one -->
+ <!-- We use AOP on juddi to get around an issue, use the modified jar for now
<fileset dir="${lib.ext.dir}" includes="juddi-*.jar,juddi-client-*.jar"/>
+ -->
+ <fileset dir="${aoplib.dir}" includes="juddi-*.jar"/>
+ <fileset dir="${lib.ext.dir}" includes="juddi-client*.jar"/>
<!-- smooks for transformation -->
<fileset dir="${lib.ext.dir}"
includes="opencsv-*.jar,ognl-*.jar,groovy-*.jar,commons-lang-2.1.jar,stringtemplate-3.0.jar,antlr-2.7.6.jar"/>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -5,10 +5,13 @@
</description>
<condition property="JDK_VERSION_OK">
+ <or>
<equals arg1="${java.specification.version}" arg2="1.5"/>
+ <equals arg1="${java.specification.version}" arg2="1.6"/>
+ </or>
</condition>
<fail unless="JDK_VERSION_OK"
- message="JBoss ESB requires jdk1.5 to build."/>
+ message="JBoss ESB requires jdk1.5 or jdk1.6 to build."/>
<import file="esb-config.xml"/>
@@ -34,7 +37,7 @@
<property name="org.jboss.esb.internal.jar.dest" location="build/jbossesb/lib"/>
<!-- JBoss ESB version -->
- <property name="version" value="4.2.1CP3"/>
+ <property name="version" value="4.2.1CP4"/>
<property name="esb.server.name" value="jbossesb-server-${version}"/>
<property name="esbserver.dist.dir" value="${org.jboss.esb.internal.dest}/${esb.server.name}"/>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/docs/services/Registry.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/docs/services/Registry.pdf
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -149,9 +149,6 @@
<!-- contracts app -->
<copy file="${org.jboss.esb.dist}/tools/console/console/jboss-esb-console.ear/contract.war" todir="${deploy.dir}" />
- <!-- config-editor app -->
- <copy file="${org.jboss.esb.dist}/tools/configeditor/dist/jbossesb-config-editor.war" todir="${deploy.dir}" />
- <copy file="${org.jboss.esb.dist}/tools/configeditor/resources/action-templates.xml" todir="${conf.dir}" />
<!-- install h2 jar -->
<copy file="${org.jboss.esb.dist.lib}/ext/h2.jar" todir="${server.lib.dir}"/>
@@ -177,7 +174,6 @@
<delete dir="${deploy.dir}/soap.esb" />
<delete dir="${deploy.dir}/soapui-client.sar" />
<delete dir="${deploy.dir}/contract.war" />
- <delete dir="${deploy.dir}/jbossesb-config-editor.war" />
<delete dir="${conf.dir}/action-templates.xml" />
</target>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/conf/jbossesb-properties.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/install/conf/jbossesb-properties.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -45,6 +45,15 @@
<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.LocalTransport"/>
+
+ <!-- specify the interceptors, in order. -->
+ <property name="org.jboss.soa.esb.registry.interceptors"
+ value="org.jboss.internal.soa.esb.services.registry.CachingRegistryInterceptor"/>
+ -->
+
+ <!-- The following properties modify the cache interceptor behaviour -->
+ <property name="org.jboss.soa.esb.registry.cache.maxSize" value="100"/>
+ <property name="org.jboss.soa.esb.registry.cache.validityPeriod" value="600000"/>
</properties>
<properties name="transports" depends="core">
<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/lib/ext/mvel-1.3.1-java1.4.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/lib/ext/mvel-1.3.1-java1.4.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/lib/ext/mvel14-1.2rc4rv908.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,57 +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.registry.aspect;
-
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Aspect used to support CDATA sections from within jUDDI.
- *
- * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
- */
-public class JUDDIAspect
-{
- public Object getText(final MethodInvocation invocation)
- throws Throwable
- {
- final Object[] args = invocation.getArguments() ;
- final Element element = (Element)args[0] ;
- final StringBuffer sb = new StringBuffer();
-
- final NodeList nodeList = element.getChildNodes() ;
- final int numNodes = nodeList.getLength() ;
- for(int count = 0 ; count < numNodes ; count++)
- {
- final Node node = nodeList.item(count) ;
- final short type = node.getNodeType() ;
- if ((type == Element.TEXT_NODE) || (type == Element.CDATA_SECTION_NODE))
- {
- sb.append(node.getNodeValue()) ;
- }
- }
-
- return sb.toString().trim();
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,57 @@
+/*
+ * 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.registry.aspect;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Aspect used to support CDATA sections from within jUDDI.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class JUDDIAspect
+{
+ public Object getText(final MethodInvocation invocation)
+ throws Throwable
+ {
+ final Object[] args = invocation.getArguments() ;
+ final Element element = (Element)args[0] ;
+ final StringBuffer sb = new StringBuffer();
+
+ final NodeList nodeList = element.getChildNodes() ;
+ final int numNodes = nodeList.getLength() ;
+ for(int count = 0 ; count < numNodes ; count++)
+ {
+ final Node node = nodeList.item(count) ;
+ final short type = node.getNodeType() ;
+ if ((type == Element.TEXT_NODE) || (type == Element.CDATA_SECTION_NODE))
+ {
+ sb.append(node.getNodeValue()) ;
+ }
+ }
+
+ return sb.toString().trim();
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,59 +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.registry.aspect;
-
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.infomodel.Service;
-
-import org.apache.ws.scout.registry.BusinessQueryManagerImpl;
-import org.apache.ws.scout.registry.infomodel.ServiceImpl;
-import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
-
-/**
- * Aspect used to prevent scout from loading the complete service
- * graph for the registry just to return a binding.
- *
- * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
- */
-public class ScoutAspect
-{
- public Object getRegistryObject(final MethodCalledByMethodInvocation invocation)
- throws Throwable
- {
- final BusinessQueryManagerImpl bqmImpl = (BusinessQueryManagerImpl)invocation.getCallingObject() ;
- final Object[] args = invocation.getArguments() ;
- final String id = (String)args[0] ;
- final String objectType = (String)args[1] ;
-
- if (LifeCycleManager.SERVICE.equals(objectType))
- {
- final LifeCycleManager lcm = bqmImpl.getRegistryService().getBusinessLifeCycleManager() ;
- final Service service = new ServiceImpl(lcm);
- service.setKey(lcm.createKey(id));
- return service ;
- }
- else
- {
- return invocation.invokeNext() ;
- }
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,59 @@
+/*
+ * 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.registry.aspect;
+
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.infomodel.Service;
+
+import org.apache.ws.scout.registry.BusinessQueryManagerImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
+
+/**
+ * Aspect used to prevent scout from loading the complete service
+ * graph for the registry just to return a binding.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class ScoutAspect
+{
+ public Object getRegistryObject(final MethodCalledByMethodInvocation invocation)
+ throws Throwable
+ {
+ final BusinessQueryManagerImpl bqmImpl = (BusinessQueryManagerImpl)invocation.getCallingObject() ;
+ final Object[] args = invocation.getArguments() ;
+ final String id = (String)args[0] ;
+ final String objectType = (String)args[1] ;
+
+ if (LifeCycleManager.SERVICE.equals(objectType))
+ {
+ final LifeCycleManager lcm = bqmImpl.getRegistryService().getBusinessLifeCycleManager() ;
+ final Service service = new ServiceImpl(lcm);
+ service.setKey(lcm.createKey(id));
+ return service ;
+ }
+ else
+ {
+ return invocation.invokeNext() ;
+ }
+ }
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/resources)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/resources/META-INF)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE aop PUBLIC
- "-//JBoss//DTD JBOSS AOP 1.0//EN"
- "http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
-
-<aop>
- <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect" scope="PER_VM"/>
- <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect" scope="PER_VM"/>
-
- <bind pointcut="withincode(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->findServiceBindings(..)) AND call(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->getRegistryObject(..))">
- <advice name="getRegistryObject" aspect="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect"/>
- </bind>
-
- <bind pointcut="execution(* org.apache.juddi.util.xml.XMLUtils->getText(..))">
- <advice name="getText" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
- </bind>
-</aop>
-
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/aop/resources/META-INF/jboss-aop.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE aop PUBLIC
+ "-//JBoss//DTD JBOSS AOP 1.0//EN"
+ "http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
+
+<aop>
+ <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect" scope="PER_VM"/>
+ <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect" scope="PER_VM"/>
+
+ <bind pointcut="withincode(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->findServiceBindings(..)) AND call(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->getRegistryObject(..))">
+ <advice name="getRegistryObject" aspect="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect"/>
+ </bind>
+
+ <bind pointcut="execution(* org.apache.juddi.util.xml.XMLUtils->getText(..))">
+ <advice name="getText" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
+ </bind>
+</aop>
+
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,12 +4,16 @@
<property name="org.jboss.esb.rosetta.jar.name" value="jbossesb-rosetta"/>
<property name="org.jboss.esb.rosetta.distrib.dir" location="${org.jboss.esb.internal.dest}/jbossesb"/>
<property name="org.jboss.esb.rosetta.classes.dir" location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
+ <property name="org.jboss.esb.rosetta.aop.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-aop"/>
+ <property name="org.jboss.esb.rosetta.aopc.scout.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-scout-aopc"/>
+ <property name="org.jboss.esb.rosetta.aopc.juddi.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-juddi-aopc"/>
<property name="org.jboss.esb.rosetta.src.dir" location="src"/>
<property name="org.jboss.esb.root.dir" location="../"/>
<property name="gendir" location="${org.jboss.esb.internal.dest}/schema-model" />
<property environment="env"/>
-
+ <property name="org.jboss.esb.lib.dir" location="${org.jboss.esb.internal.dest}/lib"/>
+ <property name="org.jboss.esb.aoplib.dir" location="${org.jboss.esb.internal.dest}/aoplib"/>
<property name="org.jboss.esb.ext.lib.dir" location="${org.jboss.esb.root.dir}/lib/ext"/>
<path id="org.jboss.esb.rosetta.base.classpath">
@@ -28,6 +32,9 @@
<mkdir dir="${org.jboss.esb.rosetta.classes.dir}"/>
<mkdir dir="${org.jboss.esb.rosetta.distrib.dir}"/>
<mkdir dir="${org.jboss.esb.rosetta.distrib.dir}/lib"/>
+ <!-- aop dirs -->
+ <mkdir dir="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ <mkdir dir="${org.jboss.esb.aoplib.dir}"/>
</target>
<target name="clean" description="Remove classes directory">
@@ -35,7 +42,7 @@
<delete dir="${org.jboss.esb.rosetta.classes.dir}"/>
</target>
- <target name="org.jboss.esb.rosetta.compile" depends="generate-config-model, org.jboss.esb.rosetta.internal.compile">
+ <target name="org.jboss.esb.rosetta.compile" depends="generate-config-model, org.jboss.esb.rosetta.internal.compile, aop">
<ant inheritAll="true" dir="tests" target="org.jboss.esb.rosetta.tests.compile"/>
</target>
@@ -131,6 +138,50 @@
<property name="coverage.dir" location="${org.jboss.esb.internal.dest}/tests/coverage"/>
+ <path id="aop-classpath">
+ <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="jboss-aop-*.jar, javassist.jar, jbossall-client.jar, xbean.jar"/>
+ <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="trove.jar"/>
+ </path>
+ <target name="aop" depends="aop-jar">
+ <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="aop-classpath"/>
+ <delete dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}" quiet="true"/>
+ <delete dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}" quiet="true"/>
+ <mkdir dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <mkdir dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+
+ <unzip src="${org.jboss.esb.ext.lib.dir}/scout-1.0rc1.jar" dest="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <unzip src="${org.jboss.esb.ext.lib.dir}/juddi-2.0rc5.jar" dest="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+
+ <aopc compilerclasspathref="aop-classpath">
+ <classpath path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <src path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <include name="org/apache/ws/scout/registry/BusinessQueryManagerImpl.class"/>
+ <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
+ <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ </aopc>
+ <aopc compilerclasspathref="aop-classpath">
+ <classpath path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+ <src path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+ <include name="org/apache/juddi/util/xml/XMLUtils.class"/>
+ <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
+ <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ </aopc>
+ <zip destfile="${org.jboss.esb.aoplib.dir}/scout-1.0rc1.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <zip destfile="${org.jboss.esb.aoplib.dir}/juddi-2.0rc5.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+ </target>
+
+ <target name="aop-jar" depends="aop-compile">
+ <jar destfile="${org.jboss.esb.internal.dest}/rosetta.aop">
+ <fileset dir="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ <fileset dir="aop/resources"/>
+ </jar>
+ </target>
+
+ <target name="aop-compile">
+ <javac srcdir="aop/java" destdir="${org.jboss.esb.rosetta.aop.classes.dir}"
+ debug="${org.jboss.esb.debug}" optimize="${org.jboss.esb.optimize}"
+ classpathref="org.jboss.esb.rosetta.base.classpath"/>
+ </target>
</project>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -240,7 +240,7 @@
}
synchronized(this) {
- while (_messageProducer != null) {
+ if (_messageProducer != null) {
try {
for (KeyValuePair kvp : _messageProperties) {
String key = kvp.getKey();
@@ -248,7 +248,11 @@
message.setStringProperty(key, kvp.getValue());
}
}
+ } catch (final JMSException e) {
+ throw new CourierTransportException("Caught exception initialising properties! ",e);
+ }
+ try {
_messageProducer.send(message);
return true;
@@ -256,6 +260,15 @@
catch (JMSException e) {
if (!jmsConnectRetry(e))
throw new CourierTransportException("Caught exception during delivery and could not reconnect! ",e);
+ try {
+ _messageProducer.send(message);
+
+ return true;
+ } catch (final JMSException e2) {
+ throw new CourierTransportException("Caught exception during delivery having successfully recovered! ",e2);
+ } catch (Exception e2) {
+ throw new CourierException(e2);
+ }
}
catch (Exception e) {
throw new CourierException(e);
@@ -421,14 +434,20 @@
javax.jms.Message jmsMessage = null;
synchronized(this) {
- while (null != _messageConsumer) {
+ if (null != _messageConsumer) {
try {
jmsMessage = _messageConsumer.receive(millis);
- break;
}
catch (JMSException e) {
if (!jmsConnectRetry(e))
throw new CourierTransportException("Caught exception during receive and could not reconnect! ",e);
+ try {
+ jmsMessage = _messageConsumer.receive(millis);
+ } catch (JMSException e2) {
+ throw new CourierTransportException("Caught exception during delivery having successfully recovered! ",e2);
+ } catch (Exception e2) {
+ throw new CourierTransportException(e2);
+ }
}
catch (Exception e) {
throw new CourierTransportException(e);
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -29,14 +29,18 @@
import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
import org.jboss.soa.esb.common.TransactionStrategy;
import org.jboss.soa.esb.common.TransactionStrategyException;
-import org.jboss.soa.esb.couriers.*;
+import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierTimeoutException;
+import org.jboss.soa.esb.couriers.CourierTransportException;
+import org.jboss.soa.esb.couriers.FaultMessageException;
import org.jboss.soa.esb.listeners.message.errors.Factory;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.util.Type;
import org.jboss.soa.esb.util.Util;
-import java.io.Reader;
+import java.io.ByteArrayInputStream;
import java.io.Serializable;
+import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Blob;
@@ -57,6 +61,8 @@
protected boolean deleteOnSuccess, deleteOnError;
protected boolean _isReceiver;
+
+ private int messageType = Types.OTHER ;
private JDBCEprDBResourceFactory jdbcFactory;
@@ -95,7 +101,7 @@
throw new CourierException(e);
}
- jdbcFactory = new JDBCEprDBResourceFactory(epr);
+ jdbcFactory = new JDBCEprDBResourceFactory(epr);
}
public void cleanup() {
@@ -138,9 +144,9 @@
boolean transactional = isTransactional();
- Serializable serilaizedMessage;
+ Serializable serializedMessage;
try {
- serilaizedMessage = Util.serialize(message);
+ serializedMessage = Util.serialize(message);
} catch (Exception e) {
throw new CourierTransportException("Unable to serialize ESB Message.", e);
}
@@ -151,7 +157,34 @@
PreparedStatement insertStatement = jdbcFactory.createInsertStatement(connection);
try {
insertStatement.setString(1, msgId);
- insertStatement.setObject(2, serilaizedMessage);
+
+ final int type = getMessageType(connection) ;
+ switch(type)
+ {
+ case Types.BLOB:
+ final byte[] blobData = serializedMessage.toString().getBytes() ;
+ final ByteArrayInputStream bais = new ByteArrayInputStream(blobData) ;
+ insertStatement.setBinaryStream(2, bais, blobData.length) ;
+ break ;
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ final byte[] data = serializedMessage.toString().getBytes() ;
+ insertStatement.setBytes(2, data) ;
+ break ;
+ case Types.CLOB:
+ final String clobData = serializedMessage.toString() ;
+ final StringReader clobReader = new StringReader(clobData) ;
+ insertStatement.setCharacterStream(2, clobReader, clobData.length()) ;
+ break ;
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ insertStatement.setString(2, serializedMessage.toString()) ;
+ break ;
+ default:
+ insertStatement.setObject(2, serializedMessage);
+ }
insertStatement.setString(3, State.Pending.getColumnValue());
insertStatement.setLong(4, System.currentTimeMillis());
@@ -290,8 +323,6 @@
selectUpdateStatement.setString(2, State.Pending.getColumnValue());
ResultSet resultSet = selectUpdateStatement.executeQuery();
- final ResultSetMetaData metaData = resultSet.getMetaData() ;
- final int type = metaData.getColumnType(1) ;
try
{
if (resultSet.next())
@@ -301,19 +332,32 @@
try
{
final Serializable value ;
- if (type == Types.BLOB)
+ final int type = getMessageType(resultSet) ;
+ switch (type)
{
+ case Types.BLOB:
final Blob blob = resultSet.getBlob(1) ;
- value = StreamUtils.readStreamString(blob.getBinaryStream(), "UTF-8");
- }
- else if (type == Types.CLOB)
- {
+ final byte[] blobData = StreamUtils.readStream(blob.getBinaryStream()) ;
+ value = new String(blobData) ;
+ break ;
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ final byte[] binaryData = StreamUtils.readStream(resultSet.getBinaryStream(1)) ;
+ value = new String(binaryData) ;
+ break ;
+ case Types.CLOB:
final Clob clob = resultSet.getClob(1) ;
value = StreamUtils.readReader(clob.getCharacterStream());
- }
- else
- {
+ break ;
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ value = resultSet.getString(1) ;
+ break ;
+ default:
value = (Serializable) resultSet.getObject(1);
+ break ;
}
result = Util.deserialize(value);
}
@@ -425,4 +469,53 @@
}
return transactional;
}
-}
\ No newline at end of file
+
+ private synchronized int getMessageType(final Connection connection)
+ throws SQLException
+ {
+ if (messageType != Types.OTHER)
+ {
+ return messageType ;
+ }
+
+ final PreparedStatement ps = jdbcFactory.createSelect4UpdateStatement(connection) ;
+ try
+ {
+ ps.setString(1, "");
+ ps.setString(2, State.Pending.getColumnValue());
+
+ final ResultSet resultSet = ps.executeQuery();
+ try
+ {
+ return getMessageType(resultSet) ;
+ }
+ finally
+ {
+ try
+ {
+ resultSet.close() ;
+ }
+ catch (final Throwable th) {} // ignore
+ }
+ }
+ finally
+ {
+ try
+ {
+ ps.close() ;
+ }
+ catch (final Throwable th) {} // ignore
+ }
+ }
+
+ private synchronized int getMessageType(final ResultSet resultSet)
+ throws SQLException
+ {
+ if (messageType == Types.OTHER)
+ {
+ final ResultSetMetaData metaData = resultSet.getMetaData() ;
+ messageType = metaData.getColumnType(1) ;
+ }
+ return messageType ;
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -76,16 +76,10 @@
public void setToEpr(EPR toEPR) throws CourierException,
MalformedEPRException
{
- DeliverOnlyCourier old = _deliverCourier;
- try
- {
- _deliverCourier = getDeliverCourier(toEPR);
- _toEPR = toEPR ;
- }
- finally
- {
- CourierUtil.cleanCourier(old) ;
- }
+ CourierUtil.cleanCourier(_deliverCourier) ;
+ _deliverCourier = null ;
+ _deliverCourier = getDeliverCourier(toEPR);
+ _toEPR = toEPR ;
}
/**
@@ -94,15 +88,9 @@
public void setReplyToEpr(EPR replyToEPR) throws CourierException,
MalformedEPRException
{
- PickUpOnlyCourier old = _pickupCourier;
- try
- {
- _pickupCourier = getPickupCourier(replyToEPR);
- }
- finally
- {
- CourierUtil.cleanCourier(old) ;
- }
+ CourierUtil.cleanCourier(_pickupCourier);
+ _pickupCourier = null ;
+ _pickupCourier = getPickupCourier(replyToEPR);
}
private DeliverOnlyCourier getDeliverCourier(EPR toEPR)
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -116,6 +116,26 @@
//boolean isError = isErrorReturn(metadata);
//if(isBinary || isError)
+ if (metadata != null) {
+ Object value = metadata.get("Content-Type");
+ if (value == null) {
+ value = metadata.get("content-type");
+ }
+ if (value != null) {
+ if (value instanceof List) {
+ List valueList = (List) value;
+ if (valueList != null && valueList.size() > 0) {
+ value = valueList.get(0);
+ }
+ }
+ final String contentType = (String)value ;
+ if (contentType.startsWith("multipart/"))
+ {
+ return totalByteArray ;
+ }
+ }
+ }
+
try {
ret = new String(totalByteArray);
}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptor.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptor.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptor.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/CachingRegistryInterceptor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,265 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.collections.map.LRUMap;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.services.registry.AbstractRegistryInterceptor;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+/**
+ * Caching registry interceptor.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class CachingRegistryInterceptor extends AbstractRegistryInterceptor
+{
+ /**
+ * The logger for the registry cache
+ */
+ private static final Logger LOGGER = Logger.getLogger(CachingRegistryInterceptor.class) ;
+
+ /**
+ * The default service cache size.
+ */
+ private static final int DEFAULT_MAX_CACHE_SIZE = 100 ;
+ /**
+ * The default cache validity period.
+ */
+ private static final long DEFAULT_VALIDITY_PERIOD = (10*60*1000L) ;
+
+ /**
+ * The maximum number of services stored in the cache.
+ */
+ private static final int MAX_CACHE_SIZE ;
+ /**
+ * The validity period of the entry.
+ */
+ private static final long VALIDITY_PERIOD ;
+
+ /**
+ * The LRU map for the cached services.
+ */
+ private final LRUMap serviceInfoMap = new LRUMap(MAX_CACHE_SIZE) ;
+
+ public List<String> findAllServices() throws RegistryException
+ {
+ // Do not cache, go direct to the registry
+ return getRegistry().findAllServices() ;
+ }
+
+ public List<String> findServices(final String category)
+ throws RegistryException
+ {
+ // Do not cache, go direct to the registry
+ return getRegistry().findServices(category) ;
+ }
+
+ public EPR findEPR(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final List<EPR> eprs = findEPRs(category, name) ;
+ return eprs.get(0) ;
+ }
+
+ public List<EPR> findEPRs(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final Service service = new Service(category, name) ;
+ return Collections.unmodifiableList(getEPRs(service)) ;
+ }
+
+ public void registerEPR(final String category, final String name,
+ final String serviceDescription, final EPR epr, final String eprDescription)
+ throws RegistryException
+ {
+ final Service service = new Service(category, name) ;
+ synchronized(this)
+ {
+ getRegistry().registerEPR(category, name, serviceDescription, epr, eprDescription) ;
+ final List<EPR> eprs = getCurrentEPRs(service) ;
+ if (eprs != null)
+ {
+ eprs.add(epr) ;
+ }
+ }
+ }
+
+ public void unRegisterEPR(final String category, final String name,
+ final EPR epr) throws RegistryException, ServiceNotFoundException
+ {
+ final Service service = new Service(category, name) ;
+ synchronized(this)
+ {
+ final List<EPR> eprs = getCurrentEPRs(service) ;
+ if ((eprs != null) && eprs.remove(epr) && (eprs.size() == 0))
+ {
+ serviceInfoMap.remove(service) ;
+ if (LOGGER.isInfoEnabled())
+ {
+ LOGGER.debug("Cache removing service " + service) ;
+ }
+ }
+ getRegistry().unRegisterEPR(category, name, epr) ;
+ }
+ }
+
+ public void unRegisterService(final String category, final String name)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final Service service = new Service(category, name) ;
+ synchronized(this)
+ {
+ serviceInfoMap.remove(service) ;
+ if (LOGGER.isInfoEnabled())
+ {
+ LOGGER.debug("Cache removing service " + service) ;
+ }
+ getRegistry().unRegisterService(category, name) ;
+ }
+ }
+
+ private synchronized List<EPR> getEPRs(final Service service)
+ throws RegistryException, ServiceNotFoundException
+ {
+ final List<EPR> eprs = getCurrentEPRs(service) ;
+ if (eprs != null)
+ {
+ return eprs ;
+ }
+ else
+ {
+ final List<EPR> currentEPRs = getRegistry().findEPRs(service.getCategory(), service.getName()) ;
+ final List<EPR> copyEPRs = new ArrayList<EPR>(currentEPRs) ;
+ final ServiceInfo serviceInfo = new ServiceInfo(copyEPRs) ;
+ serviceInfoMap.put(service, serviceInfo) ;
+ if (LOGGER.isInfoEnabled())
+ {
+ LOGGER.debug("Cache reloaded for service " + service) ;
+ }
+ return copyEPRs ;
+ }
+ }
+
+ private synchronized List<EPR> getCurrentEPRs(final Service service)
+ {
+ final ServiceInfo serviceInfo = (ServiceInfo)serviceInfoMap.get(service) ;
+ if (serviceInfo != null)
+ {
+ final boolean infoEnabled = LOGGER.isInfoEnabled() ;
+ if (serviceInfo.isValid())
+ {
+ if (infoEnabled)
+ {
+ LOGGER.debug("Cache hit for service " + service) ;
+ }
+ return serviceInfo.getEPRs() ;
+ }
+ else
+ {
+ if (infoEnabled)
+ {
+ LOGGER.debug("Cache expiry for service " + service) ;
+ }
+ serviceInfoMap.remove(service) ;
+ }
+ }
+ return null ;
+ }
+
+ private static class ServiceInfo
+ {
+ private final long expiryTime ;
+
+ private List<EPR> eprs ;
+
+ private ServiceInfo(final List<EPR> eprs)
+ {
+ this.eprs = eprs ;
+ if (VALIDITY_PERIOD > 0)
+ {
+ expiryTime = System.currentTimeMillis() + VALIDITY_PERIOD ;
+ }
+ else
+ {
+ expiryTime = Long.MAX_VALUE ;
+ }
+ }
+
+ boolean isValid()
+ {
+ return System.currentTimeMillis() < expiryTime ;
+ }
+
+ List<EPR> getEPRs()
+ {
+ return eprs ;
+ }
+ }
+
+ static
+ {
+ final String maxCacheSizeVal = Configuration.getRegistryCacheMaxSize() ;
+ int maxCacheSize = DEFAULT_MAX_CACHE_SIZE ;
+ if (maxCacheSizeVal != null)
+ {
+ try
+ {
+ maxCacheSize = Integer.parseInt(maxCacheSizeVal) ;
+ }
+ catch (final NumberFormatException nfe)
+ {
+ // fallback to default
+ LOGGER.warn("Failed to parse maximum cache size, falling back to default", nfe) ;
+ }
+ }
+
+ final String validityPeriodVal = Configuration.getRegistryCacheValidityPeriod() ;
+ long validityPeriod = DEFAULT_VALIDITY_PERIOD ;
+ if (validityPeriodVal != null)
+ {
+ try
+ {
+ validityPeriod = Long.parseLong(validityPeriodVal) ;
+ }
+ catch (final NumberFormatException nfe)
+ {
+ // fallback to default
+ LOGGER.warn("Failed to parse validity period, falling back to default", nfe) ;
+ }
+ }
+ VALIDITY_PERIOD = validityPeriod ;
+ MAX_CACHE_SIZE = maxCacheSize ;
+
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Registry cache validity period: " + VALIDITY_PERIOD) ;
+ LOGGER.debug("Registry cache maximum size: " + MAX_CACHE_SIZE) ;
+ }
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -50,7 +50,6 @@
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.helpers.NamingContextException;
import org.jboss.soa.esb.helpers.NamingContextPool;
import org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter;
import org.jboss.soa.esb.notification.jms.JMSPropertiesSetter;
@@ -123,10 +122,6 @@
*/
private String queueName;
/**
- * JMS Queue setup.
- */
- private JMSSendQueueSetup queueSetup;
- /**
* Strategy for setting JMSProperties
*/
private JMSPropertiesSetter jmsPropertiesStrategy = new DefaultJMSPropertiesSetter();
@@ -144,6 +139,24 @@
* The time-to-live for messages sent with this router
*/
private long timeToLive = Message.DEFAULT_TIME_TO_LIVE;
+ /**
+ * The pool to use for the jms routing.
+ */
+ private JmsConnectionPool pool ;
+ /**
+ * The jms target destination for routing.
+ */
+ private Destination jmsDestination ;
+ /**
+ * Thread local used for passing JmsSession between methods.
+ * This is to allow modifications without changing the API.
+ */
+ private ThreadLocal<JmsSession> SESSION = new ThreadLocal<JmsSession>() ;
+ /**
+ * The JMS reply to destination.
+ */
+ private String jmsReplyToName ;
+
/**
* Public constructor.
@@ -181,7 +194,16 @@
else if ( securityCredential != null && securityPrincipal == null )
throw new ConfigurationException("'" + SECURITY_CREDITIAL + "' must be accompanied by a '" + SECURITY_PRINCIPAL + "'");
- createQueueSetup(queueName, securityPrincipal, securityCredential);
+ final Properties environment = getEnvironment() ;
+ try {
+ pool = ( securityPrincipal != null ) ?
+ JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", securityPrincipal, securityCredential) :
+ JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory" );
+ } catch (final ConnectionException ce) {
+ throw new ConfigurationException("Unexpected error obtaining JMS connection pool") ;
+ }
+
+ createQueueSetup(queueName, securityPrincipal, securityCredential);
}
/**
@@ -200,59 +222,94 @@
* @see org.jboss.soa.esb.actions.routing.AbstractRouter#route(java.lang.Object)
*/
public void route(Object message) throws ActionProcessingException {
-
- if(!(message instanceof org.jboss.soa.esb.message.Message)) {
- throw new ActionProcessingException("Cannot send Object [" + message.getClass().getName() + "] to destination [" + queueName + "]. Object must be an instance of org.jboss.soa.esb.message.Message) .");
+ final JmsSession jmsSession = getJmsSession() ;
+ try {
+ handleRouting(jmsSession, message) ;
+ } catch (final JMSException jmse) {
+ try {
+ if (jmsSession.getTransacted()) {
+ jmsSession.rollback() ;
+ throw new ActionProcessingException("Unexpected exception routing message", jmse) ;
+ } else {
+ // Try to acquire again
+ final JmsSession newJmsSession = getJmsSession() ;
+ try {
+ handleRouting(newJmsSession, message) ;
+ } finally {
+ pool.closeSession(newJmsSession) ;
+ }
+ }
+ } catch (final JMSException jmse2) {
+ throw new ActionProcessingException("Unexpected exception routing message", jmse) ;
+ }
+ } finally {
+ pool.closeSession(jmsSession) ;
}
+ }
+
+ private void handleRouting(final JmsSession jmsSession, Object message) throws JMSException, ActionProcessingException {
+ SESSION.set(jmsSession) ;
+ try {
+ if(!(message instanceof org.jboss.soa.esb.message.Message)) {
+ throw new ActionProcessingException("Cannot send Object [" + message.getClass().getName() + "] to destination [" + queueName + "]. Object must be an instance of org.jboss.soa.esb.message.Message) .");
+ }
- final org.jboss.soa.esb.message.Message esbMessage = (org.jboss.soa.esb.message.Message)message;
-
- try {
- Message jmsMessage = null;
-
- if ( unwrap ) {
- Object objectFromBody = getPayloadProxy().getPayload(esbMessage);
- jmsMessage = createJMSMessageWithObjectType( objectFromBody );
- }
- else {
- jmsMessage = createObjectMessage(Util.serialize(esbMessage));
- }
-
- setStringProperties(jmsMessage);
- setJMSProperties( esbMessage, jmsMessage );
- send( jmsMessage );
+ final org.jboss.soa.esb.message.Message esbMessage = (org.jboss.soa.esb.message.Message)message;
- } catch(Exception e) {
- StringBuilder sb = new StringBuilder();
- sb.append("Exception while sending message [").append(message).append("] to destination [");
-
- if (queueSetup != null)
- sb.append(queueSetup.queueName).append("].");
- else
- sb.append("null ].");
-
- String errorMessage = sb.toString();
- logger.error(errorMessage, e);
- throw new ActionProcessingException(errorMessage, e);
+ try {
+ Message jmsMessage = null;
+
+ if ( unwrap ) {
+ Object objectFromBody = getPayloadProxy().getPayload(esbMessage);
+ jmsMessage = createJMSMessageWithObjectType( objectFromBody );
+ }
+ else {
+ jmsMessage = createObjectMessage(Util.serialize(esbMessage));
+ }
+
+ setStringProperties(jmsMessage);
+ setJMSProperties( esbMessage, jmsMessage );
+ send( jmsMessage );
+ } catch (JMSException jmse) {
+ throw jmse ;
+ } catch(Exception e) {
+ final String errorMessage = "Exception while sending message [" + message + "] to destination [" + queueName + "]." ;
+ logger.error(errorMessage);
+ throw new ActionProcessingException(errorMessage, e);
+ }
+ } finally {
+ SESSION.set(null) ;
}
}
+ private JmsSession getJmsSession() throws ActionProcessingException {
+ try {
+ return pool.getSession() ;
+ } catch (final ConnectionException ce) {
+ throw new ActionProcessingException("Unexpected ConnectionException acquiring JMS session", ce) ;
+ } catch (NamingException ne) {
+ throw new ActionProcessingException("Unexpected NamingException acquiring JMS session", ne) ;
+ } catch (JMSException jmse) {
+ throw new ActionProcessingException("Unexpected JMSException acquiring JMS session", jmse) ;
+ }
+ }
+
protected Message createJMSMessageWithObjectType( Object objectFromBody ) throws JMSException
{
Message jmsMessage = null;
if(objectFromBody instanceof String) {
- jmsMessage = queueSetup.jmsSession.createTextMessage();
+ jmsMessage = SESSION.get().createTextMessage();
if(logger.isDebugEnabled()) {
- logger.debug("Sending Text message: [" + objectFromBody + "] to destination [" + queueSetup.queueName + "].");
+ logger.debug("Sending Text message: [" + objectFromBody + "] to destination [" + queueName + "].");
}
((TextMessage)jmsMessage).setText((String)objectFromBody);
} else if(objectFromBody instanceof byte[]) {
- jmsMessage = queueSetup.jmsSession.createBytesMessage();
+ jmsMessage = SESSION.get().createBytesMessage();
if(logger.isDebugEnabled()) {
- logger.debug("Sending byte[] message: [" + objectFromBody + "] to destination [" + queueSetup.queueName + "].");
+ logger.debug("Sending byte[] message: [" + objectFromBody + "] to destination [" + queueName + "].");
}
((BytesMessage)jmsMessage).writeBytes((byte[])objectFromBody);
@@ -265,7 +322,22 @@
protected void send( Message jmsMessage ) throws JMSException
{
- queueSetup.jmsProducer.send(jmsMessage);
+ final MessageProducer jmsProducer = SESSION.get().createProducer(jmsDestination) ;
+ try {
+ jmsProducer.setPriority(priority) ;
+ jmsProducer.setDeliveryMode(deliveryMode) ;
+ jmsProducer.setTimeToLive(timeToLive) ;
+
+ // The following seems to be broken but is copied for now. I am not even sure it is ever used.
+ if (jmsReplyToName != null) {
+ final Destination jmsReplyToDestination = SESSION.get().createQueue(jmsReplyToName);
+ jmsMessage.setJMSReplyTo(jmsReplyToDestination);
+ }
+
+ jmsProducer.send(jmsMessage);
+ } finally {
+ jmsProducer.close() ;
+ }
}
/**
@@ -282,10 +354,10 @@
protected Message createObjectMessage(Object message) throws JMSException {
Message jmsMessage;
- jmsMessage = queueSetup.jmsSession.createObjectMessage();
+ jmsMessage = SESSION.get().createObjectMessage();
if(logger.isDebugEnabled()) {
- logger.debug("Sending Object message: [" + message + "] to destination [" + queueSetup.queueName + "].");
+ logger.debug("Sending Object message: [" + message + "] to destination [" + queueName + "].");
}
((ObjectMessage)jmsMessage).setObject((Serializable) message);
return jmsMessage;
@@ -316,117 +388,56 @@
public Serializable getErrorNotification(org.jboss.soa.esb.message.Message message) {
return null;
}
-
- @Override
- protected void finalize() throws Throwable {
- queueSetup.close();
- super.finalize();
- }
void createQueueSetup( final String queueName, final String principal, final String credential ) throws ConfigurationException
{
+ final Properties environment = getEnvironment() ;
try
{
- queueSetup = new JMSSendQueueSetup(queueName,principal,credential);
- queueSetup.setDeliveryMode( deliveryMode );
- queueSetup.setPriority( priority );
- queueSetup.setTimeToLive( timeToLive );
- if ( logger.isDebugEnabled() )
- {
- logger.debug( "JMSRouter DeliveryMode : " + deliveryMode);
- logger.debug( "JMSRouter Priority : " + priority);
- logger.debug( "JMSRouter TimeToLive : " + timeToLive);
- }
- }
- catch (Throwable t)
- {
- throw new ConfigurationException("Failed to configure JMS Queue for routing.", t);
- }
- }
-
- protected void createQueueSetup( String queueName ) throws ConfigurationException
- {
- createQueueSetup(queueName, null, null );
- }
-
- private static class JMSSendQueueSetup {
- JmsSession jmsSession;
- Queue jmsQueue;
- MessageProducer jmsProducer;
- String queueName;
- JmsConnectionPool pool;
- Properties environment;
-
- // TODO: Modify to support topic destinations too
-
- private JMSSendQueueSetup(final String queueName, final String principal, final String credential) throws NamingException, JMSException, ConnectionException, NamingContextException {
- environment = new Properties();
- environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
- environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, Configuration.getJndiServerContextFactory());
- environment.setProperty(Context.URL_PKG_PREFIXES, Configuration.getJndiServerPkgPrefix());
- Context oCtx = NamingContextPool.getNamingContext(environment);
+ final JmsSession jmsSession = pool.getSession();
try {
- pool = ( principal != null ) ?
- JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", principal, credential) :
- JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory" );
-
- this.queueName = queueName;
-
- jmsSession = pool.getSession();
- boolean clean = true ;
+ Context oCtx = NamingContextPool.getNamingContext(environment);
try {
try {
- jmsQueue = (Queue) oCtx.lookup(queueName);
+ jmsDestination = (Queue) oCtx.lookup(queueName);
} catch (NamingException ne) {
try {
oCtx = NamingContextPool.replaceNamingContext(oCtx, environment);
- jmsQueue = (Queue) oCtx.lookup(queueName);
+ jmsDestination = (Queue) oCtx.lookup(queueName);
} catch (NamingException nex) {
//ActiveMQ
- jmsQueue = jmsSession.createQueue(queueName);
+ jmsDestination = jmsSession.createQueue(queueName);
}
}
- jmsProducer = jmsSession.createProducer(jmsQueue);
- clean = false ;
+ final MessageProducer jmsProducer = jmsSession.createProducer(jmsDestination);
+ jmsProducer.close() ;
} finally {
- if (clean) {
- pool.closeSession(jmsSession) ;
- }
+ NamingContextPool.releaseNamingContext(oCtx) ;
}
} finally {
- NamingContextPool.releaseNamingContext(oCtx) ;
+ pool.closeSession(jmsSession) ;
}
- }
-
- public void setDeliveryMode(final int deliveryMode ) throws JMSException
- {
- if ( jmsProducer != null )
- jmsProducer.setDeliveryMode( deliveryMode );
- }
-
- public void setPriority(final int priority ) throws JMSException
- {
- if ( jmsProducer != null )
- jmsProducer.setPriority( priority );
- }
-
- public void setTimeToLive(final long ttl ) throws JMSException
- {
- if ( jmsProducer != null )
- jmsProducer.setTimeToLive( ttl );
- }
-
- private void close() {
- try {
- pool.closeSession(jmsSession);
- if (jmsProducer!=null) {
- jmsProducer.close();
- }
- } catch (Exception e) {
- logger.error("Unable to close JMS Queue Setup.", e);
- }
- }
+ }
+ catch (Throwable t)
+ {
+ throw new ConfigurationException("Failed to configure JMS Queue for routing.", t);
+ }
}
+
+ private Properties getEnvironment()
+ {
+ final Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, Configuration.getJndiServerContextFactory());
+ environment.setProperty(Context.URL_PKG_PREFIXES, Configuration.getJndiServerPkgPrefix());
+ return environment ;
+ }
+
+ protected void createQueueSetup( String queueName ) throws ConfigurationException
+ {
+ createQueueSetup(queueName, null, null );
+ }
+
protected void setJMSReplyTo( Message jmsMessage, org.jboss.soa.esb.message.Message esbMessage ) throws URISyntaxException, JMSException, NamingException, ConnectionException
{
@@ -436,11 +447,9 @@
JMSEpr jmsEpr = (JMSEpr) replyToEpr;
String destinationType = jmsEpr.getDestinationType();
- Destination jmsDestination = null;
-
if ( destinationType.equals( JMSEpr.QUEUE_TYPE ))
{
- jmsDestination = queueSetup.jmsSession.createQueue( jmsEpr.getDestinationName() );
+ jmsReplyToName = jmsEpr.getDestinationName() ;
}
else
{
@@ -449,10 +458,6 @@
jmsDestination = pool.getTopicSession().createTopic( jmsEpr.getDestinationName() );
*/
}
-
- if ( jmsDestination != null )
- jmsMessage.setJMSReplyTo( jmsDestination );
-
}
/**
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -94,9 +94,6 @@
public void setTo (EPR epr)
{
- if (epr == null)
- throw new IllegalArgumentException();
-
_to = epr;
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -219,8 +219,10 @@
}
}
- if (uri != null)
- setAddr(new PortReference(JMS_PROTOCOL + PROTOCOL_SEPARATOR + uri + "/" + name));
+ if (uri != null) {
+ final String address = getJmsAddress(uri, name) ;
+ setAddr(new PortReference(address));
+ }
}
/**
@@ -477,7 +479,7 @@
if (destinationType.equals(QUEUE_TYPE)
|| destinationType.equals(TOPIC_TYPE))
{
- String uri = Configuration.getJndiServerURL();
+ String uri = null;
String name = null;
PortReference addr = new PortReference();
@@ -498,14 +500,20 @@
addr.addExtension(key.toString(), environment.getProperty(key.toString()));
}
}
-
-
}
+
+ if (uri == null) {
+ uri = addr.getExtensionValue(Context.PROVIDER_URL) ;
+ }
+
+ if (uri == null) {
+ uri = Configuration.getJndiServerURL() ;
+ }
if (name == null)
name = destinationName;
- addr.setAddress(JMS_PROTOCOL + PROTOCOL_SEPARATOR + uri + "/" + name);
+ addr.setAddress(getJmsAddress(uri, name));
addr.addExtension(DESTINATION_TYPE_TAG, destinationType);
@@ -690,6 +698,23 @@
return new JMSEpr(this);
}
+ private String getJmsAddress(final String uri, final String name)
+ {
+ try {
+ final URI uriVal = new URI(uri) ;
+ final String host = uriVal.getHost() ;
+ if (host != null) {
+ final int port = uriVal.getPort() ;
+ if (port > 0) {
+ return JMS_PROTOCOL + PROTOCOL_SEPARATOR + host + ":" + port + "/" + name;
+ } else {
+ return JMS_PROTOCOL + PROTOCOL_SEPARATOR + host + "/" + name;
+ }
+ }
+ } catch (final URISyntaxException urise) {}
+ return JMS_PROTOCOL + PROTOCOL_SEPARATOR + uri + "/" + name;
+ }
+
public String toString ()
{
return "JMSEpr [ "+super.getAddr().extendedToString()+" ]";
@@ -715,4 +740,4 @@
throw new ExceptionInInitializerError(ex.toString());
}
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -28,6 +28,7 @@
import org.jboss.internal.soa.esb.assertion.AssertArgument;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.PortReference;
@@ -504,26 +505,28 @@
if (courier != null) {
// make sure the message header does not change when we exit
+ final Call call = message.getHeader().getCall() ;
+ final EPR currentToEpr = call.getTo() ;
+ final EPR currentReplyToEpr = call.getReplyTo() ;
- EPR currentEpr = message.getHeader().getCall().getTo();
-
try {
- EPR replyToEPR = message.getHeader().getCall().getReplyTo();
+ call.setTo(targetEPR);
- message.getHeader().getCall().setTo(targetEPR);
-
+ final EPR replyToEPR ;
if (synchronous) {
- if (replyToEPR == null)
- replyToEPR = getReplyToAddress(targetEPR);
+ replyToEPR = (currentReplyToEpr == null ? getReplyToAddress(targetEPR) : currentReplyToEpr) ;
if (replyToEPR == null) {
logger.debug("Not using epr [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. No reply-to address available for synchronous response.");
return null;
}
- message.getHeader().getCall().setReplyTo(replyToEPR);
+ call.setReplyTo(replyToEPR);
+ } else {
+ replyToEPR = null ;
}
if (courier.deliver(message)) {
if (synchronous) {
+ courier.cleanup() ;
// JBESB-1016 replyToEPR has to be non-null or we'd have dropped out by this point!
// do we need to do this for synchronous calls? Vagueries of Couriers?
@@ -570,8 +573,8 @@
// put back the old To since we will have changed it.
- if (currentEpr != null)
- message.getHeader().getCall().setTo(currentEpr);
+ call.setTo(currentToEpr) ;
+ call.setReplyTo(currentReplyToEpr) ;
}
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -73,7 +73,10 @@
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TEST_TABLE, getStorePoolTestTable()),
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TIMEOUT_MILLIS,getStorePoolTimeoutMillis()),
new KeyValuePair(Environment.MSG_STORE_DB_CONN_MANAGER ,getStoreDBConnectionManager()),
- new KeyValuePair(Environment.MSG_STORE_DB_DATASOURCE_NAME ,getStoreDBDatasourceName())
+ new KeyValuePair(Environment.MSG_STORE_DB_DATASOURCE_NAME ,getStoreDBDatasourceName()),
+ new KeyValuePair(Environment.REGISTRY_INTERCEPTORS ,getRegistryInterceptors()),
+ new KeyValuePair(Environment.REGISTRY_CACHE_MAX_SIZE ,getRegistryCacheMaxSize()),
+ new KeyValuePair(Environment.REGISTRY_CACHE_VALIDITY_PERIOD ,getRegistryCacheValidityPeriod())
};
public static String dump()
@@ -336,6 +339,33 @@
return ModulePropertyManager.getPropertyManager(ModulePropertyManager.DBSTORE_MODULE).getProperty(Environment.MSG_STORE_JCR_ROOT_NODE_PATH);
}
+ /**
+ * Get the registry interceptor class names
+ * @return Registry interceptor Class names.
+ */
+ public static String getRegistryInterceptors()
+ {
+ return ModulePropertyManager.getPropertyManager(ModulePropertyManager.REGISTRY_MODULE).getProperty(Environment.REGISTRY_INTERCEPTORS);
+ }
+
+ /**
+ * Get the maximum cache size for the caching registry.
+ * @return The maximum cache size.
+ */
+ public static String getRegistryCacheMaxSize()
+ {
+ return ModulePropertyManager.getPropertyManager(ModulePropertyManager.REGISTRY_MODULE).getProperty(Environment.REGISTRY_CACHE_MAX_SIZE) ;
+ }
+
+ /**
+ * Get the validity period for the caching registry.
+ * @return The cache validity period.
+ */
+ public static String getRegistryCacheValidityPeriod()
+ {
+ return ModulePropertyManager.getPropertyManager(ModulePropertyManager.REGISTRY_MODULE).getProperty(Environment.REGISTRY_CACHE_VALIDITY_PERIOD) ;
+ }
+
/**
* Construct a naming context based on the connection details outlined
* in the named configuration module/section.
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Environment.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/common/Environment.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -114,6 +114,19 @@
* Property that holds the max number of rows the UDDI should return on searches.
*/
public static final String REGISTRY_UDDI_MAX_ROWS = "org.jboss.soa.esb.registry.uddi.maxRows";
+
+ /**
+ * The Registry interceptor class names.
+ */
+ public static final String REGISTRY_INTERCEPTORS = "org.jboss.soa.esb.registry.interceptors";
+ /**
+ * The maximum cache size for the registry.
+ */
+ public static final String REGISTRY_CACHE_MAX_SIZE = "org.jboss.soa.esb.registry.cache.maxSize";
+ /**
+ * The cache validity period.
+ */
+ public static final String REGISTRY_CACHE_VALIDITY_PERIOD = "org.jboss.soa.esb.registry.cache.validityPeriod";
/*
* Some default values.
*/
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -26,8 +26,6 @@
import java.sql.DriverManager;
import java.sql.SQLException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
@@ -177,4 +175,15 @@
{
m_oPW = out;
}
+
+ public boolean isWrapperFor(final Class<?> iface)
+ throws SQLException
+ {
+ return false ;
+ }
+
+ public <T> T unwrap(final Class<T> iface) throws SQLException
+ {
+ throw new SQLException("unwrap method not supported by this implementation") ;
+ }
} // ______________________________________________________
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/http/HttpClientFactory.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/http/HttpClientFactory.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/http/HttpClientFactory.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -68,6 +68,7 @@
} catch (final NumberFormatException nfe) {
throw new ConfigurationException("Invalid " + MAX_TOTAL_CONNECTIONS + " property: " + maxTotalConnections) ;
}
+ connectionManager.setParams(params) ;
}
HttpClient httpClient = new HttpClient(connectionManager);
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -37,6 +37,11 @@
public static final int RULE_BASE_PRIORITY = 50000;
/**
+ * The scheduler priority.
+ */
+ public static final int SCHEDULE_RESOURCE_PRIORITY = 70000 ;
+
+ /**
* The courier priority.
*/
public static final int COURIER_PRIORITY = 100000 ;
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -26,6 +26,8 @@
package org.jboss.soa.esb.listeners;
import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
+import org.jboss.soa.esb.listeners.config.ScheduleProviderFactory;
+import org.jboss.soa.esb.schedule.ScheduleProvider;
public class ListenerTagNames
{
@@ -128,4 +130,14 @@
/** Reply Listener */
public static final String REPLY_LISTENER_TIMEOUT_TAG = "replyListenerTimeout";
+
+ /** Scheduled listeners */
+ public static final String SCHEDULE_ID_REF = "scheduleidref" ; // taken from ScheduleProviderFactory
+ public static final String SCHEDULE_FREQUENCY = "schedule-frequency" ; // taken from ScheduleProviderFactory
+ public static final String SCHEDULE_START_DATE = "scheduleStartDate" ;
+ public static final String SCHEDULE_END_DATE = "scheduleEndDate" ;
+ public static final String SCHEDULE_SIMPLE_FREQUENCY = "scheduleSimpleFrequency" ;
+ public static final String SCHEDULE_SIMPLE_EXEC = "scheduleSimpleExec" ;
+ public static final String SCHEDULE_CRON_EXPRESSION = "scheduleCronExpression" ;
+ public static final String SCHEDULE_PROPERTIES = "ScheduleProperties" ;
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -19,25 +19,25 @@
*/
package org.jboss.soa.esb.listeners;
-import org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Initializable;
+import org.jboss.soa.esb.common.TransactionStrategy;
+import org.jboss.soa.esb.common.TransactionStrategyException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.lifecycle.AbstractScheduledManagedLifecycle;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
+import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.schedule.ScheduledEventListener;
import org.jboss.soa.esb.schedule.SchedulingException;
-import org.jboss.soa.esb.common.TransactionStrategy;
-import org.jboss.soa.esb.common.TransactionStrategyException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.Initializable;
import org.jboss.soa.esb.util.ClassUtil;
-import org.jboss.soa.esb.message.Message;
/**
* ESB Schedule listener.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public class ScheduleListener extends AbstractManagedLifecycle implements ScheduledEventListener {
+public class ScheduleListener extends AbstractScheduledManagedLifecycle {
/**
*
@@ -136,23 +136,8 @@
}
}
- protected void doInitialise() throws ManagedLifecycleException {
- }
-
- public void initialize(ConfigTree config) throws ConfigurationException {
- // TODO Convert lifecycle code to use the Initializable interface.
- }
-
- public void uninitialize() {
- }
-
- protected void doStart() throws ManagedLifecycleException {
- }
-
- protected void doStop() throws ManagedLifecycleException {
- }
-
- protected void doDestroy() throws ManagedLifecycleException {
+ @Override
+ protected void doScheduledDestroy() throws ManagedLifecycleException {
eventProcessor.uninitialize();
if(pipeline != null) {
pipeline.destroy() ;
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -38,7 +38,6 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
import org.jboss.soa.esb.util.ClassUtil;
-import org.jboss.soa.esb.schedule.ScheduleProvider;
import org.xml.sax.InputSource;
/**
@@ -113,8 +112,6 @@
instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
ManagedLifecycleController controller = new ManagedLifecycleController(instances);
- ScheduleProvider scheduleProvider = ScheduleProviderFactory.createInstance(instances, generator.getModel().getScheduleProvider());
- controller.setScheduleProvider(scheduleProvider);
// In parallel, create a map of the contract publication info...
ServicePublisher.addServicePublishers(controller, generator.getModel());
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -46,7 +46,6 @@
import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.util.ClassUtil;
-import org.jboss.soa.esb.schedule.ScheduleProvider;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.xml.sax.InputSource;
@@ -359,8 +358,6 @@
instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
ManagedLifecycleController lifecycleController = new ManagedLifecycleController(instances);
- ScheduleProvider scheduleProvider = ScheduleProviderFactory.createInstance(instances, configModel.getScheduleProvider());
- lifecycleController.setScheduleProvider(scheduleProvider);
try {
lifecycleController.start();
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -102,7 +102,7 @@
if(listener instanceof JmsListener) {
listenerConfigTree = JmsListenerMapper.map(root, (JmsListener)listener, model);
} else if (listener instanceof ScheduledListener) {
- listenerConfigTree = ScheduledListenerMapper.map(root, (ScheduledListener) listener);
+ listenerConfigTree = ScheduledListenerMapper.map(root, (ScheduledListener) listener, model);
} else if(listener instanceof FsListener) {
listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
} else if (listener instanceof FtpListener) {
@@ -119,7 +119,7 @@
}
if (listener instanceof AbstractScheduledListener) {
- ScheduleMapper.map(listenerConfigTree, (AbstractScheduledListener) listener);
+ ScheduleMapper.map(listenerConfigTree, (AbstractScheduledListener) listener, model);
}
// Locate the Service to which the listener is bound...
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -57,7 +57,6 @@
/**
* XMLBeans based configuration model instance.
*/
- @SuppressWarnings("unused")
private XMLBeansModel model;
/**
@@ -83,19 +82,24 @@
root = YADOMUtil.addElement(doc, "jbossesb-gateways");
root.setAttribute("parameterReloadSecs", model.getParameterReloadSecs());
- try {
- List<Service> services = model.getServices();
- HashMap<String, String> hm = new HashMap<String, String>();
- for (Service service : services) {
- if (hm.containsKey(service.getName())) {
- throw new ConfigurationException("Service names must be unique. The service name " + service.getName()
- + " is already defined within the <services> tag.");
- } else {
- hm.put(service.getName(), service.getName());
- }
- }
- } catch (ConfigurationException ce) {
- logger.error("", ce);
+ List<Service> services = model.getServices();
+ HashMap<String, HashMap<String, String>> hm = new HashMap<String, HashMap<String, String>>();
+ for (Service service : services) {
+ if (hm.containsKey(service.getCategory())) {
+ HashMap<String, String> hc = hm.get(service.getCategory());
+
+ if (hc.containsKey(service.getName())) {
+ throw new ConfigurationException("Service names must be unique within a category. "
+ + "The service name " + service.getName()
+ + " is already defined within the " + service.getCategory() + " category.");
+ } else {
+ hc.put(service.getName(), service.getName());
+ }
+ } else {
+ HashMap <String,String> hc = new HashMap<String,String>();
+ hc.put(service.getName(), service.getName());
+ hm.put(service.getCategory(), hc);
+ }
}
// Iterate over all the gateway configs and map them to the gateway configuration...
@@ -139,7 +143,7 @@
}
if (gateway instanceof AbstractScheduledListener) {
- ScheduleMapper.map(listenerConfig, (AbstractScheduledListener) gateway);
+ ScheduleMapper.map(listenerConfig, (AbstractScheduledListener) gateway, model);
}
}
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -259,12 +259,20 @@
List<Service> services = getServices();
for(Service service : services) {
- for(Listener serviceListener : service.getListeners().getListenerList()) {
- if(serviceListener == listener) {
- return service;
- }
- }
- }
+ ListenersDocument.Listeners listeners = service.getListeners();
+
+ if(listeners != null) {
+ List<Listener> listenerList = listeners.getListenerList();
+
+ if(listenerList != null) {
+ for(Listener serviceListener : listenerList) {
+ if(serviceListener == listener) {
+ return service;
+ }
+ }
+ }
+ }
+ }
throw new IllegalStateException("No Service instance found for the supplied Listener instance. This should not be possible if the Listener instance was provided by this configuration. Where has this Listener instance come from?");
}
@@ -329,6 +337,28 @@
throw new IllegalStateException("No Provider instance found for the supplied Bus config instance. This should not be possible if the Bus instance was provided by this configuration. Where has this Bus instance come from?");
}
+ public Schedule getSchedule(final String id) {
+ if((id == null) || (jbossesb.getProviders() == null)) {
+ return null;
+ }
+
+ List<Provider> providers = jbossesb.getProviders().getProviderList();
+
+ for(Provider provider : providers) {
+ if(provider instanceof ScheduleProvider) {
+ final ScheduleProvider scheduleProvider = (ScheduleProvider)provider ;
+ final List<Schedule> schedules = scheduleProvider.getScheduleList() ;
+ for(Schedule schedule: schedules) {
+ if (id.equals(schedule.getScheduleid())) {
+ return schedule ;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
public ScheduleProvider getScheduleProvider() {
if(jbossesb.getProviders() == null) {
return null;
@@ -344,6 +374,24 @@
return null;
}
+
+ public int getScheduledListenerCount() {
+ int count = 0 ;
+ if (jbossesb.getServices() != null) {
+ final List<Service> services = getServices() ;
+ for(Service service: services) {
+ final ListenersDocument.Listeners listeners = service.getListeners() ;
+ if (listeners != null) {
+ for (Listener listener: listeners.getListenerList()) {
+ if (listener instanceof AbstractScheduledListener) {
+ count++ ;
+ }
+ }
+ }
+ }
+ }
+ return count ;
+ }
private boolean isGateway(Listener listener)
{
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -63,20 +63,16 @@
}
List<Action> actionList = actions.getActionList();
- try {
- HashMap<String,String> hm = new HashMap<String,String>();
- for(Action action : actionList) {
- mapAction(listenerConfigTree, action);
- if (hm.containsKey(action.getName())) {
- throw new ConfigurationException("Tried to register a duplicate action name. Service "
- + listenerService.getName() + " already contains an action named "
- + action.getName() + ". Action names must be unique per service.");
- } else {
- hm.put(action.getName(), action.getName());
- }
+ HashMap<String,String> hm = new HashMap<String,String>();
+ for(Action action : actionList) {
+ mapAction(listenerConfigTree, action);
+ if (hm.containsKey(action.getName())) {
+ throw new ConfigurationException("Tried to register a duplicate action name. Service "
+ + listenerService.getName() + " already contains an action named "
+ + action.getName() + ". Action names must be unique per service.");
+ } else {
+ hm.put(action.getName(), action.getName());
}
- } catch (ConfigurationException ce) {
- logger.error("", ce);
}
}
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -51,11 +51,13 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, FsListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
FsBus bus;
FsProvider provider;
-
- try {
+
+ listenerNode.setAttribute("name", listener.getName());
+
+ try {
bus = (FsBus) model.getBus(listener.getBusidref());
} catch (ClassCastException e) {
throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "]. A <fs-listener> must reference a <fs-bus>.");
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -51,9 +51,11 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, FtpListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
FtpBus bus;
FtpProvider provider;
+
+ listenerNode.setAttribute("name", listener.getName());
try {
bus = (FtpBus) model.getBus(listener.getBusidref());
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -36,8 +36,10 @@
public class GroovyListenerMapper {
public static Element map(Element root, GroovyListenerDocument.GroovyListener listener, Generator.XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
+ listenerNode.setAttribute("name", listener.getName());
+
// Map the standard listener attributes - common across all listener types...
MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
// Map the <property> elements targeted at the listener - from the listener itself.
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -52,10 +52,12 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, HibernateListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
HibernateBus bus;
HibernateProvider provider;
-
+
+ listenerNode.setAttribute("name", listener.getName());
+
try {
bus = (HibernateBus) model.getBus(listener.getBusidref());
} catch (ClassCastException e) {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -44,10 +44,12 @@
* @throws org.jboss.soa.esb.ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, JbrListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
JbrBus bus;
JbrProvider provider;
+ listenerNode.setAttribute("name", listener.getName());
+
try {
bus = (JbrBus) model.getBus(listener.getBusidref());
} catch (ClassCastException e) {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -40,9 +40,11 @@
{
public static Element map(Element root, JcaGateway gateway, Generator.XMLBeansModel model) throws ConfigurationException
{
- Element listenerNode = YADOMUtil.addElement(root, gateway.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
gateway.setIsGateway(true);
+ listenerNode.setAttribute("name", gateway.getName());
+
ServiceDocument.Service service = model.getService(gateway);
listenerNode.setAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG, service.getDescription());
listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, service.getCategory());
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -65,10 +65,12 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, JmsListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
JmsBus bus;
JmsProviderType provider;
-
+
+ listenerNode.setAttribute("name", listener.getName());
+
try {
bus = (JmsBus) model.getBus(listener.getBusidref());
} catch (ClassCastException e) {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -43,31 +43,43 @@
* Mapper utility methods.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-abstract class MapperUtil {
+public abstract class MapperUtil {
/**
* Map all default listener attributes onto the target listener ConfigTree.
* @param listener The listener configuration instance.
- * @param target The target DOM ConfigTree listener element.
+ * @param listenerNode The target DOM ConfigTree listener element.
* @param model The model.
*/
- protected static void mapDefaultAttributes(Listener listener, Element target, XMLBeansModel model) {
- Service service = model.getService(listener);
-
- // Map maxThreads - appears to be a JMS only attrib...
- target.setAttribute(ListenerTagNames.MAX_THREADS_TAG, String.valueOf(listener.getMaxThreads()));
- target.setAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG, service.getDescription());
- if(listener.getIsGateway()) {
- target.setAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, service.getCategory());
- target.setAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG, service.getName());
- } else {
- target.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG, service.getCategory());
- target.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, service.getName());
- if(!target.hasAttribute(ListenerTagNames.LISTENER_CLASS_TAG)) {
- target.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());
- }
+ protected static void mapDefaultAttributes(Listener listener, Element listenerNode, XMLBeansModel model) {
+ Service service = model.getService(listener);
+ boolean isGateway = listener.getIsGateway();
+
+ // Map maxThreads - appears to be a JMS only attrib...
+ listenerNode.setAttribute(ListenerTagNames.MAX_THREADS_TAG, String.valueOf(listener.getMaxThreads()));
+
+ mapListenerServiceAttributes(listenerNode, service, isGateway);
+ if (!isGateway && !listenerNode.hasAttribute(ListenerTagNames.LISTENER_CLASS_TAG)) {
+ listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());
}
- }
+ }
+
+ /**
+ * Map the Service specific attributes onto the listener configuration.
+ * @param listenerNode The listener config node.
+ * @param service The Service details (from the model).
+ * @param isGateway True if the listener is a gateway, otherwise false.
+ */
+ public static void mapListenerServiceAttributes(Element listenerNode, Service service, boolean isGateway) {
+ listenerNode.setAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG, service.getDescription());
+ if (isGateway) {
+ listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, service.getCategory());
+ listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG, service.getName());
+ } else {
+ listenerNode.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG, service.getCategory());
+ listenerNode.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, service.getName());
+ }
+ }
/**
* Map all the properties targeted at the supplied listener onto the target element.
@@ -93,7 +105,7 @@
* @param target The target DOM element.
* @param properties The properties to be mapped.
*/
- protected static void mapProperties(List<Property> properties, Element target) {
+ public static void mapProperties(List<Property> properties, Element target) {
// Map the property elements to actions attributes...
for(Property property : properties) {
Element propertyElement = target.getOwnerDocument().createElement("property");
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -19,11 +19,22 @@
*/
package org.jboss.soa.esb.listeners.config.mappers;
+import java.util.List;
+
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.config.Generator;
import org.jboss.soa.esb.listeners.config.ScheduleProviderFactory;
+import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
import org.jboss.soa.esb.listeners.config.xbeanmodel.AbstractScheduledListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.PropertyDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Schedule;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.CronScheduleDocument.CronSchedule;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduleProviderDocument.ScheduleProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SimpleScheduleDocument.SimpleSchedule;
+import org.jboss.soa.esb.schedule.SchedulerResource;
import org.w3c.dom.Element;
/**
@@ -39,20 +50,45 @@
private static Logger logger = Logger.getLogger(ScheduleMapper.class);
- public static void map(Element listenerConfig, AbstractScheduledListener scheduledListener) throws ConfigurationException {
+ public static void map(Element listenerConfig, AbstractScheduledListener scheduledListener, final XMLBeansModel model) throws ConfigurationException {
String scheduleIdRef = scheduledListener.getScheduleidref();
Element domElement = (Element) scheduledListener.getDomNode();
- int frequency = scheduledListener.getScheduleFrequency();
+ int scheduleFrequency = scheduledListener.getScheduleFrequency();
int pollFrequency = scheduledListener.getPollFrequencySeconds();
int pollLatency = getPollLatencySeconds(scheduledListener);
if(scheduleIdRef != null) {
- listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_SCHEDULE_ID_REF, scheduleIdRef);
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_ID_REF, scheduleIdRef);
+ final Schedule schedule = model.getSchedule(scheduleIdRef) ;
+ if (schedule.isSetStartDate()) {
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_START_DATE, Long.toString(schedule.getStartDate().getTimeInMillis())) ;
+ }
+ if (schedule.isSetEndDate()) {
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_END_DATE, Long.toString(schedule.getEndDate().getTimeInMillis())) ;
+ }
+ if (schedule instanceof SimpleSchedule) {
+ final SimpleSchedule simpleSchedule = (SimpleSchedule)schedule ;
+ final long simpleFrequency = simpleSchedule.getFrequency() ;
+ final String frequencyVal = Long.toString(simpleFrequency * 1000) ;
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_SIMPLE_FREQUENCY, frequencyVal) ;
+ if (simpleSchedule.isSetExecCount()) {
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_SIMPLE_EXEC, Integer.toString(simpleSchedule.getExecCount())) ;
+ }
+ } else if (schedule instanceof CronSchedule) {
+ final String cronExpression = ((CronSchedule)schedule).getCronExpression() ;
+ if (cronExpression == null) {
+ throw new ConfigurationException("Missing cron expression from configuration") ;
+ }
+ listenerConfig.setAttribute(ListenerTagNames.SCHEDULE_CRON_EXPRESSION, cronExpression) ;
+ } else {
+ throw new ConfigurationException("Unknown schedule type specified in configuration: " + schedule.getClass().getName()) ;
+ }
+
if(domElement.hasAttribute("poll-frequency-seconds") || domElement.hasAttribute("schedule-frequency") ) {
logger.warn("Schedule Listener '" + listenerConfig.getTagName() + "' defines both 'scheduleidref' and frequency attributes. Using the 'scheduleidref'.");
}
- } else if(frequency > -1) {
- listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, Integer.toString(frequency));
+ } else if(scheduleFrequency > -1) {
+ listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, Integer.toString(scheduleFrequency));
} else if(pollFrequency > -1) {
listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, Integer.toString(pollFrequency));
} else if(pollLatency > -1) {
@@ -61,6 +97,12 @@
listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, "10");
}
+ final ScheduleProvider scheduleProvider = model.getScheduleProvider() ;
+ if (scheduleProvider != null) {
+ // There is only one schedule provider allowed in the configuration at present
+ copyProperties(listenerConfig, model.getScheduleProvider().getPropertyList(), model.getScheduledListenerCount()) ;
+ }
+
if(domElement.hasAttribute("poll-frequency-seconds")) {
logger.warn("Attrubute 'poll-frequency-seconds' is DEPRECATED. Please change your configuration to use 'schedule-frequency'.");
}
@@ -69,6 +111,17 @@
}
}
+ private static void copyProperties(final Element listenerConfig, final List<PropertyDocument.Property> properties, final int numScheduledListeners)
+ {
+ final Element schedulePropertyElement = YADOMUtil.addElement(listenerConfig, ListenerTagNames.SCHEDULE_PROPERTIES) ;
+ schedulePropertyElement.setAttribute(SchedulerResource.THREAD_COUNT, Integer.toString(numScheduledListeners)) ;
+
+ if ((properties != null) && (properties.size() > 0))
+ {
+ MapperUtil.mapProperties(properties, schedulePropertyElement) ;
+ }
+ }
+
private static int getPollLatencySeconds(AbstractScheduledListener scheduledListener) {
String value = Generator.XMLBeansModel.getProperty(scheduledListener.getPropertyList(), "pollLatencySeconds", "-1");
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -20,7 +20,9 @@
package org.jboss.soa.esb.listeners.config.mappers;
import org.w3c.dom.Element;
+import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduledListenerDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.ScheduleListener;
import org.jboss.soa.esb.dom.YADOMUtil;
@@ -30,17 +32,22 @@
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class ScheduledListenerMapper {
- public static Element map(Element root, ScheduledListenerDocument.ScheduledListener scheduledListener) {
- Element listenerNode = YADOMUtil.addElement(root, scheduledListener.getName());
+ public static Element map(Element root, ScheduledListenerDocument.ScheduledListener listener, XMLBeansModel model) {
+ Service service = model.getService(listener);
+ boolean isGateway = listener.getIsGateway();
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
- listenerNode.setAttribute("event-processor", scheduledListener.getEventProcessor());
+ listenerNode.setAttribute("name", listener.getName());
+
+ listenerNode.setAttribute("event-processor", listener.getEventProcessor());
listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, ScheduleListener.class.getName());
- if (scheduledListener.isSetTransacted()) {
- listenerNode.setAttribute(ListenerTagNames.TRANSACTED_TAG, Boolean.toString(scheduledListener.getTransacted()));
+ if (listener.isSetTransacted()) {
+ listenerNode.setAttribute(ListenerTagNames.TRANSACTED_TAG, Boolean.toString(listener.getTransacted()));
}
+ MapperUtil.mapListenerServiceAttributes(listenerNode, service, isGateway) ;
// Map the <property> elements targeted at the listener - from the listener itself.
- MapperUtil.mapProperties(scheduledListener.getPropertyList(), listenerNode);
+ MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
return listenerNode;
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -49,10 +49,12 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, SqlListener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
SqlBus bus;
SqlProvider provider;
-
+
+ listenerNode.setAttribute("name", listener.getName());
+
try {
bus = (SqlBus) model.getBus(listener.getBusidref());
} catch (ClassCastException e) {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -56,8 +56,10 @@
* @throws ConfigurationException Invalid listener configuration.
*/
public static Element map(Element root, Listener listener, XMLBeansModel model) throws ConfigurationException {
- Element listenerNode = YADOMUtil.addElement(root, listener.getName());
-
+ Element listenerNode = YADOMUtil.addElement(root, "listener");
+
+ listenerNode.setAttribute("name", listener.getName());
+
assertListenerConfigOK(listener, model);
// Map the standard listener attributes - common across all listener types...
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -35,7 +35,6 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.Service;
import org.jboss.soa.esb.addressing.eprs.FileEpr;
-import org.jboss.soa.esb.schedule.ScheduledEventListener;
import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.couriers.CourierException;
@@ -59,7 +58,7 @@
* @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
* @since Version 4.0
*/
-public abstract class AbstractFileGateway extends AbstractManagedLifecycle implements ScheduledEventListener {
+public abstract class AbstractFileGateway extends AbstractScheduledManagedLifecycle {
protected final static Logger _logger = Logger
.getLogger(AbstractFileGateway.class);
@@ -102,22 +101,6 @@
}
}
- public void initialize(ConfigTree config) throws ConfigurationException {
- // TODO Convert lifecycle code to use the Initializable interface.
- }
-
- public void uninitialize() {
- }
-
- protected void doStart() throws ManagedLifecycleException {
- }
-
- protected void doStop() throws ManagedLifecycleException {
- }
-
- protected void doDestroy() throws ManagedLifecycleException {
- }
-
/**
* Execute on trigger from the scheduler.
*/
@@ -268,14 +251,6 @@
return new File(fileIn.toString() + _workingSuffix);
}
- /**
- * Handle the threaded destroy of the managed instance.
- *
- * @throws ManagedLifecycleException for errors while destroying.
- */
- protected void doThreadedDestroy() throws ManagedLifecycleException {
- }
-
/*
* Is the input suffix valid for this type of gateway?
*/
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -143,11 +143,6 @@
@Override
boolean renameFile(File from, File to) throws GatewayException {
- if (to.exists() && !to.delete()) {
- throw new GatewayException("Cannot delete target file: "
- + to.getAbsolutePath());
- }
-
return FileUtil.renameTo(from, to);
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateGatewayListener.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateGatewayListener.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -54,6 +54,8 @@
protected String _composerName;
protected String m_targetServiceCategory, m_targetServiceName;
+ private HibernateInterceptor interceptor ;
+
protected Collection<EPR> m_targetEprs;
private static final String MESSAGE_FILTER = "messagefilter";
@@ -119,7 +121,8 @@
// we need to close the SessionFactory so that the old interceptors don't get
// in the way.
if (eventList.size() != 0) {
- cfg.setInterceptor(new HibernateInterceptor(m_config, eventList));
+ interceptor = new HibernateInterceptor(m_config, eventList) ;
+ cfg.setInterceptor(interceptor);
}
// We're suppressing warnings here - we need to initialize the
@@ -137,9 +140,15 @@
@Override
protected void doStart() throws ManagedLifecycleException {
+ if (interceptor != null) {
+ interceptor.enable() ;
+ }
}
@Override
protected void doStop() throws ManagedLifecycleException {
+ if (interceptor != null) {
+ interceptor.disable() ;
+ }
}
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HibernateInterceptor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -36,12 +36,7 @@
import org.hibernate.type.Type;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.couriers.Courier;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.couriers.CourierFactory;
-import org.jboss.soa.esb.couriers.CourierUtil;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.ListenerUtil;
@@ -74,6 +69,8 @@
protected Object m_composer;
protected String m_composerName;
protected ConfigTree m_config;
+
+ private boolean enabled ;
protected ServiceInvoker m_serviceInvoker;
protected String m_targetServiceCategory, m_targetServiceName;
@@ -267,68 +264,84 @@
}
public void afterTransactionBegin(Transaction arg0) {
- m_logger.debug("afterTransactionBegin");
+ if (isEnabled()) {
+ m_logger.debug("afterTransactionBegin");
+ }
}
public void afterTransactionCompletion(Transaction arg0) {
- m_logger.debug("afterTransactionCompletion");
+ if (isEnabled()) {
+ m_logger.debug("afterTransactionCompletion");
+ }
}
public void beforeTransactionCompletion(Transaction arg0) {
- m_logger.debug("beforeTransactionCompletion");
+ if (isEnabled()) {
+ m_logger.debug("beforeTransactionCompletion");
+ }
}
public void onCollectionRecreate(Object entity, Serializable id) throws CallbackException {
- m_logger.debug("onCollectionRecreate");
+ if (isEnabled()) {
+ m_logger.debug("onCollectionRecreate");
+ }
}
public void onCollectionRemove(Object entity, Serializable id) throws CallbackException {
- System.out.println("onCollectionRemove");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(COLLECTION_REMOVE_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- message.getProperties().setProperty(ListenerTagNames.HIBERNATE_INTERCEPTOR_ID, id);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onCollectionRemove");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(COLLECTION_REMOVE_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ message.getProperties().setProperty(ListenerTagNames.HIBERNATE_INTERCEPTOR_ID, id);
+ deliverMessage(message);
+ }
}
}
}
}
public void onCollectionUpdate(Object entity, Serializable id) throws CallbackException {
- System.out.println("onCollectionUpdate");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(COLLECTION_UPDATE_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- message.getProperties().setProperty(ListenerTagNames.HIBERNATE_INTERCEPTOR_ID, id);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onCollectionUpdate");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(COLLECTION_UPDATE_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ message.getProperties().setProperty(ListenerTagNames.HIBERNATE_INTERCEPTOR_ID, id);
+ deliverMessage(message);
+ }
}
}
}
}
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException {
- System.out.println("onDelete");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(DELETE_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- addMessageInfo(message, id, state, propertyNames, types);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onDelete");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(DELETE_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ addMessageInfo(message, id, state, propertyNames, types);
+ deliverMessage(message);
+ }
}
}
}
}
public boolean onFlushDirty(Object entity, Serializable id, Object[] newValues, Object[] oldValues, String[] propertyNames, Type[] types) throws CallbackException {
- m_logger.debug("onFlushDirty");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(FLUSH_DIRTY_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- addMessageInfo(message, id, newValues, oldValues, propertyNames, types);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onFlushDirty");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(FLUSH_DIRTY_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ addMessageInfo(message, id, newValues, oldValues, propertyNames, types);
+ deliverMessage(message);
+ }
}
}
}
@@ -336,13 +349,15 @@
}
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException {
- System.out.println("onLoad");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(LOAD_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- addMessageInfo(message, id, state, propertyNames, types);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onLoad");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(LOAD_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ addMessageInfo(message, id, state, propertyNames, types);
+ deliverMessage(message);
+ }
}
}
}
@@ -351,13 +366,15 @@
public boolean onSave(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types) throws CallbackException {
- System.out.println("onSave");
- for (HibernateEventBean heb: m_events) {
- if (heb.getEvent().equals(SAVE_EVENT)) {
- if (entity.getClass().getName().equals(heb.getClassname())) {
- Message message = createMessage(entity);
- addMessageInfo(message, id, state, propertyNames, types);
- deliverMessage(message);
+ if (isEnabled()) {
+ m_logger.debug("onSave");
+ for (HibernateEventBean heb: m_events) {
+ if (heb.getEvent().equals(SAVE_EVENT)) {
+ if (entity.getClass().getName().equals(heb.getClassname())) {
+ Message message = createMessage(entity);
+ addMessageInfo(message, id, state, propertyNames, types);
+ deliverMessage(message);
+ }
}
}
}
@@ -365,10 +382,26 @@
}
public void postFlush(Iterator arg0) throws CallbackException {
- m_logger.debug("postFlush");
+ if (isEnabled()) {
+ m_logger.debug("postFlush");
+ }
}
public void preFlush(Iterator arg0) throws CallbackException {
- m_logger.debug("preFlush");
- }
+ if (isEnabled()) {
+ m_logger.debug("preFlush");
+ }
+ }
+
+ public synchronized boolean isEnabled() {
+ return enabled ;
+ }
+
+ public synchronized void enable() {
+ enabled = true ;
+ }
+
+ public synchronized void disable() {
+ enabled = false ;
+ }
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -173,20 +173,22 @@
* Stop the service and also after that stop the
* remotefileSystemStrategy in use
*/
+ @Override
protected void doStop() throws ManagedLifecycleException
{
+ super.doStop();
remotefileSystemStrategy.stop();
- super.doStop();
}
/**
* Destroys the service and also after that stop the
* remotefileSystemStrategy in use
*/
- protected void doThreadedDestroy() throws ManagedLifecycleException
+ @Override
+ protected void doScheduledDestroy() throws ManagedLifecycleException
{
+ super.doScheduledDestroy();
remotefileSystemStrategy.destroy();
- super.doDestroy();
}
private void createRemoteFileSystemStrategy() throws ConfigurationException
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractScheduledManagedLifecycle.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractScheduledManagedLifecycle.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractScheduledManagedLifecycle.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractScheduledManagedLifecycle.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,340 @@
+/*
+ * 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.listeners.lifecycle;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.schedule.SchedulerJob;
+import org.jboss.soa.esb.schedule.SchedulerJobListener;
+import org.jboss.soa.esb.schedule.SchedulingException;
+
+
+/**
+ * This class provides threaded support for a managed instance.
+ *
+ * @author kevin
+ */
+public abstract class AbstractScheduledManagedLifecycle extends AbstractManagedLifecycle
+{
+ /**
+ * The job associated with the scheduler.
+ */
+ private final SchedulerJob job ;
+ /**
+ * The logger for this class.
+ */
+ private static final Logger logger = Logger.getLogger(AbstractScheduledManagedLifecycle.class) ;
+
+ /**
+ * Construct the threaded managed lifecycle.
+ * @param config The configuration associated with this instance.
+ * @throws ConfigurationException for configuration errors during initialisation.
+ */
+ protected AbstractScheduledManagedLifecycle(final ConfigTree config)
+ throws ConfigurationException
+ {
+ super(config) ;
+
+ final Properties properties = extractProperties(config) ;
+ final SchedulerJobListener listener = new SchedulerJobListener() {
+ public void onSchedule() throws SchedulingException {
+ AbstractScheduledManagedLifecycle.this.onSchedule() ;
+ }
+ } ;
+ final String scheduleIdRef = config.getAttribute(ListenerTagNames.SCHEDULE_ID_REF) ;
+ if (scheduleIdRef == null)
+ {
+ final String intervalVal = config.getAttribute(ListenerTagNames.SCHEDULE_FREQUENCY) ;
+ final long interval ;
+ if (intervalVal != null)
+ {
+ interval = parseInt(ListenerTagNames.SCHEDULE_FREQUENCY, intervalVal) ;
+ }
+ else
+ {
+ interval = 10 ;
+ }
+
+ job = SchedulerJob.createIntervalSchedulerJob(null, listener, interval*1000, properties) ;
+ }
+ else
+ {
+ final Date scheduleStartDate = getDate(config.getAttribute(ListenerTagNames.SCHEDULE_START_DATE)) ;
+ final Date scheduleEndDate = getDate(config.getAttribute(ListenerTagNames.SCHEDULE_END_DATE)) ;
+ final String simpleFrequency = config.getAttribute(ListenerTagNames.SCHEDULE_SIMPLE_FREQUENCY) ;
+ if (simpleFrequency != null)
+ {
+ final long frequency = parseLong(ListenerTagNames.SCHEDULE_SIMPLE_FREQUENCY, simpleFrequency) ;
+ if (frequency <= 0)
+ {
+ throw new ConfigurationException("Invalid " + ListenerTagNames.SCHEDULE_SIMPLE_FREQUENCY + " value, must be greate than zero: " + simpleFrequency) ;
+ }
+ final String simpleExecCount = config.getAttribute(ListenerTagNames.SCHEDULE_SIMPLE_EXEC) ;
+ if (simpleExecCount != null)
+ {
+ final int execCount = parseInt(ListenerTagNames.SCHEDULE_SIMPLE_EXEC, simpleExecCount) ;
+ if (execCount < 0)
+ {
+ job = SchedulerJob.createIntervalSchedulerJob(scheduleIdRef, listener, frequency, scheduleStartDate, scheduleEndDate, properties) ;
+ }
+ else if (execCount == 0)
+ {
+ logger.warn("<simple-schedule> '" + scheduleIdRef + "' has an execCount of 0 configured. This schedule will not fire!");
+ job = null ;
+ }
+ else
+ {
+ job = SchedulerJob.createIntervalSchedulerJob(scheduleIdRef, listener, frequency, execCount, scheduleStartDate, scheduleEndDate, properties) ;
+ }
+ }
+ else
+ {
+ job = SchedulerJob.createIntervalSchedulerJob(scheduleIdRef, listener, frequency, scheduleStartDate, scheduleEndDate, properties) ;
+ }
+ }
+ else
+ {
+ final String cronExpression = config.getAttribute(ListenerTagNames.SCHEDULE_CRON_EXPRESSION) ;
+ if (cronExpression == null)
+ {
+ throw new ConfigurationException("Missing cron expression") ;
+ }
+ try
+ {
+ job = SchedulerJob.createCronSchedulerJob(scheduleIdRef, listener, cronExpression, scheduleStartDate, scheduleEndDate, properties) ;
+ }
+ catch (final ParseException pe)
+ {
+ throw new ConfigurationException("Invalid cron expression", pe) ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Handle the initialisation of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while initialisation.
+ */
+ @Override
+ protected void doInitialise()
+ throws ManagedLifecycleException
+ {
+ }
+
+ /**
+ * Handle the start of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while starting.
+ */
+ @Override
+ protected void doStart()
+ throws ManagedLifecycleException
+ {
+ if (job != null)
+ {
+ try
+ {
+ job.start() ;
+ }
+ catch (final SchedulingException se)
+ {
+ throw new ManagedLifecycleException("Failed to start the scheduling job", se) ;
+ }
+ }
+ }
+
+ /**
+ * Execute the scheduled event.
+ */
+ protected abstract void onSchedule()
+ throws SchedulingException ;
+
+ /**
+ * Handle the stop of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while stopping.
+ */
+ @Override
+ protected void doStop()
+ throws ManagedLifecycleException
+ {
+ if (job != null)
+ {
+ try
+ {
+ job.pause() ;
+ }
+ catch (final SchedulingException se)
+ {
+ throw new ManagedLifecycleException("Failed to pause the scheduling job", se) ;
+ }
+ }
+ }
+
+ /**
+ * Handle the destroy of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while destroying.
+ */
+ @Override
+ protected final void doDestroy()
+ throws ManagedLifecycleException
+ {
+ try
+ {
+ doScheduledDestroy() ;
+ }
+ finally
+ {
+ if (job != null)
+ {
+ try
+ {
+ job.destroy() ;
+ }
+ catch (final SchedulingException se)
+ {
+ throw new ManagedLifecycleException("Failed to destroy the scheduling job", se) ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Handle the scheduled destroy of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while destroying.
+ */
+ protected void doScheduledDestroy()
+ throws ManagedLifecycleException
+ {
+ }
+
+ /**
+ * Parse the value as an integer.
+ * @param propertyName The property name.
+ * @param value The string representation.
+ * @return the integer value.
+ * @throws ConfigurationException For failures in parsing the integer.
+ */
+ private int parseInt(final String propertyName, final String value)
+ throws ConfigurationException
+ {
+ try
+ {
+ return Integer.parseInt(value) ;
+ }
+ catch (final NumberFormatException nfe)
+ {
+ throw new ConfigurationException("Failed to parse " + propertyName + " as integer: " + value) ;
+ }
+ }
+
+ /**
+ * Parse the value as a long.
+ * @param propertyName The property name.
+ * @param value The string representation.
+ * @return the long value.
+ * @throws ConfigurationException For failures in parsing the long.
+ */
+ private long parseLong(final String propertyName, final String value)
+ throws ConfigurationException
+ {
+ try
+ {
+ return Long.parseLong(value) ;
+ }
+ catch (final NumberFormatException nfe)
+ {
+ throw new ConfigurationException("Failed to parse " + propertyName + " as long: " + value) ;
+ }
+ }
+
+ /**
+ * Extract any scheduler properties from the configuration.
+ * @param config The current configuration.
+ * @return The scheduler properties or null if none present.
+ * @throws ConfigurationException for errors in configuration
+ */
+ private Properties extractProperties(final ConfigTree config)
+ throws ConfigurationException
+ {
+ final ConfigTree[] children = config.getChildren(ListenerTagNames.SCHEDULE_PROPERTIES) ;
+ final int numChildren = (children == null ? 0 : children.length) ;
+ if (numChildren == 0)
+ {
+ return null ;
+ }
+ else if (numChildren > 1)
+ {
+ throw new ConfigurationException("Only one " + ListenerTagNames.SCHEDULE_PROPERTIES + " element allowed within the configuration") ;
+ }
+
+ final List<KeyValuePair> attributeList = children[0].attributesAsList() ;
+ if ((attributeList == null) || attributeList.isEmpty())
+ {
+ return null ;
+ }
+
+ final Properties properties = new Properties() ;
+ for(KeyValuePair pair: attributeList)
+ {
+ properties.put(pair.getKey(), pair.getValue()) ;
+ }
+ return properties ;
+ }
+
+ /**
+ * Create a date object from the time value.
+ * @param time The time value.
+ * @return The date instance.
+ * @throws ConfigurationException for parsing errors.
+ */
+ private Date getDate(final String time)
+ throws ConfigurationException
+ {
+ if (time == null)
+ {
+ return null ;
+ }
+
+ final long timeval ;
+ try
+ {
+ timeval = Long.parseLong(time) ;
+ }
+ catch (final NumberFormatException nfe)
+ {
+ throw new ConfigurationException("Could not create date from millisecond value: " + time) ;
+ }
+ return new Date(timeval) ;
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -23,10 +23,6 @@
import java.util.Collection;
-import org.jboss.soa.esb.schedule.ScheduleProvider;
-import org.jboss.soa.esb.schedule.SchedulingException;
-import org.apache.log4j.Logger;
-
/**
* Controller class to manage the lifecycles of a set of managed instances.
*
@@ -34,13 +30,10 @@
*/
public class ManagedLifecycleController
{
- private static Logger logger = Logger.getLogger(ManagedLifecycleController.class);
-
/**
* The managed lifecycle instances.
*/
private final ManagedLifecycle[] instances;
- private ScheduleProvider scheduleProvider;
/**
* Construct the controller to manage the specified managed lifecycle instances.
@@ -68,14 +61,6 @@
{
initialiseInstances();
startInstances();
- try {
- if(scheduleProvider != null) {
- scheduleProvider.start();
- }
- } catch (SchedulingException e) {
- stopAndDestroy(false);
- throw new ManagedLifecycleException("Failed to start schedule provider.", e);
- }
}
/**
@@ -87,25 +72,8 @@
*/
public void restart() throws ManagedLifecycleException
{
- try
- {
- if(scheduleProvider != null) {
- scheduleProvider.standby();
- }
- } catch (SchedulingException e) {
- stopAndDestroy(false);
- throw new ManagedLifecycleException("Failed to put schedule provider into standby.", e);
- }
stopInstances();
startInstances();
- try {
- if(scheduleProvider != null) {
- scheduleProvider.start();
- }
- } catch (SchedulingException e) {
- stopAndDestroy(false);
- throw new ManagedLifecycleException("Failed to restart schedule provider.", e);
- }
}
/**
@@ -117,20 +85,7 @@
*/
public void stop() throws ManagedLifecycleException
{
- try
- {
- stopAndDestroy(true) ;
- }
- finally
- {
- if(scheduleProvider != null) {
- try {
- scheduleProvider.stop();
- } catch (SchedulingException e) {
- logger.error("Failed to stop scheduling.", e);
- }
- }
- }
+ stopAndDestroy(true) ;
}
/**
@@ -302,8 +257,4 @@
destroyInstances(numInstances-1) ;
}
}
-
- public void setScheduleProvider(ScheduleProvider scheduleProvider) {
- this.scheduleProvider = scheduleProvider;
- }
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleState.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleState.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleState.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -48,7 +48,7 @@
{
CONSTRUCTED { public boolean canTransition(final ManagedLifecycleState newState) { return (newState == INITIALISING) ;}} ,
INITIALISING { public boolean canTransition(final ManagedLifecycleState newState) { return ((newState == INITIALISED) || (newState == DESTROYED)) ;}} ,
- INITIALISED { public boolean canTransition(final ManagedLifecycleState newState) { return ((newState == STARTING) || (newState == DESTROYED)) ;}} ,
+ INITIALISED { public boolean canTransition(final ManagedLifecycleState newState) { return ((newState == STARTING) || (newState == DESTROYING)) ;}} ,
STARTING { public boolean canTransition(final ManagedLifecycleState newState) { return ((newState == STARTED) || (newState == STOPPED)) ;}} ,
STARTED { public boolean canTransition(final ManagedLifecycleState newState) { return ((newState == RUNNING) || (newState == STOPPING)) ;}} ,
RUNNING { public boolean canTransition(final ManagedLifecycleState newState) { return (newState == STOPPING) ;}} ,
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -37,6 +37,7 @@
*
* @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @deprecated {@link ScheduleResource}
*/
public class ScheduleProvider {
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,309 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.quartz.CronTrigger;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.SimpleTrigger;
+import org.quartz.StatefulJob;
+import org.quartz.Trigger;
+
+/**
+ * Scheduler job tied to the lifecycle.
+ */
+public class SchedulerJob
+{
+ /**
+ * The logger for this class.
+ */
+ private static Logger LOGGER = Logger.getLogger(SchedulerJob.class);
+
+ /**
+ * The job group used by scheduled jobs.
+ */
+ private static final String JOB_GROUP = "ESBScheduler" ;
+
+ /**
+ * The base job name used by scheduled jobs.
+ */
+ private static final String JOB_NAME = "ESBJob" ;
+
+ /**
+ * The job counter.
+ */
+ private static long jobCounter ;
+
+ /**
+ * The name associated with this scheduler.
+ */
+ private final String name ;
+ /**
+ * The job details.
+ */
+ private final JobDetail jobDetail ;
+ /**
+ * The trigger associated with this job.
+ */
+ private final Trigger trigger ;
+ /**
+ * The scheduler properties.
+ */
+ private final Properties properties ;
+
+ /**
+ * Construct the job with the specified listener, trigger and properties.
+ * @param listener The job listener.
+ * @param trigger The associated trigger.
+ * @param properties Scheduler properties.
+ */
+ private SchedulerJob(final String name, final SchedulerJobListener listener,
+ final Trigger trigger, final Properties properties)
+ {
+ this.name = name ;
+ this.jobDetail = new JobDetail(trigger.getName(), JOB_GROUP, ESBScheduledJob.class) ;
+
+ final JobDataMap jobDataMap = new JobDataMap() ;
+ jobDataMap.put(SchedulerJobListener.class.getName(), listener) ;
+ jobDataMap.put(ClassLoader.class.getName(), Thread.currentThread().getContextClassLoader()) ;
+ jobDetail.setJobDataMap(jobDataMap) ;
+
+ this.trigger = trigger ;
+ this.properties = properties ;
+ }
+
+ /**
+ * Start or resume the operation of the trigger.
+ * @throws SchedulingException for errors during the operation.
+ */
+ public void start()
+ throws SchedulingException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Starting SchedulerJob " + getName()) ;
+ }
+ SchedulerResource.getSchedulerResource().start(trigger, jobDetail, properties) ;
+ }
+
+ /**
+ * Pause the operation of the trigger.
+ * @throws SchedulingException for errors during the operation.
+ */
+ public void pause()
+ throws SchedulingException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Pausing SchedulerJob " + getName()) ;
+ }
+ SchedulerResource.getSchedulerResource().pause(trigger) ;
+ }
+
+ /**
+ * Destroy the trigger.
+ * @throws SchedulingException for errors during the operation.
+ */
+ public void destroy()
+ throws SchedulingException
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Destroying SchedulerJob " + getName()) ;
+ }
+ SchedulerResource.getSchedulerResource().destroy(trigger) ;
+ }
+
+ /**
+ * Get a name associated with this schedule.
+ * @return a name for this schedule.
+ */
+ private String getName()
+ {
+ if (name != null)
+ {
+ return name + '/' + trigger.getName();
+ }
+ else
+ {
+ return trigger.getName() ;
+ }
+ }
+
+ /**
+ * Create a job based on an interval.
+ * @param name The name for the job.
+ * @param listener The listener to fire on schedule.
+ * @param interval The specified interval.
+ * @param properties Any scheduler properties that may be required.
+ * @return The Scheduler Job managing the schedule.
+ */
+ public static SchedulerJob createIntervalSchedulerJob(final String name, final SchedulerJobListener listener,
+ final long interval, final Properties properties)
+ {
+ final SimpleTrigger trigger = new SimpleTrigger(getJobName(), JOB_GROUP, SimpleTrigger.REPEAT_INDEFINITELY, interval) ;
+ trigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT) ;
+ return new SchedulerJob(name, listener, trigger, properties) ;
+ }
+
+ /**
+ * Create a job based on an interval.
+ * @param name The name for the job.
+ * @param listener The listener to fire on schedule.
+ * @param interval The specified interval.
+ * @param startDate The start date of the trigger or null if not constrained.
+ * @param endDate The end date of the trigger or null if not constrained.
+ * @param properties Any scheduler properties that may be required.
+ * @return The Scheduler Job managing the schedule.
+ */
+ public static SchedulerJob createIntervalSchedulerJob(final String name, final SchedulerJobListener listener,
+ final long interval, final Date startDate, final Date endDate, final Properties properties)
+ {
+ final SimpleTrigger trigger = new SimpleTrigger(getJobName(), JOB_GROUP, SimpleTrigger.REPEAT_INDEFINITELY, interval) ;
+ trigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT) ;
+ if (startDate != null)
+ {
+ trigger.setStartTime(startDate) ;
+ }
+ if (endDate != null)
+ {
+ trigger.setEndTime(endDate) ;
+ }
+ return new SchedulerJob(name, listener, trigger, properties) ;
+ }
+
+ /**
+ * Create a job based on an interval.
+ * @param name The name for the job.
+ * @param listener The listener to fire on schedule.
+ * @param interval The specified interval.
+ * #param execCount The execution count.
+ * @param startDate The start date of the trigger or null if not constrained.
+ * @param endDate The end date of the trigger or null if not constrained.
+ * @param properties Any scheduler properties that may be required.
+ * @return The Scheduler Job managing the schedule.
+ */
+ public static SchedulerJob createIntervalSchedulerJob(final String name, final SchedulerJobListener listener,
+ final long interval, final int execCount, final Date startDate, final Date endDate, final Properties properties)
+ {
+ final SimpleTrigger trigger = new SimpleTrigger(getJobName(), JOB_GROUP, execCount-1, interval) ;
+ trigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT) ;
+ if (startDate != null)
+ {
+ trigger.setStartTime(startDate) ;
+ }
+ if (endDate != null)
+ {
+ trigger.setEndTime(endDate) ;
+ }
+ return new SchedulerJob(name, listener, trigger, properties) ;
+ }
+
+ /**
+ * Create a job based on cron.
+ * @param name The name for the job.
+ * @param listener The listener to fire on schedule.
+ * @param cronExpression The cron expression.
+ * @param startDate The start date of the trigger or null if not constrained.
+ * @param endDate The end date of the trigger or null if not constrained.
+ * @param properties Any scheduler properties that may be required.
+ * @return The Scheduler Job managing the schedule.
+ * @throws ParseException for errors in the cron expression.
+ */
+ public static SchedulerJob createCronSchedulerJob(final String name, final SchedulerJobListener listener,
+ final String cronExpression, final Date startDate, final Date endDate, final Properties properties)
+ throws ParseException
+ {
+ final CronTrigger trigger = new CronTrigger(getJobName(), JOB_GROUP, cronExpression) ;
+ trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) ;
+ if (startDate != null)
+ {
+ trigger.setStartTime(startDate) ;
+ }
+ if (endDate != null)
+ {
+ trigger.setEndTime(endDate) ;
+ }
+ return new SchedulerJob(name, listener, trigger, properties) ;
+ }
+
+ /**
+ * Get the name of the next job.
+ * @return The job name.
+ */
+ private static String getJobName()
+ {
+ final long id ;
+ synchronized(SchedulerJob.class)
+ {
+ id = ++jobCounter ;
+ }
+ return JOB_NAME + id ;
+ }
+
+ /**
+ * The scheduled job for executing the listener.
+ * @author kevin
+ */
+ public static class ESBScheduledJob implements StatefulJob
+ {
+ /**
+ * Execute the current job.
+ */
+ public void execute(final JobExecutionContext jobExecutionContext)
+ throws JobExecutionException
+ {
+ final JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap() ;
+ final SchedulerJobListener listener = (SchedulerJobListener) jobDataMap.get(SchedulerJobListener.class.getName()) ;
+ final ClassLoader tcc = (ClassLoader)jobDataMap.get(ClassLoader.class.getName()) ;
+
+ final Thread thread = Thread.currentThread() ;
+ final ClassLoader currentClassLoader = thread.getContextClassLoader() ;
+ thread.setContextClassLoader(tcc) ;
+ try
+ {
+ listener.onSchedule() ;
+ }
+ catch (final SchedulingException se)
+ {
+ final JobExecutionException jobException = new JobExecutionException("Scheduling exception on " + jobExecutionContext.getTrigger().getName()) ;
+ jobException.initCause(se) ;
+ throw jobException ;
+ }
+ catch (final Throwable th)
+ {
+ final JobExecutionException jobException = new JobExecutionException("Unexpected exception on " + jobExecutionContext.getTrigger().getName()) ;
+ jobException.initCause(th) ;
+ throw jobException ;
+ }
+ finally
+ {
+ thread.setContextClassLoader(currentClassLoader) ;
+ }
+ }
+ }
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJobListener.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJobListener.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJobListener.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJobListener.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,36 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+/**
+ * Interface used to register scheduled resource listeners with the lifecycle.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+public interface SchedulerJobListener
+{
+ /**
+ * Handle the scheduled event.
+ *
+ * @throws SchedulingException For any errors occurring during the scheduled event.
+ */
+ public void onSchedule()
+ throws SchedulingException ;
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerResource.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerResource.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerResource.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerResource.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,307 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+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.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.quartz.JobDetail;
+import org.quartz.ObjectAlreadyExistsException;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.impl.StdSchedulerFactory;
+
+/**
+ * Scheduler resource tied to the lifecycle.
+ */
+public class SchedulerResource
+{
+ /**
+ * The logger for this class.
+ */
+ private static Logger LOGGER = Logger.getLogger(SchedulerResource.class);
+
+ /**
+ * The lifecycle resource factory.
+ */
+ private static final LifecycleResourceFactory<SchedulerResource> lifecycleSchedulerFactory = new SchedulerFactory() ;
+ /**
+ * Lifecycle schedulers.
+ */
+ private static final LifecycleResource<SchedulerResource> lifecycleSchedulerResource =
+ new LifecycleResource<SchedulerResource>(lifecycleSchedulerFactory, LifecyclePriorities.SCHEDULE_RESOURCE_PRIORITY) ;
+
+ /**
+ * The instance name property.
+ */
+ public static final String INSTANCE_NAME = "org.quartz.scheduler.instanceName" ;
+ /**
+ * The thread name property.
+ */
+ public static final String THREAD_NAME = "org.quartz.scheduler.threadName" ;
+ /**
+ * The thread count property.
+ */
+ public static final String THREAD_COUNT = "org.quartz.threadPool.threadCount" ;
+
+ /**
+ * The quartz scheduler associated with this resource.
+ */
+ private Scheduler scheduler ;
+
+ private SchedulerResource()
+ {
+ }
+
+ /**
+ * Start a trigger on the contextualised resource.
+ * @param trigger The trigger to enable.
+ * @param jobDetail The details of the job.
+ * @param properties The properties for the scheduler.
+ * @throws SchedulingException For any errors.
+ *
+ * Note that there is only one scheduler in force per scheduled esb artifact and, therefore,
+ * the first invocation will create the scheduler. We may support multiple schedulers at a later
+ * point in time.
+ */
+ synchronized void start(final Trigger trigger, final JobDetail jobDetail, final Properties properties)
+ throws SchedulingException
+ {
+ initScheduler(properties) ;
+ try
+ {
+ try
+ {
+ scheduler.scheduleJob(jobDetail, trigger) ;
+ }
+ catch (final ObjectAlreadyExistsException oaee)
+ {
+ scheduler.resumeTrigger(trigger.getName(), trigger.getGroup()) ;
+ }
+ }
+ catch (final SchedulerException se)
+ {
+ throw new SchedulingException("Failed to start scheduled job", se) ;
+ }
+ }
+
+ /**
+ * Pause a trigger on the contextualised resource.
+ * @param trigger The trigger to pause.
+ * @throws SchedulingException For any errors.
+ */
+ synchronized void pause(final Trigger trigger)
+ throws SchedulingException
+ {
+ if (scheduler != null)
+ {
+ try
+ {
+ if (scheduler.isShutdown())
+ {
+ throw new SchedulingException("Scheduler has been shutdown") ;
+ }
+ scheduler.pauseTrigger(trigger.getName(), trigger.getGroup()) ;
+ }
+ catch (final SchedulerException se)
+ {
+ throw new SchedulingException("Failed to pause scheduled job", se) ;
+ }
+ }
+ }
+
+ /**
+ * Destroy a trigger on the contextualised resource.
+ * @param trigger The trigger to destroy.
+ * @throws SchedulingException For any errors.
+ */
+ synchronized void destroy(final Trigger trigger)
+ throws SchedulingException
+ {
+ if (scheduler != null)
+ {
+ try
+ {
+ if (scheduler.isShutdown())
+ {
+ throw new SchedulingException("Scheduler has been shutdown") ;
+ }
+ scheduler.unscheduleJob(trigger.getName(), trigger.getGroup()) ;
+ }
+ catch (final SchedulerException se)
+ {
+ throw new SchedulingException("Failed to destroy scheduled job", se) ;
+ }
+ }
+ }
+
+ /**
+ * Shutdown the contextualised resource.
+ * @throws SchedulingException For any errors.
+ */
+ synchronized void shutdown()
+ throws SchedulingException
+ {
+ if (scheduler != null)
+ {
+ try
+ {
+ if (!scheduler.isShutdown())
+ {
+ scheduler.shutdown() ;
+ }
+ }
+ catch (final SchedulerException se)
+ {
+ throw new SchedulingException("Failed to shutdown scheduler", se) ;
+ }
+ }
+ }
+
+ /**
+ * Initialise the scheduler if necessary.
+ * @param properties The properties used to create a scheduler.
+ */
+ private void initScheduler(final Properties properties)
+ throws SchedulingException
+ {
+ if (scheduler == null)
+ {
+ final InputStream quartzProperties = ClassUtil.getResourceAsStream("quartz.properties", SchedulerResource.class) ;
+
+ if(quartzProperties == null)
+ {
+ throw new SchedulingException("Failed to locate the default scheduling properties") ;
+ }
+
+ final Properties defaultProperties = new Properties();
+ try
+ {
+ defaultProperties.load(quartzProperties) ;
+ }
+ catch (final IOException ioe)
+ {
+ throw new SchedulingException("Failed to load the default scheduling properties") ;
+ }
+
+ if(properties != null)
+ {
+ defaultProperties.putAll(properties) ;
+ }
+
+ final String name = "ESBScheduler:" + getDeploymentName() ;
+ defaultProperties.put(INSTANCE_NAME, name) ;
+ defaultProperties.put(THREAD_NAME, name) ;
+ if (!defaultProperties.containsKey(THREAD_COUNT))
+ {
+ defaultProperties.put(THREAD_COUNT, "1") ;
+ }
+ final Scheduler scheduler ;
+ try
+ {
+ scheduler = new StdSchedulerFactory(defaultProperties).getScheduler();
+ scheduler.start() ;
+ }
+ catch (final SchedulerException se)
+ {
+ throw new SchedulingException("Failed to initialise the scheduler", se) ;
+ }
+ this.scheduler = scheduler ;
+ }
+ }
+
+ /**
+ * Create a name associated with this deployment.
+ * @return The deployment name.
+ */
+ private String getDeploymentName()
+ {
+ final LifecycleResourceManager lifecycleResourceManager = LifecycleResourceManager.getSingleton() ;
+ final String deployment = lifecycleResourceManager.getIdentity() ;
+ return deployment ;
+ }
+
+ /**
+ * Get the scheduler resource.
+ * @return The scheduler resource.
+ * @throws LifecycleResourceException for errors acquiring the resource.
+ */
+ static SchedulerResource getSchedulerResource()
+ throws SchedulingException
+ {
+ try
+ {
+ return lifecycleSchedulerResource.getLifecycleResource() ;
+ }
+ catch (final LifecycleResourceException lre)
+ {
+ throw new SchedulingException("Failed to obtain the contextualised scheduler resource", lre) ;
+ }
+ }
+
+ /**
+ * The lifecycle resource factory
+ * @author kevin
+ */
+ private static class SchedulerFactory implements LifecycleResourceFactory<SchedulerResource>
+ {
+ /**
+ * 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 SchedulerResource createLifecycleResource(final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ return new SchedulerResource() ;
+ }
+
+ /**
+ * 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 SchedulerResource resource, final String lifecycleIdentity)
+ throws LifecycleResourceException
+ {
+ LOGGER.debug("Shutting down scheduler for identity " + lifecycleIdentity) ;
+ try
+ {
+ resource.shutdown() ;
+ }
+ catch (final SchedulingException se)
+ {
+ throw new LifecycleResourceException("Failed to shutdown the contextualised scheduler resource") ;
+ }
+ }
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/quartz.properties
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/quartz.properties 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/schedule/quartz.properties 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,17 +1,14 @@
# Default ESB Quartz Properties file.
#
-org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
-org.quartz.threadPool.threadCount = 2
org.quartz.threadPool.threadPriority = 5
-org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
-org.quartz.jobStore.misfireThreshold = 60000
+org.quartz.jobStore.misfireThreshold = 1
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/AbstractRegistryInterceptor.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/services/registry/AbstractRegistryInterceptor.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/AbstractRegistryInterceptor.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/AbstractRegistryInterceptor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,59 @@
+/*
+* 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.services.registry;
+
+/**
+ * An abstract registry interceptor for managing the registry assignment.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public abstract class AbstractRegistryInterceptor implements RegistryInterceptor
+{
+ /**
+ * The next registry or interceptor in the chain.
+ */
+ private Registry registry ;
+
+ /**
+ * Initialise the registry or interceptor that is next in the chain.
+ * @param registry The next entry in the chain or null if dismantling.
+ */
+ public synchronized void setRegistry(final Registry registry)
+ {
+ this.registry = registry ;
+ }
+
+ /**
+ * Get the next registry or interceptor in the chain.
+ * @return The next registry or interceptor in the chain.
+ * @throws RegistryException If the chain has been dismantled.
+ */
+ protected synchronized Registry getRegistry()
+ throws RegistryException
+ {
+ if (registry == null)
+ {
+ throw new RegistryException("Registry has been reconfigured and is no longer valid") ;
+ }
+ return registry ;
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -21,8 +21,11 @@
*/
package org.jboss.soa.esb.services.registry;
+import java.util.List;
+
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.util.ClassUtil;
@@ -37,25 +40,66 @@
private static Logger logger = Logger.getLogger(RegistryFactory.class);
private static Registry singleton;
+ /**
+ * The current registry implementation.
+ */
+ private static Registry currentRegistry ;
+ /**
+ * The interceptors applied to the registry.
+ */
+ private static RegistryInterceptor[] interceptors ;
+ /**
+ * Set the singleton. Any existing instance will be overwritten.
+ *
+ * @param registry
+ */
+
public static synchronized void setRegistry(Registry registry)
{
- singleton = registry;
+ currentRegistry = registry;
+ singleton = configureInterceptors(registry) ;
}
+/**
+ * Get the singleton.
+ *
+ * @return the singleton or <code>null</code> if one has not been created.
+ */
+
+ public static synchronized Registry getRegistrySingleton() {
+ return singleton;
+ }
- public static Registry getRegistry() throws RegistryException {
- // no synchronized block as there should be a service that initializes this
+ /**
+ * Obtain the current registry singleton or create a new instance if one
+ * is not available. This will assign the singleton as well.
+ *
+ * @return the singleton
+ * @throws RegistryException
+ */
+
+ public static synchronized Registry getRegistry() throws RegistryException {
if (singleton != null) {
return singleton;
}
-
- return createRegistry();
+ setRegistry(createRegistry());
+ return singleton ;
}
- public static Registry createRegistry()
+ /**
+ * Create a new registry (singleton) or return a pre-existing instance.
+ *
+ * @return the registry singleton
+ * @throws RegistryException
+ */
+
+ public static synchronized Registry createRegistry()
throws RegistryException
{
+ if (currentRegistry != null)
+ return currentRegistry;
+
Registry registry = null;
String className = Configuration.getRegistryImplementationClass();
logger.log(Level.DEBUG, "Going to load " + className);
@@ -74,12 +118,142 @@
}
catch (Exception e)
{
- e.printStackTrace();
-
throw new RegistryException("Invocation exception. "
+ e.getLocalizedMessage(), e);
}
+ currentRegistry = registry;
+
return registry;
}
+
+ /**
+ * Configure the interceptors around the registry
+ * @return The intercepted registry.
+ */
+ private static Registry configureInterceptors(final Registry registry)
+ {
+ if (interceptors != null)
+ {
+ final int numInterceptors = interceptors.length ;
+ for(int count = 0 ; count < numInterceptors ; count++)
+ {
+ interceptors[count].setRegistry(null) ;
+ }
+ interceptors = null ;
+ }
+
+ if (registry == null)
+ {
+ return null ;
+ }
+
+ final String registryInterceptorConfig = Configuration.getRegistryInterceptors() ;
+ final String[] registryInterceptorNames = (registryInterceptorConfig == null ? null : registryInterceptorConfig.split(",")) ;
+ final int numInterceptors = (registryInterceptorNames == null ? 0 : registryInterceptorNames.length) ;
+ final RegistryInterceptor[] registryInterceptors = new RegistryInterceptor[numInterceptors + 1] ;
+
+ Registry current = registry ;
+ try
+ {
+ for(int count = numInterceptors ; count > 0 ; count--)
+ {
+ final Class interceptorClass ;
+ try
+ {
+ interceptorClass = ClassUtil.forName(registryInterceptorNames[count-1].trim(), RegistryFactory.class) ;
+ }
+ catch (final ClassNotFoundException cnfe)
+ {
+ throw new RegistryException("Failed to instantiate registry interceptor, disabling all interceptors", cnfe) ;
+ }
+ if (!RegistryInterceptor.class.isAssignableFrom(interceptorClass))
+ {
+ throw new RegistryException("Registry interceptor does not implement RegistryInterceptor interface: " + interceptorClass.getName()) ;
+ }
+ final Object interceptor ;
+ try
+ {
+ interceptor = interceptorClass.newInstance() ;
+ }
+ catch (final Throwable th)
+ {
+ throw new RegistryException("Failed to instantiate registry interceptor", th) ;
+ }
+ final RegistryInterceptor registryInterceptor = (RegistryInterceptor)interceptor ;
+ registryInterceptor.setRegistry(current) ;
+ registryInterceptors[count] = registryInterceptor ;
+ current = registryInterceptor ;
+ }
+ }
+ catch (final RegistryException re)
+ {
+ for(int count = 1 ; count <= numInterceptors ; count++)
+ {
+ final RegistryInterceptor interceptor = registryInterceptors[count] ;
+ if (interceptor != null)
+ {
+ interceptor.setRegistry(null) ;
+ }
+ }
+ logger.error("Failed to create registry interceptors, falling back to registry implementation", re) ;
+ return registry ;
+ }
+ final HeadRegistryInterceptor headInterceptor = new HeadRegistryInterceptor() ;
+ headInterceptor.setRegistry(current) ;
+ registryInterceptors[0] = headInterceptor ;
+ interceptors = registryInterceptors ;
+ return headInterceptor ;
+ }
+
+ /**
+ * Registry Interceptor that throws an exception if a registry is used after it has been disabled.
+ * @author <a href='Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+ private static final class HeadRegistryInterceptor extends AbstractRegistryInterceptor
+ {
+ public List<String> findAllServices() throws RegistryException
+ {
+ return getRegistry().findAllServices() ;
+ }
+
+ public EPR findEPR(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ return getRegistry().findEPR(serviceCategoryName, serviceName) ;
+ }
+
+ public List<EPR> findEPRs(final String serviceCategoryName, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ return getRegistry().findEPRs(serviceCategoryName, serviceName) ;
+ }
+
+ public List<String> findServices(final String serviceCategoryName)
+ throws RegistryException
+ {
+ return getRegistry().findServices(serviceCategoryName) ;
+ }
+
+ public void registerEPR(final String serviceCategoryName, final String serviceName,
+ final String serviceDescription, final EPR epr, final String eprDescription)
+ throws RegistryException
+ {
+ getRegistry().registerEPR(serviceCategoryName, serviceName,
+ serviceDescription, epr, eprDescription) ;
+ }
+
+ public void unRegisterEPR(final String serviceCategoryName, final String serviceName,
+ final EPR epr)
+ throws RegistryException, ServiceNotFoundException
+ {
+ getRegistry().unRegisterEPR(serviceCategoryName, serviceName, epr) ;
+ }
+
+ public void unRegisterService(final String category, final String serviceName)
+ throws RegistryException, ServiceNotFoundException
+ {
+ getRegistry().unRegisterService(category, serviceName) ;
+ }
+ }
}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryInterceptor.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryInterceptor.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryInterceptor.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/src/org/jboss/soa/esb/services/registry/RegistryInterceptor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,38 @@
+/*
+* 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.services.registry;
+
+/**
+ * Interface implemented by interceptors added to the underlying registry.
+ *
+ * These interceptors will provide additional functionality such as caching, InVm etc.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public interface RegistryInterceptor extends Registry
+{
+ /**
+ * Initialise the registry or interceptor that is next in the chain.
+ * @param registry The next entry in the chain or null if dismantling.
+ */
+ public void setRegistry(final Registry registry) ;
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -120,6 +120,7 @@
<pathelement location="${basedir}/resources/etc"/>
<!-- using instrumented code for code coverage -->
<pathelement location="${org.jboss.esb.module.classes.instr.dir}"/>
+ <pathelement location="${org.jboss.esb.module.src.dir}"/>
<pathelement location="${org.jboss.esb.tests.classes.dir}"/>
<!-- Need the tests src folder because there may be non-compiled test resources -->
<pathelement location="${org.jboss.esb.module.tests.src.dir}"/>
@@ -200,6 +201,7 @@
<classpath>
<!-- using instrumented code for code coverage -->
<pathelement location="${org.jboss.esb.module.classes.instr.dir}"/>
+ <pathelement location="${org.jboss.esb.module.src.dir}"/>
<pathelement location="${org.jboss.esb.tests.classes.dir}"/>
<!-- Need the tests src folder because there may be non-compiled test resources -->
<pathelement location="${org.jboss.esb.module.tests.src.dir}"/>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,316 @@
+/*
+ * 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.couriers;
+
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.naming.Context;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.couriers.CourierTransportException;
+import org.jboss.soa.esb.helpers.NamingContextPool;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockejb.jms.MockQueue;
+import org.mockejb.jms.QueueConnectionFactoryImpl;
+import org.mockejb.jndi.MockContextFactory;
+
+/**
+ * JmsCourier unit tests.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class JmsCourierUnitTest
+{
+ private static final String CONNECTION_FACTORY = "ConnectionFactory" ;
+ private static final String QUEUE_NAME = "failQueue" ;
+
+ private JMSEpr testEPR ;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ MockContextFactory.setAsInitial();
+
+ final Context ctx = NamingContextPool.getNamingContext(null);
+ try
+ {
+ ctx.rebind(CONNECTION_FACTORY, new MockQueueConnectionFactory());
+ ctx.rebind(QUEUE_NAME, new MockQueue(QUEUE_NAME));
+ }
+ finally
+ {
+ NamingContextPool.releaseNamingContext(ctx) ;
+ }
+ testEPR = new JMSEpr(JMSEpr.QUEUE_TYPE, QUEUE_NAME, CONNECTION_FACTORY) ;
+ testEPR.getAddr().addExtension(Context.INITIAL_CONTEXT_FACTORY, System.getProperty(Context.INITIAL_CONTEXT_FACTORY)) ;
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ MockContextFactory.revertSetAsInitial();
+ }
+
+ @Test(timeout=10000)
+ public void testDelivery()
+ throws Exception
+ {
+ final JmsCourier courier = new JmsCourier(testEPR) ;
+ try
+ {
+ courier.deliver(MessageFactory.getInstance().getMessage()) ;
+ fail("Expected to receive a CourierTransportException") ;
+ }
+ catch (final CourierTransportException cte) {} // expected
+ }
+
+ @Test(timeout=10000)
+ public void testPickup()
+ throws Exception
+ {
+ final JmsCourier courier = new JmsCourier(testEPR, true) ;
+ try
+ {
+ courier.pickup(10) ;
+ fail("Expected to receive a CourierTransportException") ;
+ }
+ catch (final CourierTransportException cte) {} // expected
+ }
+
+ private static final class MockQueueConnectionFactory extends QueueConnectionFactoryImpl
+ {
+ @Override
+ public QueueConnection createQueueConnection() throws JMSException
+ {
+ return (QueueConnection)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {QueueConnection.class},
+ new MockQueueExceptionHandlerInvocationHandler(super.createQueueConnection())) ;
+ }
+ }
+
+ private static final class MockQueueExceptionHandlerInvocationHandler implements InvocationHandler
+ {
+ private final QueueConnection queueConnection ;
+ private ExceptionListener exceptionListener ;
+
+ MockQueueExceptionHandlerInvocationHandler(final QueueConnection queueConnection)
+ {
+ this.queueConnection = queueConnection ;
+ }
+
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
+ throws Throwable
+ {
+ final String methodName = method.getName() ;
+ if ("setExceptionListener".equals(methodName))
+ {
+ exceptionListener = (ExceptionListener)args[0] ;
+ return null ;
+ }
+ else if ("getExceptionListener".equals(methodName))
+ {
+ return exceptionListener ;
+ }
+ else
+ {
+ final Object response = method.invoke(queueConnection, args) ;
+ if (response instanceof QueueSession)
+ {
+ final QueueSession queueSession = (QueueSession)response ;
+ return (QueueSession)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {QueueSession.class},
+ new MockQueueSessionInvocationHandler(queueSession)) ;
+ }
+ else
+ {
+ return response ;
+ }
+ }
+ }
+ }
+
+ private static final class MockQueueSessionInvocationHandler implements InvocationHandler
+ {
+ private final QueueSession queueSession ;
+
+ MockQueueSessionInvocationHandler(final QueueSession queueSession)
+ {
+ this.queueSession = queueSession ;
+ }
+
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
+ throws Throwable
+ {
+ final String methodName = method.getName() ;
+ if ("recover".equals(methodName))
+ {
+ return null ;
+ }
+ else if ("createConsumer".equals(methodName))
+ {
+ return new MockFailMessageConsumer() ;
+ }
+ else if ("createProducer".equals(methodName))
+ {
+ return new MockFailMessageProducer() ;
+ }
+ else
+ {
+ return method.invoke(queueSession, args) ;
+ }
+ }
+ }
+
+ private static final class MockFailMessageConsumer implements MessageConsumer
+ {
+ public void close() throws JMSException {}
+
+ public MessageListener getMessageListener()
+ throws JMSException
+ {
+ return null;
+ }
+
+ public String getMessageSelector()
+ throws JMSException
+ {
+ return null;
+ }
+
+ public Message receive()
+ throws JMSException
+ {
+ throw new JMSException("Deliberate receive exception") ;
+ }
+
+ public Message receive(long arg0)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate receive exception") ;
+ }
+
+ public Message receiveNoWait()
+ throws JMSException
+ {
+ throw new JMSException("Deliberate receive exception") ;
+ }
+
+ public void setMessageListener(MessageListener arg0) throws JMSException {}
+ }
+
+ private static final class MockFailMessageProducer implements MessageProducer
+ {
+ public void close() throws JMSException {}
+
+ public int getDeliveryMode()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public Destination getDestination()
+ throws JMSException
+ {
+ return null;
+ }
+
+ public boolean getDisableMessageID()
+ throws JMSException
+ {
+ return false;
+ }
+
+ public boolean getDisableMessageTimestamp()
+ throws JMSException
+ {
+ return false;
+ }
+
+ public int getPriority()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public long getTimeToLive()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public void send(Message arg0)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate send exception") ;
+ }
+
+ public void send(Destination arg0, Message arg1)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate send exception") ;
+ }
+
+ public void send(Message arg0, int arg1, int arg2, long arg3)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate send exception") ;
+ }
+
+ public void send(Destination arg0, Message arg1, int arg2, int arg3, long arg4)
+ throws JMSException
+ {
+ }
+
+ public void setDeliveryMode(int arg0) throws JMSException {}
+
+ public void setDisableMessageID(boolean arg0) throws JMSException {}
+
+ public void setDisableMessageTimestamp(boolean arg0) throws JMSException {}
+
+ public void setPriority(int arg0) throws JMSException {}
+
+ public void setTimeToLive(long arg0) throws JMSException {}
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(JmsCourierUnitTest.class);
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -33,6 +33,7 @@
import org.jboss.soa.esb.common.ModulePropertyManager;
import org.jboss.soa.esb.services.registry.Registry;
import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import com.arjuna.common.util.propertyservice.PropertyManager;
@@ -132,18 +133,18 @@
/* (non-Javadoc)
* @see org.jboss.soa.esb.services.registry.Registry#unRegisterService(java.lang.String, java.lang.String)
*/
- public void unRegisterService(String category, String serviceName) throws RegistryException {
+ public void unRegisterService(String category, String serviceName) throws RegistryException, ServiceNotFoundException {
unRegisterEPR(category, serviceName, null);
}
/* (non-Javadoc)
* @see org.jboss.soa.esb.services.registry.Registry#unRegisterEPR(java.lang.String, java.lang.String, org.jboss.soa.esb.addressing.EPR)
*/
- public void unRegisterEPR(String serviceCategoryName, String serviceName, EPR epr) throws RegistryException {
+ public void unRegisterEPR(String serviceCategoryName, String serviceName, EPR epr) throws RegistryException, ServiceNotFoundException {
int indexOf = repository.indexOf(new RepositoryEntry(serviceCategoryName, serviceName, null, epr, null));
if (indexOf == -1) {
- throw new RegistryException("Registry entry [" + serviceCategoryName + "][" + serviceName + "] not found.");
+ throw new ServiceNotFoundException("Registry entry [" + serviceCategoryName + "][" + serviceName + "] not found.");
}
repository.remove(indexOf);
}
@@ -191,13 +192,13 @@
* @see org.jboss.soa.esb.services.registry.Registry#findEPR(java.lang.String, java.lang.String)
*/
public EPR findEPR(String serviceCategoryName, String serviceName)
- throws RegistryException {
+ throws RegistryException, ServiceNotFoundException {
for (RepositoryEntry entry : repository) {
if (serviceCategoryName.equals(entry.serviceCategoryName) && serviceName.equals(entry.serviceName)) {
return entry.epr;
}
}
- return null;
+ throw new ServiceNotFoundException("Registry entry [" + serviceCategoryName + "][" + serviceName + "] not found.");
}
public static class RepositoryEntry {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistryUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistryUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistryUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -28,9 +28,8 @@
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.services.registry.Registry;
import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
/**
* MockRegistry Unit Test.
@@ -43,14 +42,12 @@
MockRegistry.install();
assertEquals(MockRegistry.class.getName(), MockRegistry.regPropManager.getProperty(Environment.REGISTRY_IMPEMENTATION_CLASS));
- Registry registry = RegistryFactory.getRegistry();
- assertTrue(registry instanceof MockRegistry);
MockRegistry.uninstall();
assertNotSame(MockRegistry.class.getName(), MockRegistry.regPropManager.getProperty(Environment.REGISTRY_IMPEMENTATION_CLASS));
}
- public void test_features() throws RegistryException {
+ public void test_features() throws RegistryException, ServiceNotFoundException {
MockRegistry registry = new MockRegistry();
EPR epr = new EPR();
List<String> services = new ArrayList<String>();
@@ -81,7 +78,7 @@
try {
registry.unRegisterService("cat2", "cat1-service2");
fail("Expected RegistryException for unknown service.");
- } catch(RegistryException e) {
+ } catch(ServiceNotFoundException e) {
//OK
}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JMSRouterUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JMSRouterUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JMSRouterUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JMSRouterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,315 @@
+/*
+ * 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.routing;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.Context;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.NamingContextPool;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockejb.jms.MockQueue;
+import org.mockejb.jms.QueueConnectionFactoryImpl;
+import org.mockejb.jndi.MockContextFactory;
+
+/**
+ * JMSRouter unit tests.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class JMSRouterUnitTest
+{
+ private static final String CONNECTION_FACTORY = "ConnectionFactory" ;
+ private static final String QUEUE_NAME = "failQueue" ;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ MockContextFactory.setAsInitial();
+
+ final Context ctx = NamingContextPool.getNamingContext(null);
+ try
+ {
+ ctx.rebind(CONNECTION_FACTORY, new MockQueueConnectionFactory());
+ ctx.rebind(QUEUE_NAME, new MockQueue(QUEUE_NAME));
+ }
+ finally
+ {
+ NamingContextPool.releaseNamingContext(ctx) ;
+ }
+ System.setProperty(Environment.JNDI_SERVER_CONTEXT_FACTORY, System.getProperty(Context.INITIAL_CONTEXT_FACTORY)) ;
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ MockContextFactory.revertSetAsInitial();
+ }
+
+ @Test
+ public void testRetry()
+ throws Exception
+ {
+ final ConfigTree config = new ConfigTree("config") ;
+ config.setAttribute("jndiName", QUEUE_NAME);
+
+ final JMSRouter router = new JMSRouter(config) ;
+
+ assertEquals("Original connection count", 1, MockQueueConnectionFactory.queueConnectionCount) ;
+ assertEquals("Original session count", 1, MockQueueExceptionHandlerInvocationHandler.queueSessionCount) ;
+ assertEquals("Original producer count", 1, MockQueueSessionInvocationHandler.producerCount) ;
+
+ try
+ {
+ router.process(MessageFactory.getInstance().getMessage()) ;
+ fail("Expected to receive an ActionProcessingException") ;
+ }
+ catch (final ActionProcessingException ape) {} // expected
+
+ // Connection count changes as we fire the exception handler and this closes connections/sessions/producers
+ assertEquals("Original connection count", 2, MockQueueConnectionFactory.queueConnectionCount) ;
+ // session count should increment by one to reflect the second session created when handling the exception.
+ assertEquals("Original session count", 2, MockQueueExceptionHandlerInvocationHandler.queueSessionCount) ;
+ // One producer for setup, first failure and second retry.
+ assertEquals("Original producer count", 3, MockQueueSessionInvocationHandler.producerCount) ;
+ }
+
+ private static final class MockQueueConnectionFactory extends QueueConnectionFactoryImpl
+ {
+ static int queueConnectionCount ;
+
+ @Override
+ public QueueConnection createQueueConnection() throws JMSException
+ {
+ queueConnectionCount++ ;
+ return (QueueConnection)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {QueueConnection.class},
+ new MockQueueExceptionHandlerInvocationHandler(super.createQueueConnection())) ;
+ }
+ }
+
+ private static final class MockQueueExceptionHandlerInvocationHandler implements InvocationHandler
+ {
+ private final QueueConnection queueConnection ;
+ private ExceptionListener exceptionListener ;
+ static int queueSessionCount ;
+
+ MockQueueExceptionHandlerInvocationHandler(final QueueConnection queueConnection)
+ {
+ this.queueConnection = queueConnection ;
+ }
+
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
+ throws Throwable
+ {
+ final String methodName = method.getName() ;
+ if ("setExceptionListener".equals(methodName))
+ {
+ exceptionListener = (ExceptionListener)args[0] ;
+ return null ;
+ }
+ else if ("getExceptionListener".equals(methodName))
+ {
+ return exceptionListener ;
+ }
+ else
+ {
+ final Object response = method.invoke(queueConnection, args) ;
+ if (response instanceof QueueSession)
+ {
+ queueSessionCount++ ;
+ final QueueSession queueSession = (QueueSession)response ;
+ return (QueueSession)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {QueueSession.class},
+ new MockQueueSessionInvocationHandler(this, queueSession)) ;
+ }
+ else
+ {
+ return response ;
+ }
+ }
+ }
+
+ void fireExceptionListener(final JMSException exception)
+ {
+ if (exceptionListener != null)
+ {
+ exceptionListener.onException(exception) ;
+ }
+ }
+ }
+
+ private static final class MockQueueSessionInvocationHandler implements InvocationHandler
+ {
+ private final MockQueueExceptionHandlerInvocationHandler exceptionHandler ;
+ private final QueueSession queueSession ;
+ static int producerCount ;
+
+ MockQueueSessionInvocationHandler(final MockQueueExceptionHandlerInvocationHandler exceptionHandler, final QueueSession queueSession)
+ {
+ this.exceptionHandler = exceptionHandler ;
+ this.queueSession = queueSession ;
+ }
+
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
+ throws Throwable
+ {
+ final String methodName = method.getName() ;
+ if ("recover".equals(methodName))
+ {
+ return null ;
+ }
+ else if ("createProducer".equals(methodName))
+ {
+ producerCount++ ;
+ return new MockFailMessageProducer(exceptionHandler) ;
+ }
+ else if ("getAcknowledgeMode".equals(methodName))
+ {
+ return Integer.valueOf(Session.AUTO_ACKNOWLEDGE) ;
+ }
+ else if ("getTransacted".equals(methodName))
+ {
+ return Boolean.FALSE ;
+ }
+ else
+ {
+ return method.invoke(queueSession, args) ;
+ }
+ }
+ }
+
+ private static final class MockFailMessageProducer implements MessageProducer
+ {
+ private final MockQueueExceptionHandlerInvocationHandler exceptionHandler ;
+
+ public MockFailMessageProducer(final MockQueueExceptionHandlerInvocationHandler exceptionHandler)
+ {
+ this.exceptionHandler = exceptionHandler ;
+ }
+
+ public void close() throws JMSException {}
+
+ public int getDeliveryMode()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public Destination getDestination()
+ throws JMSException
+ {
+ return null;
+ }
+
+ public boolean getDisableMessageID()
+ throws JMSException
+ {
+ return false;
+ }
+
+ public boolean getDisableMessageTimestamp()
+ throws JMSException
+ {
+ return false;
+ }
+
+ public int getPriority()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public long getTimeToLive()
+ throws JMSException
+ {
+ return 0;
+ }
+
+ public void send(Message arg0)
+ throws JMSException
+ {
+ exception() ;
+ }
+
+ public void send(Destination arg0, Message arg1)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate send exception") ;
+ }
+
+ public void send(Message arg0, int arg1, int arg2, long arg3)
+ throws JMSException
+ {
+ throw new JMSException("Deliberate send exception") ;
+ }
+
+ private void exception()
+ throws JMSException
+ {
+ final JMSException exception = new JMSException("Deliberate send exception") ;
+ exceptionHandler.fireExceptionListener(exception) ;
+ throw exception ;
+ }
+
+ public void send(Destination arg0, Message arg1, int arg2, int arg3, long arg4)
+ throws JMSException
+ {
+ }
+
+ public void setDeliveryMode(int arg0) throws JMSException {}
+
+ public void setDisableMessageID(boolean arg0) throws JMSException {}
+
+ public void setDisableMessageTimestamp(boolean arg0) throws JMSException {}
+
+ public void setPriority(int arg0) throws JMSException {}
+
+ public void setTimeToLive(long arg0) throws JMSException {}
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(JMSRouterUnitTest.class);
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -145,11 +145,6 @@
msg.getHeader().getCall().setReplyTo( jmsEpr );
JMSRouter router = new JMSRouter( createConfigTree() );
router.setJMSReplyTo( jmsMessage, msg );
-
- Destination replyTo = jmsMessage.getJMSReplyTo();
- assertTrue( replyTo instanceof Queue );
- Queue replyToQueue = (Queue) replyTo;
- assertEquals( queueName , replyToQueue.getQueueName() );
}
@Test
@@ -164,11 +159,6 @@
msg.getHeader().getCall().setReplyTo( jmsEpr );
JMSRouter router = new JMSRouter( createConfigTree() );
router.setJMSReplyTo( jmsMessage, msg );
-
- Destination replyTo = jmsMessage.getJMSReplyTo();
- assertTrue( replyTo instanceof Topic );
- Topic replyToTopic = (Topic) replyTo;
- assertEquals( queueName , replyToTopic.getTopicName() );
}
@Test
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -31,7 +31,10 @@
import junit.framework.JUnit4TestAdapter;
+import org.jboss.soa.esb.addressing.PortReference;
import org.jboss.soa.esb.addressing.eprs.JMSEpr.AcknowledgeMode;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.couriers.CourierException;
import org.junit.Test;
@@ -42,12 +45,16 @@
*/
public class JMSEprUnitTest
{
+ private String defaultProvider = "default.test" ;
+ private String extensionProvider = "extension.test" ;
+ private String propertyJndi = "jndiurl.test" ;
private String expectedDestination = "/queue/test";
private String expectedConnectionFactory = "ConnectionFactory";
private String expectedDestinationType = JMSEpr.QUEUE_TYPE;
private String expectedSelector = "JMSCorrelationID=1000";
private static final boolean NON_PERSISTENT = false;
private static final boolean PERSISTENT = true;
+ private static final String JNDI_PREFIX = "jnp://" ;
private final Properties nullEnvironment = null;
@@ -187,6 +194,49 @@
}
@Test
+ public void generatedAddresses()
+ {
+ final String jndiServerUrl = System.getProperty(Environment.JNDI_SERVER_URL) ;
+ try
+ {
+ System.setProperty(Environment.JNDI_SERVER_URL, JNDI_PREFIX + defaultProvider) ;
+
+ final String queueName = "queueName" ;
+
+ // should default address to system property
+ final JMSEpr firstEpr = new JMSEpr(ONE_ONE_PROTOCOL, expectedDestinationType,
+ queueName, "connection", null, null, true, null, null, null, true) ;
+ assertEquals("System JNDI_SERVER_URL", "jms://" + defaultProvider + "/" + queueName, firstEpr.getAddr().getAddress()) ;
+
+ // should use Provider URL extension
+ final Properties environment = new Properties() ;
+ environment.setProperty(Context.PROVIDER_URL, JNDI_PREFIX + extensionProvider) ;
+ final JMSEpr secondEpr = new JMSEpr(ONE_ONE_PROTOCOL, expectedDestinationType,
+ queueName, "connection", environment, null, true, null, null, null, true) ;
+ assertEquals("Extension Context.PROVIDER_URL", "jms://" + extensionProvider + "/" + queueName, secondEpr.getAddr().getAddress()) ;
+
+ // should use jndi-URL property
+ environment.setProperty(JNDI_URL_TAG, JNDI_PREFIX + propertyJndi) ;
+ final JMSEpr thirdEpr = new JMSEpr(ONE_ONE_PROTOCOL, expectedDestinationType,
+ queueName, "connection", environment, null, true, null, null, null, true) ;
+ assertEquals("Extension Context.PROVIDER_URL", "jms://" + propertyJndi + "/" + queueName, thirdEpr.getAddr().getAddress()) ;
+ }
+ finally
+ {
+ if (jndiServerUrl != null)
+ {
+ System.setProperty(Environment.JNDI_SERVER_URL, jndiServerUrl) ;
+ }
+ else
+ {
+ final Properties properties = System.getProperties() ;
+ properties.remove(Environment.JNDI_SERVER_URL) ;
+ System.setProperties(properties) ;
+ }
+ }
+ }
+
+ @Test
public void acknowledgeEnumTest()
{
AcknowledgeMode ackMode = AcknowledgeMode.getAckMode( null );
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/common/tests/MockDataSource.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -91,4 +91,15 @@
this.loginTimeout = loginTimeout;
}
+
+ public boolean isWrapperFor(final Class<?> iface)
+ throws SQLException
+ {
+ return false ;
+ }
+
+ public <T> T unwrap(final Class<T> iface) throws SQLException
+ {
+ throw new SQLException("unwrap method not supported by this implementation") ;
+ }
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -20,9 +20,13 @@
package org.jboss.soa.esb.listeners;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import javax.xml.parsers.ParserConfigurationException;
+
import junit.framework.JUnit4TestAdapter;
import org.jboss.internal.soa.esb.util.StreamUtils;
@@ -32,6 +36,7 @@
import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.jboss.soa.esb.testutils.StringUtils;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -42,12 +47,12 @@
public class ScheduledListenerUnitTest {
@Test
- public void test() throws UnsupportedEncodingException {
+ public void test() throws UnsupportedEncodingException, IOException, SAXException, ParserConfigurationException {
ESBConfigUtil configUtil = new ESBConfigUtil(ScheduledListenerUnitTest.class.getResourceAsStream("scheduled-listener-config.xml"));
String actualListenerConfig = configUtil.getListenerConfig("simple-schedule-listener").toXml();
String expectedListenerConfig = StreamUtils.readStreamString(getClass().getResourceAsStream("scheduled-listener-config-configtree.xml"), "UTF-8");
- assertEquals(expectedListenerConfig, actualListenerConfig);
+ assertTrue("Service configuration", StringUtils.compareXMLContent(expectedListenerConfig, actualListenerConfig));
}
@Test
@@ -71,6 +76,7 @@
tree.setAttribute("listenerClass", listenerClass );
tree.setAttribute("my-prop", "1");
tree.setAttribute("scheduleidref", "1-sec-trigger");
+ tree.setAttribute("scheduleSimpleFrequency", "1000") ;
final ConfigTree action = new ConfigTree("action", tree);
action.setAttribute("action", "action");
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,32 +1,27 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
+ * 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.
+ * 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
+ * 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,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
package org.jboss.soa.esb.listeners.config;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
import junit.framework.TestCase;
-
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.soa.esb.ConfigurationException;
@@ -34,19 +29,23 @@
import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsBusDocument.JmsBus;
import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsMessageFilterDocument.JmsMessageFilter;
-import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsProviderType;
import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.testutils.FileUtil;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
/**
* Generator unit tests.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class GeneratorUnitTest extends TestCase {
-
+
private Logger log = Logger.getLogger( GeneratorUnitTest.class );
-
+
private File outdir = new File("test-outdir");
private File gatewayConfig;
private File awareConfig;
@@ -59,36 +58,36 @@
// OK
}
}
-
+
public void test_generate_badagrs() throws ConfigurationException, IOException {
test_generate_badargs(null, "null 'outdir' arg in method call");
test_generate_badargs(new File("build.xml"), "'outdir' exists, but is not a directory");
}
-
+
public void test_generate_files() throws ConfigurationException, IOException {
test_generate_files("jbossesb_config_01.xml");
test_generate_files("jbossesb_config_02.xml");
}
-
+
public void test_generate_files(String filename) throws ConfigurationException, IOException {
Generator generator = new Generator(getClass().getResourceAsStream(filename));
String expectedGatewayConfig = new String(StreamUtils.readStream(getClass().getResourceAsStream("jbossesb_config_01_gateways.xml"))).trim();
String expectedESBAwareConfig = new String(StreamUtils.readStream(getClass().getResourceAsStream("jbossesb_config_01_esbaware.xml"))).trim();
String actualGatewayConfig;
String actualESBAwareConfig;
-
+
expectedGatewayConfig = removeEOL(expectedGatewayConfig);
expectedESBAwareConfig = removeEOL(expectedESBAwareConfig);
-
+
generator.generate(outdir);
-
+
gatewayConfig = new File(outdir, Generator.ESB_CONFIG_GATEWAY_XML_FILE);
assertTrue(gatewayConfig.exists());
actualGatewayConfig = FileUtil.readTextFile(gatewayConfig);
log.debug("actual [" + removeEOL(actualGatewayConfig) + "]");
log.debug("expected[" + expectedGatewayConfig + "]");
assertEquals(expectedGatewayConfig, removeEOL(actualGatewayConfig));
-
+
awareConfig = new File(outdir, Generator.ESB_CONFIG_XML_FILE);
assertTrue(awareConfig.exists());
actualESBAwareConfig = FileUtil.readTextFile(awareConfig);
@@ -96,12 +95,12 @@
actualESBAwareConfig = removeEOL(actualESBAwareConfig);
boolean isIndentical = expectedESBAwareConfig.equals(actualESBAwareConfig);
log.debug("Strings identical=" + isIndentical);
- assertEquals(expectedESBAwareConfig, actualESBAwareConfig);
+ assertEquals(expectedESBAwareConfig, actualESBAwareConfig);
}
public void test_bad_base_listener_busref() throws ConfigurationException, IOException {
Generator generator = new Generator(getClass().getResourceAsStream("jbossesb_config_03.xml"));
-
+
try {
generator.generate(outdir);
fail("Expected ConfigurationException");
@@ -111,18 +110,18 @@
}
}
}
-
+
public static String removeEOL(String string) {
StringBuffer stringBuf = new StringBuffer(string.length());
for(int i = 0; i < string.length(); i++) {
char character = string.charAt(i);
-
+
if(character != '\r' && character != '\n') {
stringBuf.append(character);
}
}
-
+
return stringBuf.toString();
}
@@ -161,12 +160,12 @@
assertEquals("queue/B", listenerDestination.getDestName());
assertEquals(JmsMessageFilter.DestType.TOPIC, listenerDestination.getDestType());
assertEquals("service='Reconciliation'", listenerDestination.getSelector());
-
+
Listener untypedAwareListener = awareListeners.get(1);
assertEquals("Bank-Listener-Generic", untypedAwareListener.getName());
assertEquals("my-generic-bus", untypedAwareListener.getBusidref());
assertTrue(!untypedAwareListener.getIsGateway());
-
+
Service gatewayService = model.getService(gatewayListener);
Service awareService = model.getService(awareListener);
assertSame(gatewayService, awareService);
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,67 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import org.jboss.soa.esb.ConfigurationException;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for bug http://jira.jboss.com/jira/browse/JBESB-1993.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+public class JBESB_1993_UnitTest extends TestCase
+{
+ public void testActionNames()
+ throws Exception
+ {
+ runTest("JBESB_1993_action.xml", "Tried to register a duplicate action name.") ;
+ }
+
+ public void testServiceNames()
+ throws Exception
+ {
+ runTest("JBESB_1993_service.xml", "Service names must be unique within a category.") ;
+ }
+
+ private void runTest(final String resource, final String expected)
+ throws Exception
+ {
+ final InputStream resourceIs = getClass().getResourceAsStream(resource) ;
+ final ByteArrayOutputStream listenerBAOS = new ByteArrayOutputStream() ;
+ final ByteArrayOutputStream gatewayBAOS = new ByteArrayOutputStream() ;
+ final Generator generator = new Generator(resourceIs, listenerBAOS, gatewayBAOS) ;
+ try
+ {
+ generator.generate();
+ }
+ catch (final ConfigurationException ce)
+ {
+ if (!ce.getMessage().startsWith(expected))
+ {
+ throw ce ;
+ }
+ }
+ }
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,22 @@
+<?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="jms" connection-factory="ConnectionFactory">
+ <jms-bus busid="testBus">
+ <jms-message-filter dest-type="QUEUE" dest-name="XXX"/>
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service category="TestESB" name="TestService" description="Test Service">
+ <listeners>
+ <jms-listener name="testListener" busidref="testBus"/>
+ </listeners>
+ <actions>
+ <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+ <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+ </actions>
+ </service>
+ </services>
+</jbossesb>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,29 @@
+<?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="jms" connection-factory="ConnectionFactory">
+ <jms-bus busid="testBus">
+ <jms-message-filter dest-type="QUEUE" dest-name="XXX"/>
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service category="TestESB" name="TestService" description="Test Service">
+ <listeners>
+ <jms-listener name="testListener" busidref="testBus"/>
+ </listeners>
+ <actions>
+ <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+ </actions>
+ </service>
+ <service category="TestESB" name="TestService" description="Test Service">
+ <listeners>
+ <jms-listener name="testListener" busidref="testBus"/>
+ </listeners>
+ <actions>
+ <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+ </actions>
+ </service>
+ </services>
+</jbossesb>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539 (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,45 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.config.JBESB_539;
-
-import junit.framework.TestCase;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.testutils.ESBConfigUtil;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBESB_539_UnitTest extends TestCase {
-
- public void test() throws IOException, SAXException, ConfigurationException {
- ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config_01.xml"));
- ConfigTree myListenerConfig = configUtil.getGatewayConfig("My Listener");
- ConfigTree yourListenerConfig = configUtil.getListenerConfig("Your Listener");
-
- assertNotNull(myListenerConfig);
- assertEquals("My Listener", myListenerConfig.getAttribute("name"));
- assertNotNull(yourListenerConfig);
- assertEquals("Your Listener", yourListenerConfig.getAttribute("name"));
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/JBESB_539_UnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,45 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config.JBESB_539;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_539_UnitTest extends TestCase {
+
+ public void test() throws IOException, SAXException, ConfigurationException {
+ ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config_01.xml"));
+ ConfigTree myListenerConfig = configUtil.getGatewayConfig("My Listener");
+ ConfigTree yourListenerConfig = configUtil.getListenerConfig("Your Listener");
+
+ assertNotNull(myListenerConfig);
+ assertEquals("My Listener", myListenerConfig.getAttribute("name"));
+ assertNotNull(yourListenerConfig);
+ assertEquals("Your Listener", yourListenerConfig.getAttribute("name"));
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,27 +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>
- <jbr-provider name="jbr" protocol="http" host="localhost">
- <jbr-bus busid="http1" port="10909" />
- </jbr-provider>
- <jms-provider name="JMS" connection-factory="ConnectionFactory">
- <jms-bus busid="listenerBus">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/does_not_exist"/>
- </jms-bus>
- </jms-provider>
- </providers>
-
- <services>
- <service category="cat" name="name" description="blah" invmScope="GLOBAL">
- <listeners>
- <jbr-listener name="My Listener" busidref="http1" is-gateway="true" />
- <jms-listener name="Your Listener" busidref="listenerBus"/>
- </listeners>
- <actions>
- <action name="xxx" class="org.jboss.soa.esb.mock.MockAction" />
- </actions>
- </service>
- </services>
-
-</jbossesb>
\ No newline at end of file
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_539/config_01.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,27 @@
+<?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>
+ <jbr-provider name="jbr" protocol="http" host="localhost">
+ <jbr-bus busid="http1" port="10909" />
+ </jbr-provider>
+ <jms-provider name="JMS" connection-factory="ConnectionFactory">
+ <jms-bus busid="listenerBus">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/does_not_exist"/>
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service category="cat" name="name" description="blah" invmScope="GLOBAL">
+ <listeners>
+ <jbr-listener name="My Listener" busidref="http1" is-gateway="true" />
+ <jms-listener name="Your Listener" busidref="listenerBus"/>
+ </listeners>
+ <actions>
+ <action name="xxx" class="org.jboss.soa.esb.mock.MockAction" />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,41 +1 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- NOTE: DO NOT MODIFY
- This file was auto-generated.
--->
-<jbossesb-listeners parameterReloadSecs="180">
-<Bank-Listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation">
-<EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/>
-<action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">
- This is some complex..
- <!-- property -->
- value.
- <xxxx>
- boooo
- <yyyy/>
- </xxxx>
- Some CDATA data...
- </action>
-</Bank-Listener>
-<Bank-Listener-Generic listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation">
-<EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/>
-<action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">
- This is some complex..
- <!-- property -->
- value.
- <xxxx>
- boooo
- <yyyy/>
- </xxxx>
- Some CDATA data...
- </action>
-</Bank-Listener-Generic>
-<test-ftp-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest">
-<EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/>
-<action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/>
-</test-ftp-listener>
-<test-sql-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest">
-<EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/>
-<action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/>
-</test-sql-listener>
-</jbossesb-listeners>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" name="Bank-Listener" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" persistent="true" protocol="jms" transacted="false"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" ma!
xThreads="2" my-generic-listener="my-generic-listener#someattribvalue" name="Bank-Listener-Generic" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="OneWay" name="test-ftp-listener" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><a!
ction action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.Con
tentBasedRouter"/></listener><listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" mep="RequestResponse" name="test-sql-listener" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></listener></jbossesb-listeners>
\ No newline at end of file
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_gateways.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><Bank-JMS-Gateway acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><Bank-HTTP-Gateway gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol="http" maxThreads="1" service-description="Bank !
Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-gateways parameterReloadSecs="180"><listener acknowledge-mode="AUTO_ACKNOWLEDGE" connection-factory="com.xyz.provider.XYZConnectionFactory" destination-name="queue/A" destination-type="queue" gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener" is-gateway="true" jndi-URL="xyz://server1:9876" jndi-context-factory="com.xyz.provider.NamingContextFactory" jndi-pkg-prefix="com.xyz" maxThreads="1" message-selector="service='Reconciliation'" name="Bank-JMS-Gateway" persistent="true" protocol="jms" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation" transacted="false"/><listener gatewayClass="org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener" is-gateway="true" jbr-serverBindAddress="192.168.1.111" jbr-serverBindPort="8765" jbr-serverProtocol="http" maxThreads="1" name="Bank-HTTP-Gat!
eway" service-description="Bank Reconciliation Service" target-service-category="Bank" target-service-name="Reconciliation"/></jbossesb-gateways>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GroovyGatewayUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -63,20 +63,27 @@
config.setAttribute("script", "/org/jboss/soa/esb/listeners/gateway/testgateway.groovy");
groovyGateway = new MockGroovyGateway(config);
- groovyGateway.doInitialise();
- Thread thread = new Thread(new Runnable() {
- public void run() {
- groovyGateway.doRun();
- }
- });
- thread.start();
-
- Thread.sleep(2000);
- assertTrue("Is already stopped", (courier1.message == null));
- groovyGateway.stopped = true;
- Thread.sleep(2000);
- assertTrue("Is not stopped", (courier1.message != null));
- assertEquals("Hi there!", (String) courier1.message.getBody().get());
+ groovyGateway.initialise();
+ try
+ {
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ groovyGateway.doRun();
+ }
+ });
+ thread.start();
+
+ Thread.sleep(2000);
+ assertTrue("Is already stopped", (courier1.message == null));
+ groovyGateway.stopped = true;
+ Thread.sleep(2000);
+ assertTrue("Is not stopped", (courier1.message != null));
+ assertEquals("Hi there!", (String) courier1.message.getBody().get());
+ }
+ finally
+ {
+ groovyGateway.destroy() ;
+ }
}
// TODO: Fix build such that it can pick up the scripts from the src folder.
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListenerUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -101,11 +101,11 @@
} catch(ManagedLifecycleException e) {}
// Initialise...
- listener.doInitialise();
+ listener.initialise();
// try initialising again...
try {
- listener.doInitialise();
+ listener.initialise();
fail("Expected ManagedLifecycleException");
} catch(ManagedLifecycleException e) {}
@@ -116,7 +116,7 @@
} catch(ManagedLifecycleException e) {}
// Start...
- listener.doStart();
+ listener.start();
// try starting again...
try {
@@ -125,11 +125,11 @@
} catch(ManagedLifecycleException e) {}
// Stop...
- listener.doStop();
+ listener.stop();
// try stopping again...
try {
- listener.doStop();
+ listener.stop();
fail("Expected ManagedLifecycleException");
} catch(ManagedLifecycleException e) {}
@@ -195,8 +195,8 @@
listener = new JBossRemotingGatewayListener(config);
}
- listener.doInitialise();
- listener.doStart();
+ listener.initialise();
+ listener.start();
}
private void sendMessageToServer(String protocol, Object messagePayload) throws Throwable {
@@ -230,9 +230,9 @@
private void stopServer() throws ManagedLifecycleException {
if(listener != null && listener.isStarted()) {
try {
- listener.doStop();
+ listener.stop();
} finally {
- listener.doDestroy();
+ listener.destroy();
}
}
}
@@ -253,7 +253,7 @@
try {
listener = new JBossRemotingGatewayListener(config);
- listener.doInitialise();
+ listener.initialise();
fail("Expected a ManagedLifecycleException.");
} catch (ConfigurationException e) {
log.error(e);
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerIntegrationTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -115,26 +115,30 @@
RemoteGatewayListenerMock mock = createAndStartListener ( configTree, getCourierReturnValue );
- File inputDir = ftpServer.getLocalInputDir();
- String doneFileName = testFile.getName();
-
- //waitForFile( inputDir, doneFileName );
- //stopdoRun( mock );
- try {
- mock.onSchedule();
- } catch (SchedulingException e) {
- fail(e.getMessage());
- }
-
- File processedFile = new File ( inputDir, doneFileName );
- try
- {
- assertTrue ( processedFile.exists() );
+ try {
+ File inputDir = ftpServer.getLocalInputDir();
+ String doneFileName = testFile.getName();
+
+ //waitForFile( inputDir, doneFileName );
+ //stopdoRun( mock );
+ try {
+ mock.onSchedule();
+ } catch (SchedulingException e) {
+ fail(e.getMessage());
+ }
+
+ File processedFile = new File ( inputDir, doneFileName );
+ try
+ {
+ assertTrue ( processedFile.exists() );
+ }
+ finally
+ {
+ FtpTestUtil.deleteFile( processedFile );
+ }
+ } finally {
+ mock.destroy();
}
- finally
- {
- FtpTestUtil.deleteFile( processedFile );
- }
}
/**
@@ -238,7 +242,7 @@
{
final RemoteGatewayListenerMock mock = new RemoteGatewayListenerMock( configTree );
try {
- mock.doInitialise();
+ mock.initialise();
} catch (ManagedLifecycleException e) {
fail(e.getMessage());
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerIntegrationTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -79,7 +79,6 @@
boolean exception = false;
gateway.initialise();
- gateway.start();
try {
try
@@ -142,7 +141,6 @@
{
}
} finally {
- gateway.stop();
gateway.destroy();
}
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -182,7 +182,7 @@
* postDir="/upload"
*/
@Test //( timeout=3000 )
- public void doRun_PostDir_Different_From_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException
+ public void doRun_PostDir_Different_From_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException, SchedulingException
{
setAbsoluteInputDir();
setAbsolutePostDirToUploadDir();
@@ -195,11 +195,7 @@
try {
mock.onSchedule();
- } catch (SchedulingException e) {
- fail(e.getMessage());
- }
- try {
File processedFile = new File ( done, doneFileName );
try
{
@@ -221,7 +217,7 @@
* postDir="/input"
*/
@Test ( timeout=3000 )
- public void doRun_PostDir_Same_As_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException
+ public void doRun_PostDir_Same_As_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException, SchedulingException
{
setAbsoluteInputDir();
setAbsolutePostDirToInputDir();
@@ -234,11 +230,7 @@
try {
mock.onSchedule();
- } catch (SchedulingException e) {
- fail(e.getMessage());
- }
- try {
File processedFile = new File ( inputDir, doneFileName );
try
{
@@ -263,7 +255,7 @@
* Note. when this test runs a stacktrace will be displayed. This is expected.
*/
@Test ( timeout = 2000 )
- public void doRun_Negative() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException
+ public void doRun_Negative() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException, SchedulingException
{
setAbsoluteInputDir();
setAbsoluteErrorDir();
@@ -271,30 +263,26 @@
log.error( "The following exceptions are expected: " );
RemoteGatewayListenerMock mock = createAndStartListener ( configTree, getCourierReturnValue );
- File errorDir = ftpServer.getLocalErrorDir();
- String errorFileName = testFile.getName() + POST_ERROR_SUFFIX;
+ try {
+ File errorDir = ftpServer.getLocalErrorDir();
+ String errorFileName = testFile.getName() + POST_ERROR_SUFFIX;
- try {
- mock.onSchedule();
- } catch (SchedulingException e) {
- fail(e.getMessage());
- }
+ mock.onSchedule();
- try {
- File errorFile = new File ( errorDir, errorFileName );
- try
- {
- assertTrue ( errorFile.exists() );
- }
- finally
- {
- FtpTestUtil.deleteFile( errorFile );
- }
- } finally {
- mock.stop();
- mock.destroy();
- }
- }
+ File errorFile = new File ( errorDir, errorFileName );
+ try
+ {
+ assertTrue ( errorFile.exists() );
+ }
+ finally
+ {
+ FtpTestUtil.deleteFile( errorFile );
+ }
+ } finally {
+ mock.stop();
+ mock.destroy();
+ }
+ }
@Test
public void renameFile_In_Same_Directory() throws GatewayException
@@ -400,7 +388,11 @@
/* post error attributes */
configTree.setAttribute( ListenerTagNames.FILE_ERROR_DIR_TAG, remoteErrorDirName );
configTree.setAttribute( ListenerTagNames.FILE_ERROR_SFX_TAG, POST_ERROR_SUFFIX);
-
+ // Do not allow the background scheduler to fire before we run the tests.
+ // We should really be allowing it to fire so that we can test the normal operation.
+ configTree.setAttribute( ListenerTagNames.SCHEDULE_ID_REF, "idref") ;
+ configTree.setAttribute( ListenerTagNames.SCHEDULE_SIMPLE_FREQUENCY, "1000000000") ;
+ configTree.setAttribute( ListenerTagNames.SCHEDULE_SIMPLE_EXEC, "0") ;
return configTree;
}
@@ -431,15 +423,11 @@
* @param returnValueForCourier the return value for the getCourier method of the RemoteGatewayListenerMock object
* @return RemoteGatewayListenerMock Mock impl of a RemoteGatewayListener.
*/
- private RemoteGatewayListenerMock createAndStartListener ( ConfigTree configTree, boolean returnValueForCourier ) throws ConfigurationException, GatewayException, RegistryException
+ private RemoteGatewayListenerMock createAndStartListener ( ConfigTree configTree, boolean returnValueForCourier ) throws ConfigurationException, GatewayException, RegistryException, ManagedLifecycleException
{
final RemoteGatewayListenerMock mock = new RemoteGatewayListenerMock( configTree );
- try {
- mock.initialise();
- mock.start();
- } catch (ManagedLifecycleException e) {
- fail(e.getMessage());
- }
+ mock.initialise();
+ mock.start();
if(returnValueForCourier) {
MockCourierFactory.courierException = null;
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceInvokerCallUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceInvokerCallUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceInvokerCallUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceInvokerCallUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,297 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.message;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+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.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+/**
+ * Tests for Call modifications while invoking through ServiceInvoker.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class ServiceInvokerCallUnitTest
+{
+ private EPR deliverEPR ;
+ private EPR failEPR ;
+ private EPR pickupEPR ;
+ private JMSEpr jmsDeliverEPR ;
+ private MockCourier deliverCourier ;
+ private MockCourier failCourier ;
+ private Message responseMessage ;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ MockCourierFactory.install() ;
+ MockRegistry.install() ;
+
+ deliverEPR = new EPR(new URI("test:deliver")) ;
+ failEPR = new EPR(new URI("test:fail")) ;
+ pickupEPR = new EPR(new URI("test:pickup")) ;
+ jmsDeliverEPR = new JMSEpr(JMSEpr.QUEUE_TYPE, "deliver", "ConnectionFactory") ;
+
+ deliverCourier = new MockCourier(true);
+ failCourier = new MockCourier(false);
+ responseMessage = MessageFactory.getInstance().getMessage() ;
+ deliverCourier.pickupMessage = responseMessage ;
+
+ MockRegistry.register("test", "deliver", deliverEPR, deliverCourier);
+ MockRegistry.register("test", "fail", failEPR, failCourier);
+ MockRegistry.register("test", "jmsdeliver", jmsDeliverEPR, deliverCourier);
+
+ final EPR deadLetterEPR = new EPR(new URI("internal:DLQ")) ;
+ MockRegistry.register(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME, deadLetterEPR, deliverCourier);
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ MockRegistry.uninstall() ;
+ MockCourierFactory.uninstall() ;
+ }
+
+ @Test
+ public void testNullSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ final Message resp = si.deliverSync(message, 10) ;
+
+ assertEquals("Response message", resp, responseMessage) ;
+
+ assertNull("Call To EPR", message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testNonNullToSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ final Message resp = si.deliverSync(message, 10) ;
+
+ assertEquals("Response message", resp, responseMessage) ;
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testNonNullSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+ message.getHeader().getCall().setReplyTo(pickupEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ final Message resp = si.deliverSync(message, 10) ;
+
+ assertEquals("Response message", resp, responseMessage) ;
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertEquals("Call ReplyTo EPR", pickupEPR, message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testNullAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ si.deliverAsync(message) ;
+
+ assertNull("Call To EPR", message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testNonNullToAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ si.deliverAsync(message) ;
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testNonNullAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+ message.getHeader().getCall().setReplyTo(pickupEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "jmsdeliver") ;
+ si.deliverAsync(message) ;
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertEquals("Call ReplyTo EPR", pickupEPR, message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNullSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverSync(message, 10) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertNull("Call To EPR", message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNonNullToSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverSync(message, 10) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNonNullSyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+ message.getHeader().getCall().setReplyTo(pickupEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverSync(message, 10) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertEquals("Call ReplyTo EPR", pickupEPR, message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNullAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverAsync(message) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertNull("Call To EPR", message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNonNullToAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverAsync(message) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertNull("Call ReplyTo EPR", message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ @Test
+ public void testFailNonNullAsyncEPRs()
+ throws Exception
+ {
+ final Message message = MessageFactory.getInstance().getMessage() ;
+ message.getHeader().getCall().setTo(deliverEPR) ;
+ message.getHeader().getCall().setReplyTo(pickupEPR) ;
+
+ final ServiceInvoker si = new ServiceInvoker("test", "fail") ;
+ try
+ {
+ si.deliverAsync(message) ;
+ fail("Expected MessageDeliveryException") ;
+ }
+ catch (final MessageDeliverException mde) {} // expected
+
+ assertEquals("Call To EPR", deliverEPR, message.getHeader().getCall().getTo()) ;
+ assertEquals("Call ReplyTo EPR", pickupEPR, message.getHeader().getCall().getReplyTo()) ;
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ServiceInvokerCallUnitTest.class) ;
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/scheduled-listener-config-configtree.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/scheduled-listener-config-configtree.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/listeners/scheduled-listener-config-configtree.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,3 +1,6 @@
-<simple-schedule-listener event-processor="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" listenerClass="org.jboss.soa.esb.listeners.ScheduleListener" my-prop="1" scheduleidref="1-sec-trigger">
+<listener event-processor="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" listenerClass="org.jboss.soa.esb.listeners.ScheduleListener" my-prop="1"
+ name="simple-schedule-listener" scheduleSimpleFrequency="1000" scheduleidref="1-sec-trigger" service-category="ServiceCat" service-description="Test Service"
+ service-name="ServiceName">
+<ScheduleProperties org.quartz.threadPool.threadCount="1"/>
<action action="action" class="org.jboss.soa.esb.mock.MockAction"/>
-</simple-schedule-listener>
\ No newline at end of file
+</listener>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146 (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,67 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.schedule.JBESB_2146;
-
-import org.jboss.soa.esb.listeners.ScheduledEventMessageComposer;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.schedule.SchedulingException;
-import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
-
-import java.util.*;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBESB_2146_ScheduledEventMessageComposer implements ScheduledEventMessageComposer {
-
- public ConfigTree config;
- public List<Message> composedMessages = Collections.synchronizedList(new ArrayList<Message>());
- public List<Message> completedMessage = Collections.synchronizedList(new ArrayList<Message>());
- private static Map<String, JBESB_2146_ScheduledEventMessageComposer> composers = new HashMap<String, JBESB_2146_ScheduledEventMessageComposer>();
-
- public void reset() {
- composedMessages.clear();
- completedMessage.clear();
- }
-
- public void initialize(ConfigTree config) {
- this.config = config;
- composers.put(config.getAttribute("name"), this);
- }
-
- public static JBESB_2146_ScheduledEventMessageComposer getComposer(String name) {
- return composers.get(name);
- }
-
- public void uninitialize() {
- }
-
- public Message composeMessage() throws SchedulingException {
- Message message = org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage();
- composedMessages.add(message);
- return message;
- }
-
- public Message onProcessingComplete(Message message) throws SchedulingException {
- completedMessage.add(message);
- return message;
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_ScheduledEventMessageComposer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,67 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule.JBESB_2146;
+
+import org.jboss.soa.esb.listeners.ScheduledEventMessageComposer;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.schedule.SchedulingException;
+import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
+
+import java.util.*;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_2146_ScheduledEventMessageComposer implements ScheduledEventMessageComposer {
+
+ public ConfigTree config;
+ public List<Message> composedMessages = Collections.synchronizedList(new ArrayList<Message>());
+ public List<Message> completedMessage = Collections.synchronizedList(new ArrayList<Message>());
+ private static Map<String, JBESB_2146_ScheduledEventMessageComposer> composers = new HashMap<String, JBESB_2146_ScheduledEventMessageComposer>();
+
+ public void reset() {
+ composedMessages.clear();
+ completedMessage.clear();
+ }
+
+ public void initialize(ConfigTree config) {
+ this.config = config;
+ composers.put(config.getAttribute("name"), this);
+ }
+
+ public static JBESB_2146_ScheduledEventMessageComposer getComposer(String name) {
+ return composers.get(name);
+ }
+
+ public void uninitialize() {
+ }
+
+ public Message composeMessage() throws SchedulingException {
+ Message message = org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage();
+ composedMessages.add(message);
+ return message;
+ }
+
+ public Message onProcessingComplete(Message message) throws SchedulingException {
+ completedMessage.add(message);
+ return message;
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,58 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.schedule.JBESB_2146;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.mock.MockAction;
-import org.jboss.soa.esb.schedule.MockScheduledEventListener;
-import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
-import org.jboss.soa.esb.testutils.ESBConfigUtil;
-
-/**
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBESB_2146_UnitTest extends TestCase {
-
- protected void setUp() throws Exception {
- MockScheduledEventMessageComposer.reset();
- MockScheduledEventListener.reset();
- MockAction.message = null;
- }
-
- public void test_simple_schedule_01() throws Exception {
- runTestConfig("config-01.xml", 10000);
-
- JBESB_2146_ScheduledEventMessageComposer composer1 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener1");
- JBESB_2146_ScheduledEventMessageComposer composer2 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener2");
-
- assertTrue("simple-schedule-listener1 fired", composer1.composedMessages.size() > 0);
- assertTrue("simple-schedule-listener2 fired", composer2.composedMessages.size() > 0);
- }
-
- private void runTestConfig(String configName, long upTime) throws Exception {
- ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
-
- configUtil.startController();
- Thread.sleep(upTime);
- configUtil.stopController();
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,58 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule.JBESB_2146;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.mock.MockAction;
+import org.jboss.soa.esb.schedule.MockScheduledEventListener;
+import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+
+/**
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_2146_UnitTest extends TestCase {
+
+ protected void setUp() throws Exception {
+ MockScheduledEventMessageComposer.reset();
+ MockScheduledEventListener.reset();
+ MockAction.message = null;
+ }
+
+ public void test_simple_schedule_01() throws Exception {
+ runTestConfig("config-01.xml", 10000);
+
+ JBESB_2146_ScheduledEventMessageComposer composer1 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener1");
+ JBESB_2146_ScheduledEventMessageComposer composer2 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener2");
+
+ assertTrue("simple-schedule-listener1 fired", composer1.composedMessages.size() > 0);
+ assertTrue("simple-schedule-listener2 fired", composer2.composedMessages.size() > 0);
+ }
+
+ private void runTestConfig(String configName, long upTime) throws Exception {
+ ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
+
+ configUtil.startController();
+ Thread.sleep(upTime);
+ configUtil.stopController();
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,33 +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>
- <schedule-provider name="schedule">
- <cron-schedule scheduleid="schedule1" cronExpression="0/2 * * * * ?"/>
- </schedule-provider>
- </providers>
-
- <services>
- <service category="ServiceCat" name="ServiceName-01" description="Test Service">
-
- <listeners>
- <scheduled-listener name="simple-schedule-listener1" scheduleidref="schedule1" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
- </listeners>
-
- <actions>
- <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
- </actions>
- </service>
- <service category="ServiceCat" name="ServiceName-02" description="Test Service">
-
- <listeners>
- <scheduled-listener name="simple-schedule-listener2" scheduleidref="schedule1" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
- </listeners>
-
- <actions>
- <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
- </actions>
- </service>
- </services>
-
-</jbossesb>
\ No newline at end of file
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,33 @@
+<?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>
+ <schedule-provider name="schedule">
+ <cron-schedule scheduleid="schedule1" cronExpression="0/2 * * * * ?"/>
+ </schedule-provider>
+ </providers>
+
+ <services>
+ <service category="ServiceCat" name="ServiceName-01" description="Test Service">
+
+ <listeners>
+ <scheduled-listener name="simple-schedule-listener1" scheduleidref="schedule1" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
+ </listeners>
+
+ <actions>
+ <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+ </actions>
+ </service>
+ <service category="ServiceCat" name="ServiceName-02" description="Test Service">
+
+ <listeners>
+ <scheduled-listener name="simple-schedule-listener2" scheduleidref="schedule1" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
+ </listeners>
+
+ <actions>
+ <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -21,22 +21,19 @@
import junit.framework.TestCase;
import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.jboss.soa.esb.testutils.StringUtils;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.soa.esb.mock.MockAction;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.xml.sax.SAXException;
-import org.quartz.impl.StdSchedulerFactory;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
import java.io.UnsupportedEncodingException;
-import java.io.InputStream;
import java.io.IOException;
-import java.util.Properties;
+import javax.xml.parsers.ParserConfigurationException;
+
/**
* Scheduling unit tests.
*
@@ -51,11 +48,11 @@
MockAction.message = null;
}
- public void test_listener_config() throws UnsupportedEncodingException {
+ public void test_listener_config() throws UnsupportedEncodingException, IOException, SAXException, ParserConfigurationException {
ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("expected-config-01-listener.xml"), "UTF-8");
- assertEquals(expected, configUtil.getListenerConfig("simple-schedule-listener").toString());
+ assertTrue("Service Config", StringUtils.compareXMLContent(expected, configUtil.getListenerConfig("simple-schedule-listener").toString()));
}
public void test_simple_schedule_01() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,3 +1,4 @@
-<simple-schedule-listener event-processor="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" listenerClass="org.jboss.soa.esb.listeners.ScheduleListener" scheduleidref="1-sec-trigger">
+<listener event-processor="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" listenerClass="org.jboss.soa.esb.listeners.ScheduleListener" name="simple-schedule-listener" scheduleSimpleExec="2" scheduleSimpleFrequency="1000" scheduleidref="1-sec-trigger" service-category="ServiceCat" service-description="Test Service" service-name="ServiceName-01">
+<ScheduleProperties org.quartz.threadPool.threadCount="2"/>
<action action="action" class="org.jboss.soa.esb.mock.MockAction"/>
-</simple-schedule-listener>
\ No newline at end of file
+</listener>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -87,6 +87,18 @@
NodeList listenerConfigElements = config.getDocumentElement().getElementsByTagName(name);
if(listenerConfigElements == null || listenerConfigElements.getLength() == 0) {
+ listenerConfigElements = config.getDocumentElement().getElementsByTagName("listener");
+ if(listenerConfigElements == null || listenerConfigElements.getLength() == 0) {
+ return null;
+ }
+
+ for(int i = 0; i < listenerConfigElements.getLength(); i++) {
+ Element element = (Element) listenerConfigElements.item(i);
+ if(name.equals(element.getAttribute("name"))) {
+ return element;
+ }
+ }
+
return null;
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/ESBConfigUtilUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -13,8 +13,8 @@
public void test() throws ConfigurationException {
ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("jboss-esb.xml"));
- assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<JMS-ESBListener listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
- assertTrue(configUtil.getGatewayConfig("FileGateway").toString().startsWith("<FileGateway"));
+ assertTrue(configUtil.getListenerConfig("JMS-ESBListener").toString().startsWith("<listener listenerClass=\"org.jboss.soa.esb.listeners.message.MessageAwareListener\" maxThreads=\"1\" name=\"JMS-ESBListener\" service-category=\"ABI_OrderManager\" service-description=\"ABI OrderManager Service\" service-name=\"ABI_OrderManager\">"));
+ assertTrue(configUtil.getGatewayConfig("FileGateway").toString().startsWith("<listener"));
assertTrue(configUtil.getActionConfig("OrderNotificationService", "print-after-transform").toString().startsWith("<action action=\"print-after-transform\""));
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRules.drl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRules.drl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRules.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,8 +4,8 @@
#list any import classes here.
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.dvdstore.OrderHeader;
-import org.jboss.soa.esb.dvdstore.Customer;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.Customer;
global java.util.List destinations;
@@ -40,4 +40,4 @@
-
\ No newline at end of file
+
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRulesDiscount.drl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRulesDiscount.drl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyBusinessRulesDiscount.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,8 +4,8 @@
#list any import classes here.
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.dvdstore.OrderHeader;
-import org.jboss.soa.esb.dvdstore.Customer;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.Customer;
global java.util.List destinations;
@@ -43,4 +43,4 @@
-
\ No newline at end of file
+
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyRoutingRules.drl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyRoutingRules.drl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/MyRoutingRules.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,7 +4,7 @@
#list any import classes here.
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.dvdstore.OrderHeader;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
#declare any global variables here
global java.util.List destinations;
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -53,6 +53,12 @@
value="/smooks-res.xml" />
</action>
+ <!-- Update Customer Status -->
+ <action name="updateCustomerStatus"
+ class="org.jboss.soa.esb.samples.quickstart.businessrules.UpdateCustomerStatus">
+ <property name="status" value="60"/>
+ </action>
+
<!-- Use the BRP to calculate the order priority -->
<action
class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/readme.txt
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/readme.txt 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/readme.txt 2008-11-20 15:13:49 UTC (rev 23991)
@@ -40,8 +40,10 @@
Review the 3 different .drl files to see the distinction between business
rules used for calculation/validation and rules used for routing.
- The customer status is actually set in the jboss-esb.xml via the SetupMessage
+ The customer status is actually set in the jboss-esb.xml via the UpdateCustomerStatus
action since it is not provided with the inbound XML. You don't want a
customer to determine their status. In a real world situation, another
system would be integrated via an action/service, that first calculates the
- customer's status (frequent flier, volume of previous purchases, etc.)
\ No newline at end of file
+ customer's status (frequent flier, volume of previous purchases, etc.)
+ Try setting the "status" to different values and see how the customer
+ status is used in MyBusinessRules.drl
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/smooks-res.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/smooks-res.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -5,7 +5,7 @@
<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="beanClass">org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader</param>
<param name="bindings">
<binding property="orderId" selector="Order @orderId" />
<binding property="orderDate" selector="Order @orderDate" type="LongDate"/>
@@ -20,7 +20,7 @@
<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="beanClass">org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.Customer</param>
<param name="bindings">
<binding property="userName" selector="order customer @userName" />
<binding property="firstName" selector="order customer @firstName" />
@@ -33,7 +33,7 @@
<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="beanClass">org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderItem</param>
<param name="addToList">true</param>
<param name="bindings">
<binding property="position" selector="order orderlines orderline @position" type="Integer" />
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/ReviewMessage.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -25,8 +25,8 @@
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.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.Customer;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
public class ReviewMessage extends AbstractActionPipelineProcessor {
private String input = "Reviewer";
@@ -50,4 +50,4 @@
input = configTree.getAttribute("stuff");
}
-}
\ No newline at end of file
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,48 @@
+/*
+ * 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.samples.quickstart.businessrules.dvdstore.Customer;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
+
+public class UpdateCustomerStatus extends AbstractActionPipelineProcessor {
+
+ private int status;
+
+ public Message process(Message message) throws ActionProcessingException {
+
+ OrderHeader order = (OrderHeader) message.getBody().get("orderHeader");
+ Customer customer = (Customer) message.getBody().get("customer");
+ customer.setStatus( status );
+ System.out.println("{ Updated customer status to " + status + "}" );
+ return message;
+ }
+
+ public UpdateCustomerStatus(ConfigTree configTree) {
+ status = Integer.parseInt(configTree.getAttribute("status"));
+ }
+
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore)
Property changes on: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,103 +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.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;
-
- /**
- * @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;
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/Customer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,103 @@
+/*
+ * 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.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;
+
+ /**
+ * @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;
+ }
+
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,140 +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.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;
-
- /**
- * @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;
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderHeader.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,140 @@
+/*
+ * 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.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;
+
+ /**
+ * @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;
+ }
+
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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.samples.quickstart.businessrules.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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/dvdstore/OrderItem.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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.samples.quickstart.businessrules.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;
+
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Mapping.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Mapping.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Mapping.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -65,7 +65,10 @@
mapping.setEsb(mappingElement.attributeValue(Constants.ESB_VARNAME_TAG));
mapping.setBpm(mappingElement.attributeValue(Constants.BPM_VARNAME_TAG));
mapping.setDefaultValue(mappingElement.attributeValue(Constants.DEFAULT_VALUE_TAG));
- mapping.setIsProcessScope(Boolean.parseBoolean(mappingElement.attributeValue(Constants.PROCESS_SCOPE_ATTR)));
+ final String isProcessScope = mappingElement.attributeValue(Constants.PROCESS_SCOPE_ATTR) ;
+ if (isProcessScope != null) {
+ mapping.setIsProcessScope(Boolean.valueOf(isProcessScope));
+ }
if (log.isDebugEnabled()) log.debug(mappingElement.asXML() + ":" + mapping);
return mapping;
}
@@ -81,7 +84,10 @@
mapping.setEsb(mappingElement.getAttribute(Constants.ESB_VARNAME_TAG));
mapping.setBpm(mappingElement.getAttribute(Constants.BPM_VARNAME_TAG));
mapping.setDefaultValue(mappingElement.getAttribute(Constants.DEFAULT_VALUE_TAG));
- mapping.setIsProcessScope(Boolean.parseBoolean(mappingElement.getAttribute(Constants.PROCESS_SCOPE_ATTR)));
+ final String isProcessScope = mappingElement.getAttribute(Constants.PROCESS_SCOPE_ATTR) ;
+ if (isProcessScope != null) {
+ mapping.setIsProcessScope(Boolean.valueOf(isProcessScope));
+ }
if (log.isDebugEnabled()) log.debug(mappingElement.toXml() + ":" + mapping);
return mapping;
}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-compiler-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/drools-compiler-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-core-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-core-4.0.7.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/drools-core-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-decisiontables-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/drools-decisiontables-4.0.7.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-jsr94-4.0.2.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/drools-jsr94-4.0.7.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/stax-api-1.0.1.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/stax-api-1.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/lib/ext/xstream-1.2.2.jar (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/lib/ext/xstream-1.2.2.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -23,6 +23,11 @@
import java.io.ByteArrayInputStream;
import java.io.StringReader;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.Map.Entry;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
@@ -30,178 +35,638 @@
import javax.xml.xpath.XPathFactory;
import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.MessagePayloadProxy;
import org.jboss.soa.esb.message.body.content.BytesBody;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.util.XPathNamespaceContext;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* Domain Specific Language helper. Right now this supports the use of XPath, but this class can
* be beefed up upo to use other technologies as well.
+ * <p/>
*
* @author kstam at redhat.com
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
*
*/
public class DslHelper
{
private static Logger log = Logger.getLogger(DslHelper.class);
+
/** XPath instance */
private static XPathFactory xpf = XPathFactory.newInstance();
private static MessagePayloadProxy payloadProxy;
+
+ /*
+ * Maps that contain cached XPath results.
+ * K = XPath expression String
+ * V = {@link XPathCacheObject}
+ */
+ private static Map<String,XPathCacheObject<Boolean>> xpathBooleanResults = Collections.synchronizedMap( new WeakHashMap<String,XPathCacheObject<Boolean>>() );
+ private static Map<String,XPathCacheObject<Number>> xpathNumberResults = Collections.synchronizedMap( new WeakHashMap<String,XPathCacheObject<Number>>() );
+ private static Map<String,XPathCacheObject<String>> xpathStringResults = Collections.synchronizedMap( new WeakHashMap<String,XPathCacheObject<String>>() );
+ private static Map<String,XPathCacheObject<Node>> xpathNodeResults = Collections.synchronizedMap( new WeakHashMap<String,XPathCacheObject<Node>>() );
+ private static Map<String,XPathCacheObject<NodeList>> xpathNodeListResults = Collections.synchronizedMap( new WeakHashMap<String,XPathCacheObject<NodeList>>() );
static {
- payloadProxy = new MessagePayloadProxy(new ConfigTree("config"),
- new String[] {BytesBody.BYTES_LOCATION},
- new String[] {BytesBody.BYTES_LOCATION});
+ payloadProxy = new MessagePayloadProxy(new ConfigTree("config"), new String[] {BytesBody.BYTES_LOCATION}, new String[] {BytesBody.BYTES_LOCATION});
}
-
+
/**
+ * Uses XPath to evalutate if the XPath expression is true or false.
+ * This is the equivalent of calling selectAsBoolean( message, xpathExp, null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return Boolean
+ * true if the XPath expression evalutes to true
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Boolean selectAsBoolean(final Message message, final String xpathExp ) throws XPathExpressionException
+ {
+ return selectAsBoolean( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to evalutate if the XPath expression is true or false.
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return Boolean
+ * true if the XPath expression evalutes to true
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Boolean selectAsBoolean(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ XPathCacheObject<Boolean> cachedObject = xpathBooleanResults.get( xpathExp );
+ if ( cacheHit( cachedObject, message ) )
+ return cachedObject.getResult();
+
+ XPath xpath = getXPath( namespaces );
+ Boolean value = (Boolean) xpath.evaluate( xpathExp, getInputSource(message), XPathConstants.BOOLEAN);
+ xpathBooleanResults.put( xpathExp, new XPathCacheObject<Boolean>( message.hashCode(), value ) );
+ return value;
+ }
+
+ /**
+ * Uses XPath to select the Number matched by the XPath expression.
+ * <p/>
+ * This is the equivalent of calling selectAsNumber( message, xpathExp, null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return Number -
+ * the Number if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Number selectAsNumber(final Message message, final String xpathExp ) throws XPathExpressionException
+ {
+ return selectAsNumber( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to select the Number matched by the XPath expression.
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return Number -
+ * the Number if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Number selectAsNumber(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final XPathCacheObject<Number> cachedObject = xpathNumberResults.get( xpathExp );
+ if ( cacheHit( cachedObject, message ) )
+ return cachedObject.getResult();
+
+ final XPath xpath = getXPath( namespaces );
+ final Number number = (Number) xpath.evaluate( xpathExp, getInputSource(message), XPathConstants.NUMBER);
+ xpathNumberResults.put( xpathExp, new XPathCacheObject<Number>( message.hashCode(), number ) );
+ return number;
+ }
+
+ /**
+ * Uses XPath to select the String matched by the XPath expression.
+ * <p/>
+ * This is the equivalen of calling selectAsString( message, xpathExp, null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return String -
+ * the String if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static String selectAsString(final Message message, final String xpathExp ) throws XPathExpressionException
+ {
+ return selectAsString( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to select the String matched by the XPath expression.
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return String -
+ * the String if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static String selectAsString(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final XPathCacheObject<String> cachedObject = xpathStringResults.get( xpathExp );
+ if ( cacheHit( cachedObject, message ) )
+ return cachedObject.getResult();
+
+ final XPath xpath = getXPath( namespaces );
+ final String string = (String) xpath.evaluate( xpathExp, getInputSource(message), XPathConstants.STRING);
+ xpathStringResults.put( xpathExp, new XPathCacheObject<String>( message.hashCode(), string ) );
+ return string;
+ }
+
+
+ /**
+ * Uses XPath to select the Node matched by the XPath expression.
+ * <p/>
+ * This is the equivalent of calling selectAsNode( message, xpathExp null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return Node -
+ * the Node if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Node selectAsNode(final Message message, final String xpathExp ) throws XPathExpressionException
+ {
+ return selectAsNode( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to select the Node matched by the XPath expression.
+ * <p/>
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return Node -
+ * the Node if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static Node selectAsNode(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final XPathCacheObject<Node> cachedObject = xpathNodeResults.get( xpathExp );
+ if ( cacheHit( cachedObject, message ) )
+ return cachedObject.getResult();
+
+ final XPath xpath = getXPath( namespaces );
+ final Node node = (Node) xpath.evaluate( xpathExp, getInputSource(message), XPathConstants.NODE);
+ xpathNodeResults.put( xpathExp, new XPathCacheObject<Node>( message.hashCode(), node ) );
+ return node;
+ }
+
+ /**
+ * Uses XPath to select the NodeList matched by the XPath expression.
+ * <p/>
+ * This is the equivalent of calling selectAsNodeList( message, xpathExp null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @return NodeList -
+ * the NodeList if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static NodeList selectAsNodeList( final Message message, final String xpathExp ) throws XPathExpressionException
+ {
+ return selectAsNodeList( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to select the NodeList matched by the XPath expression.
+ * <p/>
+ *
+ * @param message -
+ * the ESB Message which body content will be used
+ * @param xpathExp -
+ * XPath expression
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return NodeList -
+ * the NodeList if XPath found a match, or null if no match was found.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static NodeList selectAsNodeList( final Message message, final String xpathExp, Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final XPathCacheObject<NodeList> cachedObject = xpathNodeListResults.get( xpathExp );
+ if ( cacheHit( cachedObject, message ) )
+ return cachedObject.getResult();
+
+ final XPath xpath = getXPath( namespaces );
+ final NodeList nodeList = (NodeList) xpath.evaluate(xpathExp, getInputSource(message), XPathConstants.NODESET);
+ log.info("XPath [" + xpathExp + "], nr of matches : " + nodeList.getLength());
+ xpathNodeListResults.put( xpathExp, new XPathCacheObject<NodeList>( message.hashCode(), nodeList ) );
+ return nodeList;
+ }
+
+ /**
+ * Uses XPath to look for the occurence of a certain node, specified in the XPath expression.
+ * This can be used to find out if the Message object contains the node specified by the XPath
+ * expression.
+ * <p/>
+ * This is the equivalent of calling xmlContentMatches( message, xpathExp, null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true
+ * if the node is found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentMatches(final Message message, final String xpathExp) throws XPathExpressionException
+ {
+ return xmlContentMatches( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to look for the occurence of a certain node, specified in the XPath expression.
+ * This can be used to find out if the Message object contains the node specified by the XPath
+ * expression.
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return true
+ * if the node is found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentMatches(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ return selectAsNode( message, xpathExp, namespaces ) != null ;
+ }
+
+ /**
+ * Uses XPath to look for any occurence of a certain tag, specific in the xpath expression.
+ * This can be used to find out if the Message object contains the node specified by the XPath
+ * Note, that this method cannot be used with a boolean expression, use {@link #selectAsBoolean(Message, String)}
+ * for that.
+ * <p/>
+ * This is the equivalent of calling xmlContentExists( message, xpathExp, null).
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true
+ * if one or more nodes are found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentExists(final Message message, final String xpathExp) throws XPathExpressionException
+ {
+ return xmlContentExists( message, xpathExp, null );
+ }
+
+ /**
+ * Uses XPath to look for any occurence of a certain tag, specific in the xpath expression.
+ * This can be used to find out if the Message object contains the node specified by the XPath
+ * Note, that this method cannot be used with a boolean expression, use {@link #selectAsBoolean(Message, String)}
+ * for that.
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return true
+ * if one or more nodes are found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentExists(final Message message, final String xpathExp, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final NodeList nodeList = selectAsNodeList( message, xpathExp, namespaces );
+ return nodeList == null ? false : nodeList.getLength() > 0 ;
+ }
+
+ /**
* Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
+ * </p>
+ * Note that {@link #selectAsBoolean(Message, String)} can be used instead of this method
+ * and the XPath equality operator can be used in the XPath expression:
+ * <br>
+ * <pre>{@code
+ * String xpathExp = "/Order/OrderLines/OrderLine/Product/@productId = 364";
+ * }</pre>
+ * <br>
+ * <p/>
+ * This is the equivalent of calling xmlContentEquals( message, xpathExp, null).
*
- * @param message - the ESB Message which body content will be used.
- * @param xpathExp - XPath expression to find a node.
- * @return true if the node is found and false in all other cases.
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true -
+ * if the node is found and false in all other cases.
* @throws XPathExpressionException
+ * represents an error in an XPath expression
*/
- public static boolean xmlContentMatches(Message message, String xpathExp) throws XPathExpressionException
+ public static boolean xmlContentEquals(final Message message, final String xpathExp, final String value ) throws XPathExpressionException
{
- if (log.isDebugEnabled()) {
- log.debug("Trying to match xpath: '" + xpathExp + "' in message=" + message);
- }
- XPath xpath = xpf.newXPath();
- InputSource inputSource = getInputSource(message);
- Object node = xpath.evaluate(xpathExp, inputSource, XPathConstants.NODE);
- if (log.isDebugEnabled()) {
- log.debug("Found node=" + node);
- }
- return node != null;
+ return xmlContentEquals( message, xpathExp, value, null );
}
-
+
+ /**
+ * Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
+ * </p>
+ * Note that {@link #selectAsBoolean(Message, String)} can be used instead of this method
+ * and the XPath equality operator can be used in the XPath expression:
+ * <br>
+ * <pre>{@code
+ * String xpathExp = "/Order/OrderLines/OrderLine/Product/@productId = 364";
+ * }</pre>
+ * <br>
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return true -
+ * if the node is found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentEquals(final Message message, final String xpathExp, final String value, final Map<String,String> namespaces ) throws XPathExpressionException
+ {
+ final String xpathResult = selectAsString( message, xpathExp, namespaces );
+ return xpathResult == null ? false : xpathResult.equals( value );
+ }
+
/**
* Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
+ * <p/>
+ * This is the equivalent of calling xmlContentGreaterThan( message, xpathExp, value, null).
*
- * @param message - the ESB Message which body content will be used.
- * @param xpathExp - XPath expression to find a node.
- * @param value - used to compare against the result found using the XPath expression.
- * @return true if equal, false in all other cases.
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true
+ * if the node is found and false in all other cases.
* @throws XPathExpressionException
+ * represents an error in an XPath expression
*/
- public static boolean xmlContentEquals(Message message, String xpathExp, String value) throws XPathExpressionException
+ public static boolean xmlContentGreaterThan( final Message message, final String xpathExp, final String value) throws XPathExpressionException
{
- if (log.isDebugEnabled()) {
- log.debug("Trying to match xpath: '" + xpathExp + "' in message=" + message.getBody().get());
- }
- XPath xpath = xpf.newXPath();
- InputSource inputSource = getInputSource(message);
- String nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);
- if (log.isDebugEnabled()) {
- log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
- }
- return value.equals(nodeValue);
+ return xmlContentGreaterThan( message, xpathExp, value, null );
}
-
- /**
+
+ /**
* Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
*
- * @param message - the ESB Message which body content will be used.
- * @param xpathExp - XPath expression to find a node.
- * @param value - used to compare against the result found using the XPath expression.
- * @return true if node (returned by the xpath expression) is greater than the current value, false in all other cases.
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @param namespaces -
+ * Map of namespaces to be used in the xpath expression. Key=prefix,value = uri
+ * @return true
+ * if the node is found and false in all other cases.
* @throws XPathExpressionException
+ * represents an error in an XPath expression
*/
- public static boolean xmlContentGreaterThan(Message message, String xpathExp, String value) throws XPathExpressionException
+ public static boolean xmlContentGreaterThan( final Message message, final String xpathExp, final String value, final Map<String,String> namespaces) throws XPathExpressionException
{
- String nodeValue=null;
- double doubleValue=0;
- double doubleNodeValue=0;
+ final String xpathResult = (String) selectAsString( message, xpathExp, namespaces );
- if (log.isDebugEnabled()) {
- log.debug("Trying to match xpath: '" + xpathExp + "' in message=" + message.getBody().get());
- }
- XPath xpath = xpf.newXPath();
- InputSource inputSource = getInputSource(message);
- nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);if (log.isDebugEnabled()) {
- log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
- }
- if (nodeValue!=null && !"".equals(nodeValue)) {
-
- try {
- doubleValue = Double.parseDouble(value);
- } catch (NumberFormatException ne) {
- log.equals("Could not parse value=" + doubleValue + " to double");
- }
- try {
- doubleNodeValue = Double.parseDouble(nodeValue);
- } catch (NumberFormatException ne) {
- log.equals("Could not parse nodeValue=" + doubleNodeValue + " to double");
- }
- if (doubleNodeValue > doubleValue) {
- return true;
- }
- }
- return false;
+ if ( xpathResult != null && !"".equals( xpathResult ) )
+ return parseDouble( xpathResult ) > parseDouble( value );
+ else
+ return false;
}
-
- /**
+
+ /**
* Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
+ * <p/>
+ * This is the equivalent of calling xmlContentLessThan( message, xpathExp, value, null).
*
- * @param message - the ESB Message which body content will be used.
- * @param xpathExp - XPath expression to find a node.
- * @param value - used to compare against the result found using the XPath expression.
- * @return true if node (returned by the xpath expression) is less than the current value, false in all other cases.
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true
+ * if the node is found and false in all other cases.
* @throws XPathExpressionException
+ * represents an error in an XPath expression
*/
- public static boolean xmlContentLessThan(Message message, String xpathExp, String value) throws XPathExpressionException
+ public static boolean xmlContentLessThan( final Message message, final String xpathExp, final String value) throws XPathExpressionException
+ {
+ return xmlContentLessThan( message, xpathExp, value, null );
+ }
+
+ /**
+ * Uses XPath to look for the occurence of a certain tag, specific in the xpath expression.
+ *
+ * @param message -
+ * the ESB Message which body content will be used.
+ * @param xpathExp -
+ * XPath expression to find a node.
+ * @return true
+ * if the node is found and false in all other cases.
+ * @throws XPathExpressionException
+ * represents an error in an XPath expression
+ */
+ public static boolean xmlContentLessThan( final Message message, final String xpathExp, final String value, final Map<String,String> namespaces) throws XPathExpressionException
+ {
+ final String xpathResult = (String) selectAsString( message, xpathExp, namespaces );
+
+ if ( xpathResult != null && !"".equals( xpathResult ) )
+ return parseDouble( xpathResult ) < parseDouble( value );
+ else
+ return false;
+ }
+
+ /**
+ * Will take the passed in string of namespaces in the form "prefix=uri,prefix=uri".
+ *
+ * @param namespaces string of namespaces in the form "prefix=uri,prefix=uri"
+ * @return Map<String,String> where the key will be the namespace prefix and the value the uri
+ */
+ public static Map<String, String> parseNamespaces( final String namespaces )
{
- String nodeValue=null;
- double doubleValue=0;
- double doubleNodeValue=0;
-
- if (log.isDebugEnabled()) {
- log.debug("Trying to match xpath: '" + xpathExp + "' in message=" + message.getBody().get());
+ AssertArgument.isNotNullAndNotEmpty( namespaces, "namespaces" );
+
+ final String[] namespacesElements = namespaces.split( "," );
+ final Map<String,String> namespacesMap = new HashMap<String,String>();
+ for ( String ns : namespacesElements )
+ {
+ final String[] pairs = ns.split( "=" );
+ namespacesMap.put( pairs[0].trim(), pairs[1].trim() );
}
- XPath xpath = xpf.newXPath();
- InputSource inputSource = getInputSource(message);
- nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);if (log.isDebugEnabled()) {
- log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
+ return namespacesMap;
+ }
+
+ /*
+ * Checks if the cachedObject was non-null, and if so, checks the message hashCode against
+ * the cachedObjects messageHashCode.
+ */
+ private static <T> boolean cacheHit ( final XPathCacheObject<T> cachedObject, final Message message )
+ {
+ return cachedObject != null && cachedObject.getMessageHashCode() == message.hashCode();
+ }
+
+ private static double parseDouble( final String string ) throws XPathExpressionException
+ {
+ try
+ {
+ return Double.parseDouble( string );
+ }
+ catch (NumberFormatException e)
+ {
+ throw new XPathExpressionException("Could not parse value [" + string + "] to double" );
}
- if (nodeValue!=null && !"".equals(nodeValue)) {
-
- try {
- doubleValue = Double.parseDouble(value);
- } catch (NumberFormatException ne) {
- log.equals("Could not parse value=" + doubleValue + " to double");
- }
- try {
- doubleNodeValue = Double.parseDouble(nodeValue);
- } catch (NumberFormatException ne) {
- log.equals("Could not parse nodeValue=" + doubleNodeValue + " to double");
- }
- if (doubleNodeValue < doubleValue) {
- return true;
- }
- }
- return false;
}
+
+ private static void setNamespaces( final XPath xpath, final Map<String,String> namespaces )
+ {
+ if ( namespaces == null )
+ return;
- private static InputSource getInputSource(Message message) throws XPathExpressionException {
+ final XPathNamespaceContext namespaceContext = new XPathNamespaceContext();
+ for ( Entry<String, String> entry : namespaces.entrySet() )
+ namespaceContext.setMapping( entry.getKey(), entry.getValue() );
+
+ xpath.setNamespaceContext( namespaceContext );
+ }
+
+
+ private static InputSource getInputSource(Message message) throws XPathExpressionException
+ {
Object payload;
- try {
+ try
+ {
payload = payloadProxy.getPayload(message);
- } catch (MessageDeliverException e) {
+ }
+ catch (MessageDeliverException e)
+ {
throw new XPathExpressionException(e);
}
- if(payload instanceof byte[]) {
+ if(payload instanceof byte[])
+ {
return new InputSource(new ByteArrayInputStream((byte[]) payload));
- } else if(payload instanceof String) {
+ }
+ else if(payload instanceof String)
+ {
return new InputSource(new StringReader((String) payload));
- } else {
+ }
+ else
+ {
throw new XPathExpressionException("Unsupport expression input object type: " + payload.getClass().getName());
}
}
+
+ private static XPath getXPath( final Map<String,String> namespaces )
+ {
+ final XPath xpath = xpf.newXPath();
+ setNamespaces( xpath, namespaces );
+ return xpath;
+ }
+
+ /**
+ * XPathCacheObject holds results from XPath evaluations and message object instance hashcodes.
+ * </p>
+ * The intent of this class is for it to be used as the value in a Map:
+ * <pre>
+ * {@code
+ * Map<String,XPathCacheObject> xpathResults = new WeakHashMap<String,XPathCacheObject>() );
+ * }</pre><br><br>
+ * The key would be a String representing the XPath expression which was used to evaluate the result from
+ * the Message Object instance represented by the messageHashCode.
+ *
+ */
+ private static class XPathCacheObject<T>
+ {
+ /*
+ * The hashCode of the Message object used in the XPath evaluation
+ */
+ private final int messageHashCode;
+ /*
+ * The result from the XPath evalutaion
+ */
+ private final T result;
+
+ /**
+ * Sole constructor.
+ *
+ * @param messageHashCode -
+ * The hashCode of the Message object used in the XPath evaluation
+ * @param result -
+ * The result from the XPath evalutaion
+ */
+ public XPathCacheObject( final int messageHashCode, final T result )
+ {
+ this.messageHashCode = messageHashCode;
+ this.result = result;
+ }
+
+ public int getMessageHashCode()
+ {
+ return messageHashCode;
+ }
+
+ public T getResult()
+ {
+ return result;
+ }
+ }
+
}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBRulesCounter.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,303 +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 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");
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,855 +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.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();
-
- synchronized (ruleSets) {
- 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
- {
- Map<String, RuleBase> ruleBases = getCachedRuleBases();
-
- synchronized (ruleBases) {
- RuleBase ruleBase = ruleBases.get( decisionTable );
- if ( ruleReload || ruleBase == null )
- {
- ruleBase = DroolsRuleBaseHelper.getInstance().createRuleBaseFromDecisionTable(decisionTable);
- ruleBases.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)
- {
- synchronized (ruleBase) {
- final StatefulSession statefulSession = getStatefulSession( ruleBase );
- try
- {
- addGlobalsVariables( statefulSession, globals );
- final List<Object> facts = getFacts( message, objectList );
- insertObjectsIntoWorkingMemory( facts, statefulSession );
- statefulSession.fireAllRules();
- }
- finally
- {
- if ( dispose )
- {
- statefulSession.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 )
- {
- synchronized (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
- }
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleService.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,855 @@
+/*
+ * 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();
+
+ synchronized (ruleSets) {
+ 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
+ {
+ Map<String, RuleBase> ruleBases = getCachedRuleBases();
+
+ synchronized (ruleBases) {
+ RuleBase ruleBase = ruleBases.get( decisionTable );
+ if ( ruleReload || ruleBase == null )
+ {
+ ruleBase = DroolsRuleBaseHelper.getInstance().createRuleBaseFromDecisionTable(decisionTable);
+ ruleBases.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)
+ {
+ synchronized (ruleBase) {
+ final StatefulSession statefulSession = getStatefulSession( ruleBase );
+ try
+ {
+ addGlobalsVariables( statefulSession, globals );
+ final List<Object> facts = getFacts( message, objectList );
+ insertObjectsIntoWorkingMemory( facts, statefulSession );
+ statefulSession.fireAllRules();
+ }
+ finally
+ {
+ if ( dispose )
+ {
+ statefulSession.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 )
+ {
+ synchronized (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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceBuilderException.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,168 +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.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;
-import org.apache.log4j.Logger;
-
-/**
- * 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 static Logger logger = Logger.getLogger(RuleServiceCallHelper.class);
-
- 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() );
-
- if(logger.isDebugEnabled()) {
- final boolean isRuleReloadSpecified = (configTree.getAttribute(ListenerTagNames.RULE_RELOAD_TAG) != null);
- if (ruleAgent != null && isRuleReloadSpecified) {
- logger.debug("'" + ListenerTagNames.RULE_RELOAD_TAG + "' is specified on the same configuration as a Rule Agent configuration is specified. Ignoring the '" + ListenerTagNames.RULE_RELOAD_TAG + "' configuration.");
- }
- }
-
- 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;
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceCallHelper.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,168 @@
+/*
+ * 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;
+import org.apache.log4j.Logger;
+
+/**
+ * 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 static Logger logger = Logger.getLogger(RuleServiceCallHelper.class);
+
+ 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() );
+
+ if(logger.isDebugEnabled()) {
+ final boolean isRuleReloadSpecified = (configTree.getAttribute(ListenerTagNames.RULE_RELOAD_TAG) != null);
+ if (ruleAgent != null && isRuleReloadSpecified) {
+ logger.debug("'" + ListenerTagNames.RULE_RELOAD_TAG + "' is specified on the same configuration as a Rule Agent configuration is specified. Ignoring the '" + ListenerTagNames.RULE_RELOAD_TAG + "' configuration.");
+ }
+ }
+
+ 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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceException.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/RuleServiceFactory.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/BusinessRulesProcessor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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 {
@@ -73,15 +119,11 @@
try {
dlQueueInvoker = new ServiceInvoker(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, ServiceInvoker.DEAD_LETTER_SERVICE_NAME);
} catch (MessageDeliverException e) {
- new MessageRouterException(e);
+ throw new MessageRouterException(e);
}
}
- public void initialise() {
- if (messageMulticaster.getRecipientCount() == 0) {
- _logger.info("Missing or empty destination list - This action class won't have any effect");
- }
- }
+ public void initialise() { }
/**
* Router the message to one or more destinations, using the
@@ -157,25 +199,13 @@
* @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() + ".");
- 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;
- }
+ _ruleSet = _config.getAttribute(ListenerTagNames.RULE_SET_TAG);
+ _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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,208 +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 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;
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleService.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,52 +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 ( "ruleServiceImplClass" ),
- 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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/java/org/jboss/soa/esb/services/rules/RuleServicePropertiesNames.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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 ( "ruleServiceImplClass" ),
+ 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;
+ }
+
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/resources/XPathLanguage.dsl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/resources/XPathLanguage.dsl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/main/resources/XPathLanguage.dsl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -5,3 +5,9 @@
[when]xpathLessThan "{xpath}", "{value}"=msg : org.jboss.soa.esb.message.Message( type == org.jboss.soa.esb.message.format.MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentLessThan(msg, "{xpath}", "{value}") )
[then]Log : "{message}"=System.out.println("{message}");
[then]Destination : "{message}"=destinations.add("{message}");
+
+# Namespace(NS) aware methods
+[when]xpathMatch expr "{xpath}" use namespaces "{namespaces}"=msg : org.jboss.soa.esb.message.Message( type == org.jboss.soa.esb.message.format.MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentMatches(msg, "{xpath}",org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.parseNamespaces("{namespaces}")) )
+[when]xpathEquals expr "{xpath}", "{value}" use namespaces "{namespaces}"=msg : org.jboss.soa.esb.message.Message( type == org.jboss.soa.esb.message.format.MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentEquals(msg, "{xpath}", "{value}",org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.parseNamespaces("{namespaces}")))
+[when]xpathGreaterThan expr "{xpath}", "{value}" use namespaces "{namespaces}"=msg : org.jboss.soa.esb.message.Message( type == org.jboss.soa.esb.message.format.MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentGreaterThan(msg, "{xpath}", "{value}",org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.parseNamespaces("{namespaces}") ) )
+[when]xpathLessThan expr "{xpath}", "{value}" use namespaces "{namespaces}"=msg : org.jboss.soa.esb.message.Message( type == org.jboss.soa.esb.message.format.MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentLessThan(msg, "{xpath}", "{value}", org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.parseNamespaces("{namespaces}") ))
\ No newline at end of file
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorRoutingUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/BusinessProcessorUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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);
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelperUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelperUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelperUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelperUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,265 @@
+/*
+* 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.routing.cbr;
+
+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.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link DslHelper}
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class DslHelperUnitTest
+{
+ private Logger log = Logger.getLogger( DslHelperUnitTest.class );
+
+ // message with xml content in body
+ private static Message msg;
+
+ // message with namespace context in body
+ private static Message nsmsg;
+ private static HashMap<String, String> namespaces;
+
+ @Test
+ public void xmlContentExists() throws XPathExpressionException, UnsupportedEncodingException
+ {
+ assertTrue( DslHelper.xmlContentExists( msg, "//*[@productId = 299]" ) );
+ assertTrue( DslHelper.xmlContentExists( msg, "//*[@productId < 1000]" ) );
+ assertFalse( DslHelper.xmlContentExists( msg, "//*[@productId = 2299]" ) );
+ }
+
+ @Test
+ public void xmlContentExistsWithNamespaces() throws XPathExpressionException, UnsupportedEncodingException
+ {
+ assertTrue( DslHelper.xmlContentExists( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product", namespaces ) );
+ assertTrue( DslHelper.xmlContentExists( nsmsg, "//p:Product", namespaces ) );
+
+ HashMap<String, String> oneNamspace = new HashMap<String,String>();
+ oneNamspace.put( "ord", "http://org.jboss.soa.esb/order" );
+ assertTrue( DslHelper.xmlContentExists( nsmsg, "/ord:Order", oneNamspace ) );
+ }
+
+ @Test
+ public void xmlContentMatches() throws XPathExpressionException, UnsupportedEncodingException
+ {
+ assertTrue( DslHelper.xmlContentMatches( msg, "//*[@productId = 299]" ) );
+ assertTrue( DslHelper.xmlContentMatches( msg, "/Order/OrderLines/OrderLine/Product" ) );
+ assertFalse( DslHelper.xmlContentMatches( msg, "//*[@productId > 1299]" ) );
+ }
+
+ @Test
+ public void xmlContentMatchesWithNamespaces() throws XPathExpressionException, UnsupportedEncodingException
+ {
+ assertTrue( DslHelper.xmlContentMatches( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product", namespaces ) );
+ }
+
+ @Test
+ public void selectAsBoolean() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.selectAsBoolean( msg, "/Order/OrderLines/OrderLine/Product/@productId = 364" ) );
+ assertTrue( DslHelper.selectAsBoolean( msg, "//*[@productId = 299]" ) );
+ assertTrue( DslHelper.selectAsBoolean( msg, "//*[@productId < 1299]" ) );
+ assertFalse( DslHelper.selectAsBoolean( msg, "/Order/OrderLines/OrderLine/Product/@productId = 33" ) );
+ }
+
+ @Test
+ public void selectAsBooleanWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.selectAsBoolean( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product/@productId = 364", namespaces ) );
+ }
+
+ @Test
+ public void selectAsNumber() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( 364, DslHelper.selectAsNumber( msg, "//Product/@productId" ).intValue() );
+ }
+
+ @Test
+ public void selectAsNumberWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( 364, DslHelper.selectAsNumber( msg, "//Product/@productId", namespaces ).intValue() );
+ }
+
+ @Test
+ public void selectAsString() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( "364", DslHelper.selectAsString( msg, "//Product/@productId" ) );
+ }
+
+ @Test
+ public void selectAsStringWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( "364", DslHelper.selectAsString( nsmsg, "//p:Product/@productId", namespaces ) );
+ }
+
+ @Test
+ public void selectAsNode() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( "productId", DslHelper.selectAsNode( msg, "/Order/OrderLines/OrderLine/Product/@productId").getNodeName() );
+ }
+
+ @Test
+ public void selectAsNodeWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( "productId", DslHelper.selectAsNode( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product/@productId", namespaces ).getNodeName() );
+ }
+
+ @Test
+ public void selectAsNodeList() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( 42, DslHelper.selectAsNodeList( msg, "//Product/@productId" ).getLength() );
+ }
+
+ @Test
+ public void selectAsNodeListWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertEquals ( 2, DslHelper.selectAsNodeList( nsmsg, "//p:Product/@productId", namespaces ).getLength() );
+ }
+
+ @Test
+ public void xmlContentEquals() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentEquals( msg, "/Order/OrderLines/OrderLine/Product/@productId", "364" ) );
+ assertFalse( DslHelper.xmlContentEquals( msg, "/Order/OrderLines/OrderLine/Product/@productId", "1" ) );
+ }
+
+ @Test
+ public void xmlContentEqualsWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentEquals( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product/@productId", "364", namespaces ) );
+ }
+
+ @Test
+ public void xmlContentGreaterThan() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentGreaterThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "363" ) );
+ assertFalse( DslHelper.xmlContentGreaterThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "365" ) );
+ assertFalse( DslHelper.xmlContentGreaterThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "364" ) );
+ }
+
+ @Test
+ public void xmlContentGreaterThanWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentGreaterThan( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product/@productId", "363", namespaces ) );
+ }
+
+ @Test ( expected = XPathExpressionException.class )
+ public void shouldThrowIfArgumentIsNotAParsableDouble() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentGreaterThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "aaa" ) );
+ assertTrue( DslHelper.xmlContentLessThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "aaa" ) );
+ }
+
+ @Test
+ public void xmlContentLessThan() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentLessThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "366" ) );
+ assertTrue( DslHelper.xmlContentLessThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "365" ) );
+ assertFalse( DslHelper.xmlContentLessThan( msg, "/Order/OrderLines/OrderLine/Product/@productId", "363" ) );
+ }
+
+ @Test
+ public void xmlContentLessThanWithNamespaces() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ assertTrue( DslHelper.xmlContentLessThan( nsmsg, "/ord:Order/ord:OrderLines/ord:OrderLine/p:Product/@productId", "366", namespaces));
+ }
+
+ @Test
+ public void xmlContentEqualsPerformanceTest() throws UnsupportedEncodingException, XPathExpressionException
+ {
+ int nrOfCalls = 4000;
+
+ long startTime = System.nanoTime();
+ for ( int i = 0 ; i < nrOfCalls ; i++ )
+ {
+ DslHelper.xmlContentEquals( msg, "/Order/OrderLines/OrderLine/Product/@productId", "364" );
+ }
+ long endTime = TimeUnit.NANOSECONDS.toMillis( System.nanoTime() - startTime );
+ log.info( "Timed " + nrOfCalls + " runs : " + endTime + "ms" );
+ assertTrue( nrOfCalls + " of calls should have taken less then 150ms", endTime < 150 );
+ }
+
+ @Test
+ public void parseNamespaces()
+ {
+ Map<String,String> namespaces = DslHelper.parseNamespaces( "pro=http://org.jboss.soa.esb/product, ord=http://org.jboss.soa.esb/order" );
+ assertNotNull( namespaces );
+ assertEquals( 2, namespaces.size() );
+ assertTrue( namespaces.containsKey( "pro" ) );
+ assertTrue( namespaces.containsKey( "ord" ) );
+ }
+
+ @Test ( expected = IllegalArgumentException.class )
+ public void parseNamespacesNegative()
+ {
+ DslHelper.parseNamespaces( null );
+ }
+
+ @BeforeClass
+ public static void createMessage() throws UnsupportedEncodingException
+ {
+ msg = MessageFactory.getInstance().getMessage();
+ InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KB_message.xml", DslHelperUnitTest.class );
+ String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
+ msg.getBody().add( contents );
+ }
+
+ @BeforeClass
+ public static void createNamespaceMessage() throws UnsupportedEncodingException
+ {
+ nsmsg = MessageFactory.getInstance().getMessage();
+ InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KBNS_message.xml", DslHelperUnitTest.class );
+ String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
+ nsmsg.getBody().add( contents );
+
+ namespaces = new HashMap<String,String>();
+ namespaces.put( "ord", "http://org.jboss.soa.esb/order" );
+ namespaces.put( "p", "http://org.jboss.soa.esb/product" );
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(DslHelperUnitTest.class);
+ }
+}
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,121 +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.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 );
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,318 +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.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-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.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.ConfigurationException;
-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.jboss.soa.esb.util.ClassUtil;
-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 executeStatelessRulesDrlWithDsl() throws RuleServiceException, ConfigurationException, UnsupportedEncodingException
- {
- Message msg = MessageFactory.getInstance().getMessage();
- InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KB_message.xml", getClass() );
- String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
- msg.getBody().add( contents );
- Map<String,Object> globals = getGlobalsWithDest();
- boolean ruleReload = true;
-
- // first run
- long startTime = System.nanoTime();
-
- message = ruleService.executeStatelessRules( "RulesWithDsl.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
- ArrayList<String> destinations = getDistinations( globals );
- assertTrue( destinations.size() == 1 );
-
- long procTime = System.nanoTime() - startTime;
- long firstRun = TimeUnit.NANOSECONDS.toMillis( procTime ) ;
- System.out.println( "Timed First run : " + firstRun + "ms" );
-
- // second run
- startTime = System.nanoTime();
-
- message = ruleService.executeStatelessRules( "RulesWithDsl.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
- procTime = System.nanoTime() - startTime;
- long secondRun = TimeUnit.NANOSECONDS.toMillis( procTime ) ;
- System.out.println( "Timed Second run : " + secondRun + "ms" );
-
- destinations = getDistinations( globals );
- assertTrue( destinations.size() == 2 );
- }
-
- @Test
- public void executeStatelessRulesDrlWithDslAndNamespaces() throws RuleServiceException, ConfigurationException, UnsupportedEncodingException
- {
- Message msg = MessageFactory.getInstance().getMessage();
- InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KBNS_message.xml", getClass() );
- String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
- msg.getBody().add( contents );
- Map<String,Object> globals = getGlobalsWithDest();
- boolean ruleReload = true;
-
- message = ruleService.executeStatelessRules( "RulesWithDslNS.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
- ArrayList<String> destinations = getDistinations( globals );
- assertEquals( 3 , destinations.size() );
- }
-
- @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 );
- }
-
- @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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleServiceUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,318 @@
+/*
+ * 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.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+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.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+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.jboss.soa.esb.util.ClassUtil;
+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 executeStatelessRulesDrlWithDsl() throws RuleServiceException, ConfigurationException, UnsupportedEncodingException
+ {
+ Message msg = MessageFactory.getInstance().getMessage();
+ InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KB_message.xml", getClass() );
+ String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
+ msg.getBody().add( contents );
+ Map<String,Object> globals = getGlobalsWithDest();
+ boolean ruleReload = true;
+
+ // first run
+ long startTime = System.nanoTime();
+
+ message = ruleService.executeStatelessRules( "RulesWithDsl.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 1 );
+
+ long procTime = System.nanoTime() - startTime;
+ long firstRun = TimeUnit.NANOSECONDS.toMillis( procTime ) ;
+ System.out.println( "Timed First run : " + firstRun + "ms" );
+
+ // second run
+ startTime = System.nanoTime();
+
+ message = ruleService.executeStatelessRules( "RulesWithDsl.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
+ procTime = System.nanoTime() - startTime;
+ long secondRun = TimeUnit.NANOSECONDS.toMillis( procTime ) ;
+ System.out.println( "Timed Second run : " + secondRun + "ms" );
+
+ destinations = getDistinations( globals );
+ assertTrue( destinations.size() == 2 );
+ }
+
+ @Test
+ public void executeStatelessRulesDrlWithDslAndNamespaces() throws RuleServiceException, ConfigurationException, UnsupportedEncodingException
+ {
+ Message msg = MessageFactory.getInstance().getMessage();
+ InputStream resourceAsStream = ClassUtil.getResourceAsStream( "/" + "5KBNS_message.xml", getClass() );
+ String contents = StreamUtils.readStreamString( resourceAsStream, "UTF-8" );
+ msg.getBody().add( contents );
+ Map<String,Object> globals = getGlobalsWithDest();
+ boolean ruleReload = true;
+
+ message = ruleService.executeStatelessRules( "RulesWithDslNS.drl", "XPathLanguage.dsl", ruleReload, msg, globals, null );
+ ArrayList<String> destinations = getDistinations( globals );
+ assertEquals( 3 , destinations.size() );
+ }
+
+ @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 );
+ }
+
+ @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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,141 +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;
-
-/**
- * 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;
- }
-
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/BusinessRulesProcessorUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,126 +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 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;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/CBRConfigTreeBuilder.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedRouterUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/ContentBasedWiretapUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/Counter.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/java/org/jboss/soa/esb/actions/MessageFilterUnitTest.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KBNS_message.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/5KBNS_message.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KBNS_message.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KBNS_message.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Order xmlns="http://org.jboss.soa.esb/order"
+ orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0" netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer xmlns="http://org.jboss.soa.esb/customer" userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <prod:Product xmlns:prod="http://org.jboss.soa.esb/product" productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="2">
+ <prod2:Product xmlns:prod2="http://org.jboss.soa.esb/product" productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KB_message.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/5KB_message.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KB_message.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/5KB_message.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBPricingRulesStateful.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBRules.drl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBRules.drl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/JBossESBRules.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -7,6 +7,7 @@
#declare any global variables here
global java.util.List destinations;
+global Message message;
rule "Routing Rule - Serialized based message"
@@ -26,4 +27,4 @@
then
System.out.println("JBoss_XML");
destinations.add("xml-destination");
-end
\ No newline at end of file
+end
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.drl (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/RuleBaseHelper.drl)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.drl (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.properties (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/RuleBaseHelper.properties)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.properties (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.properties 2008-11-20 15:13:49 UTC (rev 23991)
@@ -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/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RuleBaseHelper.xls (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/RuleBaseHelper.xls)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDsl.drl (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/RulesWithDsl.drl)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDsl.drl (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDsl.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,816 @@
+package com.jboss.soa.esb.routing.cbr
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+import javax.xml.xpath.XPathExpression;
+
+expander XPathLanguage.dsl
+
+global java.util.List destinations;
+
+rule "ProductId1"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "1"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId2"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "2"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId3"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "3"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId4"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "4"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId5"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "5"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId6"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "6"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId7"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "7"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId8"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "8"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId9"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "9"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId10"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "10"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId11"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "11"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId12"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "12"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId13"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "13"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId14"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "14"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId15"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "15"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId16"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "16"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId17"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "17"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId18"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "18"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId19"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "19"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId20"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "20"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId21"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "21"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId22"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "22"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId23"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "23"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId24"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "24"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId25"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "25"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId26"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "26"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId27"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "27"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId28"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "28"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId29"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "29"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId30"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "30"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId31"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "31"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId32"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "32"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId33"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "33"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId34"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "34"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId35"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "35"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId36"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "36"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId37"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "37"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId38"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "38"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId39"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "39"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId40"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "40"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId41"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "41"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId42"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "42"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId43"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "43"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId44"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "44"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId45"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "45"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId46"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "46"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId47"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "47"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId48"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "48"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId49"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "49"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId50"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "50"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId51"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "51"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId52"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "52"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId53"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "53"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId54"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "54"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId55"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "55"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId56"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "56"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId57"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "57"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId58"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "58"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId59"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "59"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId60"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "60"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId61"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "61"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId62"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "62"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId63"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "63"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId64"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "64"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId65"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "65"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId66"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "66"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId67"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "67"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId68"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "68"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId69"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "69"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId70"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "70"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId71"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "71"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId72"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "72"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId73"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "73"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId74"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "74"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId75"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "75"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId76"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "76"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId77"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "77"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId78"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "78"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId79"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "79"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId80"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "80"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId81"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "81"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId82"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "82"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId83"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "83"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId84"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "84"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId85"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "85"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId86"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "86"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId87"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "87"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId88"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "88"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId89"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "89"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId90"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "90"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId91"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "91"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId92"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "92"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId93"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "93"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId94"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "94"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId95"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "95"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId96"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "96"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId97"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "97"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId98"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "98"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId99"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "99"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId299"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "299"
+ then
+ Destination : "regular0";
+end
+
+rule "Default rule"
+ salience 1
+ when
+ then
+ Destination : "regular0";
+end
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDslNS.drl (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/RulesWithDslNS.drl)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDslNS.drl (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/RulesWithDslNS.drl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,809 @@
+package com.jboss.soa.esb.routing.cbr
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+import javax.xml.xpath.XPathExpression;
+
+expander XPathLanguage.dsl
+
+global java.util.List destinations;
+
+rule "ProductId1"
+ salience 99
+ when
+ xpathMatch expr "/order:Order/order:OrderLines/order:OrderLine/prod:Product/@productId" use namespaces "order=http://org.jboss.soa.esb/order,prod=http://org.jboss.soa.esb/product"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId2"
+ salience 99
+ when
+ xpathEquals expr "/order:Order/order:OrderLines/order:OrderLine/prod:Product/@productId", "364" use namespaces "order=http://org.jboss.soa.esb/order,prod=http://org.jboss.soa.esb/product"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId3"
+ salience 99
+ when
+ xpathGreaterThan expr "/o:Order/o:OrderLines/o:OrderLine/p:Product/@productId", "200" use namespaces "o=http://org.jboss.soa.esb/order,p=http://org.jboss.soa.esb/product"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId4"
+ salience 99
+ when
+ xpathLessThan expr "/o:Order/o:OrderLines/o:OrderLine/p:Product/@productId", "200" use namespaces "o=http://org.jboss.soa.esb/order,p=http://org.jboss.soa.esb/product"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId5"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "5"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId6"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "6"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId7"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "7"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId8"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "8"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId9"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "9"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId10"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "10"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId11"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "11"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId12"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "12"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId13"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "13"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId14"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "14"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId15"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "15"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId16"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "16"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId17"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "17"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId18"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "18"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId19"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "19"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId20"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "20"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId21"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "21"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId22"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "22"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId23"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "23"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId24"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "24"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId25"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "25"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId26"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "26"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId27"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "27"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId28"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "28"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId29"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "29"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId30"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "30"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId31"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "31"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId32"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "32"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId33"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "33"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId34"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "34"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId35"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "35"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId36"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "36"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId37"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "37"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId38"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "38"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId39"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "39"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId40"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "40"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId41"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "41"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId42"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "42"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId43"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "43"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId44"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "44"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId45"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "45"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId46"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "46"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId47"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "47"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId48"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "48"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId49"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "49"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId50"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "50"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId51"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "51"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId52"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "52"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId53"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "53"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId54"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "54"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId55"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "55"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId56"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "56"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId57"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "57"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId58"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "58"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId59"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "59"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId60"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "60"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId61"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "61"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId62"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "62"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId63"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "63"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId64"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "64"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId65"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "65"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId66"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "66"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId67"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "67"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId68"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "68"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId69"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "69"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId70"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "70"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId71"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "71"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId72"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "72"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId73"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "73"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId74"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "74"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId75"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "75"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId76"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "76"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId77"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "77"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId78"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "78"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId79"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "79"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId80"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "80"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId81"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "81"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId82"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "82"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId83"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "83"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId84"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "84"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId85"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "85"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId86"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "86"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId87"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "87"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId88"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "88"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId89"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "89"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId90"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "90"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId91"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "91"
+ then
+ Destination : "regular1";
+end
+
+rule "ProductId92"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "92"
+ then
+ Destination : "regular2";
+end
+
+rule "ProductId93"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "93"
+ then
+ Destination : "regular3";
+end
+
+rule "ProductId94"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "94"
+ then
+ Destination : "regular4";
+end
+
+rule "ProductId95"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "95"
+ then
+ Destination : "regular5";
+end
+
+rule "ProductId96"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "96"
+ then
+ Destination : "regular6";
+end
+
+rule "ProductId97"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "97"
+ then
+ Destination : "regular7";
+end
+
+rule "ProductId98"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "98"
+ then
+ Destination : "regular8";
+end
+
+rule "ProductId99"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "99"
+ then
+ Destination : "regular9";
+end
+
+rule "ProductId299"
+ salience 100
+ when
+ xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "299"
+ then
+ Destination : "regular0";
+end
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/jbrules/src/test/resources/testrules.pkg (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/jbrules/src/test/resources/testrules.pkg)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -378,6 +378,10 @@
} catch (MessageDeliverException e) {
throw new ActionProcessingException("Error getting SOAP message parameters from payload.", e);
}
+ catch (final ClassCastException ex)
+ {
+ throw new ActionProcessingException("Required a Map in the payload, but got something else!");
+ }
if (!(payload instanceof Map)) {
throw new ActionProcessingException("Invalid payload type in message body location '" + payloadProxy.getGetPayloadLocation() + "'. Expected 'java.util.Map', was '" + payload.getClass().getName() + "'.");
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -19,31 +19,37 @@
*/
package org.jboss.soa.esb.actions.soap;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
import org.jboss.internal.soa.esb.publish.Publish;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorHttpServletRequest;
+import org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorHttpServletResponse;
+import org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorServletContext;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.MessagePayloadProxy;
+import org.jboss.soa.esb.message.Properties;
import org.jboss.soa.esb.message.ResponseHeader;
import org.jboss.soa.esb.message.body.content.BytesBody;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-import javax.management.ObjectName;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Set;
-
/**
* JBoss Webservices SOAP Processor.
* <p/>
@@ -133,7 +139,6 @@
public Message process(Message message) throws ActionProcessingException {
Endpoint endpoint = getServiceEndpoint(jbossws_endpoint);
byte[] soapMessage;
- String response = null;
if(endpoint == null) {
throw new ActionProcessingException("Unknown Service Endpoint '" + jbossws_endpoint + "'.");
@@ -144,34 +149,93 @@
messageTL.set(message);
RequestHandler requestHandler = endpoint.getRequestHandler();
- InvocationContext invocationContext = new InvocationContext();
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- requestHandler.handleRequest(endpoint, new ByteArrayInputStream(soapMessage), os, invocationContext);
-
- Object contentType = message.getProperties().getProperty("Content-Type");
- if(!(contentType instanceof ResponseHeader)) {
- message.getProperties().setProperty("Content-Type", new ResponseHeader("Content-Type", "text/xml"));
+ final Map<String, List<String>> headers = new HashMap<String, List<String>>() ;
+ final Properties properties = message.getProperties() ;
+ final String[] names = properties.getNames() ;
+ for(final String name: names)
+ {
+ final Object value = properties.getProperty(name) ;
+ if (value != null)
+ {
+ final String normalisedName = name.toLowerCase() ;
+ final List<String> values = headers.get(normalisedName) ;
+ if (values == null)
+ {
+ final List<String> newValues = new ArrayList<String>() ;
+ newValues.add(value.toString()) ;
+ headers.put(normalisedName, newValues) ;
+ }
+ else
+ {
+ values.add(value.toString()) ;
+ }
+ }
}
-
- response = new String(os.toByteArray()).trim();
+
+ final String requestContentType = getHeaderValue(headers, "content-type") ;
+ if ("application/octet-stream".equals(requestContentType))
+ {
+ headers.remove("content-type") ;
+ }
+ final String path = getHeaderValue(headers, "path") ;
+ final SOAPProcessorHttpServletRequest servletRequest = new SOAPProcessorHttpServletRequest(path, soapMessage, headers) ;
+ final SOAPProcessorHttpServletResponse servletResponse = new SOAPProcessorHttpServletResponse() ;
+ final SOAPProcessorServletContext servletContext = new SOAPProcessorServletContext() ;
+ requestHandler.handleHttpRequest(endpoint, servletRequest, servletResponse, servletContext) ;
+
+ // This may have been changed, make sure we get the current version.
+ message = messageTL.get();
+ final Properties responseProperties = message.getProperties() ;
+ final String contentType = servletResponse.getContentType() ;
+ final Map<String, List<String>> responseHeaders = servletResponse.getHeaders() ;
+ // We deal with Content-Type below
+ // HTTP Headers *should* be case-insensitive but not with JBR
+ responseHeaders.remove("content-type") ;
+
+ for(Map.Entry<String, List<String>> header: responseHeaders.entrySet())
+ {
+ // We can only deal with the first value in the list.
+ responseProperties.setProperty(header.getKey(), new ResponseHeader(header.getKey(), header.getValue().get(0))) ;
+ }
+
+ final byte[] responseData = servletResponse.getContent() ;
+ if(contentType != null) {
+ responseProperties.setProperty("Content-Type", new ResponseHeader("Content-Type", contentType));
+ } else {
+ responseProperties.setProperty("Content-Type", new ResponseHeader("Content-Type", "text/xml"));
+ }
+
+ if ((contentType != null) && contentType.startsWith("multipart/")) {
+ payloadProxy.setPayload(message, responseData) ;
+ } else {
+ final String charset = servletResponse.getCharset() ;
+ if (charset == null) {
+ payloadProxy.setPayload(message, new String(responseData)) ;
+ } else {
+ payloadProxy.setPayload(message, new String(responseData, charset)) ;
+ }
+ }
} catch (Exception ex) {
throw new ActionProcessingException("Cannot process SOAP request", ex);
} finally {
- // Get the message instance set on the Threadlocal before removing it. The Webservice endpoint
- // may have reset it with a new Message instance.
- message = messageTL.get();
messageTL.remove();
- try {
- payloadProxy.setPayload(message, response);
- } catch (MessageDeliverException e) {
- throw new ActionProcessingException(e);
- }
}
return message;
}
+ private String getHeaderValue(final Map<String, List<String>> headers,
+ final String header)
+ {
+ final List<String> values = headers.get(header) ;
+ if (values != null)
+ {
+ return values.get(0) ;
+ }
+ return null ;
+ }
+
private byte[] getSOAPMessagePayload(Message message) throws ActionProcessingException {
byte[] soapMessage;
Object messagePayload;
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,324 +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.soap.adapter;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * This is an adapter used when integrating with JBossWS.
- *
- * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
- */
-public class SOAPProcessorHttpServletRequest implements HttpServletRequest
-{
- private final Map<String, List<String>> headers ;
-
- private final byte[] content ;
-
- private final String path ;
-
- public SOAPProcessorHttpServletRequest(final String path, final byte[] content, final Map<String, List<String>> headers)
- {
- this.path = path ;
- this.content = content ;
- this.headers = headers ;
- }
-
- public String getHeader(final String name)
- {
- final List<String> values = headers.get(name) ;
- if (values != null)
- {
- return values.get(0) ;
- }
- return null ;
- }
-
- public Enumeration getHeaderNames()
- {
- return Collections.enumeration(headers.keySet()) ;
- }
-
- public String getMethod()
- {
- // always use POST
- return "POST" ;
- }
-
- public String getPathInfo()
- {
- return null ;
- }
-
- public String getQueryString()
- {
- return null ;
- }
-
- public String getRequestURI()
- {
- return (path == null ? "/" : path) ;
- }
-
- public String getContextPath()
- {
- return "" ;
- }
-
- public HttpSession getSession(boolean arg0)
- {
- return null ;
- }
-
- public String getContentType()
- {
- return getHeader("Content-Type") ;
- }
-
- public ServletInputStream getInputStream() throws IOException
- {
- return new SOAPProcessorServletInputStream(new ByteArrayInputStream(content)) ;
- }
-
- public String getParameter(final String name)
- {
- return null ;
- }
-
- public Principal getUserPrincipal()
- {
- // TODO link this is with security
- return null ;
- }
-
- public boolean isUserInRole(final String name)
- {
- // TODO link this is with security
- return false ;
- }
-
- /*
- * The following methods are not supported by this adapter.
- */
-
- public StringBuffer getRequestURL()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getAuthType()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Cookie[] getCookies()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public long getDateHeader(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getHeaders(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getIntHeader(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getPathTranslated()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRemoteUser()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRequestedSessionId()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getServletPath()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public HttpSession getSession()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isRequestedSessionIdFromCookie()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isRequestedSessionIdFromURL()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isRequestedSessionIdFromUrl()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isRequestedSessionIdValid()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getAttributeNames()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getCharacterEncoding()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getContentLength()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Locale getLocale()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getLocales()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Map getParameterMap()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getParameterNames()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String[] getParameterValues(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getProtocol()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public BufferedReader getReader() throws IOException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRealPath(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRemoteAddr()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRemoteHost()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public RequestDispatcher getRequestDispatcher(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getScheme()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getServerName()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getServerPort()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isSecure()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void removeAttribute(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setAttribute(String arg0, Object arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setCharacterEncoding(String arg0)
- throws UnsupportedEncodingException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Object getAttribute(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletRequest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,324 @@
+/*
+ * 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.soap.adapter;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class SOAPProcessorHttpServletRequest implements HttpServletRequest
+{
+ private final Map<String, List<String>> headers ;
+
+ private final byte[] content ;
+
+ private final String path ;
+
+ public SOAPProcessorHttpServletRequest(final String path, final byte[] content, final Map<String, List<String>> headers)
+ {
+ this.path = path ;
+ this.content = content ;
+ this.headers = headers ;
+ }
+
+ public String getHeader(final String name)
+ {
+ final List<String> values = headers.get(name) ;
+ if (values != null)
+ {
+ return values.get(0) ;
+ }
+ return null ;
+ }
+
+ public Enumeration getHeaderNames()
+ {
+ return Collections.enumeration(headers.keySet()) ;
+ }
+
+ public String getMethod()
+ {
+ // always use POST
+ return "POST" ;
+ }
+
+ public String getPathInfo()
+ {
+ return null ;
+ }
+
+ public String getQueryString()
+ {
+ return null ;
+ }
+
+ public String getRequestURI()
+ {
+ return (path == null ? "/" : path) ;
+ }
+
+ public String getContextPath()
+ {
+ return "" ;
+ }
+
+ public HttpSession getSession(boolean arg0)
+ {
+ return null ;
+ }
+
+ public String getContentType()
+ {
+ return getHeader("Content-Type") ;
+ }
+
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return new SOAPProcessorServletInputStream(new ByteArrayInputStream(content)) ;
+ }
+
+ public String getParameter(final String name)
+ {
+ return null ;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ // TODO link this is with security
+ return null ;
+ }
+
+ public boolean isUserInRole(final String name)
+ {
+ // TODO link this is with security
+ return false ;
+ }
+
+ /*
+ * The following methods are not supported by this adapter.
+ */
+
+ public StringBuffer getRequestURL()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getAuthType()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Cookie[] getCookies()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public long getDateHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getHeaders(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getIntHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getPathTranslated()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteUser()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRequestedSessionId()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getServletPath()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public HttpSession getSession()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdFromURL()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getCharacterEncoding()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getContentLength()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Locale getLocale()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getLocales()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Map getParameterMap()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getParameterNames()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String[] getParameterValues(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getProtocol()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRealPath(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteAddr()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteHost()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getScheme()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getServerName()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getServerPort()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isSecure()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setCharacterEncoding(String arg0)
+ throws UnsupportedEncodingException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Object getAttribute(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,291 +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.soap.adapter;
-
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * This is an adapter used when integrating with JBossWS.
- *
- * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
- */
-public class SOAPProcessorHttpServletResponse implements HttpServletResponse
-{
- private static final String CHARSET = "charset=" ;
-
- private Map<String, List<String>> headers = new HashMap<String, List<String>>() ;
-
- private int status ;
-
- private ByteArrayOutputStream baos ;
-
- private boolean streamReturned ;
-
- public SOAPProcessorHttpServletResponse()
- {
- baos = new ByteArrayOutputStream() ;
- }
-
- public void addHeader(final String name, final String value)
- {
- final String normalisedName = name.toLowerCase() ;
- final List<String> values = headers.get(normalisedName) ;
- if (values != null)
- {
- values.add(value) ;
- }
- else
- {
- final List<String> newValues = new ArrayList<String>() ;
- newValues.add(value) ;
- headers.put(normalisedName, newValues) ;
- }
- }
-
- public void setHeader(final String name, final String value)
- {
- final List<String> values = new ArrayList<String>() ;
- values.add(value) ;
- headers.put(name.toLowerCase(), values) ;
- }
-
- public void setStatus(final int status)
- {
- this.status = status ;
- }
-
- public ServletOutputStream getOutputStream() throws IOException
- {
- if (streamReturned)
- {
- throw new IOException("Output stream already accessed") ;
- }
- streamReturned = true ;
- return new SOAPProcessorServletOutputStream(baos) ;
- }
-
- public PrintWriter getWriter() throws IOException
- {
- if (streamReturned)
- {
- throw new IOException("Output stream already accessed") ;
- }
- streamReturned = true ;
- final String charset = getCharset() ;
- final OutputStreamWriter osw = (charset != null ? new OutputStreamWriter(baos, charset) : new OutputStreamWriter(baos)) ;
- return new PrintWriter(new BufferedWriter(osw)) ;
- }
-
- public void setContentType(final String contentType)
- {
- setHeader("content-type", contentType) ;
- }
-
- public int getStatus()
- {
- return status ;
- }
-
- public Map<String, List<String>> getHeaders()
- {
- return headers ;
- }
-
- public byte[] getContent()
- {
- return baos.toByteArray() ;
- }
-
- public String getContentType()
- {
- final List<String> values = headers.get("content-type") ;
- if (values != null)
- {
- return values.get(0) ;
- }
- return null ;
- }
-
- public String getCharset()
- {
- final String contentType = getContentType() ;
- if (contentType != null)
- {
- final int index = contentType.indexOf(CHARSET) ;
- if (index >= 0)
- {
- final int beginIndex = index + CHARSET.length() ;
- if (beginIndex < contentType.length())
- {
- final int endIndex = contentType.indexOf(';', beginIndex) ;
- if (endIndex >= 0)
- {
- return contentType.substring(beginIndex, endIndex).trim() ;
- }
- else
- {
- return contentType.substring(beginIndex).trim();
- }
- }
- }
- }
- return null ;
- }
-
- /*
- * The following methods are not supported by this adapter.
- */
-
- public void addCookie(Cookie arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void addDateHeader(String arg0, long arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void addIntHeader(String arg0, int arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean containsHeader(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String encodeRedirectURL(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String encodeRedirectUrl(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String encodeURL(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String encodeUrl(String arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void sendError(int arg0) throws IOException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void sendError(int arg0, String arg1) throws IOException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void sendRedirect(String arg0) throws IOException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setDateHeader(String arg0, long arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setIntHeader(String arg0, int arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setStatus(int arg0, String arg1)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void flushBuffer() throws IOException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getBufferSize()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getCharacterEncoding()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Locale getLocale()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public boolean isCommitted()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void reset()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void resetBuffer()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setBufferSize(int arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setContentLength(int arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setLocale(Locale arg0)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorHttpServletResponse.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,291 @@
+/*
+ * 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.soap.adapter;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class SOAPProcessorHttpServletResponse implements HttpServletResponse
+{
+ private static final String CHARSET = "charset=" ;
+
+ private Map<String, List<String>> headers = new HashMap<String, List<String>>() ;
+
+ private int status ;
+
+ private ByteArrayOutputStream baos ;
+
+ private boolean streamReturned ;
+
+ public SOAPProcessorHttpServletResponse()
+ {
+ baos = new ByteArrayOutputStream() ;
+ }
+
+ public void addHeader(final String name, final String value)
+ {
+ final String normalisedName = name.toLowerCase() ;
+ final List<String> values = headers.get(normalisedName) ;
+ if (values != null)
+ {
+ values.add(value) ;
+ }
+ else
+ {
+ final List<String> newValues = new ArrayList<String>() ;
+ newValues.add(value) ;
+ headers.put(normalisedName, newValues) ;
+ }
+ }
+
+ public void setHeader(final String name, final String value)
+ {
+ final List<String> values = new ArrayList<String>() ;
+ values.add(value) ;
+ headers.put(name.toLowerCase(), values) ;
+ }
+
+ public void setStatus(final int status)
+ {
+ this.status = status ;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (streamReturned)
+ {
+ throw new IOException("Output stream already accessed") ;
+ }
+ streamReturned = true ;
+ return new SOAPProcessorServletOutputStream(baos) ;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ if (streamReturned)
+ {
+ throw new IOException("Output stream already accessed") ;
+ }
+ streamReturned = true ;
+ final String charset = getCharset() ;
+ final OutputStreamWriter osw = (charset != null ? new OutputStreamWriter(baos, charset) : new OutputStreamWriter(baos)) ;
+ return new PrintWriter(new BufferedWriter(osw)) ;
+ }
+
+ public void setContentType(final String contentType)
+ {
+ setHeader("content-type", contentType) ;
+ }
+
+ public int getStatus()
+ {
+ return status ;
+ }
+
+ public Map<String, List<String>> getHeaders()
+ {
+ return headers ;
+ }
+
+ public byte[] getContent()
+ {
+ return baos.toByteArray() ;
+ }
+
+ public String getContentType()
+ {
+ final List<String> values = headers.get("content-type") ;
+ if (values != null)
+ {
+ return values.get(0) ;
+ }
+ return null ;
+ }
+
+ public String getCharset()
+ {
+ final String contentType = getContentType() ;
+ if (contentType != null)
+ {
+ final int index = contentType.indexOf(CHARSET) ;
+ if (index >= 0)
+ {
+ final int beginIndex = index + CHARSET.length() ;
+ if (beginIndex < contentType.length())
+ {
+ final int endIndex = contentType.indexOf(';', beginIndex) ;
+ if (endIndex >= 0)
+ {
+ return contentType.substring(beginIndex, endIndex).trim() ;
+ }
+ else
+ {
+ return contentType.substring(beginIndex).trim();
+ }
+ }
+ }
+ }
+ return null ;
+ }
+
+ /*
+ * The following methods are not supported by this adapter.
+ */
+
+ public void addCookie(Cookie arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void addDateHeader(String arg0, long arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void addIntHeader(String arg0, int arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean containsHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeRedirectURL(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeRedirectUrl(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeURL(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeUrl(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendError(int arg0) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendError(int arg0, String arg1) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendRedirect(String arg0) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setDateHeader(String arg0, long arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setIntHeader(String arg0, int arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setStatus(int arg0, String arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getBufferSize()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getCharacterEncoding()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Locale getLocale()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isCommitted()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void reset()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void resetBuffer()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setBufferSize(int arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setContentLength(int arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setLocale(Locale arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,164 +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.soap.adapter;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-/**
- * This is an adapter used when integrating with JBossWS.
- *
- * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
- */
-public class SOAPProcessorServletContext implements ServletContext
-{
- public Object getAttribute(final String name)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getAttributeNames()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public ServletContext getContext(final String name)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getInitParameter(final String param)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getInitParameterNames()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getMajorVersion()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public int getMinorVersion()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getMimeType(final String file)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public RequestDispatcher getNamedDispatcher(final String name)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getRealPath(final String path)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public RequestDispatcher getRequestDispatcher(final String path)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public URL getResource(final String path)
- throws MalformedURLException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public InputStream getResourceAsStream(final String path)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Set getResourcePaths(final String path)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getServerInfo()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Servlet getServlet(final String name)
- throws ServletException
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public String getServletContextName()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getServletNames()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public Enumeration getServlets()
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void log(final String msg)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void log(final Exception ex, final String msg)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void log(final String msg, final Throwable th)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void removeAttribute(final String name)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-
- public void setAttribute(final String name, final Object value)
- {
- throw new UnsupportedOperationException("Not yet supported") ;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletContext.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,164 @@
+/*
+ * 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.soap.adapter;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class SOAPProcessorServletContext implements ServletContext
+{
+ public Object getAttribute(final String name)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public ServletContext getContext(final String name)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getInitParameter(final String param)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getMajorVersion()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getMinorVersion()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getMimeType(final String file)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public RequestDispatcher getNamedDispatcher(final String name)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRealPath(final String path)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public RequestDispatcher getRequestDispatcher(final String path)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public URL getResource(final String path)
+ throws MalformedURLException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public InputStream getResourceAsStream(final String path)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Set getResourcePaths(final String path)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getServerInfo()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Servlet getServlet(final String name)
+ throws ServletException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getServletContextName()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getServletNames()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getServlets()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void log(final String msg)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void log(final Exception ex, final String msg)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void log(final String msg, final Throwable th)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void removeAttribute(final String name)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setAttribute(final String name, final Object value)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,49 +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.soap.adapter;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletInputStream;
-
-/**
- * This is an adapter used when integrating with JBossWS.
- *
- * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
- */
-public class SOAPProcessorServletInputStream extends ServletInputStream
-{
- private final InputStream is ;
-
- SOAPProcessorServletInputStream(final InputStream is)
- {
- this.is = is ;
- }
-
- @Override
- public int read() throws IOException
- {
- return is.read() ;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletInputStream.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,49 @@
+/*
+ * 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.soap.adapter;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class SOAPProcessorServletInputStream extends ServletInputStream
+{
+ private final InputStream is ;
+
+ SOAPProcessorServletInputStream(final InputStream is)
+ {
+ this.is = is ;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ return is.read() ;
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,50 +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.soap.adapter;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.servlet.ServletOutputStream;
-
-/**
- * This is an adapter used when integrating with JBossWS.
- *
- * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
- */
-public class SOAPProcessorServletOutputStream extends ServletOutputStream
-{
- private final OutputStream os ;
-
- SOAPProcessorServletOutputStream(final OutputStream os)
- {
- this.os = os ;
- }
-
- @Override
- public void write(final int byteVal)
- throws IOException
- {
- os.write(byteVal) ;
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/SOAPProcessorServletOutputStream.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,50 @@
+/*
+ * 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.soap.adapter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletOutputStream;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class SOAPProcessorServletOutputStream extends ServletOutputStream
+{
+ private final OutputStream os ;
+
+ SOAPProcessorServletOutputStream(final OutputStream os)
+ {
+ this.os = os ;
+ }
+
+ @Override
+ public void write(final int byteVal)
+ throws IOException
+ {
+ os.write(byteVal) ;
+ }
+}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.itrl.ipl.sj.se/">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ws:postTrainMessage>
+ <!--Optional:-->
+ <arg0>argument 0</arg0>
+ <!--Zero or more repetitions: - cloned-->
+ <arg1>1111</arg1>
+ <arg1>2222</arg1>
+<arg1>3333</arg1>
+<arg1>4444</arg1>
+<arg2>true</arg2>
+ <!--Optional:-->
+ <arg3>argument 3</arg3>
+ <arg4>1</arg4>
+ <arg5>2</arg5>
+ </ws:postTrainMessage>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl 2008-11-20 15:13:49 UTC (rev 23991)
@@ -48,4 +48,4 @@
<soap:address location='http://localhost:8380/HanddatorDummyWS/DummyHanddatorWSBean'/>
</port>
</service>
-</definitions>
+</definitions>
\ No newline at end of file
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/MANAGEMENT-README.txt
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/MANAGEMENT-README.txt 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/MANAGEMENT-README.txt 2008-11-20 15:13:49 UTC (rev 23991)
@@ -17,7 +17,9 @@
In the management-esb directory there is a db.properties file. In order
to change the database from hsqldb to mysql or oracle, edit this file and
-change the db property to "mysql" or "oracle".
+change the db property to "mysql", "oracle" or "postgreql". Also, change
+the db.username and db.password to the username and password setup for
+the database.
Next, change the management-esb/src/main/resources/<db>/management-ds.xml
file so that the settings match the datasource for your database.
@@ -29,7 +31,11 @@
For MySQL, it may be necessary to create the database "statistics" before
deploying if you have not edited the management-ds.xml file.
+For Postgres, it may be necessary to create the database "jbossesb" or
+if you have modified the postgres management-ds.xml file, create the
+database that was named in the database url.
+
Collection Periods :
The period of time in between collections is by default 10 minutes, but
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,7 +4,6 @@
<property name="console.dir" value="${esb.root.dir}/tools/console"/>
<property file="${esb.root.dir}/tools/console/management-esb/db.properties"/>
<property name="mgmt.dir" location="."/>
- <property name="lib.dir" location="${mgmt.dir}/../../../lib"/>
<property name="mgmt.build.dir" location="${mgmt.dir}/build"/>
<property name="src.java.dir" location="${mgmt.dir}/src/main/java"/>
@@ -12,28 +11,47 @@
<delete dir="${mgmt.build.dir}"/>
</target>
+ <!-- Are we embedded in a source hierarchy? -->
+ <condition property="hierarchy.source">
+ <available file="${esb.root.dir}/build-distr.xml"/>
+ </condition>
+ <!-- Are we embedded in a jbossesb distribution hierarchy? -->
+ <condition property="hierarchy.jbossesb">
+ <or>
+ <available file="${esb.root.dir}/JBossORG-EULA.txt"/>
+ <available file="${esb.root.dir}/JEMS-EULA.txt"/>
+ </or>
+ </condition>
+
+ <target name="dependencies" depends="dependencies.source, dependencies.jbossesb"/>
+ <target name="dependencies.jbossesb" if="hierarchy.jbossesb">
+ <path id="lib.jars">
+ <fileset dir="${mgmt.dir}/../../../lib" includes="*.jar"/>
+ </path>
+ </target>
+ <target name="dependencies.source" if="hierarchy.source">
+ <available file="${esb.root.dir}/build/jbossesb" property="dist.exists"/>
+ <fail unless="dist.exists"
+ message="JBossESB must be built. Please run 'ant dist' in ${esb.root.dir}"/>
+
+ <path id="lib.jars">
+ <fileset dir="${mgmt.dir}/../../../lib/ext" includes="*.jar"/>
+ <fileset dir="${mgmt.dir}/../../../build/jbossesb/lib" includes="*.jar"/>
+ </path>
+ </target>
+
<target name="define-lib">
<condition property="esb.lib.dir"
value="${esb.root.dir}/lib/ext">
<available type="dir" file="${esb.root.dir}/lib/ext"/>
</condition>
<condition property="esb.lib.dir"
- value="${esb.root.dir}/server/default/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/default/deploy/jbossesb.sar/lib"/>
+ value="${esb.root.dir}/server/${org.jboss.esb.server.config}/deploy/jbossesb.sar/lib">
+ <available type="dir" file="${esb.root.dir}/server/${org.jboss.esb.server.config}/deploy/jbossesb.sar/lib"/>
</condition>
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib"/>
- </condition>
- <condition property="esb.lib.dir"
- value="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib">
- <available type="dir" file="${esb.root.dir}/server/all/deploy/jbossesb.sar/lib"/>
+ <condition property="server.lib.dir" value="../../../server/${org.jboss.esb.server.config}/lib">
+ <available type="dir" file="../../../server/${org.jboss.esb.server.config}/lib" />
</condition>
- <condition property="server.lib.dir"
- value="../../../server/default/lib">
- <available type="dir" file="../../../server/default/lib"
-/>
- </condition>
<property name="server.lib.dir" value="${esb.lib.dir}"/>
<path id="build.classpath">
<fileset dir="${esb.root.dir}/tools/console/management-web/lib">
@@ -48,7 +66,7 @@
<fileset dir="${mgmt.dir}/lib">
<include name="*.jar"/>
</fileset>
- <fileset refid="lib"/>
+ <path refid="lib.jars"/>
</path>
<condition property="lib.dir.path"
@@ -60,20 +78,10 @@
<available type="dir" file="${mgmt.dir}/./lib"/>
</condition>
- <fileset id="lib" dir="${lib.dir}">
- <include name="*.jar" />
- </fileset>
-
- <condition property="rosetta.src" value="${esb.root.dir}/rosetta/src">
- <available type="dir" file="${esb.root.dir}/rosetta/src"/>
- </condition>
- <condition property="rosetta.src" value="${src.java.dir}">
- <available type="dir" file="${src.java.dir}"/>
- </condition>
<property name="lib.dir" location="lib.dir.path"/>
</target>
- <target name="init" depends="define-lib">
+ <target name="init" depends="dependencies, define-lib">
<mkdir dir="${mgmt.build.dir}"/>
<mkdir dir="${mgmt.build.dir}/classes"/>
</target>
@@ -81,16 +89,15 @@
<target name="compile" depends="init"
description="Build the management war">
<echo>${esb.root.dir}</echo>
+
<mkdir dir="${mgmt.build.dir}/classes"/>
<javac classpathref="build.classpath"
destdir="${mgmt.build.dir}/classes"
debug="on"
- includes="org/jboss/soa/esb/monitoring/**"
source="1.5"
target="1.5"
deprecation="${javac.deprecation}"
nowarn="on">
- <src path="${rosetta.src}"/>
<src path="${src.java.dir}"/>
</javac>
<copy file="${mgmt.dir}/src/main/resources/${db}/monitoring-mappings.hbm.xml"
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/postgresql.properties (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management/postgresql.properties)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/postgresql.properties (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/postgresql.properties 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,4 @@
+db.dialect=org.hibernate.dialect.PostgreSQLDialect
+connection.datasource=java:/ManagementDS
+db.datasource=ManagementDS
+database.depends=
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/mysql/management-ds.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management/src/main/resources/mysql/management-ds.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/mysql/management-ds.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/mysql/management-ds.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- The Hypersonic embedded database JCA connection factory config -->
+
+<!-- $Id: hsqldb-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ -->
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>ManagementDS</jndi-name>
+
+ <connection-url>jdbc:mysql://${jboss.bind.address}:3306/statistics</connection-url>
+
+ <!-- The driver class -->
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+
+ <!-- The login and password -->
+ <user-name>@db.username@</user-name>
+ <password>@db.password@</password>
+
+ <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
+ <min-pool-size>5</min-pool-size>
+
+ <!-- The maximum connections in a pool/sub-pool -->
+ <max-pool-size>20</max-pool-size>
+ <connection-property name="autoReconnect">true</connection-property>
+ <metadata>
+ <type-mapping>mySQL</type-mapping>
+ </metadata>
+ </local-tx-datasource>
+</datasources>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management/src/main/resources/postgresql)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="org.jboss.soa.esb.monitoring.pojo.JMXPattern" table="JMXPATTERN">
- <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
- <generator class="sequence">
- <param name="sequence">mgmt_hibernate_sequence</param>
- </generator>
- </id>
- <property name="classpattern" type="java.lang.String" column="classpattern"/>
- <property name="keyvalue" type="java.lang.String" column="keyvalue"/>
- </class>
- <class name="org.jboss.soa.esb.monitoring.pojo.JMXData" table="JMXDATA">
- <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
- <generator class="sequence">
- <param name="sequence">mgmt_hibernate_sequence</param>
- </generator>
- </id>
- <many-to-one name="attribute" column="STATID"/>
- <property name="server" type="java.lang.String" column="SERVER"/>
- <property name="statdate" type="java.util.Date" column="STATDATE"/>
- <property name="timevalue" type="java.lang.Float" column="timevalue"/>
- <property name="countvalue" type="java.lang.Integer" column="countvalue"/>
- <property name="textvalue" type="java.lang.String" column="textvalue"/>
- </class>
- <class name="org.jboss.soa.esb.monitoring.pojo.JMXOperationResult" table="JMXOPERATIONRESULT">
- <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
- <generator class="sequence">
- <param name="sequence">mgmt_hibernate_sequence</param>
- </generator>
- </id>
- <many-to-one name="operation" column="OPID"/>
- <property name="servername" type="java.lang.String" column="SERVER"/>
- <property name="statdate" type="timestamp" column="STATDATE"/>
- <property name="result" type="java.lang.String" column="RESULT"/>
- </class>
- <class name="org.jboss.soa.esb.monitoring.pojo.JMXAttribute" table="JMXATTRIBUTE">
- <id name="id" column="statid" type="java.lang.Long" unsaved-value="0">
- <generator class="sequence">
- <param name="sequence">mgmt_hibernate_sequence</param>
- </generator>
- </id>
- <property name="objectname" type="java.lang.String" column="objectname"/>
- <property name="attribute" type="java.lang.String" column="attribute"/>
- </class>
- <class name="org.jboss.soa.esb.monitoring.pojo.JMXOperation" table="JMXOPERATION">
- <id name="id" column="opid" type="java.lang.Long" unsaved-value="0">
- <generator class="sequence">
- <param name="sequence">mgmt_hibernate_sequence</param>
- </generator>
- </id>
- <property name="objectname" type="java.lang.String" column="objectname"/>
- <property name="operation" type="java.lang.String" column="operation"/>
- <property name="description" type="java.lang.String" column="description"/>
- <property name="returntype" type="java.lang.String" column="returntype"/>
- <property name="servername" type="java.lang.String" column="servername"/>
- <property name="activeflag" type="java.lang.Boolean" column="activeflag"/>
- </class>
-</hibernate-mapping>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management/src/main/resources/postgresql/monitoring-mappings.hbm.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.jboss.soa.esb.monitoring.pojo.JMXPattern" table="JMXPATTERN">
+ <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
+ <generator class="sequence">
+ <param name="sequence">mgmt_hibernate_sequence</param>
+ </generator>
+ </id>
+ <property name="classpattern" type="java.lang.String" column="classpattern"/>
+ <property name="keyvalue" type="java.lang.String" column="keyvalue"/>
+ </class>
+ <class name="org.jboss.soa.esb.monitoring.pojo.JMXData" table="JMXDATA">
+ <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
+ <generator class="sequence">
+ <param name="sequence">mgmt_hibernate_sequence</param>
+ </generator>
+ </id>
+ <many-to-one name="attribute" column="STATID"/>
+ <property name="server" type="java.lang.String" column="SERVER"/>
+ <property name="statdate" type="java.util.Date" column="STATDATE"/>
+ <property name="timevalue" type="java.lang.Float" column="timevalue"/>
+ <property name="countvalue" type="java.lang.Integer" column="countvalue"/>
+ <property name="textvalue" type="java.lang.String" column="textvalue"/>
+ </class>
+ <class name="org.jboss.soa.esb.monitoring.pojo.JMXOperationResult" table="JMXOPERATIONRESULT">
+ <id name="id" column="id" type="java.lang.Long" unsaved-value="0">
+ <generator class="sequence">
+ <param name="sequence">mgmt_hibernate_sequence</param>
+ </generator>
+ </id>
+ <many-to-one name="operation" column="OPID"/>
+ <property name="servername" type="java.lang.String" column="SERVER"/>
+ <property name="statdate" type="timestamp" column="STATDATE"/>
+ <property name="result" type="java.lang.String" column="RESULT"/>
+ </class>
+ <class name="org.jboss.soa.esb.monitoring.pojo.JMXAttribute" table="JMXATTRIBUTE">
+ <id name="id" column="statid" type="java.lang.Long" unsaved-value="0">
+ <generator class="sequence">
+ <param name="sequence">mgmt_hibernate_sequence</param>
+ </generator>
+ </id>
+ <property name="objectname" type="java.lang.String" column="objectname"/>
+ <property name="attribute" type="java.lang.String" column="attribute"/>
+ </class>
+ <class name="org.jboss.soa.esb.monitoring.pojo.JMXOperation" table="JMXOPERATION">
+ <id name="id" column="opid" type="java.lang.Long" unsaved-value="0">
+ <generator class="sequence">
+ <param name="sequence">mgmt_hibernate_sequence</param>
+ </generator>
+ </id>
+ <property name="objectname" type="java.lang.String" column="objectname"/>
+ <property name="operation" type="java.lang.String" column="operation"/>
+ <property name="description" type="java.lang.String" column="description"/>
+ <property name="returntype" type="java.lang.String" column="returntype"/>
+ <property name="servername" type="java.lang.String" column="servername"/>
+ <property name="activeflag" type="java.lang.Boolean" column="activeflag"/>
+ </class>
+</hibernate-mapping>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -8,7 +8,7 @@
<property file="${install.dir}/deployment.properties"/>
<property name="mgmt.esb.dir" value="${console.dir}/management-esb"/>
- <property file="${mgmt.esb.dir}/db.properties"/>
+ <property file="${mgmt.esb.dir}/db.properties"/>
<property file="${console.dir}/management/${db}.properties"/>
<property name="build.dir" location="${mgmt.esb.dir}/build"/>
@@ -108,7 +108,9 @@
</target>
<target name="copy-datasource" if="management.ds.available">
- <copy file="${mgmt.esb.dir}/src/main/resources/${db}/management-ds.xml" todir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy" overwrite="true"/>
+ <filter token="db.username" value="${db.username}"/>
+ <filter token="db.password" value="${db.password}"/>
+ <copy file="${mgmt.esb.dir}/src/main/resources/${db}/management-ds.xml" todir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy" filtering="true" overwrite="true"/>
</target>
<target name="deploy" depends="esb,copy-datasource" description="Deploy the WAR">
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/db.properties
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/db.properties 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/db.properties 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,2 +1,4 @@
db=hsqldb
+db.username=sa
+db.password=
pollMinuteFrequency=10
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/hsqldb/management-ds.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/hsqldb/management-ds.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/hsqldb/management-ds.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -4,8 +4,8 @@
<jndi-name>ManagementDS</jndi-name>
<connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}ManagementDS</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
+ <user-name>@db.username@</user-name>
+ <password>@db.password@</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>0</idle-timeout-minutes>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/oracle/management-ds.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/oracle/management-ds.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/oracle/management-ds.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -14,8 +14,8 @@
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<!-- The login and password -->
- <user-name>oracle</user-name>
- <password>oracle</password>
+ <user-name>@db.username@</user-name>
+ <password>@db.password@</password>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>5</min-pool-size>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,77 +0,0 @@
- CREATE SEQUENCE mgmt_hibernate_sequence
- INCREMENT 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- START 1
- CACHE 1;
-
- create table JMXDATA (
- id bigint,
- STATID integer,
- SERVER varchar(255),
- STATDATE timestamp,
- timevalue float,
- countvalue integer,
- textvalue text
- );
-
- create table JMXATTRIBUTE (
- statid bigint,
- objectname varchar(255),
- attribute varchar(255)
- );
-
- create table JMXPATTERN (
- id bigint,
- classpattern varchar(255),
- keyvalue varchar(255)
- );
-
- create table JMXOPERATION (
- opid bigint,
- objectname varchar(255),
- operation varchar(255),
- description varchar(255),
- returntype varchar(255),
- servername varchar(255),
- activeflag boolean
- );
-
- create table JMXOPERATIONRESULT (
- id bigint,
- opid bigint,
- server varchar(255),
- statdate timestamp,
- result varchar(255)
- );
- alter table JMXDATA
- alter column id SET DEFAULT nextval('mgmt_hibernate_sequence');
- alter table JMXATTRIBUTE
- alter column statid SET DEFAULT nextval('mgmt_hibernate_sequence');
- alter table JMXPATTERN
- alter column id SET DEFAULT nextval('mgmt_hibernate_sequence');
- alter table JMXOPERATION
- alter column opid SET DEFAULT nextval('mgmt_hibernate_sequence');
- alter table JMXOPERATIONRESULT
- alter column id set DEFAULT nextval('mgmt_hibernate_sequence');
- alter table JMXDATA
- ADD primary key(id);
- alter table JMXATTRIBUTE
- ADD primary key(statid);
- alter table JMXPATTERN
- ADD primary key(id);
- alter table JMXOPERATION
- ADD primary key(opid);
- alter table JMXOPERATIONRESULT
- ADD primary key(id);
- CREATE INDEX FKD2EA449F4522DA9E ON JMXDATA (STATID);
- alter table JMXDATA
- add constraint FKD2EA449F4522DA9E
- foreign key (STATID)
- references JMXATTRIBUTE (statid);
- CREATE INDEX FKD2EA449F4522DA9F ON JMXOPERATIONRESULT (OPID);
- alter table JMXOPERATIONRESULT
- add constraint FKD2EA449F4522DA9F
- foreign key (OPID)
- references JMXOPERATION(opid);
-
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/create_database.sql 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,77 @@
+ CREATE SEQUENCE mgmt_hibernate_sequence
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+
+ create table JMXDATA (
+ id bigint,
+ STATID integer,
+ SERVER varchar(255),
+ STATDATE timestamp,
+ timevalue float,
+ countvalue integer,
+ textvalue text
+ );
+
+ create table JMXATTRIBUTE (
+ statid bigint,
+ objectname varchar(255),
+ attribute varchar(255)
+ );
+
+ create table JMXPATTERN (
+ id bigint,
+ classpattern varchar(255),
+ keyvalue varchar(255)
+ );
+
+ create table JMXOPERATION (
+ opid bigint,
+ objectname varchar(255),
+ operation varchar(255),
+ description varchar(255),
+ returntype varchar(255),
+ servername varchar(255),
+ activeflag boolean
+ );
+
+ create table JMXOPERATIONRESULT (
+ id bigint,
+ opid bigint,
+ server varchar(255),
+ statdate timestamp,
+ result varchar(255)
+ );
+ alter table JMXDATA
+ alter column id SET DEFAULT nextval('mgmt_hibernate_sequence');
+ alter table JMXATTRIBUTE
+ alter column statid SET DEFAULT nextval('mgmt_hibernate_sequence');
+ alter table JMXPATTERN
+ alter column id SET DEFAULT nextval('mgmt_hibernate_sequence');
+ alter table JMXOPERATION
+ alter column opid SET DEFAULT nextval('mgmt_hibernate_sequence');
+ alter table JMXOPERATIONRESULT
+ alter column id set DEFAULT nextval('mgmt_hibernate_sequence');
+ alter table JMXDATA
+ ADD primary key(id);
+ alter table JMXATTRIBUTE
+ ADD primary key(statid);
+ alter table JMXPATTERN
+ ADD primary key(id);
+ alter table JMXOPERATION
+ ADD primary key(opid);
+ alter table JMXOPERATIONRESULT
+ ADD primary key(id);
+ CREATE INDEX FKD2EA449F4522DA9E ON JMXDATA (STATID);
+ alter table JMXDATA
+ add constraint FKD2EA449F4522DA9E
+ foreign key (STATID)
+ references JMXATTRIBUTE (statid);
+ CREATE INDEX FKD2EA449F4522DA9F ON JMXOPERATIONRESULT (OPID);
+ alter table JMXOPERATIONRESULT
+ add constraint FKD2EA449F4522DA9F
+ foreign key (OPID)
+ references JMXOPERATION(opid);
+
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,9 +0,0 @@
-INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'service=MessageCounter');
-
-INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'category=MessageCounter');
-
-INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'category=SmooksMessageCounter');
-
-INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'listener-name=');
-
-INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'gateway-name=');
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/insert_rows.sql 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,9 @@
+INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'service=MessageCounter');
+
+INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'category=MessageCounter');
+
+INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'category=SmooksMessageCounter');
+
+INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'listener-name=');
+
+INSERT INTO JMXPATTERN (CLASSPATTERN, KEYVALUE) VALUES ('jboss.esb:*', 'gateway-name=');
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<datasources>
- <local-tx-datasource>
- <jndi-name>ManagementDS</jndi-name>
- <connection-url>jdbc:postgresql://${jboss.bind.address}:5432/jbossesb</connection-url>
- <driver-class>org.postgresql.Driver</driver-class>
- <user-name>@db.username@</user-name>
- <password>@db.password@</password>
- <metadata>
- <type-mapping>PostgreSQL 8.3</type-mapping>
- </metadata>
- </local-tx-datasource>
-</datasources>
-
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/product/tools/console/management-esb/src/main/resources/postgresql/management-ds.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>ManagementDS</jndi-name>
+ <connection-url>jdbc:postgresql://${jboss.bind.address}:5432/jbossesb</connection-url>
+ <driver-class>org.postgresql.Driver</driver-class>
+ <user-name>@db.username@</user-name>
+ <password>@db.password@</password>
+ <metadata>
+ <type-mapping>PostgreSQL 8.3</type-mapping>
+ </metadata>
+ </local-tx-datasource>
+</datasources>
+
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -3,10 +3,13 @@
<property name="build.sysclasspath" value="ignore"/>
<condition property="JDK_VERSION_OK">
+ <or>
<equals arg1="${java.specification.version}" arg2="1.5"/>
+ <equals arg1="${java.specification.version}" arg2="1.6"/>
+ </or>
</condition>
<fail unless="JDK_VERSION_OK"
- message="JBoss ESB requires jdk1.5 to build."/>
+ message="JBoss ESB requires jdk1.5 or jdk1.6 to build."/>
<property name="product.dir" location="../product"/>
<property name="build.location" location="build"/>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/build.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/build.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/build.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -133,6 +133,12 @@
<include name="META-INF/*.xml"/>
</fileset>
</jar>
+ <jar jarfile="${qa.build.lib}/aop-test.sar">
+ <fileset dir="${qa.junit.classes}">
+ <include name="org/jboss/soa/esb/server/aop/*.class"/>
+ </fileset>
+ <fileset dir="${qa.junit.resources}/server/aop"/>
+ </jar>
</target>
<target name="one-test" if="test" depends="jars"
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/resources/server/aop)
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/resources/server/aop/META-INF)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<server>
- <mbean name="jboss.esb:test=AOPServer" code="org.jboss.soa.esb.server.aop.AOPServer"/>
-</server>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/resources/server/aop/META-INF/jboss-service.xml)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean name="jboss.esb:test=AOPServer" code="org.jboss.soa.esb.server.aop.AOPServer"/>
+</server>
Modified: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/jbossesb-properties.xml 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/resources/server/jbossesb-properties.xml 2008-11-20 15:13:49 UTC (rev 23991)
@@ -51,6 +51,12 @@
<!-- 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"/>
+ <!-- specify the interceptors, in order -->
+ <property name="org.jboss.soa.esb.registry.interceptors"
+ value="org.jboss.internal.soa.esb.services.registry.CachingRegistryInterceptor"/>
+ <!-- The following properties modify the cache interceptor behaviour -->
+ <property name="org.jboss.soa.esb.registry.cache.maxSize" value="100"/>
+ <property name="org.jboss.soa.esb.registry.cache.validityPeriod" value="600000"/>
</properties>
<properties name="transports" depends="core">
<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop)
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,189 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collection;
-
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessQueryManager;
-import javax.xml.registry.Connection;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.JAXRResponse;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-
-import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
-import org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory;
-import org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
-import org.jboss.soa.esb.services.registry.Registry;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
-import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
-
-
-/**
- * MBean to manage AOP tests.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public class AOPServer implements AOPServerMBean
-{
- public AOPServer()
- {
- System.out.println("AOP test MBean deployed") ;
- }
-
- public String verifyScoutPerformanceIssue()
- throws JAXRException, ConfigurationException
- {
- return new TestScoutRegistryImpl().checkService() ;
- }
-
- public String verifyJUDDICDataIssue()
- throws RegistryException, MarshalException, ServiceNotFoundException
- {
- final Registry registry = RegistryFactory.getRegistry() ;
- final String category = "DummyAOPCategory" ;
- final String serviceName = "DummyAOPServiceName" ;
- final String serviceDescription = "Dummy AOP Service Description" ;
- final LogicalEPR epr = new LogicalEPR(category, serviceName) ;
- for (char name = 'a' ; name <= 'z' ; name++)
- {
- final String val = new String(new char[] {name}) ;
- epr.getAddr().addExtension(val, val) ;
- }
- final String eprAsXML = EPRHelper.toXMLString(epr) ;
- final String heuristic = verifyHeuristic(eprAsXML) ;
- if (heuristic != null)
- {
- return null ;
- }
-
- final String eprDescription = "Dummy AOP EPR Description" ;
-
- registry.registerEPR(category, serviceName, serviceDescription, epr, eprDescription) ;
- try
- {
- registry.findEPR(category, serviceName) ;
- }
- catch (final Throwable th)
- {
- final StringWriter sw = new StringWriter() ;
- final PrintWriter pw = new PrintWriter(sw) ;
- th.printStackTrace(pw) ;
- pw.flush() ;
- return sw.toString() ;
- }
-
- return null ;
- }
-
- private String verifyHeuristic(final String value)
- {
- final char[] contents = value.toCharArray() ;
- final int numChars = contents.length ;
- int counter = 0 ;
- for(int index = 0 ; index < numChars ; index++)
- {
- final char ch = contents[index] ;
- if ((ch == '<') || (ch == '&'))
- {
- counter++;
- }
- }
- if ((numChars > 32) && (counter > 5) &&
- (((counter * 100) / numChars) > 1))
- {
- return null ;
- }
- else
- {
- return "Heuristic failure" ;
- }
- }
-
- private static final class TestScoutRegistryImpl extends JAXRRegistryImpl
- {
- public TestScoutRegistryImpl()
- throws ConfigurationException
- {
- }
-
- public String checkService()
- throws JAXRException, ConfigurationException
- {
- final Service service = findService("JBossESB-Internal", "DeadLetterService") ;
-
- if (service == null)
- {
- return "Service not found" ;
- }
-
- final ScoutConnectionFactory scoutConnectionFactory = new ScoutConnectionFactory() ;
- final Connection connection = scoutConnectionFactory.getConnection();
- final RegistryService rs = connection.getRegistryService();
- final BusinessQueryManager bqm = rs.getBusinessQueryManager();
- final BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),null,null,null);
- if (bulkResponse.getStatus()!=JAXRResponse.STATUS_SUCCESS)
- {
- return "findServiceBindings failed" ;
- }
- final Collection<ServiceBinding> serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
- if ((serviceBindings == null) || (serviceBindings.size() == 0))
- {
- return "could not find service bindings for DeadLetterService" ;
- }
-
- for(ServiceBinding serviceBinding: serviceBindings)
- {
- final Service bindingService = serviceBinding.getService() ;
- if (bindingService == null)
- {
- return "Could not find service associated with binding" ;
- }
- if (bindingService.getProvidingOrganization() != null)
- {
- return "FAILED: Organization is present in service binding" ;
- }
- }
-
- return null ;
- }
- }
-
- private static class ScoutConnectionFactory extends JAXRConnectionFactory
- {
- public ScoutConnectionFactory()
- throws ConfigurationException
- {
- }
-
- public Connection getConnection()
- {
- return super.getConnection() ;
- }
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,189 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collection;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.Connection;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+
+import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
+import org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory;
+import org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+
+/**
+ * MBean to manage AOP tests.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public class AOPServer implements AOPServerMBean
+{
+ public AOPServer()
+ {
+ System.out.println("AOP test MBean deployed") ;
+ }
+
+ public String verifyScoutPerformanceIssue()
+ throws JAXRException, ConfigurationException
+ {
+ return new TestScoutRegistryImpl().checkService() ;
+ }
+
+ public String verifyJUDDICDataIssue()
+ throws RegistryException, MarshalException, ServiceNotFoundException
+ {
+ final Registry registry = RegistryFactory.getRegistry() ;
+ final String category = "DummyAOPCategory" ;
+ final String serviceName = "DummyAOPServiceName" ;
+ final String serviceDescription = "Dummy AOP Service Description" ;
+ final LogicalEPR epr = new LogicalEPR(category, serviceName) ;
+ for (char name = 'a' ; name <= 'z' ; name++)
+ {
+ final String val = new String(new char[] {name}) ;
+ epr.getAddr().addExtension(val, val) ;
+ }
+ final String eprAsXML = EPRHelper.toXMLString(epr) ;
+ final String heuristic = verifyHeuristic(eprAsXML) ;
+ if (heuristic != null)
+ {
+ return null ;
+ }
+
+ final String eprDescription = "Dummy AOP EPR Description" ;
+
+ registry.registerEPR(category, serviceName, serviceDescription, epr, eprDescription) ;
+ try
+ {
+ registry.findEPR(category, serviceName) ;
+ }
+ catch (final Throwable th)
+ {
+ final StringWriter sw = new StringWriter() ;
+ final PrintWriter pw = new PrintWriter(sw) ;
+ th.printStackTrace(pw) ;
+ pw.flush() ;
+ return sw.toString() ;
+ }
+
+ return null ;
+ }
+
+ private String verifyHeuristic(final String value)
+ {
+ final char[] contents = value.toCharArray() ;
+ final int numChars = contents.length ;
+ int counter = 0 ;
+ for(int index = 0 ; index < numChars ; index++)
+ {
+ final char ch = contents[index] ;
+ if ((ch == '<') || (ch == '&'))
+ {
+ counter++;
+ }
+ }
+ if ((numChars > 32) && (counter > 5) &&
+ (((counter * 100) / numChars) > 1))
+ {
+ return null ;
+ }
+ else
+ {
+ return "Heuristic failure" ;
+ }
+ }
+
+ private static final class TestScoutRegistryImpl extends JAXRRegistryImpl
+ {
+ public TestScoutRegistryImpl()
+ throws ConfigurationException
+ {
+ }
+
+ public String checkService()
+ throws JAXRException, ConfigurationException
+ {
+ final Service service = findService("JBossESB-Internal", "DeadLetterService") ;
+
+ if (service == null)
+ {
+ return "Service not found" ;
+ }
+
+ final ScoutConnectionFactory scoutConnectionFactory = new ScoutConnectionFactory() ;
+ final Connection connection = scoutConnectionFactory.getConnection();
+ final RegistryService rs = connection.getRegistryService();
+ final BusinessQueryManager bqm = rs.getBusinessQueryManager();
+ final BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),null,null,null);
+ if (bulkResponse.getStatus()!=JAXRResponse.STATUS_SUCCESS)
+ {
+ return "findServiceBindings failed" ;
+ }
+ final Collection<ServiceBinding> serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
+ if ((serviceBindings == null) || (serviceBindings.size() == 0))
+ {
+ return "could not find service bindings for DeadLetterService" ;
+ }
+
+ for(ServiceBinding serviceBinding: serviceBindings)
+ {
+ final Service bindingService = serviceBinding.getService() ;
+ if (bindingService == null)
+ {
+ return "Could not find service associated with binding" ;
+ }
+ if (bindingService.getProvidingOrganization() != null)
+ {
+ return "FAILED: Organization is present in service binding" ;
+ }
+ }
+
+ return null ;
+ }
+ }
+
+ private static class ScoutConnectionFactory extends JAXRConnectionFactory
+ {
+ public ScoutConnectionFactory()
+ throws ConfigurationException
+ {
+ }
+
+ public Connection getConnection()
+ {
+ return super.getConnection() ;
+ }
+ }
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,43 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import javax.xml.registry.JAXRException;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
-
-/**
- * MBean to manage AOP tests.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public interface AOPServerMBean
-{
- public static final String OBJECT_NAME="jboss.esb:test=AOPServer" ;
-
- public String verifyScoutPerformanceIssue()
- throws JAXRException, ConfigurationException ;
-
- public String verifyJUDDICDataIssue()
- throws RegistryException, MarshalException, ServiceNotFoundException ;
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,43 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import javax.xml.registry.JAXRException;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+/**
+ * MBean to manage AOP tests.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public interface AOPServerMBean
+{
+ public static final String OBJECT_NAME="jboss.esb:test=AOPServer" ;
+
+ public String verifyScoutPerformanceIssue()
+ throws JAXRException, ConfigurationException ;
+
+ public String verifyJUDDICDataIssue()
+ throws RegistryException, MarshalException, ServiceNotFoundException ;
+}
Deleted: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
===================================================================
--- labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-11-20 14:48:29 UTC (rev 23990)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -1,100 +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, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestCase;
-
-/**
- * Test asynchronous callbacks for jBPM processes.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public class AOPUnitTest extends JBossTestCase
-{
- /**
- * The name of the deployment archive.
- */
- private static final String SAR_ARCHIVE = "aop-test.sar" ;
-
- /**
- * Construct the test case with the specified name.
- * @param name The name of the test case.
- */
- public AOPUnitTest(final String name)
- {
- super(name) ;
- }
-
- /**
- * Test for scout performance issue.
- * @throws Exception For any failures.
- */
- public void testScoutPerformanceIssue()
- throws Exception
- {
- final String result = (String)execute("verifyScoutPerformanceIssue", null, null) ;
- if (result != null)
- {
- fail(result) ;
- }
- }
-
- /**
- * Test for juddi CDATA issue..
- * @throws Exception For any failures.
- */
- public void testJUDDICDataIssue()
- throws Exception
- {
- final String result = (String)execute("verifyJUDDICDataIssue", null, null) ;
- if (result != null)
- {
- fail(result) ;
- }
- }
-
- /**
- * Execute the specified method on the mbean.
- * @param method The method name.
- * @param values The parmeter values.
- * @param types The parameter types.
- * @return The method return value.
- * @throws Exception For errors during invocation.
- */
- private Object execute(final String method, final Object[] values, final String[] types)
- throws Exception
- {
- return getServer().invoke(new ObjectName(AOPServerMBean.OBJECT_NAME), method, values, types) ;
- }
-
- /**
- * Create the test suite.
- * @return The suite representing this test case.
- */
- public static Test suite()
- throws Exception
- {
- return getDeploySetup(AOPUnitTest.class, SAR_ARCHIVE);
- }
-}
Copied: labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java (from rev 23990, labs/jbossesb/tags/JBESB_4_2_1_GA_CP4/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/platform/JBESB_4_2_1_SOA_4_2/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-11-20 15:13:49 UTC (rev 23991)
@@ -0,0 +1,100 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test asynchronous callbacks for jBPM processes.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public class AOPUnitTest extends JBossTestCase
+{
+ /**
+ * The name of the deployment archive.
+ */
+ private static final String SAR_ARCHIVE = "aop-test.sar" ;
+
+ /**
+ * Construct the test case with the specified name.
+ * @param name The name of the test case.
+ */
+ public AOPUnitTest(final String name)
+ {
+ super(name) ;
+ }
+
+ /**
+ * Test for scout performance issue.
+ * @throws Exception For any failures.
+ */
+ public void testScoutPerformanceIssue()
+ throws Exception
+ {
+ final String result = (String)execute("verifyScoutPerformanceIssue", null, null) ;
+ if (result != null)
+ {
+ fail(result) ;
+ }
+ }
+
+ /**
+ * Test for juddi CDATA issue..
+ * @throws Exception For any failures.
+ */
+ public void testJUDDICDataIssue()
+ throws Exception
+ {
+ final String result = (String)execute("verifyJUDDICDataIssue", null, null) ;
+ if (result != null)
+ {
+ fail(result) ;
+ }
+ }
+
+ /**
+ * Execute the specified method on the mbean.
+ * @param method The method name.
+ * @param values The parmeter values.
+ * @param types The parameter types.
+ * @return The method return value.
+ * @throws Exception For errors during invocation.
+ */
+ private Object execute(final String method, final Object[] values, final String[] types)
+ throws Exception
+ {
+ return getServer().invoke(new ObjectName(AOPServerMBean.OBJECT_NAME), method, values, types) ;
+ }
+
+ /**
+ * Create the test suite.
+ * @return The suite representing this test case.
+ */
+ public static Test suite()
+ throws Exception
+ {
+ return getDeploySetup(AOPUnitTest.class, SAR_ARCHIVE);
+ }
+}
More information about the jboss-svn-commits
mailing list