[jboss-svn-commits] JBL Code SVN: r26882 - in labs/jbossesb/workspace/dbevenius/jbossas5: product/docs and 65 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 9 07:35:08 EDT 2009
Author: beve
Date: 2009-06-09 07:35:07 -0400 (Tue, 09 Jun 2009)
New Revision: 26882
Added:
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/util/JndiUtil.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/util/JndiUtilUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-ant-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-api-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-bam-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-clips-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-compiler-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-core-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-decisiontables-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-jsr94-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-mc-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-messenger-jms-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-persistence-jpa-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-task-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-templates-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-jaxb-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-jxls-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-smooks-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-xstream-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-verifier-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-workitems-5.0.1.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/mvel2-2.0.10.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGenerator.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_05.xml
Removed:
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/smooks-config.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-ant-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-api-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-clips-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-compiler-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-core-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-dataloaders-jaxb-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-dataloaders-smooks-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-decisiontables-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-jsr94-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-enterprise-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-task-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-templates-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-verifier-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-workitems-5.0.0.M4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/mvel2-2.0.4.jar
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml
Modified:
labs/jbossesb/workspace/dbevenius/jbossas5/
labs/jbossesb/workspace/dbevenius/jbossas5/product/docs/ProgrammersGuide.odt
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/http/HttpRouterUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/aggregation_service/jbossesb.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbm-queue-service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbmq-queue-service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/samples/quickstart/aggregator/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-dvdstore.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-petstore.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_rules_service/smooks-res.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrulesstateful/dvdstore/OrderHeader.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/deployment.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbm-queue-service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbmq-queue-service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jboss-esb.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/dynamic_router/src/org/jboss/soa/esb/samples/quickstart/dynamicRouter/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-02_Low_Price_Service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-03_High_Price_Service.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-04_Reptiles_notify_webservice_proxy.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/README.html
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/jboss-esb.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/readme.txt
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/src/org/jboss/soa/esb/samples/quickstart/jmsrouter/test/SendJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/recipient_list/src/org/jboss/soa/esb/samples/quickstart/recipientList/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/simple_cbr/src/org/jboss/soa/esb/samples/quickstart/simplecbr/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-dvdstore.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-petstore.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/wiretap/src/org/jboss/soa/esb/samples/quickstart/wiretap/test/ReceiveJMSMessage.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/build.xml
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/readme.txt
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/LogAgentEventListener.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/resources/testrules.pkg
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/java/org/jboss/soa/esb/smooks/FragmentRouter.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/Customer.xsd
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/RetailerCallback.wsdl
labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
Log:
Merge from main trunk.
Property changes on: labs/jbossesb/workspace/dbevenius/jbossas5
___________________________________________________________________
Name: svnmerge-integrated
- /labs/jbossesb/trunk:1-26392
+ /labs/jbossesb/trunk:1-26878
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -32,6 +32,7 @@
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.util.JndiUtil;
import org.apache.log4j.Logger;
/**
@@ -160,7 +161,7 @@
*/
static Properties getJndiEnvironment(Map<String,String> poolKey) {
Properties environment = new Properties();
- final String[] jndiPrefixes = JMSEpr.getJndiPrefixes(poolKey.get(JMSEpr.JNDI_PREFIXES)) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(poolKey.get(JMSEpr.JNDI_PREFIXES)) ;
for (String key: poolKey.keySet()) {
for(String jndiPrefix: jndiPrefixes) {
if (key.startsWith(jndiPrefix)) {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -55,45 +55,77 @@
import org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter;
import org.jboss.soa.esb.notification.jms.JMSPropertiesSetter;
import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.util.JndiUtil;
import org.jboss.soa.esb.util.Util;
/**
* JMS Routing Action Processor.
* <p/>
* Sample Action Configuration:
- * <pre>
- * <action class="org.jboss.soa.esb.actions.routing.JMSRouter">
- * <property name="jndiName" value="queue/A"/>
- * </action>
+ * <pre>{@code
+ * <action class="org.jboss.soa.esb.actions.routing.JMSRouter">
+ * <property name="jndiName" value="queue/A"/>
+ * </action>
*
* Option properties:
- * <property name="unwrap" value="false"/>
- * <property name="jndi-context-factory" value="org.jnp.interfaces.NamingContextFactory"/>
- * <property name="jndi-URL" value="127.0.0.1:1099"/>
- * <property name="jndi-pkg-prefix" value="org.jboss.naming:org.jnp.interfaces"/>
- * <property name="connection-factory" value="ConnectionFactory"/>
- * <property name="persistent" value="true"/>
- * <property name="priority" value="javax.jms.Message.DEFAULT_PRIORITY"/>
- * <property name="time-to-live" value="javax.jms.Message.DEFAULT_TIME_TO_LIVE"/>
- * <property name="security-principal" value="username"/>
- * <property name="security-credential" value="pasword"/>
- * <property name="property-strategy" value="<property setter class name>" />
- * <property name="message-prop-<i>>prop-name<</i>="<i>> value="prop-value<</i>" />
- * </pre>
+ * <property name="unwrap" value="false"/>
+ * <property name="jndi-context-factory" value="org.jnp.interfaces.NamingContextFactory"/>
+ * <property name="jndi-URL" value="127.0.0.1:1099"/>
+ * <property name="jndi-pkg-prefix" value="org.jboss.naming:org.jnp.interfaces"/>
+ * <property name="connection-factory" value="ConnectionFactory"/>
+ * <property name="persistent" value="true"/>
+ * <property name="priority" value="javax.jms.Message.DEFAULT_PRIORITY"/>
+ * <property name="time-to-live" value="javax.jms.Message.DEFAULT_TIME_TO_LIVE"/>
+ * <property name="security-principal" value="username"/>
+ * <property name="security-credential" value="pasword"/>
+ * <property name="property-strategy" value="<property setter class name>" />
+ * <property name="message-prop-<i><prop-name></i>="<i>> value="prop-value"<</i>" />
+ * <property name="jndi-prefixes" value="org.xyz."<</i>" />
+ * }</pre>
* Description of configuration attribues:
* <ul>
- * <li><i>unwrap</i>:true will extract the message payload from the Message object before sending. false (default) will send the serialized Message object.
- * <li><i>jndi-context-factory</i>: the JNDI context factory to use. Default is "org.jnp.interfaces.NamingContextFactory"
- * <li><i>jndi-URL</i>: the JNDI URL to use. Default is "127.0.0.1:1099"
- * <li><i>jndi-pkg-prefix</i>: the JNDI naming package prefixes to use. Default is "org.jboss.naming:org.jnp.interfaces".
- * <li><i>connection-factory</i>: the name of the ConnectionFactory to use. Default is "ConnectionFactory".
- * <li><i>persistent</i>: the JMS DeliveryMode. 'true' or 'false'. Default is "true".
- * <li><i>priority</i>: the JMS Priority to be used. Default is "javax.jms.Message.DEFAULT_PRIORITY"
- * <li><i>time-to-live</i>: the JMS Time-To-Live to be used. Default is "javax.jms.Message.DEFAULT_TIME_TO_LIVE"
- * <li><i>security-principal</i>: security principal use when creating the JMS connection.
- * <li><i>security-credential</i>: the security credentials to use when creating the JMS connection.
- * <li><i>property-strategy</i>: the implementation of the JMSPropertiesSetter interface, if overriding the default.
- * <li><i>message-prop</i>: properties to be set on the message are prefixed with "message-prop-".
+ * <li><i>unwrap</i>:
+ * 'true' will extract the message payload from the Message object before sending. false (default) will send the serialized Message object.</li>
+ *
+ * <li><i>jndi-context-factory</i>:
+ * The JNDI context factory to use. Default is "org.jnp.interfaces.NamingContextFactory"</li>
+ *
+ * <li><i>jndi-URL</i>:
+ * The JNDI URL to use. Default is "127.0.0.1:1099"</li>
+ *
+ * <li><i>jndi-pkg-prefix</i>:
+ * The JNDI naming package prefixes to use. Default is "org.jboss.naming:org.jnp.interfaces".</li>
+ *
+ * <li><i>connection-factory</i>:
+ * The name of the ConnectionFactory to use. Default is "ConnectionFactory".</li>
+ *
+ * <li><i>persistent</i>:
+ * The JMS DeliveryMode. 'true' or 'false'. Default is "true".</li>
+ *
+ * <li><i>priority</i>:
+ * The JMS Priority to be used. Default is "javax.jms.Message.DEFAULT_PRIORITY"</li>
+ *
+ * <li><i>time-to-live</i>:
+ * The JMS Time-To-Live to be used. Default is "javax.jms.Message.DEFAULT_TIME_TO_LIVE"</li>
+ *
+ * <li><i>security-principal</i>:
+ * Security principal use when creating the JMS connection.</li>
+ *
+ * <li><i>security-credential</i>:
+ * The security credentials to use when creating the JMS connection. </li>
+ *
+ * <li><i>property-strategy</i>:
+ * The implementation of the JMSPropertiesSetter interface, if overriding the default. </li>
+ *
+ * <li><i>message-prop</i>:
+ * Properties to be set on the message are prefixed with "message-prop-".</li>
+ *
+ * <li><i>jndi-prefixes</i>:
+ * A comma separated string of prefixes. Properties that have these prefixes will be added to the JNDI environment.</li>
+ *
+ * <li><i>org.xyz.propertyName</i>:
+ * A jndi environment property that will be added to the jndi environment if the prefix 'org.xyz' was specified in the jndi-prefixes list.</li>
+ *
* </ul>
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -177,6 +209,7 @@
* The JMS reply to destination.
*/
private String jmsReplyToName ;
+ private Properties environment;
/**
@@ -232,7 +265,11 @@
else if ( securityCredential != null && securityPrincipal == null )
throw new ConfigurationException("'" + SECURITY_CREDITIAL + "' must be accompanied by a '" + SECURITY_PRINCIPAL + "'");
- final Properties environment = getEnvironment() ;
+ // Extract and environment properties given as properties in the config.
+ environment = JndiUtil.parseEnvironmentProperties(propertiesTree);
+ environment.setProperty(Context.PROVIDER_URL, jndiUrl);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, jndiContextFactory);
+ environment.setProperty(Context.URL_PKG_PREFIXES, jndiPkgPrefix);
try {
pool = ( securityPrincipal != null ) ?
JmsConnectionPoolContainer.getPool(environment, connectionFactory, securityPrincipal, securityCredential) :
@@ -469,12 +506,8 @@
}
}
- private Properties getEnvironment()
+ Properties getEnvironment()
{
- final Properties environment = new Properties();
- environment.setProperty(Context.PROVIDER_URL, jndiUrl);
- environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, jndiContextFactory);
- environment.setProperty(Context.URL_PKG_PREFIXES, jndiPkgPrefix);
return environment ;
}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.routing.AbstractRouter;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.message.Message;
-
-/**
- * EmailRouter routes the ESB message payload to a configured email account.
- * <p/>
- * Like all router processing will terminate after this action has been processed.
- *
- * Example configuration:
- * <pre>{@code
- * <action name="send-email" class="org.jboss.soa.esb.actions.routing.email.EmailRouter">
- * <property name="host" value="localhost" />
- * <property name="port" value="25" />
- * <property name="username" value="danbev" />
- * <property name="password" value="password" />
- * <property name="from" value="jbossesb" />
- * <property name="sendTo" value="danbev" />
- * <property name="subject" value="quickstart routing" />
- * <property name="unwrap" value="true" />
- * </action>
- * }</pre>
- * For details about the properties listed above please see {@link Emailer}s javadoc.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 4.6
- *
- */
-public class EmailRouter extends AbstractRouter
-{
- private Emailer emailer;
- private ConfigTree config;
-
- public EmailRouter(ConfigTree config) throws ConfigurationException
- {
- super(config);
- emailer = new Emailer(config);
- this.config = config;
- }
-
- @Override
- public Message process(Message message) throws ActionProcessingException
- {
- Emailer.overrideSmtpProperties(message, config);
- return super.process(message);
- }
-
- @Override
- public void route(Object object) throws ActionProcessingException
- {
- try
- {
- emailer.sendEmail(config, object);
- }
- catch (MessageDeliverException e)
- {
- throw new ActionProcessingException("Exception while trying to send email.", e);
- }
- }
-
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailRouter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.routing.AbstractRouter;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * EmailRouter routes the ESB message payload to a configured email account.
+ * <p/>
+ * Like all router processing will terminate after this action has been processed.
+ *
+ * Example configuration:
+ * <pre>{@code
+ * <action name="send-email" class="org.jboss.soa.esb.actions.routing.email.EmailRouter">
+ * <property name="host" value="localhost" />
+ * <property name="port" value="25" />
+ * <property name="username" value="danbev" />
+ * <property name="password" value="password" />
+ * <property name="from" value="jbossesb" />
+ * <property name="sendTo" value="danbev" />
+ * <property name="subject" value="quickstart routing" />
+ * <property name="unwrap" value="true" />
+ * </action>
+ * }</pre>
+ * For details about the properties listed above please see {@link Emailer}s javadoc.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 4.6
+ *
+ */
+public class EmailRouter extends AbstractRouter
+{
+ private Emailer emailer;
+ private ConfigTree config;
+
+ public EmailRouter(ConfigTree config) throws ConfigurationException
+ {
+ super(config);
+ emailer = new Emailer(config);
+ this.config = config;
+ }
+
+ @Override
+ public Message process(Message message) throws ActionProcessingException
+ {
+ Emailer.overrideSmtpProperties(message, config);
+ return super.process(message);
+ }
+
+ @Override
+ public void route(Object object) throws ActionProcessingException
+ {
+ try
+ {
+ emailer.sendEmail(config, object);
+ }
+ catch (MessageDeliverException e)
+ {
+ throw new ActionProcessingException("Exception while trying to send email.", e);
+ }
+ }
+
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
-
-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.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.message.Message;
-
-/**
- * EmailWiretap will publish the ESB message payload to a configured email account.
- * <p/>
- *
- * Example configuration:
- * <pre>{@code
- * <action name="send-email" class="org.jboss.soa.esb.actions.routing.email.EmailWiretap">
- * <property name="host" value="localhost" />
- * <property name="port" value="25" />
- * <property name="username" value="danbev" />
- * <property name="password" value="password" />
- * <property name="from" value="jbossesb" />
- * <property name="sendTo" value="danbev" />
- * <property name="subject" value="Subject goes here" />
- * </action>
- * }</pre>
- *
- * For details about the properties listed above please see {@link Emailer}s javadoc.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 4.6
- *
- */
-public class EmailWiretap extends AbstractActionPipelineProcessor
-{
- private Emailer emailer;
-
- public EmailWiretap(final ConfigTree config) throws ConfigurationException
- {
- emailer = new Emailer(config);
- }
-
- public Message process(final Message message) throws ActionProcessingException
- {
- try
- {
- emailer.sendEmail(message);
- }
- catch (final MessageDeliverException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
-
- return message;
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/EmailWiretap.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
+
+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.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * EmailWiretap will publish the ESB message payload to a configured email account.
+ * <p/>
+ *
+ * Example configuration:
+ * <pre>{@code
+ * <action name="send-email" class="org.jboss.soa.esb.actions.routing.email.EmailWiretap">
+ * <property name="host" value="localhost" />
+ * <property name="port" value="25" />
+ * <property name="username" value="danbev" />
+ * <property name="password" value="password" />
+ * <property name="from" value="jbossesb" />
+ * <property name="sendTo" value="danbev" />
+ * <property name="subject" value="Subject goes here" />
+ * </action>
+ * }</pre>
+ *
+ * For details about the properties listed above please see {@link Emailer}s javadoc.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 4.6
+ *
+ */
+public class EmailWiretap extends AbstractActionPipelineProcessor
+{
+ private Emailer emailer;
+
+ public EmailWiretap(final ConfigTree config) throws ConfigurationException
+ {
+ emailer = new Emailer(config);
+ }
+
+ public Message process(final Message message) throws ActionProcessingException
+ {
+ try
+ {
+ emailer.sendEmail(message);
+ }
+ catch (final MessageDeliverException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+
+ return message;
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,267 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.helpers.Email;
-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.notification.NotifyEmail;
-
-/**
- * General Emailer used for both notifiations and router.
- * </p>
- * This code was lifted from {@link NotifyEmail}.
- *
- * Configuration properties:
- * <lu>
- * <li>{@code host} The host name of the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.host' in jbossesb-properties.xml. </li>
- * <li>{@code port} The port for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.port' in jbossesb-properties.xml.</li>
- * <li>{@code username} The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml.</li>
- * <li>{@code password} The password for the above username on the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.password' in jbossesb-properties.xml </li>
- * <li>{@code username} The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml </li>
- * <li>{@code auth} If true will attempt to authenticate the user using the AUTH command. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.auth' in jbossesb-properties.xml </li>
- * <li>{@code msgAttachmentName} filename of an attachment containing the message payload (optional). If not specified the message payload will be included in the message body.</li>
- * </lu>
- * Note that all of the properties except attachments can be specified jboss-esb.xml can be overridden by specifying the same properties on the ESB Message object instance
- * passed to this classes sendNotification method.
- * <p>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class Emailer
-{
- private Logger log = Logger.getLogger(Emailer.class);
-
- /**
- * The name of the attachement config attribute.
- */
- private static final String MESSAGE_ATTACHMENT_NAME = "msgAttachmentName";
-
- /**
- * {@link MessagePayloadProxy} handles body locations.
- */
- private MessagePayloadProxy payloadProxy;
-
- /**
- * The ESB {@link ConfigTree}
- */
- private ConfigTree config;
-
- public Emailer(final ConfigTree config) throws ConfigurationException
- {
- this.config = config;
- checkValidAddress((String) config.getAttribute(Email.FROM), true);
- checkValidAddress((String) config.getAttribute(Email.SENDTO), false);
- checkValidAddress((String) config.getAttribute(Email.COPYTO), true);
- payloadProxy = new MessagePayloadProxy(config);
- }
-
- /**
- * Send an Email using Email() using p_o.toString() to fill in the message
- * text
- *
- * @param message
- * Object - This object's toString() method will supply contents
- * of mail message
- */
- public void sendEmail(final Message message) throws MessageDeliverException
- {
- ConfigTree configTree = config.cloneObj();
- overrideSmtpProperties(message, configTree);
-
- Object obj = payloadProxy.getPayload(message);
- sendEmail(configTree, obj);
- }
-
- public void sendEmail(final Object obj) throws MessageDeliverException
- {
- sendEmail(config, obj);
- }
-
- /**
- * Send an Email using Email() using p_o.toString() to fill in the message
- * text
- *
- * @param message
- * Object - This object's toString() method will supply contents
- * of mail message
- */
- public void sendEmail(final ConfigTree config, final Object obj) throws MessageDeliverException
- {
- try
- {
- String content;
- byte[] payloadBytes;
-
- if(obj instanceof byte[]) {
- content = new String((byte[]) obj);
- payloadBytes = ((byte[]) obj).clone();
- } else {
- content = obj.toString();
- payloadBytes = content.getBytes();
- }
-
- ConfigTree configTree = config.cloneObj();
- String sMsg = configTree.getAttribute(Email.MESSAGE);
- sMsg = ((null == sMsg) ? content : (sMsg + "\n" + content));
- configTree.setAttribute(Email.MESSAGE, sMsg);
-
- sendEmail(configTree, payloadBytes);
- }
- catch (final AddressException e)
- {
- log.error("Send Mail Failed", e);
- throw new MessageDeliverException("AddressException while trying to send email", e);
- }
- catch (final MessagingException e)
- {
- throw new MessageDeliverException("MessageingException while trying to send email", e);
- }
- catch (final IOException e)
- {
- log.error("Send Mail Failed", e);
- throw new MessageDeliverException("IOException while trying to send email", e);
- }
- }
-
-
- /**
- * Send an email notification based on the supplied parameters. <p/> This
- * method allows overriding for test purposes.
- *
- * @param messageParams
- * Message parameters.
- * @param message
- * @throws IOException
- */
- protected void sendEmail(ConfigTree messageParams, byte[] msgPayload) throws AddressException, MessagingException, IOException
- {
- Email esbMail = createEmailInstance(messageParams);
- esbMail.setSendTo(messageParams.getAttribute(Email.SENDTO));
- esbMail.setFrom(messageParams.getAttribute(Email.FROM));
- esbMail.setCopyTo(messageParams.getAttribute(Email.COPYTO));
- esbMail.setSubject(messageParams.getAttribute(Email.SUBJECT));
- esbMail.setAttachments(messageParams.getTextChildren(Email.ATTACH));
-
- if (messageParams.getAttribute(MESSAGE_ATTACHMENT_NAME) != null) {
- esbMail.addAttachment(new ByteArrayInputStream(msgPayload), messageParams.getAttribute(MESSAGE_ATTACHMENT_NAME));
- } else {
- esbMail.setMessage(messageParams.getAttribute(Email.MESSAGE));
- }
-
- esbMail.sendMessage();
- }
-
- /**
- * Allows smtp overrides by setting properties on the passed-in message. This could be
- * populated by a previous action in an action pipline.
- *
- * @param message The ESB Message object that contains the overrides in its properties.
- * @param configTree The configTree the properties on the ESB Message object will override.
- */
- public static void overrideSmtpProperties(final Message message, final ConfigTree configTree)
- {
- final Properties properties = message.getProperties();
- override(Email.HOST, properties, configTree);
- override(Email.PORT, properties, configTree);
- override(Email.USERNAME, properties, configTree);
- override(Email.PASSWORD, properties, configTree);
- override(Email.AUTH, properties, configTree);
- override(Email.FROM, properties, configTree);
- override(Email.SENDTO, properties, configTree);
- override(Email.COPYTO, properties, configTree);
- override(Email.SUBJECT, properties, configTree);
- override(MESSAGE_ATTACHMENT_NAME, properties, configTree);
- }
-
- private void checkValidAddress(final String address, boolean optional) throws ConfigurationException
- {
- if (address == null && optional)
- return;
-
- try
- {
- InternetAddress.parse(address);
- }
- catch (AddressException e)
- {
- throw new ConfigurationException(address + " is not valid", e);
- }
- }
-
- private static void override(final String key, final Properties properties, final ConfigTree configTree)
- {
- final String value = (String) properties.getProperty(key);
- if (value != null)
- {
- configTree.setAttribute(key, value);
- }
- }
-
- /**
- * Creates a new {@link Email} instance using the properties specified in the
- * passed-in {@link ConfigTree}.
- *
- * @param configTree The {@link ConfigTree} containing the SMTP properties uses to create the Email instance.
- * @return Email The newly created {@link Email} instance.
- * @throws AddressException
- * @throws MessagingException
- */
- private Email createEmailInstance(final ConfigTree configTree) throws AddressException, MessagingException
- {
- String portStr = configTree.getAttribute(Email.PORT);
- if (portStr == null)
- {
- portStr = Configuration.getSmtpPort();
- }
- int port;
- try
- {
- port = Integer.parseInt(portStr);
- }
- catch(final NumberFormatException e)
- {
- throw new MessagingException("Could not parse port '" + portStr + "'");
- }
-
- String host = configTree.getAttribute(Email.HOST, Configuration.getSmtpHost());
- String username = configTree.getAttribute(Email.USERNAME, Configuration.getSmtpUsername());
- String password = configTree.getAttribute(Email.PASSWORD,Configuration.getSmtpPassword());
- boolean auth = configTree.getBooleanAttribute(Email.AUTH, false);
-
- return new Email(host, port, username, password, auth);
- }
-
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,267 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.Email;
+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.notification.NotifyEmail;
+
+/**
+ * General Emailer used for both notifiations and router.
+ * </p>
+ * This code was lifted from {@link NotifyEmail}.
+ *
+ * Configuration properties:
+ * <lu>
+ * <li>{@code host} The host name of the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.host' in jbossesb-properties.xml. </li>
+ * <li>{@code port} The port for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.port' in jbossesb-properties.xml.</li>
+ * <li>{@code username} The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml.</li>
+ * <li>{@code password} The password for the above username on the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.password' in jbossesb-properties.xml </li>
+ * <li>{@code username} The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml </li>
+ * <li>{@code auth} If true will attempt to authenticate the user using the AUTH command. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.auth' in jbossesb-properties.xml </li>
+ * <li>{@code msgAttachmentName} filename of an attachment containing the message payload (optional). If not specified the message payload will be included in the message body.</li>
+ * </lu>
+ * Note that all of the properties except attachments can be specified jboss-esb.xml can be overridden by specifying the same properties on the ESB Message object instance
+ * passed to this classes sendNotification method.
+ * <p>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class Emailer
+{
+ private Logger log = Logger.getLogger(Emailer.class);
+
+ /**
+ * The name of the attachement config attribute.
+ */
+ private static final String MESSAGE_ATTACHMENT_NAME = "msgAttachmentName";
+
+ /**
+ * {@link MessagePayloadProxy} handles body locations.
+ */
+ private MessagePayloadProxy payloadProxy;
+
+ /**
+ * The ESB {@link ConfigTree}
+ */
+ private ConfigTree config;
+
+ public Emailer(final ConfigTree config) throws ConfigurationException
+ {
+ this.config = config;
+ checkValidAddress((String) config.getAttribute(Email.FROM), true);
+ checkValidAddress((String) config.getAttribute(Email.SENDTO), false);
+ checkValidAddress((String) config.getAttribute(Email.COPYTO), true);
+ payloadProxy = new MessagePayloadProxy(config);
+ }
+
+ /**
+ * Send an Email using Email() using p_o.toString() to fill in the message
+ * text
+ *
+ * @param message
+ * Object - This object's toString() method will supply contents
+ * of mail message
+ */
+ public void sendEmail(final Message message) throws MessageDeliverException
+ {
+ ConfigTree configTree = config.cloneObj();
+ overrideSmtpProperties(message, configTree);
+
+ Object obj = payloadProxy.getPayload(message);
+ sendEmail(configTree, obj);
+ }
+
+ public void sendEmail(final Object obj) throws MessageDeliverException
+ {
+ sendEmail(config, obj);
+ }
+
+ /**
+ * Send an Email using Email() using p_o.toString() to fill in the message
+ * text
+ *
+ * @param message
+ * Object - This object's toString() method will supply contents
+ * of mail message
+ */
+ public void sendEmail(final ConfigTree config, final Object obj) throws MessageDeliverException
+ {
+ try
+ {
+ String content;
+ byte[] payloadBytes;
+
+ if(obj instanceof byte[]) {
+ content = new String((byte[]) obj);
+ payloadBytes = ((byte[]) obj).clone();
+ } else {
+ content = obj.toString();
+ payloadBytes = content.getBytes();
+ }
+
+ ConfigTree configTree = config.cloneObj();
+ String sMsg = configTree.getAttribute(Email.MESSAGE);
+ sMsg = ((null == sMsg) ? content : (sMsg + "\n" + content));
+ configTree.setAttribute(Email.MESSAGE, sMsg);
+
+ sendEmail(configTree, payloadBytes);
+ }
+ catch (final AddressException e)
+ {
+ log.error("Send Mail Failed", e);
+ throw new MessageDeliverException("AddressException while trying to send email", e);
+ }
+ catch (final MessagingException e)
+ {
+ throw new MessageDeliverException("MessageingException while trying to send email", e);
+ }
+ catch (final IOException e)
+ {
+ log.error("Send Mail Failed", e);
+ throw new MessageDeliverException("IOException while trying to send email", e);
+ }
+ }
+
+
+ /**
+ * Send an email notification based on the supplied parameters. <p/> This
+ * method allows overriding for test purposes.
+ *
+ * @param messageParams
+ * Message parameters.
+ * @param message
+ * @throws IOException
+ */
+ protected void sendEmail(ConfigTree messageParams, byte[] msgPayload) throws AddressException, MessagingException, IOException
+ {
+ Email esbMail = createEmailInstance(messageParams);
+ esbMail.setSendTo(messageParams.getAttribute(Email.SENDTO));
+ esbMail.setFrom(messageParams.getAttribute(Email.FROM));
+ esbMail.setCopyTo(messageParams.getAttribute(Email.COPYTO));
+ esbMail.setSubject(messageParams.getAttribute(Email.SUBJECT));
+ esbMail.setAttachments(messageParams.getTextChildren(Email.ATTACH));
+
+ if (messageParams.getAttribute(MESSAGE_ATTACHMENT_NAME) != null) {
+ esbMail.addAttachment(new ByteArrayInputStream(msgPayload), messageParams.getAttribute(MESSAGE_ATTACHMENT_NAME));
+ } else {
+ esbMail.setMessage(messageParams.getAttribute(Email.MESSAGE));
+ }
+
+ esbMail.sendMessage();
+ }
+
+ /**
+ * Allows smtp overrides by setting properties on the passed-in message. This could be
+ * populated by a previous action in an action pipline.
+ *
+ * @param message The ESB Message object that contains the overrides in its properties.
+ * @param configTree The configTree the properties on the ESB Message object will override.
+ */
+ public static void overrideSmtpProperties(final Message message, final ConfigTree configTree)
+ {
+ final Properties properties = message.getProperties();
+ override(Email.HOST, properties, configTree);
+ override(Email.PORT, properties, configTree);
+ override(Email.USERNAME, properties, configTree);
+ override(Email.PASSWORD, properties, configTree);
+ override(Email.AUTH, properties, configTree);
+ override(Email.FROM, properties, configTree);
+ override(Email.SENDTO, properties, configTree);
+ override(Email.COPYTO, properties, configTree);
+ override(Email.SUBJECT, properties, configTree);
+ override(MESSAGE_ATTACHMENT_NAME, properties, configTree);
+ }
+
+ private void checkValidAddress(final String address, boolean optional) throws ConfigurationException
+ {
+ if (address == null && optional)
+ return;
+
+ try
+ {
+ InternetAddress.parse(address);
+ }
+ catch (AddressException e)
+ {
+ throw new ConfigurationException(address + " is not valid", e);
+ }
+ }
+
+ private static void override(final String key, final Properties properties, final ConfigTree configTree)
+ {
+ final String value = (String) properties.getProperty(key);
+ if (value != null)
+ {
+ configTree.setAttribute(key, value);
+ }
+ }
+
+ /**
+ * Creates a new {@link Email} instance using the properties specified in the
+ * passed-in {@link ConfigTree}.
+ *
+ * @param configTree The {@link ConfigTree} containing the SMTP properties uses to create the Email instance.
+ * @return Email The newly created {@link Email} instance.
+ * @throws AddressException
+ * @throws MessagingException
+ */
+ private Email createEmailInstance(final ConfigTree configTree) throws AddressException, MessagingException
+ {
+ String portStr = configTree.getAttribute(Email.PORT);
+ if (portStr == null)
+ {
+ portStr = Configuration.getSmtpPort();
+ }
+ int port;
+ try
+ {
+ port = Integer.parseInt(portStr);
+ }
+ catch(final NumberFormatException e)
+ {
+ throw new MessagingException("Could not parse port '" + portStr + "'");
+ }
+
+ String host = configTree.getAttribute(Email.HOST, Configuration.getSmtpHost());
+ String username = configTree.getAttribute(Email.USERNAME, Configuration.getSmtpUsername());
+ String password = configTree.getAttribute(Email.PASSWORD,Configuration.getSmtpPassword());
+ boolean auth = configTree.getBooleanAttribute(Email.AUTH, false);
+
+ return new Email(host, port, username, password, auth);
+ }
+
+}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -35,6 +35,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.internal.soa.esb.util.StreamUtils;
+import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -115,7 +116,7 @@
} catch (MessageDeliverException e) {
e.printStackTrace();
} finally {
- resultStream.close();
+ closeStream(resultStream);
}
} finally {
method.releaseConnection();
@@ -127,6 +128,12 @@
return message;
}
+ void closeStream(final Closeable c) throws IOException {
+ if (c != null) {
+ c.close();
+ }
+ }
+
private String[] extractMappedHeaderListConfig() throws ConfigurationException {
final String mappedHeaders = config.getAttribute("MappedHeaderList");
if (mappedHeaders != null) {
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * Factory for {@link Result}s.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public final class ResultFactory
-{
- public enum ResultType { STRING, BYTES, DOM, SAX, SOURCERESULT }
-
- private static ResultFactory factory = new ResultFactory();
-
- private ResultFactory() {}
-
- public static ResultFactory getInstance()
- {
- return factory;
- }
-
- public Result createResult(final ResultType type)
- {
- Result result = null;
- switch ( type )
- {
- case STRING:
- result = new StreamResult(new StringWriter());
- break;
- case BYTES:
- result = new StreamResult(new ByteArrayOutputStream());
- break;
- case DOM:
- result = new DOMResult();
- break;
- case SAX:
- result = new SAXResult();
- break;
- default:
- break;
- }
- return result;
- }
-
- public Object extractResult(final Result result, final ResultType type)
- {
- switch ( type )
- {
- case STRING:
- return ((StreamResult)result).getWriter().toString();
- case BYTES:
- OutputStream outputStream = ((StreamResult)result).getOutputStream();
- return ((ByteArrayOutputStream)outputStream).toByteArray();
- case DOM:
- return ((DOMResult)result).getNode();
- case SAX:
- return (SAXResult)result;
- case SOURCERESULT:
- return result;
- default:
- throw new IllegalArgumentException("Result type not supported: " + result);
- }
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * Factory for {@link Result}s.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public final class ResultFactory
+{
+ public enum ResultType { STRING, BYTES, DOM, SAX, SOURCERESULT }
+
+ private static ResultFactory factory = new ResultFactory();
+
+ private ResultFactory() {}
+
+ public static ResultFactory getInstance()
+ {
+ return factory;
+ }
+
+ public Result createResult(final ResultType type)
+ {
+ Result result = null;
+ switch ( type )
+ {
+ case STRING:
+ result = new StreamResult(new StringWriter());
+ break;
+ case BYTES:
+ result = new StreamResult(new ByteArrayOutputStream());
+ break;
+ case DOM:
+ result = new DOMResult();
+ break;
+ case SAX:
+ result = new SAXResult();
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ public Object extractResult(final Result result, final ResultType type)
+ {
+ switch ( type )
+ {
+ case STRING:
+ return ((StreamResult)result).getWriter().toString();
+ case BYTES:
+ OutputStream outputStream = ((StreamResult)result).getOutputStream();
+ return ((ByteArrayOutputStream)outputStream).toByteArray();
+ case DOM:
+ return ((DOMResult)result).getNode();
+ case SAX:
+ return (SAXResult)result;
+ case SOURCERESULT:
+ return result;
+ default:
+ throw new IllegalArgumentException("Result type not supported: " + result);
+ }
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-/**
- * Code contributed from the Smooks project.
- */
-public class SourceFactory
-{
- private static final SourceFactory factory = new SourceFactory();
-
- private SourceFactory()
- {
- }
-
- public static SourceFactory getInstance()
- {
- return factory;
- }
-
- public Source createSource(final Object from)
- {
- final Source source;
- if (from instanceof String)
- {
- source = new StreamSource(new StringReader((String) from));
- }
- else if (from instanceof byte[])
- {
- source = new StreamSource(new ByteArrayInputStream((byte[]) from));
- }
- else if (from instanceof Reader)
- {
- source = new StreamSource((Reader) from);
- }
- else if (from instanceof InputStream)
- {
- source = new StreamSource((InputStream) from);
- }
- else if (from instanceof File)
- {
- source = fileSource((File) from);
- }
- else if (from instanceof Source)
- {
- source = (Source) from;
- }
- else
- {
- throw new IllegalStateException("Object '" + from + "' is not of a supported type (String, byte[], Reader, InputStream, File, or Source). Try using a SourceResult instead perhaps.");
- }
- return source;
- }
-
- private Source fileSource(final File file)
- {
- try
- {
- return new StreamSource(new BufferedInputStream(new FileInputStream(file)));
- }
- catch (FileNotFoundException e)
- {
- throw new IllegalStateException(e.getMessage(), e);
- }
-
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactory.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * Code contributed from the Smooks project.
+ */
+public class SourceFactory
+{
+ private static final SourceFactory factory = new SourceFactory();
+
+ private SourceFactory()
+ {
+ }
+
+ public static SourceFactory getInstance()
+ {
+ return factory;
+ }
+
+ public Source createSource(final Object from)
+ {
+ final Source source;
+ if (from instanceof String)
+ {
+ source = new StreamSource(new StringReader((String) from));
+ }
+ else if (from instanceof byte[])
+ {
+ source = new StreamSource(new ByteArrayInputStream((byte[]) from));
+ }
+ else if (from instanceof Reader)
+ {
+ source = new StreamSource((Reader) from);
+ }
+ else if (from instanceof InputStream)
+ {
+ source = new StreamSource((InputStream) from);
+ }
+ else if (from instanceof File)
+ {
+ source = fileSource((File) from);
+ }
+ else if (from instanceof Source)
+ {
+ source = (Source) from;
+ }
+ else
+ {
+ throw new IllegalStateException("Object '" + from + "' is not of a supported type (String, byte[], Reader, InputStream, File, or Source). Try using a SourceResult instead perhaps.");
+ }
+ return source;
+ }
+
+ private Source fileSource(final File file)
+ {
+ try
+ {
+ return new StreamSource(new BufferedInputStream(new FileInputStream(file)));
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-
-/**
- * Code contributed from the Smooks project.
- */
-public class SourceResult
-{
- private Source source;
- private Result result;
-
- public SourceResult()
- {
- }
-
- public SourceResult(final Source source, final Result result)
- {
- this.source = source;
- this.result = result;
- }
-
- public Source getSource()
- {
- return source;
- }
-
- public void setSource(final Source source)
- {
- this.source = source;
- }
-
- public Result getResult()
- {
- return result;
- }
-
- public void setResult(final Result result)
- {
- this.result = result;
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/SourceResult.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+/**
+ * Code contributed from the Smooks project.
+ */
+public class SourceResult
+{
+ private Source source;
+ private Result result;
+
+ public SourceResult()
+ {
+ }
+
+ public SourceResult(final Source source, final Result result)
+ {
+ this.source = source;
+ this.result = result;
+ }
+
+ public Source getSource()
+ {
+ return source;
+ }
+
+ public void setSource(final Source source)
+ {
+ this.source = source;
+ }
+
+ public Result getResult()
+ {
+ return result;
+ }
+
+ public void setResult(final Result result)
+ {
+ this.result = result;
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,155 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.transform.URIResolver;
-
-import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
-
-/**
- * Simple data holder for Tranformer factory configuration values.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 4.6
- */
-public class TransformerFactoryConfig
-{
- /**
- * The xslt template file path.
- */
- private final String templateFile;
-
- /**
- * The xslt template file path.
- */
- private final ResultType resultType;
-
- /**
- * Map for transformer factory features.
- */
- private final Map<String, Boolean> features;
-
- /**
- * Map of transformer factory attributes.
- */
- private final Map<String, Object> attributes;
-
- /**
- * {@link URIResolver} to be used.
- */
- private URIResolver uriResolver;
-
- private TransformerFactoryConfig(final Builder builder)
- {
- templateFile = builder.templateFile;
- features = builder.features;
- attributes = builder.attributes;
- uriResolver = builder.uriResolver;
- resultType = builder.resultType;
- }
-
- public String getTemplateFile()
- {
- return templateFile;
- }
-
- public Map<String, Boolean> getFeatures()
- {
- return features;
- }
-
- public Map<String, Object> getAttributes()
- {
- return attributes;
- }
-
- public URIResolver getUriResolver()
- {
- return uriResolver;
- }
-
- public ResultType getResultType()
- {
- return resultType;
- }
-
- public static class Builder
- {
- private final String templateFile;
- private Map<String, Boolean> features;
- private Map<String, Object> attributes;
- private URIResolver uriResolver;
- private ResultType resultType;
-
- public Builder(final String templateFile)
- {
- this.templateFile = templateFile;
- }
-
- public Builder feature(final String name, final Boolean value)
- {
- if (features == null)
- features = new HashMap<String, Boolean>();
-
- features.put(name, value);
- return this;
- }
-
- public Builder attribute(final String name, final Object value)
- {
- if (attributes == null)
- attributes = new HashMap<String, Object>();
-
- attributes.put(name, value);
- return this;
- }
-
- public Builder uriResolver(final URIResolver resolver)
- {
- uriResolver = resolver;
- return this;
- }
-
- public Builder resultType(final ResultType type)
- {
- resultType = type;
- return this;
- }
-
- public TransformerFactoryConfig build()
- {
- if (features == null)
- features = Collections.emptyMap();
-
- if (attributes == null)
- attributes = Collections.emptyMap();
-
- if (resultType == null)
- resultType = ResultType.STRING;
-
- return new TransformerFactoryConfig(this);
- }
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/TransformerFactoryConfig.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.transform.URIResolver;
+
+import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
+
+/**
+ * Simple data holder for Tranformer factory configuration values.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 4.6
+ */
+public class TransformerFactoryConfig
+{
+ /**
+ * The xslt template file path.
+ */
+ private final String templateFile;
+
+ /**
+ * The xslt template file path.
+ */
+ private final ResultType resultType;
+
+ /**
+ * Map for transformer factory features.
+ */
+ private final Map<String, Boolean> features;
+
+ /**
+ * Map of transformer factory attributes.
+ */
+ private final Map<String, Object> attributes;
+
+ /**
+ * {@link URIResolver} to be used.
+ */
+ private URIResolver uriResolver;
+
+ private TransformerFactoryConfig(final Builder builder)
+ {
+ templateFile = builder.templateFile;
+ features = builder.features;
+ attributes = builder.attributes;
+ uriResolver = builder.uriResolver;
+ resultType = builder.resultType;
+ }
+
+ public String getTemplateFile()
+ {
+ return templateFile;
+ }
+
+ public Map<String, Boolean> getFeatures()
+ {
+ return features;
+ }
+
+ public Map<String, Object> getAttributes()
+ {
+ return attributes;
+ }
+
+ public URIResolver getUriResolver()
+ {
+ return uriResolver;
+ }
+
+ public ResultType getResultType()
+ {
+ return resultType;
+ }
+
+ public static class Builder
+ {
+ private final String templateFile;
+ private Map<String, Boolean> features;
+ private Map<String, Object> attributes;
+ private URIResolver uriResolver;
+ private ResultType resultType;
+
+ public Builder(final String templateFile)
+ {
+ this.templateFile = templateFile;
+ }
+
+ public Builder feature(final String name, final Boolean value)
+ {
+ if (features == null)
+ features = new HashMap<String, Boolean>();
+
+ features.put(name, value);
+ return this;
+ }
+
+ public Builder attribute(final String name, final Object value)
+ {
+ if (attributes == null)
+ attributes = new HashMap<String, Object>();
+
+ attributes.put(name, value);
+ return this;
+ }
+
+ public Builder uriResolver(final URIResolver resolver)
+ {
+ uriResolver = resolver;
+ return this;
+ }
+
+ public Builder resultType(final ResultType type)
+ {
+ resultType = type;
+ return this;
+ }
+
+ public TransformerFactoryConfig build()
+ {
+ if (features == null)
+ features = Collections.emptyMap();
+
+ if (attributes == null)
+ attributes = Collections.emptyMap();
+
+ if (resultType == null)
+ resultType = ResultType.STRING;
+
+ return new TransformerFactoryConfig(this);
+ }
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,437 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
-import org.jboss.soa.esb.actions.transformation.xslt.TransformerFactoryConfig.Builder;
-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.util.ClassUtil;
-
-/**
- * ESB Action that performs xslt tranformation.
- * <p/>
- * Example configuration:
- * <pre>{@code
- * <action name="xslt-transform" class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction">
- * <property name="templateFile" value="/sample.xsl"/>
- * <property name="failOnWarning" value="true"/>
- * <property name="resultType" value="STRING"/>
- * </action>
- * }<pre>
- *
- * <h3>Configuration Properties</h3>
- * <lu>
- * <li><i>templateFile</i>:
- * The path to the xsl template to be used. Mandatory</li>
- *
- * <li><i>resultType</i>:
- * This property controls the output result of the transformation.
- * The following values are currently available:
- * {@link ResultType.STRING} - will produce a string.
- * {@link ResultType.BYTES} - will produce a byte[].
- * {@link ResultType.DOM} - will produce a {@link DOMResult}.
- * {@link ResultType.SAX} - will produce a {@link SAXResult}.
- * </li>
- * If the above does not suite your needs then you have the option of specifying both the
- * Source and Result by creating {@link SourceResult} object instance. This is a simple
- * object that holds both a {@link Source} and a {@link Result}.
- * You need to create this object prior to calling this action and the type of {@link Result}
- * returned will be the type that was used to create the {@link SourceResult}.
- *
- * <li><i>failOnWarning</i>:
- * If true will cause a transformation warning to cause an exception to be thrown.
- * If false the failure will be logged. Default is true if not specified.</li>
- *
- * <li><i>uriResolver</i>:
- * Fully qualified class name of a class that implements {@link URIResolver}.
- * This will be set on the tranformation factory. Optional</li>
- *
- * <li><i>factory.feature.*</i>:
- * Factory features that will be set for the tranformation factory. Optional.
- * The feature name, which are fully qualified URIs will should be specified
- * after the 'factory.feature.' prefix. For example:
- * factory.feature.http://javax.xml.XMLConstants/feature/secure-processing</li>
- *
- * <li><i>factory.attribute.*</i>:
- * Factory attributes that will be set for the tranformation factory. Optional.
- * The attribute name should be specified after the 'factory.attribute.' prefix.
- * For example:
- * factory.attribute.someVendorAttributename</li>
- * </lu>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 4.6
- */
-public class XsltAction extends AbstractActionPipelineProcessor
-{
- /**
- * Logger instance.
- */
- private static Logger log = Logger.getLogger(XsltAction.class);
-
- /**
- * Config object that holds tranformation factory config options.
- */
- private TransformerFactoryConfig transformerConfig;
-
- /**
- * Can be used to control whether a warning should be reported
- * as an exception during transformation.
- */
- private boolean failOnWarning;
-
- /**
- * The templates object.
- */
- private Templates xslTemplate;
-
- /**
- * The {@link MessagePayloadProxy}.
- */
- private MessagePayloadProxy payloadProxy;
-
- /**
- * Sole constructor that parses the passed-in {@link ConfigTree} for
- * mandatory attributes and sets the fields of this instance.
- *
- * @param config The {@link ConfigTree} instance.
- *
- * @throws ConfigurationException if the mandatory attribute 'xslt' has not been set.
- */
- public XsltAction(final ConfigTree config) throws ConfigurationException
- {
- transformerConfig = createConfig(config);
- failOnWarning = config.getBooleanAttribute("failOnWarning", true);
- payloadProxy = new MessagePayloadProxy(config);
- }
-
- /**
- * Performs the xsl tranformation of the message payload.
- *
- * @param message The ESB {@link Message} object whose payload should be transformed.
- * The payload is extracted and set using contract specified by {@link MessagePayloadProxy}.
- *
- * @return {@link Message} The same ESB Message instance passed-in but with it payload transformed.
- * @throws ActionProcessingException if an error occurs while trying to perform the transformation.
- */
- public Message process(final Message message) throws ActionProcessingException
- {
- AssertArgument.isNotNull(message, "message");
- try
- {
- final Transformer transformer = xslTemplate.newTransformer();
- final Object payload = getPayload(message);
- final Source source;
- final Result result;
- // If the payload is of SourceResult that use its source and result.
- if (payload instanceof SourceResult)
- {
- final SourceResult sourceResult = (SourceResult) payload;
- source = sourceResult.getSource();
- result = sourceResult.getResult();
- }
- else
- {
- source = SourceFactory.getInstance().createSource(payload);
- result = ResultFactory.getInstance().createResult(transformerConfig.getResultType());
- }
-
- // Perform the transformation.
- transformer.transform(source, result);
-
- // Get the result and set on the message object
- final Object object = ResultFactory.getInstance().extractResult(result, transformerConfig.getResultType());
-
- return setPayload(message, object);
- }
- catch (final TransformerConfigurationException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- catch (TransformerException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- }
-
- /**
- * Creates the XSLTemplate.
- *
- * @throws ActionLifecycleException if the {@link Templates} could not be created.
- *
- */
- @Override
- public void initialise() throws ActionLifecycleException
- {
- try
- {
- final TransformerFactory factory = TransformerFactory.newInstance();
- addFeatures(transformerConfig.getFeatures(), factory);
- addAttributes(transformerConfig.getAttributes(), factory);
- setResolver(transformerConfig.getUriResolver(), factory);
- setErrorListener(new XslErrorListener(failOnWarning), factory);
-
- xslTemplate = createTemplate(transformerConfig.getTemplateFile(), factory);
- }
- catch (final TransformerConfigurationException e)
- {
- throw new ActionLifecycleException(e.getMessage(), e);
- }
- }
-
- private void addFeatures(final Map<String, Boolean> features, final TransformerFactory factory) throws TransformerConfigurationException
- {
- for (Entry<String, Boolean> entry : features.entrySet())
- {
- factory.setFeature(entry.getKey(), entry.getValue());
- }
- }
-
- private void addAttributes(final Map<String, Object> attributes, final TransformerFactory factory) throws TransformerConfigurationException
- {
- for (Entry<String, Object> entry : attributes.entrySet())
- {
- factory.setAttribute(entry.getKey(), entry.getValue());
- }
- }
-
- private void setResolver(final URIResolver uriResolver, final TransformerFactory factory)
- {
- if (uriResolver != null)
- {
- factory.setURIResolver(uriResolver);
- }
- }
-
- private void setErrorListener(final XslErrorListener xslErrorListener, final TransformerFactory factory)
- {
- factory.setErrorListener(xslErrorListener);
- }
-
- private Templates createTemplate(final String templateFile, final TransformerFactory factory) throws ActionLifecycleException, TransformerConfigurationException
- {
- InputStream stream = null;
- try
- {
- stream = StreamUtils.getResource(templateFile);
- return factory.newTemplates(new StreamSource(stream));
- }
- catch (final ConfigurationException e)
- {
- throw new ActionLifecycleException(e.getMessage(), e);
- }
- finally
- {
- if (stream != null)
- {
- try { stream.close(); } catch (final IOException ignore) { log.error("Exception while closing stream", ignore); }
- }
- }
- }
-
- /**
- * Parses the passed-in ESB {@link ConfigTree} and populates a {@link TransformerFactoryConfig}.
- *
- * @param config The ESB {@link ConfigTree}.
- * @return {@link TransformerFactoryConfig}.
- * @throws ConfigurationException
- */
- private TransformerFactoryConfig createConfig(final ConfigTree config) throws ConfigurationException
- {
- final Builder builder = new TransformerFactoryConfig.Builder(config.getRequiredAttribute("templateFile"));
- extractFeatures(config, builder);
- extractAttributes(config, builder);
- createUrlResolver(config, builder);
- builder.resultType(ResultFactory.ResultType.valueOf(config.getRequiredAttribute("resultType")));
- return builder.build();
- }
-
- /**
- * Extracts the factory attributes and adds them to the builder.
- *
- * @param config The ESB {@link ConfigTree}.
- * @param builder The {@link TransformerFactoryConfig.Builder}.
- * @return Builder To support method chainging.
- */
- void extractAttributes(final ConfigTree config, final Builder builder)
- {
- for (final String attrName : config.getAttributeNames())
- {
- int idx = attrName.indexOf("factory.attribute.");
- if (idx != -1)
- {
- final Object value = config.getAttribute(attrName);
- final String name = attrName.substring(idx + "factory.attribute.".length());
- builder.attribute(name, value);
- }
- }
- }
-
- /**
- * Extracts the 'uriResolver' attribute from the ESB {@link ConfigTree} and instantiates a class
- * of that type. This class will be set on the passed-in builder.
- * @param config The ESB {@link ConfigTree}.
- * @param builder The {@link TransformerFactoryConfig.Builder}.
- * @throws ConfigurationException If the class could not be created.
- */
- void createUrlResolver(final ConfigTree config, final Builder builder) throws ConfigurationException
- {
- final String className = config.getAttribute("uriResolver");
- if (className != null)
- {
- try
- {
- final Class<?> resolver = ClassUtil.forName(className, getClass());
- URIResolver uriResolver = (URIResolver) resolver.newInstance();
- builder.uriResolver(uriResolver);
- }
- catch (final ClassNotFoundException e)
- {
- throw new ConfigurationException(e.getMessage(), e);
- }
- catch (InstantiationException e)
- {
- throw new ConfigurationException(e.getMessage(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new ConfigurationException(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Extracts the factory features and adds them to the builder.
- *
- * @param config The ESB {@link ConfigTree}.
- * @param builder The {@link TransformerFactoryConfig.Builder}.
- */
- void extractFeatures(final ConfigTree config, Builder builder)
- {
- for (final String attrName : config.getAttributeNames())
- {
- int idx = attrName.indexOf("factory.feature.");
- if (idx != -1)
- {
- final String value = config.getAttribute(attrName);
- final String name = attrName.substring(idx + "factory.feature.".length());
- builder.feature(name, Boolean.valueOf(value));
- }
- }
- }
-
- private Object getPayload(final Message message) throws ActionProcessingException
- {
- try
- {
- return payloadProxy.getPayload(message);
- }
- catch (MessageDeliverException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- }
-
- private Message setPayload(final Message message, final Object payload) throws ActionProcessingException
- {
- try
- {
- payloadProxy.setPayload(message, payload);
- }
- catch (MessageDeliverException e)
- {
- throw new ActionProcessingException(e.getMessage(), e);
- }
- return message;
- }
-
- public TransformerFactoryConfig getTranformerConfig()
- {
- return transformerConfig;
- }
-
- @Override
- public String toString()
- {
- return String.format("%s templateFile=%s, failOnWarning=%b, features=%s, attributes=%s", getClass().getSimpleName(), transformerConfig.getTemplateFile(), failOnWarning, transformerConfig.getFeatures(), transformerConfig.getAttributes());
- }
-
- private static class XslErrorListener implements ErrorListener
- {
- private final boolean failOnWarning;
-
- public XslErrorListener(boolean failOnWarning)
- {
- this.failOnWarning = failOnWarning;
- }
-
- public void warning(final TransformerException exception) throws TransformerException
- {
- if(failOnWarning)
- {
- throw exception;
- }
- else
- {
- log.warn("XSL Warning.", exception);
- }
- }
-
- public void error(final TransformerException exception) throws TransformerException
- {
- throw exception;
- }
-
- public void fatalError(final TransformerException exception) throws TransformerException
- {
- throw exception;
- }
- }
-
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,437 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
+import org.jboss.soa.esb.actions.transformation.xslt.TransformerFactoryConfig.Builder;
+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.util.ClassUtil;
+
+/**
+ * ESB Action that performs xslt tranformation.
+ * <p/>
+ * Example configuration:
+ * <pre>{@code
+ * <action name="xslt-transform" class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction">
+ * <property name="templateFile" value="/sample.xsl"/>
+ * <property name="failOnWarning" value="true"/>
+ * <property name="resultType" value="STRING"/>
+ * </action>
+ * }<pre>
+ *
+ * <h3>Configuration Properties</h3>
+ * <lu>
+ * <li><i>templateFile</i>:
+ * The path to the xsl template to be used. Mandatory</li>
+ *
+ * <li><i>resultType</i>:
+ * This property controls the output result of the transformation.
+ * The following values are currently available:
+ * {@link ResultType.STRING} - will produce a string.
+ * {@link ResultType.BYTES} - will produce a byte[].
+ * {@link ResultType.DOM} - will produce a {@link DOMResult}.
+ * {@link ResultType.SAX} - will produce a {@link SAXResult}.
+ * </li>
+ * If the above does not suite your needs then you have the option of specifying both the
+ * Source and Result by creating {@link SourceResult} object instance. This is a simple
+ * object that holds both a {@link Source} and a {@link Result}.
+ * You need to create this object prior to calling this action and the type of {@link Result}
+ * returned will be the type that was used to create the {@link SourceResult}.
+ *
+ * <li><i>failOnWarning</i>:
+ * If true will cause a transformation warning to cause an exception to be thrown.
+ * If false the failure will be logged. Default is true if not specified.</li>
+ *
+ * <li><i>uriResolver</i>:
+ * Fully qualified class name of a class that implements {@link URIResolver}.
+ * This will be set on the tranformation factory. Optional</li>
+ *
+ * <li><i>factory.feature.*</i>:
+ * Factory features that will be set for the tranformation factory. Optional.
+ * The feature name, which are fully qualified URIs will should be specified
+ * after the 'factory.feature.' prefix. For example:
+ * factory.feature.http://javax.xml.XMLConstants/feature/secure-processing</li>
+ *
+ * <li><i>factory.attribute.*</i>:
+ * Factory attributes that will be set for the tranformation factory. Optional.
+ * The attribute name should be specified after the 'factory.attribute.' prefix.
+ * For example:
+ * factory.attribute.someVendorAttributename</li>
+ * </lu>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 4.6
+ */
+public class XsltAction extends AbstractActionPipelineProcessor
+{
+ /**
+ * Logger instance.
+ */
+ private static Logger log = Logger.getLogger(XsltAction.class);
+
+ /**
+ * Config object that holds tranformation factory config options.
+ */
+ private TransformerFactoryConfig transformerConfig;
+
+ /**
+ * Can be used to control whether a warning should be reported
+ * as an exception during transformation.
+ */
+ private boolean failOnWarning;
+
+ /**
+ * The templates object.
+ */
+ private Templates xslTemplate;
+
+ /**
+ * The {@link MessagePayloadProxy}.
+ */
+ private MessagePayloadProxy payloadProxy;
+
+ /**
+ * Sole constructor that parses the passed-in {@link ConfigTree} for
+ * mandatory attributes and sets the fields of this instance.
+ *
+ * @param config The {@link ConfigTree} instance.
+ *
+ * @throws ConfigurationException if the mandatory attribute 'xslt' has not been set.
+ */
+ public XsltAction(final ConfigTree config) throws ConfigurationException
+ {
+ transformerConfig = createConfig(config);
+ failOnWarning = config.getBooleanAttribute("failOnWarning", true);
+ payloadProxy = new MessagePayloadProxy(config);
+ }
+
+ /**
+ * Performs the xsl tranformation of the message payload.
+ *
+ * @param message The ESB {@link Message} object whose payload should be transformed.
+ * The payload is extracted and set using contract specified by {@link MessagePayloadProxy}.
+ *
+ * @return {@link Message} The same ESB Message instance passed-in but with it payload transformed.
+ * @throws ActionProcessingException if an error occurs while trying to perform the transformation.
+ */
+ public Message process(final Message message) throws ActionProcessingException
+ {
+ AssertArgument.isNotNull(message, "message");
+ try
+ {
+ final Transformer transformer = xslTemplate.newTransformer();
+ final Object payload = getPayload(message);
+ final Source source;
+ final Result result;
+ // If the payload is of SourceResult that use its source and result.
+ if (payload instanceof SourceResult)
+ {
+ final SourceResult sourceResult = (SourceResult) payload;
+ source = sourceResult.getSource();
+ result = sourceResult.getResult();
+ }
+ else
+ {
+ source = SourceFactory.getInstance().createSource(payload);
+ result = ResultFactory.getInstance().createResult(transformerConfig.getResultType());
+ }
+
+ // Perform the transformation.
+ transformer.transform(source, result);
+
+ // Get the result and set on the message object
+ final Object object = ResultFactory.getInstance().extractResult(result, transformerConfig.getResultType());
+
+ return setPayload(message, object);
+ }
+ catch (final TransformerConfigurationException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ catch (TransformerException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Creates the XSLTemplate.
+ *
+ * @throws ActionLifecycleException if the {@link Templates} could not be created.
+ *
+ */
+ @Override
+ public void initialise() throws ActionLifecycleException
+ {
+ try
+ {
+ final TransformerFactory factory = TransformerFactory.newInstance();
+ addFeatures(transformerConfig.getFeatures(), factory);
+ addAttributes(transformerConfig.getAttributes(), factory);
+ setResolver(transformerConfig.getUriResolver(), factory);
+ setErrorListener(new XslErrorListener(failOnWarning), factory);
+
+ xslTemplate = createTemplate(transformerConfig.getTemplateFile(), factory);
+ }
+ catch (final TransformerConfigurationException e)
+ {
+ throw new ActionLifecycleException(e.getMessage(), e);
+ }
+ }
+
+ private void addFeatures(final Map<String, Boolean> features, final TransformerFactory factory) throws TransformerConfigurationException
+ {
+ for (Entry<String, Boolean> entry : features.entrySet())
+ {
+ factory.setFeature(entry.getKey(), entry.getValue());
+ }
+ }
+
+ private void addAttributes(final Map<String, Object> attributes, final TransformerFactory factory) throws TransformerConfigurationException
+ {
+ for (Entry<String, Object> entry : attributes.entrySet())
+ {
+ factory.setAttribute(entry.getKey(), entry.getValue());
+ }
+ }
+
+ private void setResolver(final URIResolver uriResolver, final TransformerFactory factory)
+ {
+ if (uriResolver != null)
+ {
+ factory.setURIResolver(uriResolver);
+ }
+ }
+
+ private void setErrorListener(final XslErrorListener xslErrorListener, final TransformerFactory factory)
+ {
+ factory.setErrorListener(xslErrorListener);
+ }
+
+ private Templates createTemplate(final String templateFile, final TransformerFactory factory) throws ActionLifecycleException, TransformerConfigurationException
+ {
+ InputStream stream = null;
+ try
+ {
+ stream = StreamUtils.getResource(templateFile);
+ return factory.newTemplates(new StreamSource(stream));
+ }
+ catch (final ConfigurationException e)
+ {
+ throw new ActionLifecycleException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (stream != null)
+ {
+ try { stream.close(); } catch (final IOException ignore) { log.error("Exception while closing stream", ignore); }
+ }
+ }
+ }
+
+ /**
+ * Parses the passed-in ESB {@link ConfigTree} and populates a {@link TransformerFactoryConfig}.
+ *
+ * @param config The ESB {@link ConfigTree}.
+ * @return {@link TransformerFactoryConfig}.
+ * @throws ConfigurationException
+ */
+ private TransformerFactoryConfig createConfig(final ConfigTree config) throws ConfigurationException
+ {
+ final Builder builder = new TransformerFactoryConfig.Builder(config.getRequiredAttribute("templateFile"));
+ extractFeatures(config, builder);
+ extractAttributes(config, builder);
+ createUrlResolver(config, builder);
+ builder.resultType(ResultFactory.ResultType.valueOf(config.getRequiredAttribute("resultType")));
+ return builder.build();
+ }
+
+ /**
+ * Extracts the factory attributes and adds them to the builder.
+ *
+ * @param config The ESB {@link ConfigTree}.
+ * @param builder The {@link TransformerFactoryConfig.Builder}.
+ * @return Builder To support method chainging.
+ */
+ void extractAttributes(final ConfigTree config, final Builder builder)
+ {
+ for (final String attrName : config.getAttributeNames())
+ {
+ int idx = attrName.indexOf("factory.attribute.");
+ if (idx != -1)
+ {
+ final Object value = config.getAttribute(attrName);
+ final String name = attrName.substring(idx + "factory.attribute.".length());
+ builder.attribute(name, value);
+ }
+ }
+ }
+
+ /**
+ * Extracts the 'uriResolver' attribute from the ESB {@link ConfigTree} and instantiates a class
+ * of that type. This class will be set on the passed-in builder.
+ * @param config The ESB {@link ConfigTree}.
+ * @param builder The {@link TransformerFactoryConfig.Builder}.
+ * @throws ConfigurationException If the class could not be created.
+ */
+ void createUrlResolver(final ConfigTree config, final Builder builder) throws ConfigurationException
+ {
+ final String className = config.getAttribute("uriResolver");
+ if (className != null)
+ {
+ try
+ {
+ final Class<?> resolver = ClassUtil.forName(className, getClass());
+ URIResolver uriResolver = (URIResolver) resolver.newInstance();
+ builder.uriResolver(uriResolver);
+ }
+ catch (final ClassNotFoundException e)
+ {
+ throw new ConfigurationException(e.getMessage(), e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new ConfigurationException(e.getMessage(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ConfigurationException(e.getMessage(), e);
+ }
+ }
+ }
+
+ /**
+ * Extracts the factory features and adds them to the builder.
+ *
+ * @param config The ESB {@link ConfigTree}.
+ * @param builder The {@link TransformerFactoryConfig.Builder}.
+ */
+ void extractFeatures(final ConfigTree config, Builder builder)
+ {
+ for (final String attrName : config.getAttributeNames())
+ {
+ int idx = attrName.indexOf("factory.feature.");
+ if (idx != -1)
+ {
+ final String value = config.getAttribute(attrName);
+ final String name = attrName.substring(idx + "factory.feature.".length());
+ builder.feature(name, Boolean.valueOf(value));
+ }
+ }
+ }
+
+ private Object getPayload(final Message message) throws ActionProcessingException
+ {
+ try
+ {
+ return payloadProxy.getPayload(message);
+ }
+ catch (MessageDeliverException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ }
+
+ private Message setPayload(final Message message, final Object payload) throws ActionProcessingException
+ {
+ try
+ {
+ payloadProxy.setPayload(message, payload);
+ }
+ catch (MessageDeliverException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ return message;
+ }
+
+ public TransformerFactoryConfig getTranformerConfig()
+ {
+ return transformerConfig;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("%s templateFile=%s, failOnWarning=%b, features=%s, attributes=%s", getClass().getSimpleName(), transformerConfig.getTemplateFile(), failOnWarning, transformerConfig.getFeatures(), transformerConfig.getAttributes());
+ }
+
+ private static class XslErrorListener implements ErrorListener
+ {
+ private final boolean failOnWarning;
+
+ public XslErrorListener(boolean failOnWarning)
+ {
+ this.failOnWarning = failOnWarning;
+ }
+
+ public void warning(final TransformerException exception) throws TransformerException
+ {
+ if(failOnWarning)
+ {
+ throw exception;
+ }
+ else
+ {
+ log.warn("XSL Warning.", exception);
+ }
+ }
+
+ public void error(final TransformerException exception) throws TransformerException
+ {
+ throw exception;
+ }
+
+ public void fatalError(final TransformerException exception) throws TransformerException
+ {
+ throw exception;
+ }
+ }
+
+}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -43,6 +43,7 @@
import org.jboss.soa.esb.addressing.XMLUtil;
import org.jboss.soa.esb.addressing.PortReference.Extension;
import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.util.JndiUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -236,7 +237,7 @@
}
if (jndiPrefixesValue != null) {
- final String[] jndiPrefixes = getJndiPrefixes(jndiPrefixesValue) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(jndiPrefixesValue) ;
for(Map.Entry<String, String> entry: extensions.entrySet()) {
for(String jndiPrefix: jndiPrefixes) {
final String tag = entry.getKey() ;
@@ -544,6 +545,7 @@
addr.setAddress(getJmsAddress(uri, name));
addr.addExtension(DESTINATION_TYPE_TAG, destinationType);
+ addr.addExtension(DESTINATION_NAME_TAG, destinationName);
addr.addExtension(SPECIFICATION_VERSION_TAG, protocol);
@@ -602,18 +604,23 @@
public final String getDestinationName()
{
- try
- {
- URI uri = new URI(getAddr().getAddress());
+ final String name = getAddr().getExtensionValue(DESTINATION_NAME_TAG);
+ if (name != null)
+ {
+ return name ;
+ }
+ try
+ {
+ URI uri = new URI(getAddr().getAddress());
- return uri.getPath().substring(1);
- }
- catch (URISyntaxException ex)
- {
- _logger.warn("Unexpected parsing exception!", ex);
+ return uri.getPath().substring(1);
+ }
+ catch (URISyntaxException ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
- return null;
- }
+ return null;
+ }
}
/**
@@ -639,7 +646,7 @@
{
properties.put(JNDI_PREFIXES, jndiPrefixesValue) ;
}
- final String[] jndiPrefixes = getJndiPrefixes(jndiPrefixesValue) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(jndiPrefixesValue) ;
Iterator<Extension> iter = getAddr().getExtensions();
while (iter.hasNext()) {
@@ -668,24 +675,11 @@
* Get the list of JNDI extension prefixes.
* @param jndiPrefixesValue The JNDI prefix list or null if default.
* @return The list of JNDI extension prefixes.
+ * @deprecated Use {@link JndiUtil#getJndiPrefixes(String)}.
*/
public static String[] getJndiPrefixes(final String jndiPrefixesValue)
{
- final Set<String> jndiPrefixesSet = new TreeSet<String>();
- jndiPrefixesSet.add("java.naming.") ;
- if (jndiPrefixesValue != null)
- {
- final String[] values = jndiPrefixesValue.split(",") ;
- for(String value: values)
- {
- final String trim = value.trim() ;
- if (trim.length() > 0)
- {
- jndiPrefixesSet.add(trim) ;
- }
- }
- }
- return jndiPrefixesSet.toArray(new String[jndiPrefixesSet.size()]) ;
+ return JndiUtil.getJndiPrefixes(jndiPrefixesValue);
}
/**
@@ -762,16 +756,8 @@
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;
- }
- }
+ final URI result = new URI(JMS_PROTOCOL, uri, name) ;
+ return result.toString();
} catch (final URISyntaxException urise) {}
return JMS_PROTOCOL + PROTOCOL_SEPARATOR + uri + "/" + name;
}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -569,7 +569,9 @@
try {
courier = getCourier(targetEPR);
} catch (CourierException e) {
- logger.debug("Courier lookup failed for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", e);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Courier lookup failed for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", e);
+ }
} catch (MalformedEPRException e) {
// probably an ESB-unaware EPR in the registry!!
@@ -611,7 +613,9 @@
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.");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Not using epr [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. No reply-to address available for synchronous response.");
+ }
return null;
}
call.setReplyTo(replyToEPR);
@@ -636,7 +640,9 @@
} catch (final CourierServiceBindException e) {
// meant to be masked by the SI fail-over
- logger.debug("Caught service lookup exception for EPR [" + targetEPR + "] and Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Caught service lookup exception for EPR [" + targetEPR + "] and Service [" + service + "] and Message ["+message.getHeader()+"]. ", e);
+ }
// could be stale EPR, so move on to next entry in registry.
} catch (final CourierMarshalUnmarshalException e) {
@@ -646,7 +652,9 @@
} catch (final CourierTransportException e) {
// meant to be masked by the SI fail-over
- logger.debug("Courier indicated transport related error "+e+" during send/receive with EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Courier indicated transport related error "+e+" during send/receive with EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. ", e);
+ }
} catch (CourierException e) {
// probable config error. Log it and move on to next EPR/service entry.
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -42,6 +42,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.util.Util;
+import org.jboss.soa.esb.util.JndiUtil;
public class ListenerUtil
{
@@ -145,7 +146,7 @@
if (jndiPrefixesValue != null) {
environment.put(JMSEpr.JNDI_PREFIXES, jndiPrefixesValue) ;
}
- final String[] jndiPrefixes = JMSEpr.getJndiPrefixes(jndiPrefixesValue) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(jndiPrefixesValue) ;
for (String attributeName : names) {
for(String jndiPrefix: jndiPrefixes) {
if (attributeName.startsWith(jndiPrefix)) {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -63,6 +63,7 @@
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.util.JndiUtil;
public class JmsGatewayListener extends AbstractThreadedManagedLifecycle {
/**
@@ -363,7 +364,7 @@
if (jndiPrefixesValue != null) {
environment.setProperty(JMSEpr.JNDI_PREFIXES, jndiPrefixesValue) ;
}
- final String[] jndiPrefixes = JMSEpr.getJndiPrefixes(jndiPrefixesValue) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(jndiPrefixesValue) ;
for (String name : names) {
for(String jndiPrefix: jndiPrefixes) {
if (name.startsWith(jndiPrefix)) {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -314,10 +314,10 @@
for (String key : actionProcessTimeHash.keySet()) {
long processTotal = actionProcessTimeHash.get(key).value;
String actionId = key.substring(0, key.indexOf(PROCESSING_TIME));
- int successCount = actionCounterHash.get(actionId + " " + MESSAGE_COUNTER).value;
+ IntHolder successCount = actionCounterHash.get(actionId + " " + MESSAGE_COUNTER);
String avgTime = null;
- if (successCount > 0) {
- avgTime = ((double) processTotal / successCount) + " ns";
+ if (successCount != null && successCount.value > 0 ) {
+ avgTime = ((double) processTotal / successCount.value) + " ns";
}
Attribute at = new Attribute(key, avgTime);
attributeList.add(at);
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -27,18 +27,15 @@
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.routing.email.Emailer;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
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.body.content.BytesBody;
-import org.jboss.soa.esb.util.Util;
/**
* This class will send an e-mail using the Email class.
@@ -78,8 +75,10 @@
*/
public class NotifyEmail extends NotificationTarget
{
+ private Emailer emailer;
+
+ @Deprecated
private static final String MESSAGE_ATTACHMENT_NAME = "msgAttachmentName";
- private MessagePayloadProxy payloadProxy;
/**
* Instantiate a NotifyEmail object using the information contained in
@@ -94,29 +93,14 @@
*/
public NotifyEmail (ConfigTree configTree) throws ConfigurationException
{
- super(configTree);
-
- try
- {
- String sAtt = (String) m_oParms.getAttribute(Email.FROM);
-
- if (null != sAtt)
- InternetAddress.parse(sAtt);
-
- InternetAddress.parse(m_oParms.getAttribute(Email.SENDTO));
-
- sAtt = (String) m_oParms.getAttribute(Email.COPYTO);
- if (null != sAtt)
- InternetAddress.parse(sAtt);
- }
- catch (AddressException ex)
- {
- throw new ConfigurationException(ex);
- }
- payloadProxy = new MessagePayloadProxy(configTree,
- new String[] {BytesBody.BYTES_LOCATION},
- new String[] {BytesBody.BYTES_LOCATION});
+ this(configTree, new Emailer(configTree));
} // __________________________________
+
+ public NotifyEmail (final ConfigTree config, final Emailer emailer)
+ {
+ super(config);
+ this.emailer = emailer;
+ }
/**
* Send an Email using Email() using p_o.toString() to fill in the message
@@ -128,47 +112,14 @@
*/
public void sendNotification (final Message message) throws NotificationException
{
- try
- {
- Object obj = payloadProxy.getPayload(message);
- String content;
- byte[] payloadBytes;
-
- if(obj instanceof byte[]) {
- content = new String((byte[]) obj);
- payloadBytes = ((byte[]) obj).clone();
- } else {
- content = obj.toString();
- payloadBytes = content.getBytes();
- }
-
- ConfigTree configTree = m_oParms.cloneObj();
- String sMsg = configTree.getAttribute(Email.MESSAGE);
- sMsg = ((null == sMsg) ? content : (sMsg + "\n" + content));
- configTree.setAttribute(Email.MESSAGE, sMsg);
-
- overrideSmtpProperties(message, configTree);
-
- sendEmailNotification(configTree, payloadBytes);
+ try
+ {
+ emailer.sendEmail(message);
}
- catch (final MessageDeliverException e) {
- throw new NotificationException(e);
+ catch (final MessageDeliverException e)
+ {
+ throw new NotificationException("Exception while trying to send email", e);
}
- catch (final AddressException e)
- {
- Util.getDefaultLogger(this.getClass()).error("Send Mail Failed", e);
-
- throw new NotificationException(e);
- }
- catch (final MessagingException ex)
- {
- throw new NotificationException(ex);
- }
- catch (final IOException e) {
- Util.getDefaultLogger(this.getClass()).error("Send Mail Failed", e);
-
- throw new NotificationException(e);
- }
} // __________________________________
/**
@@ -176,6 +127,7 @@
* populated by a previsous action in an action pipline.
* @param message The ESB Message object that contains the overrides in its properties.
* @param configTree The configTree the properties on the ESB Message object will override.
+ * @deprecated Use {@link Emailer#overrideSmtpProperties(Message, ConfigTree)} instead
*/
protected void overrideSmtpProperties(final Message message, final ConfigTree configTree)
{
@@ -192,6 +144,9 @@
override(MESSAGE_ATTACHMENT_NAME, properties, configTree);
}
+ /**
+ * @deprecated
+ */
private void override(final String key, final Properties properties, final ConfigTree configTree)
{
final String value = (String) properties.getProperty(key);
@@ -209,6 +164,7 @@
* Message parameters.
* @param message
* @throws IOException
+ * @{@link Deprecated} Use {@link Emailer} instead.
*/
protected void sendEmailNotification (ConfigTree messageParams, byte[] msgPayload) throws AddressException, MessagingException, IOException
{
@@ -229,13 +185,7 @@
}
/**
- * Creates a new {@link Email} instance using the properties specified in the
- * passed-in {@link ConfigTree}.
- *
- * @param configTree The {@link ConfigTree} containing the SMTP properties uses to create the Email instance.
- * @return Email The newly created {@link Email} instance.
- * @throws AddressException
- * @throws MessagingException
+ * @{@link Deprecated} Use {@link Emailer} instead.
*/
private Email createEmailInstance(final ConfigTree configTree) throws AddressException, MessagingException
{
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -40,6 +40,7 @@
import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.util.JndiUtil;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.helpers.ConfigTree;
@@ -411,7 +412,7 @@
String prefix = configTrees[i].getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
if (prefix!=null) environment.setProperty(Context.URL_PKG_PREFIXES, prefix);
List<KeyValuePair> properties=configTrees[i].childPropertyList();
- final String[] jndiPrefixes = JMSEpr.getJndiPrefixes(KeyValuePair.getValue(JMSEpr.JNDI_PREFIXES, properties)) ;
+ final String[] jndiPrefixes = JndiUtil.getJndiPrefixes(KeyValuePair.getValue(JMSEpr.JNDI_PREFIXES, properties)) ;
for (KeyValuePair property : properties) {
for(String jndiPrefix: jndiPrefixes) {
if (property.getKey().startsWith(jndiPrefix)) {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -23,11 +23,8 @@
import java.net.URI;
-import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
-import javax.naming.Context;
-import javax.naming.NamingException;
import org.apache.log4j.Logger;
import org.jboss.soa.esb.message.Properties;
@@ -128,6 +125,10 @@
* The following expression in a message selector would evaluate to false,
* because a string cannot be used in an arithmetic expression:
* "NumberOfOrders > 1"
+ * <p/>
+ * Note that this method does not allow the setting of JMS Header properties, that is
+ * properites that start with 'JMSX', nor does it allow JMS Vendor specific properties, those
+ * that start with 'JMS_' to be set.
*
* @param fromESBMessage ESB Message object instance from which properties will be retrevied
* @param toJMSMessage JMS Message object instance upon which the properties will be set
@@ -142,13 +143,18 @@
if ( !Strings.isValidJavaIdentifier( key ))
continue;
- if (key.startsWith("JMSX"))
- {
- if (!JMSX_GROUP_ID.equals(key) && !JMSX_GROUP_SEQ.equals(key))
- {
- continue ;
- }
- }
+ if (key.startsWith("JMSX"))
+ {
+ if (!JMSX_GROUP_ID.equals(key) && !JMSX_GROUP_SEQ.equals(key))
+ {
+ continue ;
+ }
+ }
+ else if (key.startsWith("JMS_"))
+ {
+ continue ;
+ }
+
Object value = properties.getProperty( key );
log.debug( "Setting outgoing JMSProperty, key : " + key + ", value : " + value );
if ( value instanceof String )
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/smooks-ws-security.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,5 +1,9 @@
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <resource-config selector="global-parameters">
+ <param name="stream.filter.type">SAX</param>
+ </resource-config>
<resource-config selector="Envelope/Header/Security/UsernameToken">
<resource>org.milyn.javabean.BeanPopulator</resource>
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/util/JndiUtil.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/JndiUtil.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/util/JndiUtil.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/src/org/jboss/soa/esb/util/JndiUtil.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.util;
+
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Utilities class for managing JNDI related tasks.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class JndiUtil
+{
+
+ /**
+ * General Namespace prefix for ESB related properties. If the property name
+ * is prefixed with this string it will be automatically added as one of the
+ * JNDI prefixes.
+ */
+ public static final String ESB_JNDI_PARAMETER_PREFIX = "org.jboss.esb.";
+
+ private JndiUtil()
+ {
+ }
+
+ public static Set<String> getJndiPrefixesSet(final String jndiPrefixesValue)
+ {
+ final Set<String> jndiPrefixesSet = new TreeSet<String>();
+
+ // Add default prefixes.
+ jndiPrefixesSet.add("java.naming.") ;
+ jndiPrefixesSet.add(ESB_JNDI_PARAMETER_PREFIX) ;
+
+ if (jndiPrefixesValue != null)
+ {
+ final String[] values = jndiPrefixesValue.split(",") ;
+ for (String value: values)
+ {
+ final String trim = value.trim() ;
+ if (trim.length() > 0)
+ {
+ jndiPrefixesSet.add(trim) ;
+ }
+ }
+ }
+
+ return jndiPrefixesSet;
+ }
+
+ /**
+ * Get the list of JNDI extension prefixes.
+ *
+ * @param jndiPrefixesValue The JNDI prefix list or null if default.
+ * @return The list of JNDI extension prefixes.
+ */
+ public static String[] getJndiPrefixes(final String jndiPrefixesValue)
+ {
+ final Set<String> jndiPrefixesSet = getJndiPrefixesSet(jndiPrefixesValue);
+ return jndiPrefixesSet.toArray(new String[jndiPrefixesSet.size()]) ;
+ }
+
+ /**
+ * Parses the passed-in {@link ConfigTree} and extracts all properties that
+ * have been prefixed
+ *
+ * @param config
+ * @return
+ */
+ public static Properties parseEnvironmentProperties(final ConfigTree config)
+ {
+ final Properties env = new Properties();
+
+ // Comma separated list of prefixes. Will always include at least 'java.naming.'
+ final String[] jndiPrefixes = getJndiPrefixes(getPropertyValue(config, JMSEpr.JNDI_PREFIXES));
+
+ Set<String> attributeNames= config.getAttributeNames();
+ for (final String name : attributeNames)
+ {
+ for(String jndiPrefix: jndiPrefixes)
+ {
+ if (name.startsWith(jndiPrefix))
+ {
+ env.setProperty(name, config.getAttribute(name));
+ break;
+ }
+ }
+ }
+
+ return env;
+ }
+
+ public static String getPropertyValue(final ConfigTree config, final String propertyName)
+ {
+ return config.getAttribute(propertyName);
+ }
+
+
+}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,167 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
-
-import static org.junit.Assert.assertEquals;
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.helpers.Email;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.junit.Test;
-
-/**
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EmailerUnitTest
-{
- @Test
- public void test_NotifyEmail() throws Exception
- {
- ConfigTree config = new ConfigTree("email");
-
- config.setAttribute(Email.FROM, "a.b at c.com");
- config.setAttribute(Email.SENDTO, "d.e at f.com");
- config.setAttribute(Email.COPYTO, "g.h at i.com");
- config.setAttribute(Email.MESSAGE, "Hi there!!!");
-
- Emailer ne = new MockEmailer(config, "Hi there!!!\nHello");
- Message message = MessageFactory.getInstance().getMessage();
- message.getBody().add("Hello".getBytes());
- ne.sendEmail(message);
- }
-
- @Test
- public void test_NotifyEmailNoMessage() throws Exception {
- ConfigTree config = new ConfigTree("email");
-
- config.setAttribute(Email.FROM, "a.b at c.com");
- config.setAttribute(Email.SENDTO, "d.e at f.com");
- config.setAttribute(Email.COPYTO, "g.h at i.com");
-
- Emailer ne = new MockEmailer(config, "Hello");
- Message message = MessageFactory.getInstance().getMessage();
- message.getBody().add("Hello".getBytes());
- ne.sendEmail(message);
- }
-
- @Test
- public void overrideHost() throws Exception {
- assertOverride(Email.HOST, "b2.host2");
- }
-
- @Test
- public void overridePort() throws Exception {
- assertOverride(Email.PORT, "8021");
- }
-
- @Test
- public void overrideUsername() throws Exception {
- assertOverride(Email.USERNAME, "daniel");
- }
-
- @Test
- public void overridePassword() throws Exception {
- assertOverride(Email.PASSWORD, "letmein");
- }
-
- @Test
- public void overrideAuth() throws Exception {
- assertOverride(Email.AUTH, "true");
- }
-
- @Test
- public void overrideFrom() throws Exception {
- assertOverride(Email.FROM, "dbevenius at jboss.com");
- }
-
- @Test
- public void overrideSendTo() throws Exception {
- assertOverride(Email.SENDTO, "dbevenius at jboss.com");
- }
-
- @Test
- public void overrideCopyTo() throws Exception {
- assertOverride(Email.COPYTO, "dbevenius at jboss.com");
- }
-
- @Test
- public void overrideSubject() throws Exception {
- assertOverride(Email.SUBJECT, "Overridden Subject");
- }
-
- public void overrideAttachmentName() throws Exception {
- assertOverride("msgAttachmentName", "newFile.txt");
- }
-
- private void assertOverride(final String overrideName, final String overrideValue) throws Exception
- {
- ConfigTree emailMessageEl = new ConfigTree("email");
- emailMessageEl.setAttribute(Email.SENDTO, "d.e at f.com");
- emailMessageEl.setAttribute(Email.SUBJECT, "Original Subject");
- emailMessageEl.setAttribute(Email.MESSAGE, "Hi there!!!");
-
- MockEmailer ne = new MockEmailer(emailMessageEl, "Hi there!!!\nHello");
- Message message = MessageFactory.getInstance().getMessage();
-
- message.getProperties().setProperty(overrideName, overrideValue);
- message.getBody().add("Hello".getBytes());
- ne.sendEmail(message);
-
- assertEquals(overrideValue, ne.getConfigTree().getAttribute(overrideName));
-
- }
-
- private class MockEmailer extends Emailer
- {
- private final String message ;
-
- private ConfigTree configTree;
-
- public MockEmailer(ConfigTree config, final String message) throws Exception
- {
- super(config);
- this.message = message ;
- }
-
- @Override
- protected void sendEmail(ConfigTree messageParams, byte[] msgPayload)
- {
- configTree = messageParams;
- assertEquals(message, configTree.getAttribute(Email.MESSAGE));
- }
-
- public ConfigTree getConfigTree()
- {
- return configTree;
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(EmailerUnitTest.class);
- }
-
-}
-
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/email/EmailerUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.routing.email;
+
+import static org.junit.Assert.assertEquals;
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.Email;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.Test;
+
+/**
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class EmailerUnitTest
+{
+ @Test
+ public void test_NotifyEmail() throws Exception
+ {
+ ConfigTree config = new ConfigTree("email");
+
+ config.setAttribute(Email.FROM, "a.b at c.com");
+ config.setAttribute(Email.SENDTO, "d.e at f.com");
+ config.setAttribute(Email.COPYTO, "g.h at i.com");
+ config.setAttribute(Email.MESSAGE, "Hi there!!!");
+
+ Emailer ne = new MockEmailer(config, "Hi there!!!\nHello");
+ Message message = MessageFactory.getInstance().getMessage();
+ message.getBody().add("Hello".getBytes());
+ ne.sendEmail(message);
+ }
+
+ @Test
+ public void test_NotifyEmailNoMessage() throws Exception {
+ ConfigTree config = new ConfigTree("email");
+
+ config.setAttribute(Email.FROM, "a.b at c.com");
+ config.setAttribute(Email.SENDTO, "d.e at f.com");
+ config.setAttribute(Email.COPYTO, "g.h at i.com");
+
+ Emailer ne = new MockEmailer(config, "Hello");
+ Message message = MessageFactory.getInstance().getMessage();
+ message.getBody().add("Hello".getBytes());
+ ne.sendEmail(message);
+ }
+
+ @Test
+ public void overrideHost() throws Exception {
+ assertOverride(Email.HOST, "b2.host2");
+ }
+
+ @Test
+ public void overridePort() throws Exception {
+ assertOverride(Email.PORT, "8021");
+ }
+
+ @Test
+ public void overrideUsername() throws Exception {
+ assertOverride(Email.USERNAME, "daniel");
+ }
+
+ @Test
+ public void overridePassword() throws Exception {
+ assertOverride(Email.PASSWORD, "letmein");
+ }
+
+ @Test
+ public void overrideAuth() throws Exception {
+ assertOverride(Email.AUTH, "true");
+ }
+
+ @Test
+ public void overrideFrom() throws Exception {
+ assertOverride(Email.FROM, "dbevenius at jboss.com");
+ }
+
+ @Test
+ public void overrideSendTo() throws Exception {
+ assertOverride(Email.SENDTO, "dbevenius at jboss.com");
+ }
+
+ @Test
+ public void overrideCopyTo() throws Exception {
+ assertOverride(Email.COPYTO, "dbevenius at jboss.com");
+ }
+
+ @Test
+ public void overrideSubject() throws Exception {
+ assertOverride(Email.SUBJECT, "Overridden Subject");
+ }
+
+ public void overrideAttachmentName() throws Exception {
+ assertOverride("msgAttachmentName", "newFile.txt");
+ }
+
+ private void assertOverride(final String overrideName, final String overrideValue) throws Exception
+ {
+ ConfigTree emailMessageEl = new ConfigTree("email");
+ emailMessageEl.setAttribute(Email.SENDTO, "d.e at f.com");
+ emailMessageEl.setAttribute(Email.SUBJECT, "Original Subject");
+ emailMessageEl.setAttribute(Email.MESSAGE, "Hi there!!!");
+
+ MockEmailer ne = new MockEmailer(emailMessageEl, "Hi there!!!\nHello");
+ Message message = MessageFactory.getInstance().getMessage();
+
+ message.getProperties().setProperty(overrideName, overrideValue);
+ message.getBody().add("Hello".getBytes());
+ ne.sendEmail(message);
+
+ assertEquals(overrideValue, ne.getConfigTree().getAttribute(overrideName));
+
+ }
+
+ private class MockEmailer extends Emailer
+ {
+ private final String message ;
+
+ private ConfigTree configTree;
+
+ public MockEmailer(ConfigTree config, final String message) throws Exception
+ {
+ super(config);
+ this.message = message ;
+ }
+
+ @Override
+ protected void sendEmail(ConfigTree messageParams, byte[] msgPayload)
+ {
+ configTree = messageParams;
+ assertEquals(message, configTree.getAttribute(Email.MESSAGE));
+ }
+
+ public ConfigTree getConfigTree()
+ {
+ return configTree;
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(EmailerUnitTest.class);
+ }
+
+}
+
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/http/HttpRouterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/http/HttpRouterUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/http/HttpRouterUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -22,15 +22,20 @@
package org.jboss.soa.esb.actions.routing.http;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import junit.framework.JUnit4TestAdapter;
import org.jboss.soa.esb.ConfigurationException;
+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.message.format.MessageFactory;
import org.junit.Before;
import org.junit.Test;
@@ -76,6 +81,25 @@
assertEquals(0, headers.size());
}
+ @Test
+ public void testRouter_NullResponse() throws ConfigurationException, ActionProcessingException
+ {
+ final ConfigTree tree = new ConfigTree("ValidMappedHeaderList");
+ tree.setAttribute("endpointUrl", "http://foo.bar");
+ tree.setAttribute("method", "post");
+ tree.setAttribute("MappedHeaderList", "SOAPAction, Content-Type, Accept");
+
+ HttpRouter router = new HttpRouter(tree);
+ try
+ {
+ router.closeStream(null);
+ }
+ catch (final IOException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
public static junit.framework.Test suite() {
return new JUnit4TestAdapter(HttpRouterUnitTest.class);
}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
-import org.junit.Test;
-
-import junit.framework.JUnit4TestAdapter;
-
-/**
- * Unit test for {@link ResultFactory}.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class ResultFactoryUnitTest
-{
- private ResultFactory resultFactory = ResultFactory.getInstance();
-
- @Test
- public void createStringResult()
- {
- final Result result = resultFactory.createResult(ResultType.STRING);
- assertTrue(result instanceof StreamResult);
- final StreamResult streamResult = (StreamResult) result;
- assertNotNull(streamResult.getWriter());
- final Writer writer = streamResult.getWriter();
- assertTrue(writer instanceof StringWriter);
- }
-
- @Test
- public void createByteArrayResult()
- {
- final Result result = resultFactory.createResult(ResultType.BYTES);
- assertTrue(result instanceof StreamResult);
- final StreamResult streamResult = (StreamResult) result;
- assertNull(streamResult.getWriter());
- final OutputStream outputStream = streamResult.getOutputStream();
- assertNotNull(outputStream);
- assertNotNull(outputStream instanceof ByteArrayOutputStream);
- }
-
- @Test
- public void createDOMResult()
- {
- final Result result = resultFactory.createResult(ResultType.DOM);
- assertTrue(result instanceof DOMResult);
- }
-
- @Test
- public void createSAXResult()
- {
- final Result result = resultFactory.createResult(ResultType.SAX);
- assertTrue(result instanceof SAXResult);
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(ResultFactoryUnitTest.class);
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactoryUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
+import org.junit.Test;
+
+import junit.framework.JUnit4TestAdapter;
+
+/**
+ * Unit test for {@link ResultFactory}.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class ResultFactoryUnitTest
+{
+ private ResultFactory resultFactory = ResultFactory.getInstance();
+
+ @Test
+ public void createStringResult()
+ {
+ final Result result = resultFactory.createResult(ResultType.STRING);
+ assertTrue(result instanceof StreamResult);
+ final StreamResult streamResult = (StreamResult) result;
+ assertNotNull(streamResult.getWriter());
+ final Writer writer = streamResult.getWriter();
+ assertTrue(writer instanceof StringWriter);
+ }
+
+ @Test
+ public void createByteArrayResult()
+ {
+ final Result result = resultFactory.createResult(ResultType.BYTES);
+ assertTrue(result instanceof StreamResult);
+ final StreamResult streamResult = (StreamResult) result;
+ assertNull(streamResult.getWriter());
+ final OutputStream outputStream = streamResult.getOutputStream();
+ assertNotNull(outputStream);
+ assertNotNull(outputStream instanceof ByteArrayOutputStream);
+ }
+
+ @Test
+ public void createDOMResult()
+ {
+ final Result result = resultFactory.createResult(ResultType.DOM);
+ assertTrue(result instanceof DOMResult);
+ }
+
+ @Test
+ public void createSAXResult()
+ {
+ final Result result = resultFactory.createResult(ResultType.SAX);
+ assertTrue(result instanceof SAXResult);
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ResultFactoryUnitTest.class);
+ }
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import static org.junit.Assert.*;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.junit.Test;
-
-/**
- * Unit test for {@link SourceFactory}.
- * <p/>
- *
- * Code contributed from the Smooks project.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class SourceFactoryUnitTest
-{
- private SourceFactory factory = SourceFactory.getInstance();
-
- @Test
- public void createStreamSourceStreamFromString()
- {
- final Source source = factory.createSource( "testing" );
- assertNotNull( source );
- assertTrue( source instanceof StreamSource );
- }
-
- @Test
- public void getSourceByteArray()
- {
- final Source source = factory.createSource( "test".getBytes() );
- assertNotNull( source );
- assertTrue( source instanceof StreamSource );
- }
-
- @Test
- public void getSourceReader()
- {
- final Source source = factory.createSource( new StringReader( "testing" ));
- assertNotNull( source );
- assertTrue( source instanceof StreamSource );
- }
-
- @Test
- public void getSourceInputStream()
- {
- final Source source = factory.createSource( new ByteArrayInputStream( "testing".getBytes() ) );
- assertNotNull( source );
- assertTrue( source instanceof StreamSource );
- }
-
- @Test
- public void getSourceFile() throws IOException
- {
- final File file = File.createTempFile("junit", ".test");
- file.deleteOnExit();
- final Source source = factory.createSource(file);
- assertNotNull( source );
- assertTrue( source instanceof StreamSource );
- final StreamSource streamSource = (StreamSource) source;
- final InputStream inputStream = streamSource.getInputStream();
- assertTrue(inputStream instanceof BufferedInputStream);
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(SourceFactoryUnitTest.class);
- }
-
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/SourceFactoryUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link SourceFactory}.
+ * <p/>
+ *
+ * Code contributed from the Smooks project.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SourceFactoryUnitTest
+{
+ private SourceFactory factory = SourceFactory.getInstance();
+
+ @Test
+ public void createStreamSourceStreamFromString()
+ {
+ final Source source = factory.createSource( "testing" );
+ assertNotNull( source );
+ assertTrue( source instanceof StreamSource );
+ }
+
+ @Test
+ public void getSourceByteArray()
+ {
+ final Source source = factory.createSource( "test".getBytes() );
+ assertNotNull( source );
+ assertTrue( source instanceof StreamSource );
+ }
+
+ @Test
+ public void getSourceReader()
+ {
+ final Source source = factory.createSource( new StringReader( "testing" ));
+ assertNotNull( source );
+ assertTrue( source instanceof StreamSource );
+ }
+
+ @Test
+ public void getSourceInputStream()
+ {
+ final Source source = factory.createSource( new ByteArrayInputStream( "testing".getBytes() ) );
+ assertNotNull( source );
+ assertTrue( source instanceof StreamSource );
+ }
+
+ @Test
+ public void getSourceFile() throws IOException
+ {
+ final File file = File.createTempFile("junit", ".test");
+ file.deleteOnExit();
+ final Source source = factory.createSource(file);
+ assertNotNull( source );
+ assertTrue( source instanceof StreamSource );
+ final StreamSource streamSource = (StreamSource) source;
+ final InputStream inputStream = streamSource.getInputStream();
+ assertTrue(inputStream instanceof BufferedInputStream);
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SourceFactoryUnitTest.class);
+ }
+
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,288 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.custommonkey.xmlunit.XMLAssert;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-/**
- * Unit test for {@link XsltAction}.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class XsltActionUnitTest
-{
- private static final String PACKAGE_PATH = "/org/jboss/soa/esb/actions/transformation/xslt";
- private static final String TEST_XSL_1 = PACKAGE_PATH + "/test1.xsl";
- private static final String TEST_XML_1 = PACKAGE_PATH + "/example1.xml";
-
- @BeforeClass public static void before()
- {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
- @Test (expected = ConfigurationException.class)
- public void shouldThrowIfNoTemplateIsConfigured() throws ConfigurationException
- {
- new XsltAction(new ConfigTree("xslttest"));
- }
-
- @Test public void processXsltString() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().templateFile(TEST_XSL_1).resultType(ResultType.STRING).build());
- action.initialise();
-
- final String xml = StreamUtils.getResourceAsString(TEST_XML_1, "UTF-8");
-
- final Message message = MessageFactory.getInstance().getMessage();
- message.getBody().add(xml);
-
- Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
- }
-
- @Test public void extractFeatures() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
- {
- ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
- confBuilder.feature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- ConfigTree config = confBuilder.build();
-
- final XsltAction action = new XsltAction(config);
- action.initialise();
-
- final Map<String, Boolean> features = action.getTranformerConfig().getFeatures();
-
- assertNotNull(features);
- assertEquals(1, features.size());
- assertTrue(features.containsKey(XMLConstants.FEATURE_SECURE_PROCESSING));
- assertEquals(true, features.get(XMLConstants.FEATURE_SECURE_PROCESSING));
- }
-
- @Test public void extractAttributes() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
- {
- ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
- confBuilder.attribute("att1", "value1").attribute("att2", "value2");
- ConfigTree config = confBuilder.build();
-
- final XsltAction action = new XsltAction(config);
- final Map<String, Object> attributes = action.getTranformerConfig().getAttributes();
-
- assertNotNull(attributes);
- assertEquals(2, attributes.size());
- assertTrue(attributes.containsKey("att1"));
- assertTrue(attributes.containsKey("att2"));
- assertEquals("value1", attributes.get("att1"));
- assertEquals("value2", attributes.get("att2"));
- }
-
- @Test public void createURIResolver() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
- {
- ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
- confBuilder.uriResolver(MockUriResolver.class.getName());
- ConfigTree config = confBuilder.build();
-
- final XsltAction action = new XsltAction(config);
- action.initialise();
-
- URIResolver resolver = action.getTranformerConfig().getUriResolver();
-
- assertNotNull(resolver);
- assertEquals(MockUriResolver.class.getName(), resolver.getClass().getName());
- }
-
- @Test public void processFileSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
- action.initialise();
-
- final Message message = MessageFactory.getInstance().getMessage();
- final URL resource = getClass().getResource(TEST_XML_1);
- final File xmlFile = new File(resource.getFile());
- message.getBody().add(xmlFile);
-
- final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
- }
-
- @Test public void processStringSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
- action.initialise();
-
- final Message message = MessageFactory.getInstance().getMessage();
- final String xml = "<a><b><c><b></b></c></b></a>";
- message.getBody().add(xml);
-
- final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
- }
-
- @Test public void processInputStreamSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
- action.initialise();
-
- final Message message = MessageFactory.getInstance().getMessage();
- final InputStream inputStream = getClass().getResourceAsStream(TEST_XML_1);
- message.getBody().add(inputStream);
-
- final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
- }
-
- @Test public void processReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- processOneReaderSource();
- }
-
- @Test public void processMultipleReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- for (int i = 0; i < 100; i++)
- {
- processOneReaderSource();
- }
- }
-
- private void processOneReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
- action.initialise();
-
- final Message message = MessageFactory.getInstance().getMessage();
- final String xml = "<a><b><c><b></b></c></b></a>";
- final StreamSource streamSource = new StreamSource(new StringReader(xml));
- message.getBody().add(streamSource);
-
- final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
- }
-
- @Test public void processSourceResult() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
- {
- final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.SOURCERESULT).templateFile(TEST_XSL_1).build());
- action.initialise();
-
- final Message message = MessageFactory.getInstance().getMessage();
- final String xml = "<a><b><c><b></b></c></b></a>";
- final StreamSource source = new StreamSource(new StringReader(xml));
- final StringWriter stringWriter = new StringWriter();
- final StreamResult result = new StreamResult(stringWriter);
- final SourceResult sourceResult = new SourceResult(source, result);
- message.getBody().add(sourceResult);
-
- final Message processed = action.process(message);
- Object object = processed.getBody().get();
- assertTrue(object instanceof StreamResult);
-
- XMLAssert.assertXMLEqual("<xxx/>", ((StreamResult) processed.getBody().get()).getWriter().toString());
- }
-
- public static class MockUriResolver implements URIResolver
- {
- public Source resolve(String href, String base) throws TransformerException
- {
- return null;
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(XsltActionUnitTest.class);
- }
-
- private static class ConfigBuilder
- {
- private ConfigTree config;
-
- public ConfigBuilder()
- {
- config = new ConfigTree("xsltUnitTest");
- }
-
- public ConfigBuilder templateFile(final String xslt)
- {
- config.setAttribute("templateFile", xslt);
- return this;
- }
-
- public ConfigBuilder resultType(final ResultType type)
- {
- config.setAttribute("resultType", type.toString());
- return this;
- }
-
- public ConfigBuilder feature(final String name, final Boolean value)
- {
- config.setAttribute("factory.feature." + name, value.toString());
- return this;
- }
-
- public ConfigBuilder attribute(final String name, final String value)
- {
- config.setAttribute("factory.attribute." + name, value);
- return this;
- }
-
- public ConfigBuilder uriResolver(final String className)
- {
- config.setAttribute("uriResolver", className);
- return this;
- }
-
- public ConfigTree build()
- {
- return config;
- }
- }
-
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,288 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.transformation.xslt;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.transformation.xslt.ResultFactory.ResultType;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Unit test for {@link XsltAction}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class XsltActionUnitTest
+{
+ private static final String PACKAGE_PATH = "/org/jboss/soa/esb/actions/transformation/xslt";
+ private static final String TEST_XSL_1 = PACKAGE_PATH + "/test1.xsl";
+ private static final String TEST_XML_1 = PACKAGE_PATH + "/example1.xml";
+
+ @BeforeClass public static void before()
+ {
+ XMLUnit.setIgnoreWhitespace(true);
+ }
+
+ @Test (expected = ConfigurationException.class)
+ public void shouldThrowIfNoTemplateIsConfigured() throws ConfigurationException
+ {
+ new XsltAction(new ConfigTree("xslttest"));
+ }
+
+ @Test public void processXsltString() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().templateFile(TEST_XSL_1).resultType(ResultType.STRING).build());
+ action.initialise();
+
+ final String xml = StreamUtils.getResourceAsString(TEST_XML_1, "UTF-8");
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ message.getBody().add(xml);
+
+ Message processed = action.process(message);
+ XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ }
+
+ @Test public void extractFeatures() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
+ {
+ ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
+ confBuilder.feature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ ConfigTree config = confBuilder.build();
+
+ final XsltAction action = new XsltAction(config);
+ action.initialise();
+
+ final Map<String, Boolean> features = action.getTranformerConfig().getFeatures();
+
+ assertNotNull(features);
+ assertEquals(1, features.size());
+ assertTrue(features.containsKey(XMLConstants.FEATURE_SECURE_PROCESSING));
+ assertEquals(true, features.get(XMLConstants.FEATURE_SECURE_PROCESSING));
+ }
+
+ @Test public void extractAttributes() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
+ {
+ ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
+ confBuilder.attribute("att1", "value1").attribute("att2", "value2");
+ ConfigTree config = confBuilder.build();
+
+ final XsltAction action = new XsltAction(config);
+ final Map<String, Object> attributes = action.getTranformerConfig().getAttributes();
+
+ assertNotNull(attributes);
+ assertEquals(2, attributes.size());
+ assertTrue(attributes.containsKey("att1"));
+ assertTrue(attributes.containsKey("att2"));
+ assertEquals("value1", attributes.get("att1"));
+ assertEquals("value2", attributes.get("att2"));
+ }
+
+ @Test public void createURIResolver() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
+ {
+ ConfigBuilder confBuilder = new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1);
+ confBuilder.uriResolver(MockUriResolver.class.getName());
+ ConfigTree config = confBuilder.build();
+
+ final XsltAction action = new XsltAction(config);
+ action.initialise();
+
+ URIResolver resolver = action.getTranformerConfig().getUriResolver();
+
+ assertNotNull(resolver);
+ assertEquals(MockUriResolver.class.getName(), resolver.getClass().getName());
+ }
+
+ @Test public void processFileSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
+ action.initialise();
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ final URL resource = getClass().getResource(TEST_XML_1);
+ final File xmlFile = new File(resource.getFile());
+ message.getBody().add(xmlFile);
+
+ final Message processed = action.process(message);
+ XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ }
+
+ @Test public void processStringSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
+ action.initialise();
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ final String xml = "<a><b><c><b></b></c></b></a>";
+ message.getBody().add(xml);
+
+ final Message processed = action.process(message);
+ XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ }
+
+ @Test public void processInputStreamSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
+ action.initialise();
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ final InputStream inputStream = getClass().getResourceAsStream(TEST_XML_1);
+ message.getBody().add(inputStream);
+
+ final Message processed = action.process(message);
+ XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ }
+
+ @Test public void processReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ processOneReaderSource();
+ }
+
+ @Test public void processMultipleReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ for (int i = 0; i < 100; i++)
+ {
+ processOneReaderSource();
+ }
+ }
+
+ private void processOneReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
+ action.initialise();
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ final String xml = "<a><b><c><b></b></c></b></a>";
+ final StreamSource streamSource = new StreamSource(new StringReader(xml));
+ message.getBody().add(streamSource);
+
+ final Message processed = action.process(message);
+ XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ }
+
+ @Test public void processSourceResult() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ {
+ final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.SOURCERESULT).templateFile(TEST_XSL_1).build());
+ action.initialise();
+
+ final Message message = MessageFactory.getInstance().getMessage();
+ final String xml = "<a><b><c><b></b></c></b></a>";
+ final StreamSource source = new StreamSource(new StringReader(xml));
+ final StringWriter stringWriter = new StringWriter();
+ final StreamResult result = new StreamResult(stringWriter);
+ final SourceResult sourceResult = new SourceResult(source, result);
+ message.getBody().add(sourceResult);
+
+ final Message processed = action.process(message);
+ Object object = processed.getBody().get();
+ assertTrue(object instanceof StreamResult);
+
+ XMLAssert.assertXMLEqual("<xxx/>", ((StreamResult) processed.getBody().get()).getWriter().toString());
+ }
+
+ public static class MockUriResolver implements URIResolver
+ {
+ public Source resolve(String href, String base) throws TransformerException
+ {
+ return null;
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(XsltActionUnitTest.class);
+ }
+
+ private static class ConfigBuilder
+ {
+ private ConfigTree config;
+
+ public ConfigBuilder()
+ {
+ config = new ConfigTree("xsltUnitTest");
+ }
+
+ public ConfigBuilder templateFile(final String xslt)
+ {
+ config.setAttribute("templateFile", xslt);
+ return this;
+ }
+
+ public ConfigBuilder resultType(final ResultType type)
+ {
+ config.setAttribute("resultType", type.toString());
+ return this;
+ }
+
+ public ConfigBuilder feature(final String name, final Boolean value)
+ {
+ config.setAttribute("factory.feature." + name, value.toString());
+ return this;
+ }
+
+ public ConfigBuilder attribute(final String name, final String value)
+ {
+ config.setAttribute("factory.attribute." + name, value);
+ return this;
+ }
+
+ public ConfigBuilder uriResolver(final String className)
+ {
+ config.setAttribute("uriResolver", className);
+ return this;
+ }
+
+ public ConfigTree build()
+ {
+ return config;
+ }
+ }
+
+}
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1 +0,0 @@
-<a> <b> <c> <b></b> </c> </b> </a>
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/example1.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1 @@
+<a> <b> <c> <b></b> </c> </b> </a>
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,9 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:output method="xml" encoding="UTF-8" />
-
- <xsl:template match="b">
- <xxx></xxx>
- </xsl:template>
-
-</xsl:stylesheet>
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/test1.xsl 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,9 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output method="xml" encoding="UTF-8" />
+
+ <xsl:template match="b">
+ <xxx></xxx>
+ </xsl:template>
+
+</xsl:stylesheet>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/JMSEprUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -204,20 +204,20 @@
// 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()) ;
+ assertEquals("System JNDI_SERVER_URL", "jms:" + JNDI_PREFIX + 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()) ;
+ assertEquals("Extension Context.PROVIDER_URL", "jms:" + JNDI_PREFIX + 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()) ;
+ assertEquals("Extension Context.PROVIDER_URL", "jms:" + JNDI_PREFIX + propertyJndi + "#" + queueName, thirdEpr.getAddr().getAddress()) ;
}
finally
{
@@ -315,6 +315,43 @@
assertEquals("Second extension", testExtension2Value, eprProperties.get(testExtension2)) ;
}
+ @Test
+ public void testDefaultURIConfig() throws URISyntaxException
+ {
+ testEPRConfig(JMSEpr.QUEUE_TYPE, "queue/destinationName",
+ "ConnectionFactory", "jnp://localhost:1099",
+ "org.jnp.interfaces.NamingContextFactory",
+ "org.jboss.naming:org.jnp.interfaces") ;
+ }
+
+ @Test
+ public void testNonStandardURIConfig() throws URISyntaxException
+ {
+ testEPRConfig(JMSEpr.QUEUE_TYPE, "abc/def/ghi",
+ "ConnectionFactory", "scheme://host:port/config#123456?abc=def",
+ "MyNonStandardContextFactory", "MyPkgInterfaces") ;
+ }
+
+ private void testEPRConfig(final String destinationType, final String destinationName,
+ final String connectionFactory, final String jndiURL, final String contextFactory,
+ final String pkgPrefix) throws URISyntaxException
+ {
+ final Properties env = new Properties() ;
+ env.put(Context.PROVIDER_URL, jndiURL) ;
+ env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory) ;
+ env.put(Context.URL_PKG_PREFIXES, pkgPrefix) ;
+
+ final JMSEpr jmsEpr = new JMSEpr(destinationType, destinationName, connectionFactory, env, null) ;
+ assertEquals("destinationType", destinationType, jmsEpr.getDestinationType()) ;
+ assertEquals("destinationName", destinationName, jmsEpr.getDestinationName()) ;
+ assertEquals("connectionFactory", connectionFactory, jmsEpr.getConnectionFactory()) ;
+
+ final Properties jmsEprEnv = jmsEpr.getJndiEnvironment() ;
+ assertEquals(Context.PROVIDER_URL, jndiURL, jmsEprEnv.getProperty(Context.PROVIDER_URL)) ;
+ assertEquals(Context.INITIAL_CONTEXT_FACTORY, contextFactory, jmsEprEnv.getProperty(Context.INITIAL_CONTEXT_FACTORY)) ;
+ assertEquals(Context.URL_PKG_PREFIXES, pkgPrefix, jmsEprEnv.getProperty(Context.URL_PKG_PREFIXES)) ;
+ }
+
private void assertDefaults(final String destination, final String connectionFactory, final String destinationType)
{
assertEquals( expectedDestination, destination );
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -89,7 +89,6 @@
}
dir.delete();
}
-
}
public void testGateway () throws Exception
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -21,37 +21,67 @@
*/
package org.jboss.soa.esb.listeners.message;
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.MBeanException;
import javax.management.ObjectName;
+import javax.management.ReflectionException;
import junit.framework.JUnit4TestAdapter;
-import org.apache.log4j.Logger;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.Before;
import org.junit.Test;
/**
* Unit test for ServiceMessageCounter
*
- * @author <a href="mailto:daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
*
*/
public class ServiceMessageCounterUnitTest
{
- private Logger log = Logger.getLogger( ServiceMessageCounterUnitTest.class );
-
+ private ServiceMessageCounter counter;
+
+ @Before
+ public void setup() throws LifecycleResourceException
+ {
+ final ConfigTree config = createConfigTreeForScheduler();
+ counter = ServiceMessageCounterLifecycleResource.getServiceMessageCounter(config);
+ }
@Test
- public void getObjectName()
- throws LifecycleResourceException
+ public void getObjectName() throws LifecycleResourceException
{
- ConfigTree config = createConfigTreeForScheduler();
- log.debug( config );
-
- ServiceMessageCounter counter = ServiceMessageCounterLifecycleResource.getServiceMessageCounter(config);
- ObjectName objectName = counter.getObjectName();
- log.debug( objectName );
+ final ObjectName objectName = counter.getObjectName();
+ assertEquals("jboss.esb:category=MessageCounter,deployment=ID-DEFAULT", objectName.getCanonicalName());
}
+ /**
+ * Test for JIRA: https://jira.jboss.org/jira/browse/JBESB-2522
+ */
+ @Test
+ public void getAttributesMissingKey() throws LifecycleResourceException, AttributeNotFoundException, MBeanException, ReflectionException
+ {
+ counter.update(new ActionStatusBean(100l, 0, MessageFactory.getInstance().getMessage(), ActionStatusBean.ACTION_SENT));
+
+ try
+ {
+ counter.getAttributes(new String[] {"boguskey"});
+ }
+ catch (final NullPointerException e)
+ {
+ e.printStackTrace();
+ fail("getAttributes should not throw NPE if key does not exist. Exception was : " + e.getMessage());
+ }
+ }
+
private ConfigTree createConfigTreeForScheduler()
{
ConfigTree parent = new ConfigTree("parent");
@@ -62,7 +92,10 @@
config.setAttribute( "listenerClass", "org.jboss.soa.esb.listeners.ScheduleListener" );
config.setAttribute( "scheduleidref", "cronTrigger");
- return config;
+ ConfigTree action = new ConfigTree(ListenerTagNames.ACTION_ELEMENT_TAG, parent);
+ action.setAttribute("name", "testAction");
+
+ return parent;
}
/*
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -23,11 +23,15 @@
import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import junit.framework.JUnit4TestAdapter;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.routing.email.Emailer;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
import org.jboss.soa.esb.message.Message;
@@ -133,30 +137,44 @@
message.getBody().add("Hello".getBytes());
ne.sendNotification(message);
- assertEquals(overrideValue, ne.getConfigTree().getAttribute(overrideName));
+ assertEquals(overrideValue, MockEmailer.config.getAttribute(overrideName));
}
- private class TestNotifyEmail extends NotifyEmail {
+ private class TestNotifyEmail extends NotifyEmail
+ {
private final String message ;
- private ConfigTree configTree;
-
- public TestNotifyEmail(ConfigTree p_oP, final String message) throws Exception {
- super(p_oP);
+ public TestNotifyEmail(ConfigTree config, final String message) throws Exception
+ {
+ super(config, new MockEmailer(config, message));
this.message = message ;
}
@Override
- protected void sendEmailNotification(ConfigTree messageParams, byte[] notusedintest) throws AddressException, MessagingException {
- this.configTree = messageParams;
+ protected void sendEmailNotification(ConfigTree messageParams, byte[] notusedintest) throws AddressException, MessagingException
+ {
assertEquals(message, messageParams.getAttribute(Email.MESSAGE));
}
-
- public ConfigTree getConfigTree()
+ }
+
+ private static class MockEmailer extends Emailer
+ {
+ private static ConfigTree config;
+ private String message;
+
+ public MockEmailer(ConfigTree config, final String message) throws ConfigurationException
{
- return configTree;
- }
+ super(config);
+ this.message = message;
+ }
+
+ @Override
+ protected void sendEmail(ConfigTree messageParams, byte[] msgPayload) throws AddressException, MessagingException, IOException
+ {
+ config = messageParams;
+ assertEquals(message, messageParams.getAttribute(Email.MESSAGE));
+ }
}
public static junit.framework.Test suite()
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -42,7 +42,6 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.mockejb.jms.MockQueue;
import org.mockejb.jms.TextMessageImpl;
import org.mockejb.jndi.MockContextFactory;
@@ -212,6 +211,16 @@
assertEquals ( expectedMessageID, toJMSMessage.getJMSCorrelationID() );
}
+ @Test
+ public void setJMSProperties_JMSVendorProperty() throws JMSException, URISyntaxException
+ {
+ final String propertyKey = "JMS_SomeVendorName";
+ fromESBMessage.getProperties().setProperty( propertyKey, "bogus" );
+
+ strategy.setJMSProperties( fromESBMessage, toJMSMessage );
+ assertNull(toJMSMessage.getStringProperty(propertyKey) );
+ }
+
@Before
public void before() throws JMSException, NamingException
{
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -118,7 +118,7 @@
@Before
public void createInstance()
{
- extractor = new WSSecurityInfoExtractor("smooks-config.xml");
+ extractor = new WSSecurityInfoExtractor();
}
public static junit.framework.Test suite()
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/smooks-config.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/smooks-config.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/smooks-config.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <resource-config selector="Envelope/Header/Security/UsernameToken">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">userNameToken</param>
- <param name="beanClass">org.jboss.soa.esb.services.security.auth.ws.UsernameToken</param>
- <param name="bindings">
- <binding property="userName" selector="Username" default="" />
- <binding property="password" selector="Password" />
- </param>
- </resource-config>
-
- <resource-config selector="Envelope/Header/Security/BinarySecurityToken">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">binarySecurityToken</param>
- <param name="beanClass">org.jboss.soa.esb.services.security.auth.ws.BinarySecurityToken</param>
- <param name="bindings">
- <binding property="encodingType" selector="BinarySecurityToken @EncodingType" />
- <binding property="valueType" selector="BinarySecurityToken @ValueType" />
- <binding property="key" selector="BinarySecurityToken" />
- </param>
- </resource-config>
-
-</smooks-resource-list>
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/util/JndiUtilUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/util/JndiUtilUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/util/JndiUtilUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/rosetta/tests/src/org/jboss/soa/esb/util/JndiUtilUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.util;
+
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link JndiUtil}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class JndiUtilUnitTest
+{
+ @Test
+ public void getJndiPrefixesSet()
+ {
+ Set<String> set = JndiUtil.getJndiPrefixesSet("test.vendorName");
+ assertEquals(3, set.size());
+ assertTrue(set.contains("test.vendorName"));
+ assertTrue(set.contains("java.naming."));
+ }
+
+ @Test
+ public void getPropertyValue()
+ {
+ final ConfigTree config = new ConfigTree("config") ;
+ config.setAttribute(JMSEpr.JNDI_PREFIXES, "test");
+ String value = JndiUtil.getPropertyValue(config, JMSEpr.JNDI_PREFIXES);
+ assertEquals("test", value);
+ }
+
+ @Test
+ public void parseEnvironmentProperties()
+ {
+ final String envPrefix1 = "test.prefix.";
+ final String envPrefix2 = "test.prefix2.";
+ final String envPrefix = envPrefix1 + "," + envPrefix2;
+ final String propertyName = envPrefix1 + "vendor.propertyName";
+ final String propertyName2 = envPrefix2 + "propertyName2";
+ final String propertyName3 = "java.naming.object";
+ final String propertyValue = "propertyValue";
+ final String propertyValue2 = "propertyValue2";
+ final String propertyValue3 = "someValue";
+
+ final ConfigTree config = new ConfigTree("config") ;
+ config.setAttribute(JMSEpr.JNDI_PREFIXES, envPrefix);
+ config.setAttribute(propertyName, propertyValue);
+ config.setAttribute(propertyName2, propertyValue2);
+ config.setAttribute("java.naming.object", "someValue");
+
+ final Properties env = JndiUtil.parseEnvironmentProperties(config);
+
+ assertEquals(3, env.size());
+ assertTrue(env.containsKey(propertyName));
+ assertTrue(env.containsKey(propertyName2));
+ assertTrue(env.containsKey(propertyName3));
+ assertEquals(propertyValue, env.get(propertyName));
+ assertEquals(propertyValue2, env.get(propertyName2));
+ assertEquals(propertyValue3, env.get(propertyName3));
+ }
+
+}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/aggregation_service/jbossesb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/aggregation_service/jbossesb.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/aggregation_service/jbossesb.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -4,7 +4,7 @@
<providers>
<jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
<jms-bus busid="AggregatorListenQueue">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/A"/>
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_Aggregator_Service"/>
</jms-bus>
</jms-provider>
</providers>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbm-queue-service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbm-queue-service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -48,5 +48,11 @@
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Aggregator_Service"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbmq-queue-service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/jbmq-queue-service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -48,5 +48,11 @@
jboss.mq:service=DestinationManager
</depends>
</mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Aggregator_Service">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/samples/quickstart/aggregator/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/samples/quickstart/aggregator/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/samples/quickstart/aggregator/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -36,7 +36,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_Aggregator_Response";
private boolean initialised ;
public ReceiveJMSMessage() {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-dvdstore.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-dvdstore.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-dvdstore.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -8,6 +8,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@statusCode" />
<jb:value property="netAmount" data="Order/@netAmount" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-petstore.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-petstore.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/bpm_orchestration4/transforms/from-petstore.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -8,6 +8,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@status" />
<jb:value property="totalAmount" data="Order/@totalPrice" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_rules_service/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_rules_service/smooks-res.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_rules_service/smooks-res.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -7,6 +7,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@statusCode" decoder="Integer" />
<jb:value property="netAmount" data="Order/@netAmount" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -33,5 +33,15 @@
<classpath refid="exec-classpath" />
</java>
</target>
+
+ <target name="generatePackageFile" depends="compile"
+ description="Will compile ruleAgent/Original.drl and generate a pkg file for it. Can be used when upgrading Drools which can make packages that were generated with an older version invalid.">
+ <echo message="Going to regenerated ruleAgent/org.jboss.soa.esb.services.rules.pkg"/>
+ <java fork="yes" classname="org.jboss.internal.soa.esb.services.rules.util.PackageFileGenerator" failonerror="true">
+ <arg value="${basedir}/ruleAgent/Original.drl"/>
+ <arg value="${basedir}/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg"/>
+ <classpath refid="exec-classpath" />
+ </java>
+ </target>
</project>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_ruleAgent/ruleAgent/package/org.jboss.soa.esb.services.rules.pkg
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/smooks-res.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,58 +1,41 @@
<?xml version='1.0' encoding='UTF-8'?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
- <!-- Populate the OrderHeader -->
- <resource-config selector="order">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">orderHeader</param>
- <param name="beanClass">org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.OrderHeader</param>
- <param name="bindings">
- <binding property="orderId" selector="Order @orderId" />
- <binding property="orderDate" selector="Order @orderDate" type="LongDate"/>
- <binding property="statusCode" selector="Order @statusCode" type="Integer" />
- <binding property="netAmount" selector="Order @netAmount" type="Double" />
- <binding property="totalAmount" selector="Order @totalAmount" type="Double" />
- <binding property="tax" selector="Order @tax" type="Double" />
- </param>
- </resource-config>
+ <!-- Populate the OrderHeader -->
+ <jb:bindings beanId="orderHeader" class="org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.OrderHeader" createOnElement="order">
+ <jb:value property="orderId" data="Order/@orderId" />
+ <jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
+ <jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
+ </jb:value>
+ <jb:value property="statusCode" data="Order/@statusCode" decoder="Integer"/>
+ <jb:value property="netAmount" data="Order/@netAmount" decoder="Double" />
+ <jb:value property="totalAmount" data="Order/@totalAmount" decoder="Double" />
+ <jb:value property="tax" data="Order/@tax" decoder="Double" />
+ <jb:wiring property="customer" beanIdRef="customer"/>
+ </jb:bindings>
<!-- Populate the Customer -->
- <resource-config selector="order customer">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">customer</param>
- <param name="beanClass">org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.Customer</param>
- <param name="setOn">orderHeader</param>
+ <jb:bindings beanId="customer" class="org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.Customer" createOnElement="customer">
+ <jb:value property="userName" data="customer/@userName" />
+ <jb:value property="firstName" data="customer/@firstName" />
+ <jb:value property="lastName" data="customer/@lastName" />
+ <jb:value property="state" data="customer/@state" />
+ </jb:bindings>
- <param name="bindings">
- <binding property="userName" selector="order customer @userName" />
- <binding property="firstName" selector="order customer @firstName" />
- <binding property="lastName" selector="order customer @lastName" />
- <binding property="state" selector="order customer @state" />
- </param>
- </resource-config>
-
<!-- Populate the OrderItem list -->
- <resource-config selector="order orderlines orderline">
- <resource>org.milyn.javabean.BeanPopulator</resource>
- <param name="beanId">orderItem</param>
- <param name="beanClass">org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.OrderItem</param>
- <param name="addToList">true</param>
- <param name="bindings">
- <binding property="position" selector="order orderlines orderline @position" type="Integer" />
- <binding property="quantity" selector="order orderlines orderline @quantity" type="Integer" />
- <binding property="productId" selector="order orderlines orderline product @productId" />
- <binding property="title" selector="order orderlines orderline product @title" />
- <binding property="price" selector="order orderlines orderline product @price" type="Double" />
- </param>
- </resource-config>
+ <jb:bindings beanId="orderItemList" class="java.util.ArrayList" createOnElement="orderlines">
+ <jb:wiring beanIdRef="orderItem" />
+ </jb:bindings>
- <!--resource-config selector="order orderlines orderline">
- <resource>/org/jboss/soa/esb/dvdstore/orderitem.st</resource>
- </resource-config-->
+ <!-- Populate the OrderItem instance -->
+ <jb:bindings beanId="orderItem" class="org.jboss.soa.esb.samples.quickstart.businessrulesstateful.dvdstore.OrderItem" createOnElement="orderlines/orderline">
+ <jb:value property="position" data="orderline/@position" decoder="Integer" />
+ <jb:value property="quantity" data="orderline/@quantity" decoder="Integer" />
+ <jb:value property="productId" data="orderline/product/@productId" />
+ <jb:value property="title" data="orderline/product/@title" />
+ <jb:value property="price" data="orderline/product/@price" decoder="Double" />
+ </jb:bindings>
- <resource-config selector="decoder:LongDate">
- <resource>org.milyn.javabean.decoders.CalendarDecoder</resource>
- <param name="format">EEE MMM dd HH:mm:ss z yyyy</param>
- </resource-config>
-
</smooks-resource-list>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrulesstateful/dvdstore/OrderHeader.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrulesstateful/dvdstore/OrderHeader.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_ruleservice_stateful/src/org/jboss/soa/esb/samples/quickstart/businessrulesstateful/dvdstore/OrderHeader.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -120,7 +120,7 @@
*/
@Override
public String toString() {
- return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", ";
+ return orderId + ", " + orderDate + ", " + statusCode + ", " + netAmount + ", " + totalAmount + ", " + tax + ", customer=" + customer;
}
public int getOrderPriority() {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/deployment.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/deployment.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,3 +1,4 @@
<jbossesb-deployment>
<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_business_service_Request</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_business_service_esb</depends>
</jbossesb-deployment>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbm-queue-service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbm-queue-service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -5,4 +5,9 @@
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
</mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_business_service_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbmq-queue-service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jbmq-queue-service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -4,4 +4,8 @@
name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_business_service_Request">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_business_service_esb">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jboss-esb.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/business_service/jboss-esb.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -13,7 +13,7 @@
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter
dest-type="QUEUE"
- dest-name="queue/B"
+ dest-name="queue/quickstart_business_service_esb"
/>
</jms-bus>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/dynamic_router/src/org/jboss/soa/esb/samples/quickstart/dynamicRouter/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/dynamic_router/src/org/jboss/soa/esb/samples/quickstart/dynamicRouter/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/dynamic_router/src/org/jboss/soa/esb/samples/quickstart/dynamicRouter/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -44,7 +44,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_dynamicrouter_response";
QueueConnection conn1 = null;
Queue que;
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/fun_cbr/src/org/jboss/soa/esb/samples/quickstart/funcbr/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -35,7 +35,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_funcbr_response";
private boolean initialised ;
public ReceiveJMSMessage() {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-02_Low_Price_Service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-02_Low_Price_Service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-02_Low_Price_Service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,22 +1,15 @@
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+ xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the order item XML ("02_XML_OrderItem") to the
"02_Low_Price" Service, if the total is 20 or less...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
- <condition>
- <!--
- product.LISTPRICE * orderItem.quantity <= 17.00
- -->
- </condition>
- <param name="beanId">02_XML_OrderItem</param> <!-- Populated and bound below... -->
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">02_Low_Price</param>
- </resource-config>
+ <esbr:routeBean beanIdRef="02_XML_OrderItem" toServiceCategory="HugeQS" toServiceName="02_Low_Price" routeOnElement="order-item">
+ <condition><!-- product.LISTPRICE * orderItem.quantity <= 17.00 --></condition>
+ </esbr:routeBean>
<!--
At the end of every order-item, generate an <ord> split message for the "02_XML" Service
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-03_High_Price_Service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-03_High_Price_Service.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-03_High_Price_Service.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,21 +1,14 @@
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+ xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the order item Java Objects ("03_order") to the
"03_High_Price" Service, if the price per item is 190 or more...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
- <condition>
- <!--
- product.LISTPRICE > 190.00
- -->
- </condition>
- <param name="beanId">03_order</param>
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">03_High_Price</param>
- </resource-config>
+ <esbr:routeBean beanIdRef="03_order" toServiceCategory="HugeQS" toServiceName="03_High_Price" routeOnElement="order-item">
+ <condition><!-- product.LISTPRICE > 190.00 --></condition>
+ </esbr:routeBean>
<!--
At the end of every order-item, bind together the orderDetail with the current
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-04_Reptiles_notify_webservice_proxy.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-04_Reptiles_notify_webservice_proxy.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/01_split_enrich_transform_route/smooks_configs/routing/route-to-04_Reptiles_notify_webservice_proxy.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,22 +1,15 @@
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+ xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the "Reptiles Notification" SOAP message ("04_SOAP_OrderItem") to the
"04_Reptiles_notify_webservice_proxy" Service, if the order item product.CATEGORY is "REPTILES"...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
- <condition>
- <!--
- product.CATEGORY == "REPTILES"
- -->
- </condition>
- <param name="beanId">04_SOAP_OrderItem</param>
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">04_Reptiles_notify_webservice_proxy</param>
- </resource-config>
+ <esbr:routeBean beanIdRef="04_SOAP_OrderItem" toServiceCategory="HugeQS" toServiceName="04_Reptiles_notify_webservice_proxy" routeOnElement="order-item">
+ <condition><!-- product.CATEGORY == "REPTILES" --></condition>
+ </esbr:routeBean>
<!--
At the end of every order-item, generate an <ord> split message for the "02_XML" Service
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/README.html
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/README.html 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/huge-split-enrich-transform-route/README.html 2009-06-09 11:35:07 UTC (rev 26882)
@@ -470,23 +470,20 @@
<pre>
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+ xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the order item XML ("02_XML_OrderItem") to the
"02_Low_Price" Service, if the total is 20 or less...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
+ <esbr:routeBean beanIdRef="02_XML_OrderItem" toServiceCategory="HugeQS" toServiceName="02_Low_Price" routeOnElement="order-item">
<condition>
<!--<i class="commentedcode">
product.LISTPRICE * orderItem.quantity <= 17.00
</i>-->
</condition>
- <param name="beanId"><span style="color: crimson;">02_XML_OrderItem</span></param> <!-- Populated and bound below... -->
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">02_Low_Price</param>
- </resource-config>
+ </esbr:routeBean>
<!--
At the end of every order-item, generate an <ord> split message for the "02_XML" Service
@@ -542,22 +539,19 @@
<pre>
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
+ xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the order item Java Objects ("03_order") to the
"03_High_Price" Service, if the price per item is 190 or more...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
+ <esbr:routeBean beanIdRef="03_order" toServiceCategory="HugeQS" toServiceName="03_High_Price" routeOnElement="order-item">
<condition>
<!--<i class="commentedcode">
product.LISTPRICE > 190.00
</i>-->
</condition>
- <param name="beanId"><span style="color: crimson;">03_order</span></param>
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">03_High_Price</param>
- </resource-config>
+ </esbr:routeBean>
<!--
At the end of every order-item, bind together the orderDetail with the current
@@ -618,23 +612,20 @@
<pre>
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
+ xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
+ xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
<!--
At the end of every order-item, route the "Reptiles Notification" SOAP message ("04_SOAP_OrderItem") to the
"04_Reptiles_notify_webservice_proxy" Service, if the order item product.CATEGORY is "REPTILES"...
-->
- <resource-config selector="order-item">
- <resource>org.jboss.soa.esb.smooks.FragmentRouter</resource>
+ <esbr:routeBean beanIdRef="04_SOAP_OrderItem" toServiceCategory="HugeQS" toServiceName="04_Reptiles_notify_webservice_proxy" routeOnElement="order-item">
<condition>
<!--
product.CATEGORY == "REPTILES"
-->
</condition>
- <param name="beanId"><span style="color: crimson;">04_SOAP_OrderItem</span></param>
- <param name="serviceCategory">HugeQS</param>
- <param name="serviceName">04_Reptiles_notify_webservice_proxy</param>
- </resource-config>
+ </esbr:routeBean>
<!--
At the end of every order-item, generate an <ord> split message for the "02_XML" Service
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/jboss-esb.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/jboss-esb.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -27,8 +27,6 @@
description="JMS Secured quickstart sample">
<listeners>
<jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" is-gateway="true" >
- <!-- Comment out to exclude properties that are vendor specific. -->
- <!--property name="excludeProperties" value="[JMS_].*"/-->
</jms-listener>
<jms-listener name="jmssecured"
busidref="quickstartEsbChannel"/>
@@ -48,6 +46,14 @@
<property name="unwrap" value="true"/>
<property name="security-principal" value="guest"/>
<property name="security-credential" value="guest"/>
+
+ <!-- Example of adding Extension properties -->
+ <!-- comma separated list of prefixes -->
+ <property name="jndi-prefixes" value="org.xyz."/>
+ <property name="org.xyz.propertyName" value="propertyValue"/>
+
+ <!-- All properties with prefix 'java.naming' will be added -->
+ <property name="java.naming.someproperty" value="propertyValue"/>
</action>
</actions>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/readme.txt 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/readme.txt 2009-06-09 11:35:07 UTC (rev 26882)
@@ -2,8 +2,7 @@
=========
The purpose of the jms_router quickstart is to show how the JMSRouter
action can be configured.
- This quickstart also shows how a JMSCorrelationID can be used with the ESB, and
- how JMS properties can be excluded at the JMS gateway by setting the 'excludeProperties'.
+ This quickstart also shows how a JMSCorrelationID can be used with the ESB.
Running this quickstart:
========================
@@ -39,18 +38,3 @@
2. jboss-esb.xml
Take a look at how the JMSRouter can be configured.
- 3. 'excludeProperties' property.
- This propery can be used to filter out unwanted properties that exist in
- the JMS message arriving at the gateway.
-
- Usually there is no problem simply letting properties flow through but some
- JMS Provider do not excepts JMS vendor specific properties that are not there
- own and will throw an exception. This property was added to avoid this.
-
- As you can see in the configuration that we specifying a regular expression to filter
- out all properties that start with 'JMS_' but this regular expression could be
- used to filter out other properties too.
-
- Try uncommenting the 'excludeProperties' property in jboss-esb.xml and you will see
- that this property is no longer passed through and will be null in "Window2"
-
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/src/org/jboss/soa/esb/samples/quickstart/jmsrouter/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/src/org/jboss/soa/esb/samples/quickstart/jmsrouter/test/SendJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/jms_router/src/org/jboss/soa/esb/samples/quickstart/jmsrouter/test/SendJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -50,7 +50,7 @@
private Destination replyToDestination;
private String correlationId;
- private String vendorSpecificPropertyName = "JMS_IBMQ_Property";
+ private String propertyKey = "MyProperty";
public void setupConnection(String destination) throws JMSException, NamingException
{
@@ -81,7 +81,7 @@
ObjectMessage objectMsg = session.createObjectMessage(msg);
objectMsg.setJMSCorrelationID( correlationId );
objectMsg.setJMSReplyTo( replyToDestination );
- objectMsg.setStringProperty(vendorSpecificPropertyName, "Vendor specific property value");
+ objectMsg.setStringProperty(propertyKey, "My property value");
producer.send(objectMsg);
System.out.println("Sent message with CorrelationID : " + correlationId );
@@ -107,7 +107,7 @@
System.out.println("\t[MessageType : TextMessage]");
System.out.println( "\t[Text : " + ((TextMessage)jmsMsg).getText() + "]" );
}
- System.out.println("\t[Property: "+ vendorSpecificPropertyName + " : " + jmsMsg.getStringProperty(vendorSpecificPropertyName) + "]" );
+ System.out.println("\t[Property: "+ propertyKey + " : " + jmsMsg.getStringProperty(propertyKey) + "]" );
consumer.close();
}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/recipient_list/src/org/jboss/soa/esb/samples/quickstart/recipientList/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/recipient_list/src/org/jboss/soa/esb/samples/quickstart/recipientList/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/recipient_list/src/org/jboss/soa/esb/samples/quickstart/recipientList/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -35,7 +35,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_recipientList_response";
private boolean initialised ;
public ReceiveJMSMessage() {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/simple_cbr/src/org/jboss/soa/esb/samples/quickstart/simplecbr/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/simple_cbr/src/org/jboss/soa/esb/samples/quickstart/simplecbr/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/simple_cbr/src/org/jboss/soa/esb/samples/quickstart/simplecbr/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -35,7 +35,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_simplecbr_response";
private boolean initialised ;
public ReceiveJMSMessage() {
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO/smooks-res.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -7,6 +7,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@statusCode" decoder="Integer" />
<jb:value property="netAmount" data="Order/@netAmount" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-dvdstore.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-dvdstore.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-dvdstore.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -8,6 +8,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@statusCode" />
<jb:value property="netAmount" data="Order/@netAmount" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-petstore.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-petstore.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/transform_XML2POJO2/transforms/from-petstore.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -8,6 +8,8 @@
<jb:value property="orderId" data="Order/@orderId" />
<jb:value property="orderDate" data="Order/@orderDate" decoder="Calendar">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
+ <jb:decodeParam name="locale-language">en</jb:decodeParam>
+ <jb:decodeParam name="locale-country">US</jb:decodeParam>
</jb:value>
<jb:value property="statusCode" data="Order/@status" />
<jb:value property="totalAmount" data="Order/@totalPrice" decoder="Double" />
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/wiretap/src/org/jboss/soa/esb/samples/quickstart/wiretap/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/wiretap/src/org/jboss/soa/esb/samples/quickstart/wiretap/test/ReceiveJMSMessage.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/samples/quickstarts/wiretap/src/org/jboss/soa/esb/samples/quickstart/wiretap/test/ReceiveJMSMessage.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -39,7 +39,7 @@
QueueReceiver queueReceiver = null;
InitialContext iniCtx = null;
QueueConnectionFactory qcf = null;
- String receiveQueueName = "queue/D"; // Default to queue/D
+ String receiveQueueName = "queue/quickstart_wiretap_response";
// Ref: http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch6.chapt.html#d0e12917
public static class ExListener implements MessageListener
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -374,7 +374,7 @@
catch (final SQLException e)
{
if (logger.isDebugEnabled()) {
- logger.debug("Deadlocks may occur under normal processing.");
+ logger.debug("dbms doesn't support setAutoCommit(false), deadlocks may occur under normal processing.");
logger.debug(e.getMessage(), e);
}
}
@@ -403,17 +403,20 @@
} else {
//the message was not delivered
if (message.getProperties().getProperty(DELIVER_COUNT)==null) {
- //appearantly it was the first time
+ //apparently it was the first time
message.getProperties().setProperty(RedeliverStore.DELIVER_COUNT, Integer.valueOf("1"));
+ logger.debug("attempt 1 to redeliver " + uuid + " failed");
insert(uuid, message, MessageStore.CLASSIFICATION_RDLVR, "FALSE", con);
} else {
Integer redeliverCount = (Integer) message.getProperties().getProperty(DELIVER_COUNT);
if (redeliverCount < maxRedeliverCount || maxRedeliverCount < 0) {
//up the count
message.getProperties().setProperty(RedeliverStore.DELIVER_COUNT, ++redeliverCount);
+ logger.debug("attempt " + redeliverCount + " to redeliver " + uuid + " failed");
insert(uuid, message, MessageStore.CLASSIFICATION_RDLVR, "FALSE", con);
} else {
//undeliverable, send to the DLQ
+ logger.warn(" giving up and writing " + uuid + " to " + MessageStore.CLASSIFICATION_DLQ);
insert(uuid, message, MessageStore.CLASSIFICATION_DLQ, "FALSE", con);
}
}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/build.xml 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/build.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -15,4 +15,15 @@
</copy>
<antcall target="base.test"/>
</target>
-</project>
+
+ <target name="generatePackageFile" depends="compile"
+ description="Will compile the RuleBaseHelper.drl and generate a pkg file for it. Can be used when upgrading Drools which can make packages that were generated with an older version invalid.">
+ <echo message="Going to regenerated test/resources/testrules.pkg"/>
+ <java fork="yes" classname="org.jboss.internal.soa.esb.services.rules.util.PackageFileGenerator" failonerror="true">
+ <arg value="/RuleBaseHelper.drl"/>
+ <arg value="${basedir}/src/test/resources/testrules.pkg"/>
+ <classpath refid="classpath" />
+ </java>
+ </target>
+
+ </project>
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-ant-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-ant-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-ant-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-api-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-api-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-api-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-bam-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-bam-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-clips-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-clips-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-clips-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-compiler-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-compiler-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-core-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-core-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-dataloaders-jaxb-5.0.0.M4.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-dataloaders-smooks-5.0.0.M4.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-decisiontables-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-decisiontables-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-jsr94-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-jsr94-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-mc-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-mc-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-messenger-jms-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-messenger-jms-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-persistence-jpa-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-persistence-jpa-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-enterprise-5.0.0.M4.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-task-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-process-task-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-process-task-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-templates-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-templates-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-templates-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-jaxb-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-transformer-jaxb-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-jxls-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-transformer-jxls-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-smooks-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-transformer-smooks-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-transformer-xstream-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-transformer-xstream-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-verifier-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-verifier-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-verifier-5.0.1.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-workitems-5.0.0.M4.jar
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/drools-workitems-5.0.1.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-workitems-5.0.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/mvel2-2.0.10.jar (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/lib/ext/mvel2-2.0.10.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/lib/ext/mvel2-2.0.4.jar
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/readme.txt 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/readme.txt 2009-06-09 11:35:07 UTC (rev 26882)
@@ -2,74 +2,14 @@
Current version
=================
-5.0.0.M4
+5.0.1
Upgrading Drools:
=================
-1. Modified lib/ext/drools-process-enterprise-5.0.0.M4.jar/META-INF/persistence.xml:
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <persistence
- version="1.0"
- xsi:schemaLocation=
- "http://java.sun.com/xml/ns/persistence
- http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
- http://java.sun.com/xml/ns/persistence/orm
- http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
- xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/persistence">
+1. Modified lib/ext/drools-persistence-jpa-5.0.1.jar by removing the jndi.properties file in that jars root directory.
- <!--
- <persistence-unit name="ProcessService">
- <jta-data-source>java:/DefaultDS</jta-data-source>
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- </properties>
- </persistence-unit>
- -->
+2. Run 'ant compileRuleAgent"
+This will compile the RuleBaseHelper.drl and generate test/resources/testrules.pkg file for it. Can be used when upgrading Drools which can make packages that
+were generated with an older version of Drools invalid.
- <persistence-unit name="org.drools.persistence.jpa" transaction-type="RESOURCE_LOCAL">
- <non-jta-data-source>java:/DefaultDS</non-jta-data-source>
- <class>org.drools.persistence.jpa.ByteArrayObject</class>
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- </properties>
- </persistence-unit>
-
- </persistence>
-
-2. Modified lib/ext/drools-process-enterprise-5.0.0.M4.jar/META-INF/persistence.xml:
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
- http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence">
- <persistence-unit name="org.drools.task" transaction-type="RESOURCE_LOCAL">
- <non-jta-data-source>java:/DefaultDS</non-jta-data-source>
- <class>org.drools.task.Attachment</class>
- <class>org.drools.task.Content</class>
- <class>org.drools.task.BooleanExpression</class>
- <class>org.drools.task.Comment</class>
- <class>org.drools.task.Deadline</class>
- <class>org.drools.task.Comment</class>
- <class>org.drools.task.Deadline</class>
- <class>org.drools.task.Delegation</class>
- <class>org.drools.task.Escalation</class>
- <class>org.drools.task.Group</class>
- <class>org.drools.task.I18NText</class>
- <class>org.drools.task.Notification</class>
- <class>org.drools.task.EmailNotification</class>
- <class>org.drools.task.EmailNotificationHeader</class>
- <class>org.drools.task.PeopleAssignments</class>
- <class>org.drools.task.Reassignment</class>
- <class>org.drools.task.Status</class>
- <class>org.drools.task.Task</class>
- <class>org.drools.task.TaskData</class>
- <class>org.drools.task.User</class>
- <class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- </properties>
- </persistence-unit>
-
-</persistence>
-
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/LogAgentEventListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/LogAgentEventListener.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/LogAgentEventListener.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -78,4 +78,14 @@
{
return "AgentName = '" + agentName + "'";
}
+
+ public void exception(Throwable e)
+ {
+ log.error(getAgentName() + " Exception: " + e.getMessage(), e);
+ }
+
+ public void exception(String message, Throwable t)
+ {
+ log.error(getAgentName() + " Exception :" + message, t);
+ }
}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGenerator.java (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGenerator.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGenerator.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGenerator.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.util;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.StringReader;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.common.DroolsObjectOutputStream;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+
+/**
+ * Generates a file containing the a serialized drl in the local filesystem.
+ * <p/>
+ * This is useful when upgrading Drools version which can make a package
+ * compiled with an earlier version invalid.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class PackageFileGenerator
+{
+ private PackageFileGenerator()
+ {
+ }
+
+ public static void main(final String... args) throws DroolsParserException, ConfigurationException, IOException
+ {
+ if (args.length == 0 )
+ {
+ throw new IllegalArgumentException("Missing arguments to program. " + getUsageString());
+ }
+
+ final String drlFile = args[0];
+ final String pkgFile = args[1];
+
+ createPackageFile(drlFile, pkgFile);
+ }
+
+ public static void createPackageFile(final String drlFile, final String pkgFile) throws DroolsParserException, IOException, ConfigurationException
+ {
+ AssertArgument.isNotNullAndNotEmpty(drlFile, drlFile);
+ AssertArgument.isNotNullAndNotEmpty(pkgFile, pkgFile);
+
+ final PackageBuilder builder = new PackageBuilder();
+ final String drl = StreamUtils.getResourceAsString(drlFile, "UTF-8");
+ builder.addPackageFromDrl(new StringReader(drl));
+
+ // gets the package
+ org.drools.rule.Package pkg = builder.getPackage();
+
+ // creates the rulebase
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+
+ // adds the package
+ ruleBase.addPackage(pkg);
+
+ serializeObject(pkg, pkgFile);
+ }
+
+ private static void serializeObject(Object object, final String toFile) throws FileNotFoundException, IOException
+ {
+ ObjectOutputStream outstream = null;
+ try
+ {
+ outstream = new DroolsObjectOutputStream(new FileOutputStream(toFile));
+ outstream.writeObject(object);
+ }
+ finally
+ {
+ if (outstream != null)
+ {
+ outstream.close();
+ }
+ }
+ }
+
+ private static String getUsageString()
+ {
+ return String.format("Usage: %s <path to drl file> <path to destination package file>", PackageFileGenerator.class.getName());
+ }
+
+}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/DroolsRuleBaseHelperUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -129,77 +129,15 @@
// note that the is an exception occurs TestAgentEventListeners exception
// method will be called an this test will fail.
- RuleAgent ruleAgent = RuleAgent.newRuleAgent(properties, new TestAgentEventListener());
+ RuleAgent ruleAgent = RuleAgent.newRuleAgent(properties, new LogAgentEventListener());
Package pkg = ruleAgent.getRuleBase().getPackage("org.jboss.internal.soa.esb.rules");
- System.out.println(pkg);
assertNotNull(pkg);
+ assertEquals("org.jboss.internal.soa.esb.rules", pkg.getName());
}
- /**
- * This method can be used to generate .pkg file for a .drl.
- */
- @Test
- @Ignore
- public void generatePackageFromDrl() throws DroolsParserException, ConfigurationException, IOException
- {
- createPackageFile("/RuleAgentQuickstart.drl", "ruleAgent.pkg");
- }
-
- private static void createPackageFile(final String drlFile, final String pkgFile) throws DroolsParserException, IOException, ConfigurationException
- {
- final PackageBuilder builder = new PackageBuilder();
- final String drl = StreamUtils.getResourceAsString(drlFile, "UTF-8");
- builder.addPackageFromDrl(new StringReader(drl));
-
- // gets the package
- org.drools.rule.Package pkg = builder.getPackage();
-
- // creates the rulebase
- RuleBase ruleBase = RuleBaseFactory.newRuleBase();
-
- // adds the package
- ruleBase.addPackage(pkg);
-
- serializeObject(pkg, pkgFile);
- }
-
- private static void serializeObject(Object object, final String toFile) throws FileNotFoundException, IOException
- {
- ObjectOutputStream outstream = null;
- try
- {
- outstream = new DroolsObjectOutputStream(new FileOutputStream(toFile));
- outstream.writeObject(object);
- }
- finally
- {
- if (outstream != null)
- {
- outstream.close();
- }
- }
- }
-
public static junit.framework.Test suite()
{
return new JUnit4TestAdapter( DroolsRuleBaseHelperUnitTest.class );
}
- private class TestAgentEventListener implements AgentEventListener
- {
- public void exception(Exception e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- public void setAgentName(String name) { }
- public void debug(String message) { }
- public void debug(String message, Object object) { }
- public void info(String message) { }
- public void info(String message, Object object) { }
- public void warning(String message) { }
- public void warning(String message, Object object) { }
- }
-
}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, 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.util;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.JUnit4TestAdapter;
-
-
-import org.drools.compiler.DroolsParserException;
-import org.jboss.soa.esb.ConfigurationException;
-import org.junit.Test;
-
-/**
- * Unit test for {@link PackageFileGenerator}.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class PackageFileGeneratorUnitTest
-{
- @Test (expected = IllegalArgumentException.class)
- public void shouldThrowIfMissingArguments() throws DroolsParserException, ConfigurationException, IOException
- {
- PackageFileGenerator.main(new String[]{});
- }
-
- @Test
- public void main() throws DroolsParserException, ConfigurationException, IOException
- {
- final String drlName = "/RuleBaseHelper.drl";
- final String pkgFile = "ruleBaseHelper.pkg";
- try
- {
- PackageFileGenerator.main(new String[]{drlName, pkgFile});
- }
- finally
- {
- final File createdPkg = new File(pkgFile);
- if (createdPkg.exists());
- {
- createdPkg.delete();
- }
- }
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(PackageFileGeneratorUnitTest.class);
- }
-}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java (from rev 26878, labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/rules/util/PackageFileGeneratorUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, 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.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.JUnit4TestAdapter;
+
+
+import org.drools.compiler.DroolsParserException;
+import org.jboss.soa.esb.ConfigurationException;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link PackageFileGenerator}.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class PackageFileGeneratorUnitTest
+{
+ @Test (expected = IllegalArgumentException.class)
+ public void shouldThrowIfMissingArguments() throws DroolsParserException, ConfigurationException, IOException
+ {
+ PackageFileGenerator.main(new String[]{});
+ }
+
+ @Test
+ public void main() throws DroolsParserException, ConfigurationException, IOException
+ {
+ final String drlName = "/RuleBaseHelper.drl";
+ final String pkgFile = "ruleBaseHelper.pkg";
+ try
+ {
+ PackageFileGenerator.main(new String[]{drlName, pkgFile});
+ }
+ finally
+ {
+ final File createdPkg = new File(pkgFile);
+ if (createdPkg.exists());
+ {
+ createdPkg.delete();
+ }
+ }
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(PackageFileGeneratorUnitTest.class);
+ }
+}
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/jbrules/src/test/resources/testrules.pkg
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/java/org/jboss/soa/esb/smooks/FragmentRouter.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/java/org/jboss/soa/esb/smooks/FragmentRouter.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/java/org/jboss/soa/esb/smooks/FragmentRouter.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -38,7 +38,7 @@
import org.milyn.delivery.sax.SAXElement;
import org.milyn.delivery.sax.SAXVisitAfter;
import org.milyn.delivery.sax.SAXVisitBefore;
-import org.milyn.javabean.BeanAccessor;
+import org.milyn.javabean.repository.BeanRepository;
import org.w3c.dom.Element;
import java.io.IOException;
@@ -93,7 +93,7 @@
}
private void route(ExecutionContext executionContext) {
- Object object = BeanAccessor.getBean(executionContext, beanId);
+ Object object = BeanRepository.getInstance(executionContext).getBean(beanId);
if(object == null) {
// Try the exec context...
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd (from rev 26878, labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb (from rev 26878, labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb)
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks (from rev 26878, labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks)
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema targetNamespace="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd"
- elementFormDefault="qualified"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:smooks="http://www.milyn.org/xsd/smooks-1.1.xsd"
- xmlns:routing="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
-
- <xs:import namespace="http://www.milyn.org/xsd/smooks-1.1.xsd"/>
-
- <xs:annotation>
- <xs:documentation xml:lang="en">JBoss ESB Smooks Routing Components</xs:documentation>
- </xs:annotation>
-
- <xs:element name="routeBean" type="routing:routeBean" substitutionGroup="smooks:abstract-resource-config">
- <xs:annotation>
- <xs:documentation xml:lang="en">JBoss ESB Async Router.</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:complexType name="routeBean">
- <xs:annotation>
- <xs:documentation xml:lang="en">JBoss ESB Async Router.</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="smooks:element-visitor">
- <xs:attribute name="beanIdRef" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation xml:lang="en">Bean ID reference of the bean to be routed to the target Service.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="toServiceCategory" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation xml:lang="en">Target Service Category.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="toServiceName" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation xml:lang="en">Target Service Name.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="routeOnElement" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation xml:lang="en">Route on Element.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="routeOnElementNS" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">Route on Element Namespace.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="messagePayloadLocation" type="xs:string" default="">
- <xs:annotation>
- <xs:documentation xml:lang="en">ESB Message.Body location on which the routed bean will be set.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="routeBefore" type="xs:boolean" default="false">
- <xs:annotation>
- <xs:documentation xml:lang="en">Route on visitBefore of the routeOnElement.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
-</xs:schema>
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd (from rev 26878, labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema targetNamespace="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd"
+ elementFormDefault="qualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:smooks="http://www.milyn.org/xsd/smooks-1.1.xsd"
+ xmlns:routing="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
+
+ <xs:import namespace="http://www.milyn.org/xsd/smooks-1.1.xsd"/>
+
+ <xs:annotation>
+ <xs:documentation xml:lang="en">JBoss ESB Smooks Routing Components</xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="routeBean" type="routing:routeBean" substitutionGroup="smooks:abstract-resource-config">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">JBoss ESB Async Router.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="routeBean">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">JBoss ESB Async Router.</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="smooks:element-visitor">
+ <xs:attribute name="beanIdRef" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Bean ID reference of the bean to be routed to the target Service.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="toServiceCategory" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Target Service Category.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="toServiceName" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Target Service Name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="routeOnElement" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Route on Element.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="routeOnElementNS" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Route on Element Namespace.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="messagePayloadLocation" type="xs:string" default="">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">ESB Message.Body location on which the routed bean will be set.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="routeBefore" type="xs:boolean" default="false">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Route on visitBefore of the routeOnElement.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+</xs:schema>
Deleted: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml 2009-06-09 08:47:36 UTC (rev 26878)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" default-selector-namespace="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
-
- <!--
- Create Resource config...
- -->
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.NewResourceConfig</resource>
- <param name="resource">org.jboss.soa.esb.smooks.FragmentRouter</param>
- </resource-config>
-
- <!--
- Map Config attributes onto current Resource config...
- -->
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">beanIdRef</param>
- <param name="mapTo">beanId</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">toServiceCategory</param>
- <param name="mapTo">serviceCategory</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">toServiceName</param>
- <param name="mapTo">serviceName</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">routeOnElement</param>
- <param name="mapTo">selector</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">routeOnElementNS</param>
- <param name="mapTo">selector-namespace</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">routeBefore</param>
- <param name="default">false</param>
- </resource-config>
-
- <resource-config selector="routeBean">
- <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
- <param name="attribute">messagePayloadLocation</param>
- <param name="mapTo">set-payload-location</param>
- <param name="default">org.jboss.soa.esb.message.defaultEntry</param>
- </resource-config>
-
-</smooks-resource-list>
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml (from rev 26878, labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/smooks/src/main/resources/META-INF/xsd/jbossesb/smooks/routing-1.0.xsd-smooks.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" default-selector-namespace="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
+
+ <!--
+ Create Resource config...
+ -->
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.NewResourceConfig</resource>
+ <param name="resource">org.jboss.soa.esb.smooks.FragmentRouter</param>
+ </resource-config>
+
+ <!--
+ Map Config attributes onto current Resource config...
+ -->
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">beanIdRef</param>
+ <param name="mapTo">beanId</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">toServiceCategory</param>
+ <param name="mapTo">serviceCategory</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">toServiceName</param>
+ <param name="mapTo">serviceName</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">routeOnElement</param>
+ <param name="mapTo">selector</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">routeOnElementNS</param>
+ <param name="mapTo">selector-namespace</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">routeBefore</param>
+ <param name="default">false</param>
+ </resource-config>
+
+ <resource-config selector="routeBean">
+ <resource>org.milyn.cdr.extension.MapToResourceConfigFromAttribute</resource>
+ <param name="attribute">messagePayloadLocation</param>
+ <param name="mapTo">set-payload-location</param>
+ <param name="default">org.jboss.soa.esb.message.defaultEntry</param>
+ </resource-config>
+
+</smooks-resource-list>
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.io.StringReader;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -65,6 +66,7 @@
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
@@ -717,16 +719,16 @@
Node node = children.item(i);
if (childCount == 1 && node.getNodeType() == Node.TEXT_NODE) {
- if (node.getTextContent().equals("?")) {
+ if (isParameter(node)) {
String ognl = OGNLUtils.getOGNLExpression(element, soapNs);
- Object param;
+ Object param = OGNLUtils.getParameter(ognl, params);
- param = OGNLUtils.getParameter(ognl, params);
-
element.removeChild(node);
element.appendChild(element.getOwnerDocument().createTextNode(param.toString()));
}
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
+ NamedNodeMap attributes = node.getAttributes();
+ injectAttributeParameters(params, soapNs, node, attributes);
injectParameters((Element) node, params, soapNs);
}
}
@@ -734,7 +736,37 @@
element.removeAttributeNS(OGNLUtils.JBOSSESB_SOAP_NS, IS_CLONE_ATTRIB);
element.removeAttributeNS(OGNLUtils.JBOSSESB_SOAP_NS, OGNLUtils.OGNL_ATTRIB);
}
+
+ private void injectAttributeParameters(Map params, String soapNs, Node node, NamedNodeMap attributes) {
+ for (Node attribute : getNodes(attributes)) {
+ if (isParameter(attribute)) {
+ String localName = attribute.getLocalName();
+ String ognl = OGNLUtils.getOGNLExpression((Element)node, soapNs) + "." + localName;
+
+ Object param = OGNLUtils.getParameter(ognl, params);
+ if (param != null && param.toString().length() > 0) {
+ attribute.setTextContent(param.toString());
+ } else {
+ attributes.removeNamedItem(attribute.getNodeName());
+ }
+ }
+ }
+ }
+ private boolean isParameter(Node node) {
+ return node.getTextContent().equals("?");
+ }
+
+ private List<Node> getNodes(NamedNodeMap attributes) {
+ int len = attributes.getLength();
+ List<Node> list = new ArrayList<Node>(len);
+ for ( int a = 0 ; a < len ; a++)
+ {
+ list.add(attributes.item(a));
+ }
+ return list;
+ }
+
private synchronized DocumentBuilder getDocBuilder() throws IOException {
try {
return docBuilderFactory.newDocumentBuilder();
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/Customer.xsd
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/Customer.xsd 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/Customer.xsd 2009-06-09 11:35:07 UTC (rev 26882)
@@ -15,6 +15,7 @@
<xs:element name="poNumber" type="xs:string" />
<xs:element name="orderNumber" type="xs:string" />
</xs:sequence>
+ <xs:attribute name="inquiryId" type="xs:string"/>
</xs:complexType>
</xs:schema>
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/RetailerCallback.wsdl
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/RetailerCallback.wsdl 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/RetailerCallback.wsdl 2009-06-09 11:35:07 UTC (rev 26882)
@@ -75,6 +75,15 @@
<element name="salesOrderNotificationAck" type="boolean"/>
<element name="orderNumber" type="string"/>
+
+ <element name="CancelOrder">
+ <complexType>
+ <sequence>
+ <element name="in" type="string"></element>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="out" type="string"></element>
</schema>
@@ -172,6 +181,7 @@
<element name="poNumber" nillable="true" type="string"/>
</sequence>
+ <attribute name="inquiryId" type="string"/>
</complexType>
@@ -204,6 +214,19 @@
<part element="tns:salesOrderNotification" name="Document"/>
</message>
+
+<message name="CancelOrderRequest">
+
+ <part name="Document" element="tns:cancelOrder"></part>
+
+ </message>
+
+ <message name="CancelOrderResponse">
+
+ <part name="Document" element="tns:cancelOrderResponse"></part>
+
+ </message>
+
<portType name="RetailerCallbackPortType">
@@ -214,6 +237,11 @@
<output message="tns:SendSalesOrderNotificationResponse"/>
</operation>
+ <operation name="CancelOrder">
+ <input message="tns:CancelOrderRequest"></input>
+ <output message="tns:CancelOrderResponse"></output>
+ </operation>
+
</portType>
@@ -239,7 +267,25 @@
</output>
</operation>
+
+ <operation name="CancelOrder">
+ <soap:operation soapAction="" style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ <input>
+
+ <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ </input>
+
+ <output>
+
+ <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ </output>
+
+ </operation>
+
</binding>
<service name="RetailerCallback">
Modified: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2009-06-09 11:18:21 UTC (rev 26881)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2009-06-09 11:35:07 UTC (rev 26882)
@@ -332,6 +332,26 @@
assertTrue("Failed to generate correct soap fault message", str.indexOf("<say:code>test</say:code>") > -1);
}
+ public void test_has_attributes() throws IOException, SAXException, ConfigurationException {
+ File wsdlFile = new File(WSDL_LOCATAION + "/RetailerCallback.wsdl");
+ SoapUIClientService mbean = new SoapUIClientService();
+ Map<String, CancelOrder> params = new HashMap<String, CancelOrder>();
+
+ properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
+ CancelOrder cancelorder = new CancelOrder();
+ cancelorder.orderInquiry.inquiryId = "X2343443";
+ cancelorder.orderInquiry.customerNumber = "12345";
+ cancelorder.orderInquiry.poNumber = "asdsadfdfd";
+
+ params.put("cancelOrder", cancelorder);
+
+ String message = mbean.buildRequest(wsdlFile.toURI().toString(), "CancelOrder", params, properties, null, null);
+ assertTrue("Generated SOAP message not as expected. See expected_05.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_05.xml"), new ByteArrayInputStream(message.getBytes())));
+ assertEquals("http://localhost:18080/active-bpel/services/RetailerCallback", mbean.getEndpoint(wsdlFile.toURI().toString(), properties));
+ }
+
+
+
private void addOrderItems(List<OrderItem> items) {
items.add(new OrderItem(1, "item1", 1, new BigDecimal(1.00), 1));
items.add(new OrderItem(2, "item2", 2, new BigDecimal(2.00), 2));
@@ -410,4 +430,16 @@
System.out.println("compare returns: " + compareCharStreams(expectedIS, outputIS));
}
+
+ private class CancelOrder {
+ public OrderInquiry orderInquiry = new OrderInquiry();
+ }
+
+ private class OrderInquiry {
+ public String customerNumber;
+ public String poNumber;
+ public String inquiryId;
+ }
+
+
}
Copied: labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_05.xml (from rev 26878, labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_05.xml)
===================================================================
--- labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_05.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/jbossas5/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_05.xml 2009-06-09 11:35:07 UTC (rev 26882)
@@ -0,0 +1,11 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abi="http://org.jboss.esb/quickstarts/bpel/ABI_OrderManager" xmlns:jaws="http://ordermanagement.activebpel.com/jaws">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <abi:cancelOrder>
+ <abi:orderInquiry inquiryId="X2343443">
+ <jaws:customerNumber>12345</jaws:customerNumber>
+ <jaws:poNumber>asdsadfdfd</jaws:poNumber>
+ </abi:orderInquiry>
+ </abi:cancelOrder>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list