[jboss-svn-commits] JBL Code SVN: r7134 - in labs/jbossesb/workspace/dbrum/trunk/product/core: listeners/src/org/jboss listeners/src/org/jboss/internal listeners/src/org/jboss/internal/soa listeners/src/org/jboss/internal/soa/esb listeners/src/org/jboss/internal/soa/esb/couriers listeners/src/org/jboss/soa/esb listeners/src/org/jboss/soa/esb/actions listeners/src/org/jboss/soa/esb/actions/templates listeners/src/org/jboss/soa/esb/couriers listeners/src/org/jboss/soa/esb/listeners listeners/src/org/jboss/soa/esb/listeners/gateway listeners/src/org/jboss/soa/esb/listeners/message listeners/src/org/jboss/soa/esb/listeners/old listeners/tests/src/org/jboss/soa/esb/actions listeners/tests/src/org/jboss/soa/esb/listeners listeners/tests/src/org/jboss/soa/esb/listeners/old listeners/tests/src/org/jboss/soa/esb/util rosetta/src/org/jboss/internal/soa/esb/addressing rosetta/src/org/jboss/internal/soa/esb/command rosetta/src/org/jboss/internal/soa/esb/notification rosetta/src/org/jboss/soa/esb/! addressing rosetta/src/org/jboss/soa/esb/addressing/helpers rosetta/src/org/jboss/soa/esb/addressing/util rosetta/src/org/jboss/soa/esb/common rosetta/src/org/jboss/soa/esb/helpers rosetta/src/org/jboss/soa/esb/helpers/persist rosetta/src/org/jboss/soa/esb/notification rosetta/src/org/jboss/soa/esb/services rosetta/src/org/jboss/soa/esb/util rosetta/tests/src/org/jboss/soa/esb/addressing rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests rosetta/tests/src/org/jboss/soa/esb/addressing/util rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests rosetta/tests/src/org/jboss/soa/esb/command rosetta/tests/src/org/jboss/soa/esb/helpers rosetta/tests/src/org/jboss/soa/esb/notification services/src/org/jboss/soa/esb/internal/core/objectstore services/src/org/jboss/soa/esb/services services/src/org/jboss/soa/esb/services/beans services/tests/src/org/jboss/soa/esb/internal/core/objectstore services/tests/src/org/jboss/soa/esb/services/beans
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Oct 26 00:33:31 EDT 2006
Author: estebanschifman
Date: 2006-10-26 00:32:42 -0400 (Thu, 26 Oct 2006)
New Revision: 7134
Added:
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockComposer.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockMessageAction.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java
Removed:
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/DirectoryPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/RemoteDirectoryPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListener_ActionConfig.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/DirectoryPollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/DomElement.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java
Modified:
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractFileAction.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionDefinitionFactory.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionUtils.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockAction.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockFileAction.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockSqlRowAction.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/DirectoryPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/GpListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/JmsQueueListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/SqlTablePoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/AbstractMockListner.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNonblockingListener.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java
labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockPoller.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/CommandQueue.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/InMemoryCommandQueue.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/notification/MacroExpander.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/Email.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/NotificationManager.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/Util.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/command/InMemoryCommandQueueUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/MacroExpanderUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyUtilUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget2.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/NotificationHandlerBean.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java
labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/NotificationUnitTest.java
Log:
Merge EPR/gateways work with latest trunk
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal)
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal/soa)
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal/soa/esb)
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.internal.soa.esb.couriers;
-
-import java.util.*;
-import javax.jms.*;
-import javax.naming.Context;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.helpers.JMSEpr;
-import org.jboss.soa.esb.couriers.Courier;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.util.Util;
-import org.jboss.soa.esb.helpers.*;
-
-public class JmsCourier implements Courier
-{
- /**
- * disable default constructor
- */
- private JmsCourier() { }
- /**
- * package protected constructor - Objects of Courier should only be instantiated by the Factory
- * @param epr
- */
- public JmsCourier(EPR epr) throws CourierException
- {
- _sleepForRetries = 3000;
-
- try
- {
- _messageProperties = Util.propertiesFromSelector(_epr.getMessageSelector());
- createMessageProducer();
- }
- catch (Exception e) { throw new CourierException(e); }
-
- } //________________________________
-
- /**
- * package the ESB message in a javax.jms.ObjectMessage, and send it
- * @param message Message - the message to deliver
- * @return boolean - the result of the delivery
- * @throws CourierException - if problems were encountered
- */
- public boolean deliver(Message message) throws CourierException
- {
- if (null==message)
- return false;
- while (null!=_messageProducer)
- {
- try
- {
- // obtain Serializable version of arg0 and package it in a jms ObjectMessage
- sendMessage(_jmsSession.createObjectMessage(Util.serialize(message)));
- return true;
- }
- catch (JMSException e) { jmsRetry(e); }
- catch (Exception e) { throw new CourierException(e);}
- }
- return false;
- } //________________________________
-
- /**
- * send/publish a javax.jms.ObjectMessage (that will contain the serialized ESB Message)
- * @param jmsMessage
- */
- protected void sendMessage(javax.jms.Message jmsMessage) throws JMSException
- {
- if (_messageProducer instanceof TopicPublisher)
- ((TopicPublisher)_messageProducer).publish(jmsMessage);
- else
- _messageProducer.send(jmsMessage);
- } //________________________________
-
- private void jmsRetry(Exception exc)
- {
- _logger.error("JMS error. Attempting JMS reconnect.", exc);
- _jmsConnection = null;
- _jmsSession = null;
- _messageProducer= null;
-
- for (int i1 = 0; i1 < 5; i1++)
- {
- // try to reconnect to the queue
- try { createMessageProducer(); }
- catch (Exception e)
- {
- _logger.error("Reconnecting to JMS", e);
- try { Thread.sleep(_sleepForRetries); }
- catch (InterruptedException e1)
- { // Just return after logging
- _logger.error("Unexpected thread interupt exception.", e);
- break;
- }
- }
- }
- }
-
- protected void createMessageProducer() throws Exception
- {
-
- String sJndiType = _epr.getJndiType();
- if (Util.isNullString(sJndiType))
- sJndiType = "jboss";
- String sJndiURL = _epr.getJndiURL();
- if (Util.isNullString(sJndiURL))
- sJndiURL = "localhost";
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
-
- String sFactoryClass = _epr.getConnectionFactory();
- if (Util.isNullString(sFactoryClass))
- sFactoryClass = "ConnectionFactory";
-
- Object tmp = oJndiCtx.lookup(sFactoryClass);
-
- String sType = _epr.getDestinationType();
- if (JMSEpr.QUEUE_TYPE.equals(sType))
- {
- javax.jms.Queue queue = (javax.jms.Queue) oJndiCtx.lookup(_epr.getDestinationName());
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
- QueueConnection qConn = qcf.createQueueConnection();
- QueueSession qSess = qConn.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
- _jmsConnection = qConn;
- _jmsSession = qSess;
- _messageProducer = qSess.createProducer(queue);
- }
- else if(JMSEpr.TOPIC_TYPE.equals(sType))
- {
- Topic topic = (Topic) oJndiCtx.lookup(_epr.getDestinationName());
- TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
- TopicConnection tConn = tcf.createTopicConnection();
- TopicSession tSess = tConn.createTopicSession(false,TopicSession.AUTO_ACKNOWLEDGE);
- _jmsConnection = tConn;
- _jmsSession = tSess;
- _messageProducer = tSess.createPublisher(topic);
- }
- else
- throw new CourierException("Unknown destination type");
-
- } //________________________________
-
- protected JMSEpr _epr;
- protected Logger _logger = Logger.getLogger(JmsCourier.class);
- protected String _messageSelector;
- protected Connection _jmsConnection;
- protected Session _jmsSession;
- protected MessageProducer _messageProducer;
- protected long _sleepForRetries = 3000; // milliseconds
- protected List<KeyValuePair> _messageProperties;
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractFileAction.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractFileAction.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/AbstractFileAction.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -45,7 +45,7 @@
* name of the original file that has been processed. The suffix will be
* different according to the result of processing (OK or Exception). Files
* could be moved to different directories as well <br/> Parameters for
- * these options can be provided at run time in the DomElement (arg 0 in
+ * these options can be provided at run time in the ConfigTree (arg 0 in
* constructor)
* @param message The message payload to be processed.
* @return The processing result.
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionDefinitionFactory.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionDefinitionFactory.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionDefinitionFactory.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
/**
@@ -54,14 +54,14 @@
* @param config ActionDefinition configuration.
* @throws ConfigurationException Invalid configuration.
*/
- public ActionDefinitionFactory(DomElement config) throws ConfigurationException {
+ public ActionDefinitionFactory(ConfigTree config) throws ConfigurationException {
if(config == null || !config.getName().equals("Actions")) {
throw new ConfigurationException("No 'Actions' configuration.");
}
// Read the processor alias and action def configurations from the XML configuration...
- DomElement processorAliasConfig = config.getFirstElementChild("ProcessorAliases");
- DomElement[] actions = config.getElementChildren("Action");
+ ConfigTree processorAliasConfig = config.getFirstChild("ProcessorAliases");
+ ConfigTree[] actions = config.getChildren("Action");
if(processorAliasConfig == null) {
throw new ConfigurationException("No 'Actions/ProcessorAliases' configuration.");
}
@@ -94,14 +94,14 @@
* @param processorClasses Processor classes keyed by alias name.
* @throws ConfigurationException
*/
- private void initialiseActionDefinitions(DomElement[] actions, Hashtable<String, String> processorClasses) throws ConfigurationException {
+ private void initialiseActionDefinitions(ConfigTree[] actions, Hashtable<String, String> processorClasses) throws ConfigurationException {
if(processorClasses == null || processorClasses.isEmpty()) {
throw new ConfigurationException("No action processor classes defined.");
}
- for(DomElement action : actions) {
- String name = action.getAttr("name");
- String processorAlias = action.getAttr("processor");
+ for(ConfigTree action : actions) {
+ String name = action.getAttribute("name");
+ String processorAlias = action.getAttribute("processor");
String processorClass;
List<KeyValuePair> properties;
@@ -132,17 +132,17 @@
* @return Processor runtime classs
* @throws ConfigurationException Bad configuration.
*/
- private Hashtable<String, String> getProcessorClasses(DomElement processorAliasConfig) throws ConfigurationException {
- DomElement[] aliases = processorAliasConfig.getElementChildren("Alias");
+ private Hashtable<String, String> getProcessorClasses(ConfigTree processorAliasConfig) throws ConfigurationException {
+ ConfigTree[] aliases = processorAliasConfig.getChildren("Alias");
Hashtable<String, String> processorClasses = new Hashtable<String, String>();
if(aliases == null) {
throw new ConfigurationException("No 'Actions/ProcessorAliases/Alias' configurations.");
}
- for(DomElement alias : aliases) {
- String name = alias.getAttr("name");
- String className = alias.getAttr("class");
+ for(ConfigTree alias : aliases) {
+ String name = alias.getAttribute("name");
+ String className = alias.getAttribute("class");
// Check the required attributes...
if(name == null || name.trim().equals("")) {
@@ -165,20 +165,20 @@
* if no properties are defined on the action.
* @throws ConfigurationException A property name or value is empty or undefined.
*/
- private List<KeyValuePair> getProperties(DomElement action) throws ConfigurationException {
- DomElement[] properties = action.getElementChildren("property");
+ private List<KeyValuePair> getProperties(ConfigTree action) throws ConfigurationException {
+ ConfigTree[] properties = action.getChildren("property");
List<KeyValuePair> propertyList = new ArrayList<KeyValuePair>();
- for(DomElement property : properties) {
- String name = property.getAttr("name");
- String value = property.getAttr("value");
+ for(ConfigTree property : properties) {
+ String name = property.getAttribute("name");
+ String value = property.getAttribute("value");
// Check the required attributes...
if(name == null || name.trim().equals("")) {
- throw new ConfigurationException("Actions/Action/property has no 'name' defined. Action [" + action.getAttr("name") + "].");
+ throw new ConfigurationException("Actions/Action/property has no 'name' defined. Action [" + action.getAttribute("name") + "].");
}
if(value == null || value.trim().equals("")) {
- throw new ConfigurationException("Actions/Action/property has no 'value' defined. Action [" + action.getAttr("name") + "], Property [" + name + "].");
+ throw new ConfigurationException("Actions/Action/property has no 'value' defined. Action [" + action.getAttribute("name") + "], Property [" + name + "].");
}
propertyList.add(new KeyValuePair(name, value));
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionUtils.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionUtils.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ActionUtils.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -21,8 +21,11 @@
*/
package org.jboss.soa.esb.actions;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.notification.NotificationList;
/**
* Contains utility methods for actions
@@ -31,8 +34,9 @@
*/
public class ActionUtils
{
- public static final String BEFORE_ACTION="org.jboss.soa.esb.actions.current.before";
- public static final String CURRENT_OBJECT="org.jboss.soa.esb.actions.current.after";
+ public static final String BEFORE_ACTION="org.jboss.soa.esb.actions.current.before";
+ private static final String CURRENT_OBJECT="org.jboss.soa.esb.actions.current.after";
+ private static final String CONFIG_TREE ="org.jboss.soa.esb.helpers.ConfigTree";
/**
* Obtain the current object from standard spot within message
@@ -76,4 +80,46 @@
message.getBody().add(CURRENT_OBJECT,obj);
return oRet;
}
+
+ /**
+ * Put a Config tree in predefined spot for it in 'this'
+ * <br/>NULL values are not stored
+ * @param message - to operate on
+ * @param tree - ConfigTree to store - Won't be stored if <null>
+ * @return ConfigTree previously stored
+ */
+ public static ConfigTree setConfigTree(Message message, ConfigTree tree)
+ {
+ ConfigTree oRet = (ConfigTree)message.getBody().remove(CONFIG_TREE);
+ if (null!=tree)
+ message.getBody().add(CONFIG_TREE,tree);
+ return oRet;
+ }
+ /**
+ * Put a Config tree in predefined spot for it in 'this'
+ * <br/>NULL values are not stored
+ * @param message - to operate on
+ * @param tree - ConfigTree to store - Won't be stored if <null>
+ * @return ConfigTree previously stored
+ */
+ public static ConfigTree getConfigTree(Message message)
+ {
+ ConfigTree oRet = (ConfigTree)message.getBody().get(CONFIG_TREE);
+ return (null==oRet)?new ConfigTree("mock"):oRet;
+ }
+
+ public static NotificationList getNotifyList(ConfigTree tree, String type)
+ {
+ ConfigTree[] array = tree.getChildren("NotificationList");
+ for (ConfigTree curr : array)
+ {
+ String sType = curr.getAttribute(NotificationList.TYPE);
+ if (null==sType)
+ continue;
+ if (type.toLowerCase().startsWith(sType.toLowerCase()))
+ return new NotificationList(curr);
+ }
+ return null;
+ }
+
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.listeners.old.GpListener;
import org.jboss.soa.esb.listeners.old.RemoteDirectoryPoller;
@@ -37,7 +37,7 @@
public class FtpDownloader extends AbstractFileAction
{
- DomElement _parms;
+ ConfigTree _parms;
FtpClientUtil _ftpClient;
String _localDir;
RemoteDirectoryPoller.WorkingFile _workFile;
@@ -50,9 +50,9 @@
* @throws ConfigurationException Action not properly configured.
*/
public FtpDownloader(String actionName, List<KeyValuePair> properties)
- { _parms = new DomElement("fromProps");
+ { _parms = new ConfigTree("fromProps");
for (KeyValuePair oCurr : properties)
- _parms.setAttr(oCurr.getKey(),oCurr.getValue());
+ _parms.setAttribute(oCurr.getKey(),oCurr.getValue());
} //________________________________
@Override
@@ -72,12 +72,12 @@
for (KeyValuePair kvp : _workFile.getFtpProps())
{
String sVal = kvp.getValue();
- _parms.setAttr(kvp.getKey(),(null==sVal)?"":sVal);
+ _parms.setAttribute(kvp.getKey(),(null==sVal)?"":sVal);
}
// end of kludge
// System.out.println("Downloading "+_workFile);
_ftpClient = new FtpClientUtil(_parms,true);
- _localDir = _parms.getAttr(FtpClientUtil.PARMS_LOCAL_DIR);
+ _localDir = _parms.getAttribute(FtpClientUtil.PARMS_LOCAL_DIR);
String sFrom = FtpClientUtil.fileToFtpString(_workFile);
_ftpClient.downloadFile(sFrom,_workFile.getInputFile().getName());
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.listeners.old.DirectoryPoller;
import org.jboss.soa.esb.listeners.old.GpListener;
@@ -37,7 +37,7 @@
public class FtpUploader extends AbstractFileAction
{
- DomElement _parms;
+ ConfigTree _parms;
FtpClientUtil _ftpClient;
String _remoteDir;
DirectoryPoller.WorkingFile _workFile;
@@ -50,9 +50,9 @@
* @throws ConfigurationException Action not properly configured.
*/
public FtpUploader(String actionName, List<KeyValuePair> properties)
- { _parms = new DomElement("fromProps");
+ { _parms = new ConfigTree("fromProps");
for (KeyValuePair oCurr : properties)
- _parms.setAttr(oCurr.getKey(),oCurr.getValue());
+ _parms.setAttribute(oCurr.getKey(),oCurr.getValue());
} //________________________________
@Override
@@ -69,7 +69,7 @@
{
System.out.println("FTP uploading "+obj);
_ftpClient = new FtpClientUtil(_parms,true);
- _remoteDir = _parms.getAttr(FtpClientUtil.PARMS_REMOTE_DIR);
+ _remoteDir = _parms.getAttribute(FtpClientUtil.PARMS_REMOTE_DIR);
_ftpClient.uploadFile(_workFile,_workFile.getInputFile().getName());
if (_workFile.isPostDelete())
@@ -99,7 +99,7 @@
return new StringBuilder()
.append(_workFile.getInputFile().toString())
.append("successfully uploaded to ").append(_remoteDir)
- .append(" on ").append(_parms.getAttr(FtpClientUtil.PARMS_FTP_SERVER))
+ .append(" on ").append(_parms.getAttribute(FtpClientUtil.PARMS_FTP_SERVER))
.toString();
} //________________________________
@@ -108,7 +108,7 @@
return new StringBuilder()
.append("Failed to upload ").append(_workFile.getInputFile().toString())
.append(" to ").append(_remoteDir)
- .append(" on ").append(_parms.getAttr(FtpClientUtil.PARMS_FTP_SERVER))
+ .append(" on ").append(_parms.getAttribute(FtpClientUtil.PARMS_FTP_SERVER))
.toString();
} //________________________________
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockAction.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockAction.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockAction.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.soa.esb.actions.templates;
import java.io.Serializable;
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockComposer.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockComposer.java)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockFileAction.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockFileAction.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockFileAction.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.soa.esb.actions.templates;
import java.io.File;
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockMessageAction.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockMessageAction.java)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockSqlRowAction.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockSqlRowAction.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/templates/MockSqlRowAction.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.soa.esb.actions.templates;
import java.io.Serializable;
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.couriers;
-
-import org.jboss.soa.esb.message.Message;
-
-public interface Courier
-{
-/**
- * try to deliver an ESB message
- * @param message Message - the message to deliver
- * @return boolean - the result of the delivery
- * @throws CourierException - if problems were encountered
- */
- public abstract boolean deliver(Message message) throws CourierException;
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/Courier.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.couriers;
-
-import org.jboss.soa.esb.BaseException;
-
-/**
- * Dispatch Exception.
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- * @since Version 4.0
- */
-public class CourierException extends BaseException
-{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an exception instance.
- * @param message Exception message.
- */
- public CourierException(String message) { super(message); }
-
- /**
- * Construct an exception instance.
- * @param message Exception message.
- * @param cause Exception cause.
- */
- public CourierException(String message, Throwable cause) { super(message, cause); }
-
- /**
- * Construct an exception instance.
- * @param cause Exception cause.
- */
- public CourierException(Throwable cause) { super(cause); }
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierException.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.couriers;
-
-import java.net.URISyntaxException;
-
-import org.jboss.internal.soa.esb.couriers.JmsCourier;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.helpers.*;
-
-public class CourierFactory
-{
- // private default constructor
- private CourierFactory() {}
-
- public static CourierFactory getInstance(Object obj)
- {
- return _instance;
- }
-
- public static Courier getCourier(EPR epr) throws CourierException
- {
- try
- {
- String address = epr.getAddr().getAddress();
- if (address.startsWith(JMSEpr.JMS_PROTOCOL))
- return new JmsCourier(epr);
- }
- catch (URISyntaxException e) { throw new CourierException(e); }
- throw new CourierException("Unknown protocol");
- }
-
- private static final CourierFactory _instance = new CourierFactory();
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/couriers/CourierFactory.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,293 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners;
-
-import java.util.Arrays;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.actions.ActionDefinition;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-
-/**
- * Base abstract listener implementation.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public abstract class AbstractListener implements Runnable {
-
- /**
- * Name constant def for the Message attachemnt carrying the list of actions to be applied to the
- * incomming message. This allows the configured processing pipeline to be overridden by the Message
- * producer.
- */
- public static final String MESSAGE_PROCESSING_ACTIONS_LIST = "MESSAGE_PROCESSING_ACTIONS_LIST";
-
- // You can override these values at constructor time of your
- // derived class after calling super(GpListener,DomElement)
- protected int m_iSleepForThreads = 3000; // default sleep if no threads available
- protected int m_iUpperThreadLimit = 10; // just in case - override if you wish
-
- protected int m_iQthr = 0, m_iMaxThr;
-
- protected ThreadGroup m_oThrGrp = null;
- protected Logger logger;
- protected GpListener m_oDad;
- protected DomElement listenerConfig;
- protected String[] m_oActions;
- protected ActionDefinitionFactory m_oActionDefinitionFactory;
- protected MessageFactory m_oMsgFactory;
-
- protected AbstractListener(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
-
- logger = Logger.getLogger(this.getClass());
- m_oDad = p_oDad;
- listenerConfig = p_oParms.cloneObj();
- m_oActionDefinitionFactory = actionDefinitionFactory;
- m_oMsgFactory = MessageFactory.getInstance();
- m_oThrGrp = new ThreadGroup(listenerConfig.getName());
-
- String sAtt = GpListener.obtainAtt(listenerConfig, GpListener.PARM_ACTIONS, "");
- if(!sAtt.trim().equals("")) {
- m_oActions = sAtt.split(",");
- }
-
- sAtt = GpListener.obtainAtt(listenerConfig, GpListener.PARM_MAX_THREADS, "1");
- int iMax = Integer.parseInt(sAtt);
- m_iMaxThr = Math.min(iMax, m_iUpperThreadLimit);
- } // __________________________________
-
- /**
- * Implement run method for this Runnable <p/> Will continue to run until
- * controlling class (ref in m_oDad) indicates no more looping allowed for
- * all child classes <p/> This condition will not prevent child processes to
- * finish normally
- */
- public void run() {
- while (m_oDad.continueLooping()) {
- Object[] processList = receive();
- if (null==processList) {
- try { Thread.sleep(500); }
- catch(InterruptedException e) {/* ok do nothing */}
- } else {
- for (Object currentObj : processList) {
- if (m_iQthr >= m_iMaxThr) {
- logger.info("Waiting for available threads...(max=" + m_iMaxThr + ")");
- try {
- Thread.sleep(m_iSleepForThreads);
- } catch (InterruptedException e) {
- return;
- }
- break;
- }
-
- // Spawn a thread and push the message message through the pipeline...
- ActionProcessingPipeline runner = new ActionProcessingPipeline(currentObj);
- new Thread(runner).start();
- incThreads();
- }
- }
- }
-
- // Wait for all the processing pipelines to complete before closing the listener and existing...
- while(m_iQthr > 0) {
- logger.info("Waiting for all processing pipelines to complete.");
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- logger.warn("Thread interrupted while waiting for all processing pipelines to complete.", e);
- }
- }
-
- logger.info("All processing pipelines complete. Closing listener now.");
-
- close();
- }
-
- /**
- * Receive message from underlying channel implementation.
- * <p/>
- * Implementations must perform a blocking receive.
- * @return An array of Objects received on the channel.
- */
- protected abstract Object[] receive();
-
- /**
- * Called on the listener implementation when pipeline processing error has occured.
- * @param initialMsg The message that was initialy supplied to the pipeline.
- * @param processor The processor that raised the error. Can be null where the error was raised before
- * pipeline processing of the message.
- * @param error The error. Can be null.
- */
- protected abstract void processingError(Object initialMsg, ActionProcessor processor, Throwable error);
-
- /**
- * Called on the listener implementation when pipeline processing of a message is complete.
- * @param initialMsg The message that was initialy supplied to the pipeline.
- */
- protected abstract void processingComplete(Object initialMsg);
-
- /**
- * Close the listener implemenation.
- * <p/>
- * Allows the listener to perform relevant close/cleanup tasks.
- */
- protected abstract void close();
-
- /**
- * Increment the active thread count.
- */
- private void incThreads() {
- m_iQthr++;
- }
-
- /**
- * Decrement the active thread count.
- */
- private void decThreads() {
- m_iQthr--;
- }
-
- /**
- * Action Processing Pipeline.
- * <p/>
- * Runs the actions in a listeners "actions" config on a message payload message received
- * by the listener implementation.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
- private class ActionProcessingPipeline implements Runnable {
-
- private Object initialObject;
-
- /**
- * Private constructor.
- * @param pMessage The inital processing target message.
- */
- private ActionProcessingPipeline(Object obj) {
- initialObject = obj;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- public void run() {
- String currentAction = null;
- ActionProcessor currentProcessor = null;
-
- try {
- Message message;
- String[] actions;
-
- if(initialObject instanceof Message) {
- message = (Message)initialObject;
- } else {
- message = m_oMsgFactory.getMessage();
- ActionUtils.setTaskObject(message,initialObject);
- }
-
- actions = getActions(message);
-
- // Run the message through each ActionProcessor...
- for(String action : actions) {
- ActionDefinition actionDefinition;
-
- currentAction = action.trim();
- actionDefinition = m_oActionDefinitionFactory.getInstance(currentAction);
- if(actionDefinition == null) {
- throw new java.lang.IllegalStateException("Bad Listener Configuration. No 'Actions/Action' definition for action [" + currentAction + "].");
- }
-
- // The processing result of each action feeds into the processing of the next action...
- currentProcessor = actionDefinition.getProcessor();
- try {
- ActionUtils.copyCurrentToPrevious(message);
- message = currentProcessor.process(message);
- } catch (Exception e) {
- GpListener.notifyError(listenerConfig, e, currentProcessor.getErrorNotification(message));
- throw e;
- }
-
- if(message == null && action != m_oActions[m_oActions.length - 1]) {
- String exceptionMessage = "Premature termination of action processing pipeline [" + Arrays.asList(m_oActions) + "]. ActionProcessor [" + currentProcessor.getClass().getName() + "] returned a null message result on processing of action [" + currentAction + "].";
- processingError(initialObject, currentProcessor, new ActionProcessingException(exceptionMessage));
- logger.warn(exceptionMessage);
- return;
- }
- // Notify on all processors. May want to do this differently in the future i.e. more selectively ...
- GpListener.notifyOK(listenerConfig, currentProcessor.getOkNotification(message));
-
- // Setup the message for processing by the next processor...
- if(message != null) {
- message.getBody().remove(ActionUtils.BEFORE_ACTION);
- }
- }
-
- processingComplete(initialObject);
- } catch(Throwable thrown) {
- processingError(initialObject, currentProcessor, thrown);
- logger.error("Premature termination of action processing pipeline [" + (m_oActions != null?Arrays.asList(m_oActions):"") + "]. Action [" + currentAction + "] threw an exception.", thrown);
- } finally {
- // Decrement the active thread count for the listener on completion...
- decThreads();
- }
- }
-
- /**
- * Get the list of actions to be applied to the supplied message.
- * @param message The message to be processed.
- * @return The set of processing actions to be performed on the message.
- * @throws ActionProcessingException Invalid actions list attachment setting.
- */
- private String[] getActions(Message message) throws ActionProcessingException {
- // Check is there an attachment specifying an override pipeline config...
- Object overrideActionsAttachment = message.getAttachment().get(MESSAGE_PROCESSING_ACTIONS_LIST);
- if(overrideActionsAttachment != null) {
- if(overrideActionsAttachment instanceof String) {
- String overrideActions = (String)overrideActionsAttachment;
-
- if(overrideActions.trim().equals("")) {
- throw new ActionProcessingException("Message attachement [" + MESSAGE_PROCESSING_ACTIONS_LIST + "] was specified but with an empty value. Aborting message processing.");
- }
-
- return overrideActions.split(",");
- } else {
- throw new ActionProcessingException("Message attachement [" + MESSAGE_PROCESSING_ACTIONS_LIST + "] must be of type java.lang.String. Received [" + overrideActionsAttachment.getClass().getName() + "]. Aborting message processing.");
- }
- } else {
- // Otherwise use the actions configured on the listener...
- if(m_oActions == null || m_oActions.length == 0) {
- throw new ActionProcessingException("No actions configuration specified either on the listener or as a Message attachement [" + MESSAGE_PROCESSING_ACTIONS_LIST + "]. Aborting message processing.");
- }
- return m_oActions;
- }
- }
- }
-
-} // ____________________________________________________________________________
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners;
-
-import java.util.List;
-
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.helpers.DomElement;
-
-/**
- * Abstract Polling Listener.
- * <p/>
- * Polling listeners are listener implementations that periodically poll for message objects
- * that require processing. This type of listener implementation is required where the underlying
- * message channel doesn't support a blocking receive operation.
- *
- * @author Esteban
- */
-public abstract class AbstractPoller extends AbstractListener {
-
- // You can override these values at constructor time of your
- // derived class after calling super(GpListener,DomElement)
- protected int m_iMinPollMillis = 3000 // minimum polling interval
- , m_iDfltPollMillis = 20000 // default polling interval
- ;
-
- public static final String PARM_POLL_LTCY = "pollLatencySecs";
-
- protected int m_iPollMillis;
-
- /**
- * Construct an abstract polling listener.
- * @param commandListener The command listener.
- * @param listenerConfig The configuration for this polling listener.
- * @param actionDefinitionFactory The action definition factory for the bus.
- * @throws Exception
- */
- protected AbstractPoller(GpListener commandListener, DomElement listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
- super(commandListener, listenerConfig, actionDefinitionFactory);
-
- String sAtt = listenerConfig.getAttr(PARM_POLL_LTCY);
- m_iPollMillis = (null == sAtt) ? m_iDfltPollMillis : 1000 * Integer.parseInt(sAtt);
- if (m_iPollMillis < m_iMinPollMillis) {
- m_iPollMillis = m_iMinPollMillis;
- }
- }
-
- /**
- * Polling listener receive implementation.
- * @return An array of objects polled from the concrete Poller implementation.
- */
- protected Object[] receive() {
- while (m_oDad.continueLooping()) {
- List<Object> olPending = pollForCandidates();
-
- if (olPending == null || olPending.isEmpty()) {
- try {
- Thread.sleep(m_iPollMillis);
- } catch (InterruptedException e) {
- logger.error("Unexpected thread interupt exception. Not terminating blocking receive!!", e);
- }
- continue;
- } else {
- Object[] objForProcessing = new Object[olPending.size()];
-
- // Preprocess all the message objects.
- // TODO: I really think this is no longer required or a good idea!!
- for(int i = 0; i < olPending.size(); i++) {
- objForProcessing[i] = preProcess(olPending.get(i));
- }
- return objForProcessing;
- }
- }
-
- return null;
- }
-
- /**
- * Poll for message objects.
- * @return A list of message objects, or an empty list if there are no message objects.
- */
- protected abstract List<Object> pollForCandidates();
-
- /**
- * Preprocess the message object before returning for pipeline processing.
- * @param message Message object for preprocessing.
- * @return The preprocessed message object, or the supplied message unmodified.
- */
- protected abstract Object preProcess(Object message);
- // TODO: Is this "preprocessing" step needed now that we have processing pipelines on listeners???
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/DirectoryPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/DirectoryPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/DirectoryPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,263 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.listeners;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.util.Util;
-
-public class DirectoryPoller extends AbstractPoller
-{
- public static final String FILE_INPUT_DIR = "inputDirURI";
- public static final String FILE_INPUT_SFX = "inputSuffix";
- public static final String FILE_WORK_SFX = "workSuffix";
- public static final String FILE_ERROR_DIR = "errorDirURI";
- public static final String FILE_ERROR_SFX = "errorSuffix";
- public static final String FILE_POST_DIR = "postDirURI";
- public static final String FILE_POST_SFX = "postSuffix";
- public static final String FILE_POST_DEL = "postDelete";
-
- public DirectoryPoller(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
- {
- super(p_oDad, p_oParms, actionDefinitionFactory);
- checkMyParms();
- } //__________________________________
-
-
- protected File m_oInpDir ,m_oErrorDir ,m_oPostDir;
- protected FileFilter m_oFFilt;
- protected String m_sInpSfx ,m_sWrkSfx ,m_sErrSfx ,m_sPostSfx;
- protected boolean m_bPostDel;
-
- /**
- *
- * @param inputObject Object - Must be a File representing the file that has to be processed
- * @return Object - an array of 3 Files containing:
- * <p/>[0] renamed file (workSuffix appended to input file name)
- * <p/>[1] target file name in case actionClass is unable to complete successfuly
- * <p/>[2] target file name in case actionClass finishes successfuly
- */
- @Override
- public Object preProcess(Object inputObject)
- {
- if (!(inputObject instanceof File)) {
- return null;
- }
-
- File inputFile = (File)inputObject;
- WorkingFile workingFile = new WorkingFile(inputFile.getParentFile(), inputFile.getName() + m_sWrkSfx);
-
- if (!inputFile.renameTo(workingFile)) {
- return null;
- }
-
- workingFile.postDelete = m_bPostDel;
- workingFile.inputFile = inputFile;
- workingFile.errorFile = new File (m_oErrorDir ,inputFile.getName()+m_sErrSfx);
- workingFile.outputFile = new File (m_oPostDir ,inputFile.getName()+m_sPostSfx);
-
- return workingFile;
- } //________________________________
-
- @Override
- protected List<Object> pollForCandidates()
- {
- File[] oaF = m_oInpDir.listFiles(m_oFFilt);
- return Arrays.asList((Object[])oaF);
- } //________________________________
-
- private void checkMyParms() throws Exception
- {
- // INPUT directory and suffix (used for FileFilter)
- String sInpDir = GpListener.obtainAtt(listenerConfig,FILE_INPUT_DIR,null);
- m_oInpDir = getFile(sInpDir);
- seeIfOkToWorkOnDir(m_oInpDir);
-
- m_sInpSfx = GpListener.obtainAtt(listenerConfig,FILE_INPUT_SFX,null);
- m_sInpSfx = m_sInpSfx.trim();
- if (m_sInpSfx.length()<1)
- throw new Exception ("Invalid "+FILE_INPUT_SFX+" attribute");
- m_oFFilt = new FileEndsWith(m_sInpSfx);
-
- // WORK suffix (will rename in input directory)
- m_sWrkSfx = GpListener.obtainAtt(listenerConfig,FILE_WORK_SFX,".esbWork").trim();
- if (m_sWrkSfx.length()<1)
- throw new Exception ("Invalid "+FILE_WORK_SFX+" attribute");
- if (m_sInpSfx.equals(m_sWrkSfx))
- throw new Exception("Work suffix must differ from input suffix <"+m_sWrkSfx+">");
-
- // ERROR directory and suffix (defaults to input dir and ".esbError" suffix)
- String sErrDir = GpListener.obtainAtt(listenerConfig,FILE_ERROR_DIR,sInpDir);
- m_oErrorDir = getFile(sErrDir);
- seeIfOkToWorkOnDir(m_oErrorDir);
-
- m_sErrSfx = GpListener.obtainAtt(listenerConfig,FILE_ERROR_SFX,".esbError").trim();
- if (m_sErrSfx.length()<1)
- throw new Exception ("Invalid "+FILE_ERROR_SFX+" attribute");
- if (m_oErrorDir.equals(m_oInpDir) && m_sInpSfx.equals(m_sErrSfx))
- throw new Exception("Error suffix must differ from input suffix <"+m_sErrSfx+">");
-
-
- // Do users wish to delete files that were processed OK ?
- String sPostDel = GpListener.obtainAtt(listenerConfig,FILE_POST_DEL,"false").trim();
- m_bPostDel = Boolean.parseBoolean(sPostDel);
- if (m_bPostDel)
- return;
-
- // POST (done) directory and suffix (defaults to input dir and ".esbDone" suffix)
- String sPostDir = GpListener.obtainAtt(listenerConfig,FILE_POST_DIR,sInpDir);
- m_oPostDir = getFile(sPostDir);
- seeIfOkToWorkOnDir(m_oPostDir);
- m_sPostSfx = GpListener.obtainAtt(listenerConfig,FILE_POST_SFX,".esbDone").trim();
- if (m_oPostDir.equals(m_oInpDir))
- { if (m_sPostSfx.length()<1)
- throw new Exception ("Invalid "+FILE_POST_SFX+" attribute");
- if (m_sPostSfx.equals(m_sInpSfx))
- throw new Exception("Post process suffix must differ from input suffix <"+m_sPostSfx+">");
- }
-
- } //________________________________
-
- private File getFile(String file) {
- try {
- return new File(new URI(file));
- } catch(Exception e) {
- return new File(file);
- }
- }
-
- protected void seeIfOkToWorkOnDir (File p_oDir) throws Exception
- {
- if (! p_oDir.exists())
- throw new Exception ("Directory "+p_oDir.toString()+" not found");
- if (!p_oDir.isDirectory())
- throw new Exception(p_oDir.toString()+" is not a directory");
- if (!p_oDir.canRead())
- throw new Exception("Can't read directory "+p_oDir.toString());
- if (! p_oDir.canWrite())
- throw new Exception ("Can't write/rename in directory "+p_oDir.toString());
- } //________________________________
-
-
- private class FileEndsWith implements FileFilter
- {
- String m_sSuffix;
- FileEndsWith(String p_sEnd) throws Exception
- {
- m_sSuffix = p_sEnd;
- if (Util.isNullString(m_sSuffix))
- throw new Exception("Must specify file extension");
- } //______________________________
-
- public boolean accept(File p_f)
- { return (p_f.isFile())
- ? p_f.toString().endsWith(m_sSuffix)
- : false;
- } //______________________________
- } //____________________________________________________
-
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#close()
- */
- @Override
- protected void close() {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingError(java.lang.Object, org.jboss.soa.esb.actions.ActionProcessor, java.lang.Throwable)
- */
- @Override
- protected void processingError(Object currentObject, ActionProcessor processor, Throwable error) {
-
- if (null!=currentObject)
- { WorkingFile workingFile = (WorkingFile) currentObject;
- workingFile.renameToError();
- }
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingComplete(java.lang.Object)
- */
- @Override
- protected void processingComplete(Object currentObject) {
- WorkingFile workingFile = (WorkingFile) currentObject;
-
- // Delete or rename the file...
- if (workingFile.postDelete) {
- workingFile.delete();
- } else {
- workingFile.renameToOutputFile();
- }
- }
-
- /**
- * Working file.
- * <p/>
- * Once the directory poller picks up on an input file, it immediately renames it to a working file
- * in order to avoid a situation where the file gets processed again.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
- public static class WorkingFile extends File {
- private static final long serialVersionUID = 1L;
-
- private boolean postDelete;
- public boolean isPostDelete() { return postDelete; }
-
- private File inputFile, errorFile, outputFile;
-
- public WorkingFile(String filename) {
- super(filename);
- }
-
- public WorkingFile(File parentFile, String filename) {
- super(parentFile, filename);
- }
-
- public boolean renameToError() {
- return renameTo(errorFile);
- }
-
- public boolean renameToOutputFile() {
- return renameTo(outputFile);
- }
-
- /**
- * Get the File instance representing the original input file.
- * @return Original input file.
- */
- public File getInputFile() {
- return inputFile;
- }
- }
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,660 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.command.CommandQueue;
-import org.jboss.internal.soa.esb.command.CommandQueueException;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.notification.NotificationList;
-import org.jboss.soa.esb.parameters.ParamRepositoryException;
-import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
-import org.jboss.soa.esb.services.NotificationHandlerFactory;
-import org.jboss.soa.esb.services.NotificationManager;
-import org.jboss.soa.esb.util.Util;
-import org.xml.sax.SAXException;
-
-/**
- * Controlling class that will launch listener child threads for supported
- * transport listener classes, as indicated in the configuration XML tree
- * pointed by arg[0]
- *
- * <p />
- * Can be launched as uppermost controller (it has a main(args) method)
- * <p />
- * Also implements Runnable, and can thus be launched in a child thread from an
- * upper controlling process
- * <p />
- * Listens on a JMS queue (with an optional message selector) for commands (e.g.
- * Quiesce, Reload Parameters, Set End Time, etc.)
- * <p />
- * Parameter reloading can also be set using the PARM_RELOAD_SECS attribute
- * <p />
- * End time for this instance can also be set using the PARM_END_TIME attribute
- * <p />
- *
- * @author Esteban
- *
- */
-public class GpListener implements Runnable {
-
- private static Logger m_oLogger = Logger.getLogger(GpListener.class);
-
- public static void main(String[] args) throws Exception {
- GpListener oProc = new GpListener(args[0]);
- oProc.run();
- GpListener.State oS = oProc.getState();
-
- if (null != oS.getException()) {
- m_oLogger.error("GpListener <" + args[0] + "> FAILED\n", oS
- .getException());
- }
- System.exit(oS.getCompletionCode());
- } // ________________________________
-
- protected int m_iDfltReloadMillis = 180000 // default interval between
- // parameter reloads
- ;
-
- public static final String PARM_RELOAD_SECS = "parameterReloadSecs";
- public static final String PARM_END_TIME = "endTime";
-
- // Attribute name that denotes listener class to be instantiated in a child
- // thread
- // This attribute is not in the root node but in first level child
- // DomElements
- public static final String PARM_LISTENER_CLASS = "listenerClass";
- public static final String PARM_ACTIONS = "actions";
- public static final String PARM_MAX_THREADS = "maxThreads";
- public static final String CHLD_EMAIL_PARMS = "EmailProperties";
-
- private String m_sParmsName;
- private DomElement m_oParms;
-
- private HashMap<String, Object> m_oAtts;
-
- /**
- * Obtain a shallow copy of needed atributes in this object's last loaded
- * parameter tree <p/>The local bject is cloned so child threads can use it
- * as they choose to without interfering with the environment
- * <p />
- * Listener processes controlled by this object should keep a reference to
- * this object at construction time, and not call this method again unless
- * they specifically need updated values. Parameter reload could have
- * happened since last call
- *
- * @return Map - a shallow copy of the attributes Map
- */
- @SuppressWarnings("unchecked")
- public Map<String, Object> getControllerAttributes() {
- return (Map<String, Object>) m_oAtts.clone();
- }
-
- private boolean m_bReloadRequested, m_bEndRequested;
-
- private long m_lNextReload = Long.MAX_VALUE;
-
- private long m_lEndTime = Long.MAX_VALUE;
-
- public static final SimpleDateFormat s_oDateParse = new SimpleDateFormat(
- "yyyyMMdd hh:mm:ss");
-
- private State m_oState = null;
-
- public State getState() {
- return m_oState;
- }
-
- public static enum State {
- Loading_parameters, Running, Shutting_down, Done_OK, Exception_thrown;
- int m_iCompletionCode = 0;
-
- Exception m_oException = null;
-
- public int getCompletionCode() {
- return m_iCompletionCode;
- };
-
- public Exception getException() {
- return m_oException;
- }
- };
-
- private CommandQueue commandQueue;
-
- private ActionDefinitionFactory actionDefinitionFactory;
-
- private static CommandQueue defaultCommandQueue = null;
-
- /**
- * Package pivate default constructor.
- */
- protected GpListener() {
- }
-
- /**
- * Construct a Listener Manager from the named repository based
- * configuration.
- *
- * @param p_sParameterName
- * Name of the Repository entry containing the configuration.
- * @throws Exception
- * Unable to load/use the named configuration.
- */
- public GpListener(String p_sParameterName) throws Exception {
- this(GpListener.getListenerConfig(p_sParameterName));
- m_sParmsName = p_sParameterName;
- }
-
- /**
- * Construct a Listener Manager using the specified listener configuration.
- *
- * @param config
- * The configuration.
- * @throws Exception
- * Unable to load/use the supplied configuration.
- */
- public GpListener(DomElement config) throws Exception {
- m_oParms = config;
- m_oState = State.Loading_parameters;
-
- try {
- checkParms(m_oParms);
- setEmailSystemProperties();
- } catch (Exception e) {
- String configSource = config.getAttr("configSource");
-
- m_oState = State.Exception_thrown;
- m_oState.m_oException = e;
- m_oLogger.fatal("Listener configuration and startup error. Config Source: "
- + (configSource != null ? configSource
- : "unknown"), e);
-
- throw e;
- }
- }
-
- /**
- * Load the named listener configuration from the configured parameter
- * repository.
- *
- * @param reposParam
- * The name of the repository entry containing the Listener
- * configuration.
- * @return Listener Configuration as {@link DomElement}.
- * @throws IOException
- * Unable to access the repository.
- * @throws ParamRepositoryException
- * Unable to access the configuration in the repository.
- * @throws SAXException
- * Unable to parse the configuration.
- */
- private static DomElement getListenerConfig(String reposParam)
- throws IOException, ParamRepositoryException, SAXException {
- String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
- DomElement config = DomElement.fromXml(sXml);
-
- config.setAttr("configSource", "param-repository:" + reposParam);
-
- return config;
- }
-
- /**
- * Check to see if all needed parameters are there, and assign default
- * values to some of them
- *
- * @param p_oP
- * DomElement - Where to look for the mandatory/optional
- * configuration attributes
- * @throws Exception -
- * If attributes are wrong or not enough for a proper runtime
- * configuration
- */
- public void checkParms(DomElement p_oP) throws Exception {
- // We've just loaded - set to false until next reload requested
- m_bReloadRequested = false;
- commandQueue = createCommandQueue(p_oP);
-
- // Open the command queue...
- if (null!=commandQueue)
- commandQueue.open(p_oP);
-
- // if PARM_RELOAD_SECS not set, and no command queue
- // then reload every 10 minutes
- // If there is a command queue, run until command is received
- String sRldSecs = p_oP.getAttr(PARM_RELOAD_SECS);
- m_lNextReload = (null != sRldSecs)
- ? System.currentTimeMillis() + 1000 * Long.parseLong(sRldSecs)
- : (null == commandQueue)
- ? Long.MAX_VALUE
- : System.currentTimeMillis() + m_iDfltReloadMillis;
-
- // if PARM_END_TIME not set try to run forever
- // not a good practice if command queue is not set
- // Expected date format is "yyyyMMdd hh:mm:ss"
- String sEndT = p_oP.getAttr(PARM_END_TIME);
- m_lEndTime = (null == sEndT) ? Long.MAX_VALUE : s_oDateParse.parse(
- sEndT).getTime();
-
- // Read and initialise the action definitions...
- DomElement actionConfig = p_oP.getFirstElementChild("Actions");
- if(actionConfig == null) {
- throw new ConfigurationException("No 'Actions' configuration.");
- }
- actionDefinitionFactory = new ActionDefinitionFactory(actionConfig);
-
- } // ________________________________
-
- /**
- * Factory method for creating the command queue.
- * @param config GpListener config.
- * @return GpListener CommandQueue instance.
- */
- private CommandQueue createCommandQueue(DomElement config) {
- String commandQueueClass = config.getAttr("command-queue-class");
-
- if(commandQueueClass != null) {
- try {
- return (CommandQueue) Class.forName(commandQueueClass).newInstance();
- } catch (Exception e) {
- m_oLogger.error("Failed to instantiate CommandQueue ["+ commandQueueClass + "]. Defaulting to no Command Queue", e);
- }
- }
-
- return defaultCommandQueue;
- }
-
- /**
- * Allows a default command queue to be set statically for all GpListener instances.
- * @param defaultCommandQueue The defaultCommandQueue to set.
- */
- public static void setDefaultCommandQueue(CommandQueue defaultCommandQueue) {
- GpListener.defaultCommandQueue = defaultCommandQueue;
- }
-
- /**
- * Main execution loop <p/> Will continue to run until either <p/>a) run
- * time is expired <p/>b) quiesce command is received in command queue
- * <p/>For every child element that contains a PARM_LISTENER_CLASS
- * attribute, this method will try to launch a child thread instantiating an
- * object of that class, and will call it's run() method <p/>Once all child
- * processes are trigered, the main thread will either <p/>1) wait for a
- * message in the command queue (if one was configured) until next reload or
- * end of run period expired <p/>or 2) Just sleep if there's no command
- * queue to listen on
- */
- public void run() {
- while (endNotRequested()) {
- m_oState = State.Running;
- for (DomElement oCurr : m_oParms.getAllElemChildren()) {
- String sClass = oCurr.getAttr(PARM_LISTENER_CLASS);
- if (Util.isNullString(sClass))
- continue;
- tryToLaunchChildListener(oCurr, sClass);
- }
-
- waitForCmdOrSleep();
-
- if (endRequested()) {
- break;
- }
- if (m_sParmsName != null && timeToReload()) {
- try {
- m_oState = State.Loading_parameters;
- m_oLogger
- .info("Reloading parameters _____________________________________________________");
- DomElement oNew = GpListener.getListenerConfig(m_sParmsName);
- checkParms(oNew);
- m_oParms = oNew;
- setEmailSystemProperties();
- } catch (Exception e) {
- m_oLogger.error("Failed to reload parameters"
- + " - Continuing with cached version", e);
- }
- }
- }
- // m_oState = State.Shutting_down;
-
- m_oState = State.Done_OK;
- m_oState.m_iCompletionCode = 0;
- m_oLogger
- .info("Finishing_____________________________________________________");
-
- // Close the command queue...
- try {
- commandQueue.close();
- } catch (CommandQueueException e) {
- m_oLogger.error("Error closing Command Queue.", e);
- }
- } // ________________________________
-
- private void tryToLaunchChildListener(DomElement p_oP, String p_sClassName) {
- try {
- Class oListener = Class.forName(p_sClassName);
- Constructor oConst = oListener.getConstructor(new Class[] {
- this.getClass(), DomElement.class, ActionDefinitionFactory.class });
- Runnable oRun = (Runnable) oConst.newInstance(new Object[] { this,
- p_oP, actionDefinitionFactory });
- new Thread(oRun).start();
- } catch (Exception e) {
- m_oLogger.error("Cannot launch <" + p_sClassName + ">\n", e);
- }
- } // ________________________________
-
- long millisToWait() {
- return Math.min(m_lNextReload, m_lEndTime) - System.currentTimeMillis();
- } // ________________________________
-
- private void waitForCmdOrSleep() {
- long lToGo = millisToWait();
-
- if (null == commandQueue) {
- m_oLogger.debug("About to sleep " + lToGo);
- // No command queue nor topic - Just sleep until time
- // exhausted, or thread interrupted
- try {
- if (lToGo > 0)
- Thread.sleep(lToGo);
- } catch (InterruptedException e) {
- m_lEndTime = 0; // mark as end requested and return
- }
- return;
- }
-
- // Wait for commands until time exhausted or command received
- // Note that received commands might change time variables (reload/end)
- // that's why time to go is recalculated on each cycle
- while ((lToGo = millisToWait()) > 0) {
- try {
- m_oLogger.info("Waiting for command ... timeout=" + lToGo + " millis");
-
- String oM = commandQueue.receiveCommand(lToGo);
- if (null == oM) {
- return;
- }
- processCommand(oM);
- if (endRequested() || timeToReload()) {
- break;
- }
- } catch (CommandQueueException eJ) {
- m_oLogger.info("receive on command queue failed", eJ);
- }
- }
- } // ________________________________
-
- /**
- * Processes the command that has been received in the command queue (or
- * topic) <p/>m_bEndRequested, m_bReloadRequested, and m_lEndTime could be
- * changed
- *
- * <p/> <p/><TABLE border="1"> <COLGROUP> <COL width="200"/> <COL
- * width="400"/> </COLGROUP>
- * <TR>
- * <TD align="center">message text</TD>
- * <TD align="center">effect</TD>
- * </TR>
- * <TR>
- * <TD>shutdown*</TD>
- * <TD>End time will be immediately set to 'now' - quiesce process will
- * start - Child threads will be allowed to finish normally</TD>
- * </TR>
- * <TR>
- * <TD>reload param*</TD>
- * <TD>Parameters will be immediately reloaded, and listener reconfigured
- * with new values</TD>
- * </TR>
- * <TR>
- * <TD>endTime yyyyMMdd hh:mm:ss</TD>
- * <TD>End time will be set to new value. If hh:mm:ss is not supplied =>
- * end of day assumed (23:59:59)</TD>
- * </TR>
- * </TABLE> * startsWith() <p/>
- *
- * @param p_oMsg
- * Message received from the command queue.
- *
- */
- private void processCommand(String sTxt) {
- if (null == sTxt)
- return;
-
- String sLow = sTxt.trim().toLowerCase();
- if (sLow.startsWith("shutdown")) {
- m_bEndRequested = true;
- m_oLogger.info("Shutdown has been requested");
- return;
- }
- if (sLow.startsWith("reload param")) {
- m_bReloadRequested = true;
- m_oLogger
- .info("Request for parameter reload has been received");
- return;
- }
- String[] sa = sLow.split("\\s+");
- if (sa.length > 1 && "endtime".equals(sa[0])) {
- try {
- String sDate = sa[1];
- String sTime = (sa.length < 3 || null == sa[2]) ? "23:59:59"
- : sa[2];
- Date oEnd = s_oDateParse.parse(sDate + " " + sTime);
- m_oLogger.info("New end date set to : " + oEnd);
- m_lEndTime = oEnd.getTime();
- } catch (Exception eDat) {
- m_oLogger.info("Problems with endTime command", eDat);
- }
- }
- } // ________________________________
-
- /**
- * Accessor to determine if execution time is expired or shutdown requested
- *
- * @return boolean if processing has to stop (all child threads will be
- * allowed to finish)
- */
- public boolean endRequested() {
- return m_bEndRequested || System.currentTimeMillis() >= m_lEndTime;
- }
-
- /**
- * Accessor to determine if execution time is not expired, and no shutdown
- * request received
- *
- * @return boolean - true if run time has not expired and quiesce has not
- * been requested
- */
- public boolean endNotRequested() {
- return !endRequested();
- }
-
- /**
- * Provide a common accessor to determine if parameters have to be reloaded
- * <p/> For child threads this means thread execution has to end
- * </p>
- * Child processes should only call this method when they are idle (as
- * opposed to in the middle of executing a unit of work)
- *
- * @return boolean - true if it's time to reload parameters
- */
- public boolean timeToReload() {
- return m_bReloadRequested
- || System.currentTimeMillis() >= m_lNextReload;
- }
-
- /**
- * Helper accessor for child processes that provides info to determine if
- * they can continue with yet another execution cycle
- *
- * @return boolean - true if runtime is not expired and not time yet to
- * reload parameters
- */
- public boolean continueLooping() {
- return (endNotRequested() && !timeToReload());
- } // ________________________________
-
- private static final String[] s_saMailProps = { Environment.SMTP_HOST,
- Environment.SMTP_USERNAME, Environment.SMTP_PASSWORD,
- Environment.SMTP_PORT, Environment.SMTP_FROM,
- Environment.SMTP_AUTH };
-
- private void setEmailSystemProperties() {
- DomElement oEmail = m_oParms.getFirstElementChild(CHLD_EMAIL_PARMS);
- if (null != oEmail)
- for (String sCurr : s_saMailProps) {
- String sProp = oEmail.getAttr(sCurr);
- if (null != sProp)
- ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).setProperty(sCurr, sProp);
- }
- } // ________________________________
-
- /**
- * Find an attribute in the tree (arg 0) or assign default value (arg 2)
- *
- * @param p_oP
- * DomElement - look for attributes in this Element only
- * @param p_sAtt
- * String - Name of attribute to find
- * @param p_sDefault
- * String -default value if requested attribute is not there
- * @return String - value of attribute, or default value (if null)
- * @throws Exception -
- * If requested attribute not found and no default value
- * supplied by invoker
- */
- public static String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
- throws ConfigurationException {
- String sVal = p_oP.getAttr(p_sAtt);
- if ((null == sVal) && (null == p_sDefault))
- throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
-
- return (null != sVal) ? sVal : p_sDefault;
- } // ________________________________
-
- /**
- * Find child nodes named "NotificationList" that contain an attribute
- * 'type' that starts with "ok" (case insensitive)
- *
- * @param p_oP -
- * DomElement to search for "NotificationList" child Elements
- * @param p_oSer
- * Serializable - Will constitute the body of the notification
- */
- public static void notifyOK(DomElement p_oP, Serializable p_oSer) {
- if(p_oSer == null) {
- return;
- }
-
- try {
- Serializable oNotif = p_oSer;
- for (DomElement oCurr : p_oP
- .getElementChildren(NotificationList.ELEMENT)) {
- NotificationList oNL = new NotificationList(oCurr);
- if (!oNL.isOK())
- continue;
- getNotifHandler().sendNotifications(oCurr, oNotif);
- }
- } catch (Exception e) {
- }
- } // __________________________________
-
- /**
- * Find child nodes named "NotificationList" that contain an attribute
- * 'type' that starts with "err" (case insensitive) or no 'type' attribute
- * set
- *
- * @param p_oP -
- * DomElement to search for "NotificationList" child Elements
- * @param p_e -
- * Exception if not null, will be appended to the body
- * @param p_oSer
- * Serializable - Will be included at the beginning of the body
- * of the notification
- */
- public static void notifyError(DomElement p_oP, Exception p_e, Serializable p_oSer) {
- if(p_oSer == null) {
- return;
- }
-
- Serializable oNotif = p_oSer;
- ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try {
- oPS.println(oNotif.toString());
- if (null != p_e)
- p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- for (DomElement oCurr : p_oP
- .getElementChildren(NotificationList.ELEMENT)) {
- NotificationList oNL = new NotificationList(oCurr);
- if (!oNL.isErr())
- continue;
- getNotifHandler().sendNotifications(oNL, sMsg);
- }
- } catch (Exception e) {
- }
- } // ________________________________
-
- private static NotificationManager s_oNH;
-
- private static final Object s_oSync = new Integer(0);
-
- /**
- * Lazy instantiator of a InotificationHandler
- *
- * @return - a reference to an implementation of the interface or null if it
- * can't be instantiated
- */
- protected static NotificationManager getNotifHandler() {
- if (null != s_oNH)
- return s_oNH;
- synchronized (s_oSync) {
- if (null == s_oNH)
- try {
- s_oNH = NotificationHandlerFactory.getNotifHandler(
- "remote", Configuration.getJndiServerType(),
- Configuration.getJndiServerURL());
- } catch (Exception e) {
- Logger.getLogger(GpListener.class).error(
- "Notification FAILED", e);
- }
- }
- return s_oNH;
- } // ______________________________
-
-} // ____________________________________________________________________________
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,187 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.jms.TopicSession;
-import javax.naming.Context;
-
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.helpers.DomElement;
-
-public class JmsQueueListener extends AbstractListener {
-
- public static final String LISTEN_QUEUE_CONN_FACT = "queueConnFactoryClass";
- public static final String LISTEN_JNDI_TYPE = "listenJndiType";
- public static final String LISTEN_JNDI_URL = "listenJndiURL";
- public static final String LISTEN_QUEUE = "listenQueue";
- public static final String LISTEN_MSG_SELECTOR = "listenMsgSelector";
-
- protected boolean m_bError = false;
- protected QueueConnection m_oQconn;
- protected QueueSession m_oQsess;
- protected Queue m_oQueue;
- protected String m_sSelector;
-
- protected MessageConsumer jmsMessageReceiver;
-
-
- public JmsQueueListener(GpListener commandListener, DomElement listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
- super(commandListener, listenerConfig, actionDefinitionFactory);
- checkMyParms();
- } // __________________________________
-
- /**
- * Check for mandatory and optional attributes in parameter tree
- *
- * @throws Exception -
- * if mandatory atts are not right or actionClass not in
- * classpath
- */
- protected void checkMyParms() throws Exception {
- // Third arg is null - Exception will br thrown if listenQueue is not
- // found
- String sQueue = GpListener.obtainAtt(listenerConfig, LISTEN_QUEUE, null);
-
- // No problem if selector is null - everything in queue will be returned
- m_sSelector = listenerConfig.getAttr(LISTEN_MSG_SELECTOR);
-
- m_oQconn = null;
- m_oQsess = null;
- m_oQueue = null;
-
- String sJndiType = GpListener.obtainAtt(listenerConfig, LISTEN_JNDI_TYPE,
- "jboss");
- String sJndiURL = GpListener.obtainAtt(listenerConfig, LISTEN_JNDI_URL,
- "localhost");
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,
- sJndiURL);
-
- String sFactClass = GpListener.obtainAtt(listenerConfig,
- LISTEN_QUEUE_CONN_FACT, "ConnectionFactory");
- Object tmp = oJndiCtx.lookup(sFactClass);
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
-
- m_oQconn = qcf.createQueueConnection();
- m_oQueue = (Queue) oJndiCtx.lookup(sQueue);
- m_oQsess = m_oQconn.createQueueSession(false,
- TopicSession.AUTO_ACKNOWLEDGE);
- m_oQconn.start();
- jmsMessageReceiver = m_oQsess.createReceiver(m_oQueue, m_sSelector);
-
- } // ________________________________
-
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#receive()
- */
- @Override
- protected Object[] receive() {
- while (m_oDad.continueLooping()) {
- Message jmsMessage = null;
- try {
- jmsMessage = jmsMessageReceiver.receive(m_oDad.millisToWait());
- } catch (JMSException oJ) {
- logger.error("JMS error on receive. Attempting JMS Destination reconnect.", oJ);
- for (int i1 = 0; i1 < 3; i1++)
- try {
- checkMyParms();
- } // try to reconnect to the queue
- catch (Exception e) {
- logger.error("Reconnecting to Queue", e);
- try {
- Thread.sleep(m_iSleepForThreads);
- } catch (InterruptedException e1) { // Just return
- logger.error("Unexpected thread interupt exception.", e);
- return null;
- }
- }
- }
- if (null == jmsMessage) {
- // REVIEW: Can this really happen i.e. the JMS
- continue;
- }
-
- if (jmsMessage instanceof ObjectMessage) {
- try {
- return new Object[] {((ObjectMessage)jmsMessage).getObject()};
- } catch (JMSException e) {
- logger.error("Failed to read Serialized Object from JMS message.", e);
- }
- } else if (jmsMessage instanceof TextMessage) {
- try {
- return new Object[] {((TextMessage)jmsMessage).getText()};
- } catch (JMSException e) {
- logger.error("Failed to read Serialized Object from JMS message.", e);
- }
- } else {
- logger.error("Unsupported JMS message type: " + jmsMessage.getClass().getName());
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#close()
- */
- @Override
- protected void close() {
- if (null != m_oQsess) {
- try {
- m_oQsess.close();
- } catch (Exception e1) {/* Tried my best - Just continue */
- }
- }
- if (null != m_oQconn) {
- try {
- m_oQconn.close();
- } catch (Exception e2) {/* Tried my best - Just continue */
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingError(java.lang.Object, org.jboss.soa.esb.actions.ActionProcessor, java.lang.Throwable)
- */
- @Override
- protected void processingError(Object initialMessage, ActionProcessor processor, Throwable error) {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingComplete(java.lang.Object)
- */
- @Override
- protected void processingComplete(Object initialMessage) {
- }
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/RemoteDirectoryPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/RemoteDirectoryPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/RemoteDirectoryPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,284 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.listeners;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.util.FtpClientUtil;
-import org.jboss.soa.esb.util.Util;
-
-public class RemoteDirectoryPoller extends AbstractPoller
-{
- public static final String FILE_INPUT_DIR = "inputDir";
- public static final String FILE_INPUT_SFX = "inputSuffix";
- public static final String FILE_WORK_SFX = "workSuffix";
- public static final String FILE_ERROR_DIR = "errorDir";
- public static final String FILE_ERROR_SFX = "errorSuffix";
- public static final String FILE_POST_DIR = "postDir";
- public static final String FILE_POST_SFX = "postSuffix";
- public static final String FILE_POST_DEL = "postDelete";
-
- private DomElement _params;
- private Logger _logger = Logger.getLogger(this.getClass());
- FtpClientUtil _ftpClient;
-
- public RemoteDirectoryPoller(GpListener p_oDad, DomElement p_oParms,ActionDefinitionFactory actionDF)
- throws Exception
- {
- super(p_oDad,p_oParms,actionDF);
- _params = p_oParms;
- checkMyParms();
- } //__________________________________
-
-
- protected File m_oInpDir ,m_oErrorDir ,m_oPostDir;
- protected String m_sInpSfx ,m_sWrkSfx ,m_sErrSfx ,m_sPostSfx;
- protected boolean m_bPostDel;
- private List <KeyValuePair> m_ftpProps = new ArrayList<KeyValuePair>();
-
- /**
- *
- * @param p_o Object - Must be a File representing the file that has to be processed
- * @return Object - an instance of the internal WorkingFile class
- */
- @Override
- public Object preProcess(Object p_o)
- {
- if (!(p_o instanceof File))
- return null;
- File oF = (File)p_o;
- WorkingFile oCurr = new WorkingFile(oF,m_sWrkSfx,m_bPostDel);
- oCurr.errorFile = new File (m_oErrorDir ,oF.getName()+m_sErrSfx);
- oCurr.outputFile = new File (m_oPostDir ,oF.getName()+m_sPostSfx);
- oCurr.setFtpProps(m_ftpProps);
-
- try
- {
- _ftpClient = new FtpClientUtil(_params,true);
- _ftpClient.remoteRename(oF,oCurr);
- }
- catch (Exception e)
- {
- _logger.error("Can't FTP rename",e);
- return null;
- }
- finally
- {
- if (null!=_ftpClient)
- _ftpClient.quit();
- _ftpClient = null;
- }
-
- return oCurr;
- } //________________________________
-
- @Override
- protected List<Object> pollForCandidates()
- {
- List<Object> oRet = new ArrayList<Object>();
- FtpClientUtil _ftpClient = null;
- try
- {
- _ftpClient = new FtpClientUtil(_params,true);
- _ftpClient.setRemoteDir(FtpClientUtil.fileToFtpString(m_oInpDir));
- String[] sa = _ftpClient.getFileListFromRemoteDir(m_sInpSfx);
- if (null!=sa)
- for (String sCurr : sa)
- oRet.add(new File(m_oInpDir,sCurr));
- }
- catch (Exception e)
- {
- _logger.error("Problems with FTP",e);
- }
- finally
- {
- if (null!=_ftpClient)
- _ftpClient.quit();
- _ftpClient = null;
- }
- return oRet;
-
- } //________________________________
-
- protected void checkMyParms() throws Exception
- {
- // INPUT directory and suffix (used for FileFilter)
- String sInpDir = GpListener.obtainAtt(_params,FILE_INPUT_DIR,null);
- m_oInpDir = new File(sInpDir);
-
- m_sInpSfx = GpListener.obtainAtt(_params,FILE_INPUT_SFX,null);
- m_sInpSfx = m_sInpSfx.trim();
- if (m_sInpSfx.length()<1)
- throw new Exception ("Invalid "+FILE_INPUT_SFX+" attribute");
-
- // WORK suffix (will rename in input directory)
- m_sWrkSfx = GpListener.obtainAtt(_params,FILE_WORK_SFX,".esbWork").trim();
- if (m_sWrkSfx.length()<1)
- throw new Exception ("Invalid "+FILE_WORK_SFX+" attribute");
- if (m_sInpSfx.equals(m_sWrkSfx))
- throw new Exception("Work suffix must differ from input suffix <"+m_sWrkSfx+">");
-
- // ERROR directory and suffix (defaults to input dir and ".esbError" suffix)
- String sErrDir = GpListener.obtainAtt(_params,FILE_ERROR_DIR,sInpDir);
- m_oErrorDir = new File(sErrDir);
-
- m_sErrSfx = GpListener.obtainAtt(_params,FILE_ERROR_SFX,".esbError").trim();
- if (m_sErrSfx.length()<1)
- throw new Exception ("Invalid "+FILE_ERROR_SFX+" attribute");
- if (m_oErrorDir.equals(m_oInpDir) && m_sInpSfx.equals(m_sErrSfx))
- throw new Exception("Error suffix must differ from input suffix <"+m_sErrSfx+">");
-
-
- // Do users wish to delete files that were processed OK ?
- String sPostDel = GpListener.obtainAtt(_params,FILE_POST_DEL,"false").trim();
- m_bPostDel = Boolean.parseBoolean(sPostDel);
- if (m_bPostDel)
- return;
-
- // POST (done) directory and suffix (defaults to input dir and ".esbDone" suffix)
- String sPostDir = GpListener.obtainAtt(_params,FILE_POST_DIR,sInpDir);
- m_oPostDir = new File(sPostDir);
- m_sPostSfx = GpListener.obtainAtt(_params,FILE_POST_SFX,".esbDone").trim();
- if (m_oPostDir.equals(m_oInpDir))
- { if (m_sPostSfx.length()<1)
- throw new Exception ("Invalid "+FILE_POST_SFX+" attribute");
- if (m_sPostSfx.equals(m_sInpSfx))
- throw new Exception("Post process suffix must differ from input suffix <"+m_sPostSfx+">");
- }
-
-
- FtpClientUtil _ftpClient = new FtpClientUtil(_params,false);
- _ftpClient.quit();
-
- // Copy FTP parameters to be passed to the action class (inside the WorkingFile class)
- // This is a kludge - we have to get back to this (ES)
- String[] sa = new String[]
- {FtpClientUtil.PARMS_FTP_SERVER
- ,FtpClientUtil.PARMS_USER
- ,FtpClientUtil.PARMS_PASSWD
- ,FtpClientUtil.PARMS_PASSIVE
- ,FtpClientUtil.PARMS_PORT
- };
- for (String sProp : sa)
- {
- String sVal = _params.getAttr(sProp);
- if (!Util.isNullString(sVal))
- m_ftpProps.add(new KeyValuePair(sProp,sVal));
- }
-
- } //________________________________
-
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#close()
- */
- @Override
- protected void close() { }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingError(java.lang.Object, org.jboss.soa.esb.actions.ActionProcessor, java.lang.Throwable)
- */
- @Override
- protected void processingError(Object initialMessage, ActionProcessor processor, Throwable error)
- {
- @SuppressWarnings("unused")
- WorkingFile workingFile = (WorkingFile) initialMessage;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingComplete(java.lang.Object)
- */
- @Override
- protected void processingComplete(Object initialMessage)
- {
- @SuppressWarnings("unused")
- WorkingFile workingFile = (WorkingFile) initialMessage;
- }
-
- /**
- * Working file.
- * <p/>
- * Once the remote directory poller picks up on an input file, it immediately tries to rename
- * it to a working file in order to avoid a situation where the file gets processed again.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
- public static class WorkingFile extends File
- {
- private static final long serialVersionUID = 1L;
-
- private boolean postDelete;
- private File inputFile, errorFile, outputFile;
- private List <KeyValuePair> ftpProps;
- public void setFtpProps(List <KeyValuePair>props) {ftpProps = props; }
- public List <KeyValuePair >getFtpProps() {return ftpProps; }
-
- private WorkingFile(File pFile,String pWrkSfx, boolean pPostDelete)
- {
- super(pFile.getParentFile(), pFile.getName() + pWrkSfx);
- inputFile = pFile;
- }
- /**
- * Get the File instance representing the original input file.
- * @return Original input file.
- */
- public File getInputFile() { return inputFile; }
- /**
- * is this working file to be deleted after successful processing ?
- * @return boolean - true if this file can be deleted
- */
- public boolean isPostDelete() { return postDelete; }
-
- public boolean localRenameToInput() { return super.renameTo(inputFile); }
- public void remoteRenameToInput(FtpClientUtil util) throws Exception
- {
- util.remoteRename(this,inputFile);
- }
-
- public boolean localRenameToError() { return super.renameTo(errorFile); }
- public void remoteRenameToError(FtpClientUtil util) throws Exception
- {
- util.remoteRename(this,errorFile);
- }
-
- public boolean localRenameToOutput() { return renameTo(outputFile); }
- public void remoteRenameToOutput(FtpClientUtil util) throws Exception
- {
- util.remoteRename(this,outputFile);
- }
-
- public boolean localDelete() {return delete(); }
- public void remoteDelete(FtpClientUtil util) throws Exception
- {util.deleteRemoteFile(this.toString()); }
-
- }
-} //____________________________________________________________________________
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,505 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.listeners;
-
-import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.sql.DataSource;
-
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
-import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
-import org.jboss.soa.esb.util.Util;
-
-/**
- * SqlTablePoller class
- *
- * The SQL table that is polled should have
- * 1) a unique key (see "keyFields" parameter) that will be used to update status
- * 2) a column to indicate the "processing status" of this trigger row (see ROW_STATE enum)
- *
- * Each retrieved row (see OPTIONAL_ATT.whereCondition) should be considered as a trigger
- * that is intended to instantiate an object of "actionClass". The new instance will
- * receive the full DomElement (level 1 for each child group)
- *
- * @author Esteban Schifman
- */
-public class SqlTablePoller extends AbstractPoller
-{
-/* ___________________ Example XML configuration file for a SqlTablePoller_______________
- *
-<DocumentElementName>
- <ExampleListenChapter
- maxThreads="2"
- listenerClass="org.jboss.soa.esb.listeners.SqlTablePoller"
- actionClass="org.jboss.soa.esb.actions.templates.MockSqlRowAction"
-
- driver-class="org.postgresql.Driver"
- connection-url="jdbc:postgresql://myhost:5432/myDB"
- user-name="postgres"
- password=""
-
- tableName="test_notif_table"
- selectFields="oid,ref,msg"
- keyFields="oid,ref"
- inProcessField="statusCol"
- whereCondition="src='pepe'"
- orderBy="oid desc"
- >
- <NotificationList type="OK">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifOK"
- append="true"
- />
- </target>
- </NotificationList>
-
- <NotificationList type="err">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifErr"
- append="true"
- />
- </target>
- </NotificationList>
- </ExampleListenChapter>
-</DocumentElementName>
- *
- */
-
- /**
- * Mandatory attributes needed for SqlTablePoller
- * 1) Table name
- * 2) Comma separated list of fields needed in the ResultSet
- * 3) Comma separated list of fields that constitute a unique ID of the working row
- * all fields in this list MUST also be in the "selectFields" list
- * these fields will be used in the "where" clause of update statements
- * 4) Name of table field used as indicator/semaphore to avoid concurrent update
- *
- */
- public static enum TABLE_ATT
- {
- tableName
- ,selectFields
- ,keyFields
- ,inProcessField
- };
-
- /**
- * Optional fields that can be included in your parameter tree as attributes in the
- * upper Element
- * 1) 4 character long String that indicate status of each row for this poller
- * 1st: Character that indicates "Pending" state = available for processing
- * 2nd: "Working" : some poller is working on the row (or ab-ended while working)
- * 3rd: "Error" : some poller tried to process, and found an error during processing
- * 4th: "Done" : this row has already been processed successfully
- * 2) if you wish to further filter your ResultSet, you can add an optional list of
- * conditions that will be included in the "scan" SQL statement (without "where")
- * 3) Comma separated list of fields to order ResultSet (without "order by")
- *
- */
- public static enum OPTIONAL_ATT
- {
- inProcessVals
- ,whereCondition
- ,orderBy
- };
-
- /**
- * First character of these values are the default states of a table row trigger
- * the "inProcessVals" parameter can override these (if that were ever necessary)
- * this is why the default value for that parameter is "PWED" (see below)
- * The poller will only process rows that have the "inProcessField" first character
- * equal to the first character of whatever the "Pending" state is (typically "P")
- *
- */
- public static enum ROW_STATE
- {Pending
- ,Working
- ,Error
- ,Done
- };
- public static final String DEFAULT_STATES = "PWED";
-
- protected Map<String,String> m_oVals = new HashMap<String,String>();
- protected String[] m_saCols ,m_saKeys;
- protected String m_sUpdStates;
-
- /**
- * In this constructor you can override default values for the following protected base class values:
- * <br/>
- * <p/>m_iMinPollMillis : minimum polling interval (default 3000)
- * <br/>m_iDfltPollMillis : default polling interval (default 20000)
- * <br/>m_iSleepForThreads : how long to sleep if all configured threads are in use (default 3000)
- * <br/>m_iUpperThreadLimit : max number of threads allowed (default 10)
- * @param p_oDad GpListener - The controlling process
- * @param p_oParms DomElement - Sub tree that corresponds to this instance
- * @throws Exception
- */
- public SqlTablePoller(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
- {
- super(p_oDad, p_oParms, actionDefinitionFactory);
- try { checkMyParms(); }
- catch (Exception e)
- {
- logger.error("checkMyParms() FAILED",e);
- throw e;
- }
- } //__________________________________
-
- private void checkAndStoreAtt(DomElement p_oP, String p_sName, String p_sDflt)
- throws Exception
- {
- m_oVals.put(p_sName,GpListener.obtainAtt(p_oP,p_sName,p_sDflt));
- } //________________________________
-
- protected void checkMyParms() throws Exception
- {
- checkAndStoreAtt(listenerConfig,SimpleDataSource.DRIVER ,null);
- checkAndStoreAtt(listenerConfig,SimpleDataSource.URL ,null);
- checkAndStoreAtt(listenerConfig,SimpleDataSource.USER ,"");
- checkAndStoreAtt(listenerConfig,SimpleDataSource.PASSWORD ,"");
-
- for (TABLE_ATT oCurr : TABLE_ATT.values())
- checkAndStoreAtt(listenerConfig,oCurr.toString(),null);
-
- checkAndStoreAtt(listenerConfig,OPTIONAL_ATT.whereCondition.toString(),"");
- checkAndStoreAtt(listenerConfig,OPTIONAL_ATT.orderBy.toString(),"");
-
- String sAtt = OPTIONAL_ATT.inProcessVals.toString();
- checkAndStoreAtt(listenerConfig,sAtt,DEFAULT_STATES);
- m_sUpdStates = m_oVals.get(sAtt);
- if (m_sUpdStates.length()<4)
- throw new Exception("Parameter <"+sAtt+"> must be at least 4 characters long (PWED)");
-
- StringTokenizer ST = new StringTokenizer
- (m_oVals.get(TABLE_ATT.selectFields.toString()),",");
- m_saCols = new String[ST.countTokens()];
- Set<String> oSelFlds = new HashSet<String>();
- int iCurr = 0;
- while (ST.hasMoreElements())
- {
- String sColName = ST.nextToken().trim();
- m_saCols[iCurr++] = sColName;
- oSelFlds.add(sColName);
- }
-
- ST = new StringTokenizer
- (m_oVals.get(TABLE_ATT.keyFields.toString()),",");
- m_saKeys = new String[ST.countTokens()];
- if (m_saKeys.length < 1)
- throw new Exception("Empty list of keyFields");
-
- for (iCurr = 0; ST.hasMoreTokens(); iCurr++)
- { String sKeyCol = ST.nextToken().trim();
- if (! oSelFlds.contains(sKeyCol))
- throw new Exception("Key field <"+ sKeyCol + "> must also be in select list");
- m_saKeys[iCurr] = sKeyCol;
- }
-
- } //________________________________
-
- @Override
- protected Object preProcess(Object p_o)
- {
- return p_o;
- } //________________________________
-
- @SuppressWarnings("unchecked")
- @Override
- protected List<Object> pollForCandidates()
- {
- String sSel4U = selectForUpdStatement();
- String sUpdStmt = updateStatement();
- JdbcCleanConn oConn = null;
- List<Object> oResults = new ArrayList<Object>();
- try
- {
- oConn = newDbConn();
- String sScan = scanStatement();
-
- PreparedStatement PS = oConn.prepareStatement(sScan);
- ResultSet RS = oConn.execQueryWait(PS,1);
- while (RS.next()) {
- SQLPollResult rowParams = new SQLPollResult(sSel4U, sUpdStmt);
- int iCurr = 0;
-
- for (String sColName : m_saCols) {
- rowParams.put(sColName,RS.getObject(++iCurr));
- }
-
- // Set up the parameter object for the SqlRowAction
- rowParams.sUpdStates = m_sUpdStates;
- rowParams.saKeys = m_saKeys;
- rowParams.sSel4Upd = sSel4U;
- rowParams.sUpdate = sUpdStmt;
-
- // Mark the row as "working"...
- rowParams.changeStatusToWorking();
-
- oResults.add(rowParams);
- }
- }
- catch (Exception e)
- {
- logger.warn("Some triggers might not have been returned",e);
- }
- finally
- {
- if (null!=oConn)
- oConn.release();
- }
-
- logger.info("Returning " + oResults.size() + " rows.");
- return oResults;
- } //________________________________
-
- /**
- * Obtain a new database connection with parameter info
- * @return A new connection
- * @throws Exception - if problems are encountered
- */
- protected JdbcCleanConn newDbConn() throws Exception
- { DataSource oDS = new SimpleDataSource
- (m_oVals.get(SimpleDataSource.DRIVER)
- ,m_oVals.get(SimpleDataSource.URL)
- ,m_oVals.get(SimpleDataSource.USER)
- ,m_oVals.get(SimpleDataSource.PASSWORD)
- );
- return new JdbcCleanConn(oDS);
- } //________________________________
-
- /**
- * Assemble the SQL statement to scan (poll) the table
- * @return - The resulting SQL statement
- */
- protected String scanStatement()
- {
- StringBuilder sb = new StringBuilder ()
- .append("select ").append(m_oVals.get(TABLE_ATT.selectFields.toString()))
- .append(" from ") .append(m_oVals.get(TABLE_ATT.tableName.toString()));
-
- String sAux = m_oVals.get(OPTIONAL_ATT.whereCondition.toString());
- boolean bWhere = ! Util.isNullString(sAux);
- if (bWhere)
- sb.append(" where ").append(sAux);
- sb.append((bWhere) ? " and " : " where ");
-
- String sLike = m_oVals.get(OPTIONAL_ATT.inProcessVals.toString())
- .substring(0,1).toUpperCase();
- sb.append(" upper(").append(m_oVals.get(TABLE_ATT.inProcessField.toString()))
- .append(") like '").append(sLike).append("%'");
-
-
- sAux = m_oVals.get(OPTIONAL_ATT.orderBy);
- if (! Util.isNullString(sAux))
- sb.append(" order by ").append(sAux);
- return sb.toString();
- } //________________________________
-
- /**
- * Assemble the SQL statement to update the field
- * in the "inProcessField" parameter
- *
- * in the table row uniquely identified by the list of fields
- * in the "keyFields" parameter
- *
- * @return - The resulting SQL statement
- */
- protected String updateStatement()
- {
- StringBuilder sb = new StringBuilder ()
- .append("update ").append(m_oVals.get(TABLE_ATT.tableName.toString()))
- .append(" set ") .append(m_oVals.get(TABLE_ATT.inProcessField.toString()))
- .append(" = ? where ")
- ;
- int iCurr = 0;
- for(String sCurr : m_saKeys)
- { if (iCurr++ > 0)
- sb.append(" and ");
- sb.append(sCurr).append(" = ?");
- }
- return sb.toString();
- } //________________________________
-
- /**
- * Assemble the SQL "select for update" statement
- * for the "inProcessField" parameter
- *
- * in the table row uniquely identified by the list of fields
- * in the "keyFields" parameter
- *
- * @return - The resulting SQL statement
- */
- protected String selectForUpdStatement()
- {
- StringBuilder sb = new StringBuilder ()
- .append("select ").append(m_oVals.get(TABLE_ATT.inProcessField.toString()))
- .append(" from ") .append(m_oVals.get(TABLE_ATT.tableName.toString()))
- .append(" where ")
- ;
- int iCurr = 0;
- for(String sCurr : m_saKeys)
- { if (iCurr++ > 0)
- sb.append(" and ");
- sb.append(sCurr).append(" = ?");
- }
- return sb.append(" for update").toString();
- } //________________________________
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#close()
- */
- @Override
- protected void close() {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingError(java.lang.Object, org.jboss.soa.esb.actions.ActionProcessor, java.lang.Throwable)
- */
- @Override
- protected void processingError(Object initialMessage, ActionProcessor processor, Throwable error) {
- // Mark the row as "error"...
- ((SQLPollResult)initialMessage).changeStatusToError();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#processingComplete(java.lang.Object)
- */
- @Override
- protected void processingComplete(Object initialMessage) {
- // Mark the row as "working"...
- ((SQLPollResult)initialMessage).changeStatusToDone();
- }
-
- private class SQLPollResult extends LinkedHashMap implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String sUpdStates;
-
- private String[] saKeys;
-
- private String sSel4Upd, sUpdate;
-
- private SQLPollResult(String sSel4Upd, String sUpdate) throws Exception {
- this.sSel4Upd = sSel4Upd;
- this.sUpdate = sUpdate;
- }
-
- private String getStatus(ROW_STATE p_oState) {
- int iPos = p_oState.ordinal();
- return sUpdStates.substring(iPos, ++iPos);
- }
-
- private boolean changeStatusToWorking() {
- return changeStatus(ROW_STATE.Pending, ROW_STATE.Working);
- }
-
- private boolean changeStatusToDone() {
- return changeStatus(ROW_STATE.Working, ROW_STATE.Done);
- }
-
- private boolean changeStatusToError() {
- return changeStatus(ROW_STATE.Working, ROW_STATE.Error);
- }
-
- private boolean changeStatus(ROW_STATE fromState, ROW_STATE toState) {
- JdbcCleanConn dbConnection = null;
-
- try {
- // This is expensive at the moment but will be OK once we get proper connection pooling enabled!
- dbConnection = newDbConn();
- } catch (Exception e) {
- logger.error("Unable to get DB connection.", e);
- throw new IllegalStateException("Unable to get DB connection.", e);
- }
-
- try {
- PreparedStatement m_PSsel4U;
- PreparedStatement m_PSupd;
-
- m_PSsel4U = dbConnection.prepareStatement(sSel4Upd);
- m_PSupd = dbConnection.prepareStatement(sUpdate);
-
- int iParm=1;
- for (String sColName : saKeys) {
- Object oVal = get(sColName);
- m_PSsel4U.setObject (iParm ,oVal);
- // parameters are +1 in update statement
- // autoincrement leaves things ready for next SQL parameter
- m_PSupd.setObject (++iParm,oVal);
- }
-
- try {
- ResultSet resultSet = dbConnection.execQueryWait(m_PSsel4U, 5);
-
- if (resultSet.next()) {
- String sOldStatus = resultSet.getString(1).substring(0, 1);
-
- if (sOldStatus.equalsIgnoreCase(getStatus(fromState))) {
- m_PSupd.setString(1, getStatus(toState));
- dbConnection.execUpdWait(m_PSupd, 5);
- dbConnection.commit();
-
- if(logger.isDebugEnabled()) {
- logger.debug("Successfully changed row state from " + fromState + " to " + toState + ".");
- }
-
- return true;
- } else {
- logger.warn("Cannot change row state from " + fromState + " to " + toState + ". Row not in state " + fromState);
- return false;
- }
- }
- logger.error("Row status change to " + toState + " has failed. Rolling back!!");
- } catch(Exception e) {
- logger.error("Row status change to " + toState + " has failed. Rolling back!!", e);
- }
-
- try {
- dbConnection.rollback();
- } catch (Exception e) {
- logger.error("Unable to rollback row status change to " + fromState.name(), e);
- }
- } catch (Exception e) {
- logger.error("Unexpected exception.", e);
- } finally {
- dbConnection.release();
- }
-
- return false;
- }
- }
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,549 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners.gateway;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.command.CommandQueue;
-import org.jboss.internal.soa.esb.command.CommandQueueException;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.util.EPRManager;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.parameters.ParamRepositoryException;
-import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
-import org.jboss.soa.esb.util.Util;
-import org.xml.sax.SAXException;
-
-import com.arjuna.common.util.propertyservice.PropertyManager;
-
-public class GatewayListenerController implements Runnable
-{
-
- public static void main(String[] args) throws Exception
- {
- GatewayListenerController oProc = new GatewayListenerController(args[0]);
- oProc.run();
- GatewayListenerController.State oS = oProc.getState();
-
- if (null != oS.getException()) {
- _logger.error("GatewayListener <" + args[0] + "> FAILED\n", oS
- .getException());
- }
- System.exit(oS.getCompletionCode());
- } // ________________________________
-
- public static final String RELOAD_SECONDS_TAG = "parameterReloadSecs";
- public static final String END_TIME_TAG = "endTime";
-
- // Attribute name that denotes listener class to be instantiated in a child thread
- // This attribute is not in the root node but in first level child ConfigTrees
- public static final String GATEWAY_CLASS_TAG = "gatewayClass";
-
- /**
- * Obtain a shallow copy of needed atributes in this object's last loaded
- * parameter tree <p/>The local bject is cloned so child threads can use it
- * as they choose to without interfering with the environment
- * <p />
- * Listener processes controlled by this object should keep a reference to
- * this object at construction time, and not call this method again unless
- * they specifically need updated values. Parameter reload could have
- * happened since last call
- *
- * @return Map - a shallow copy of the attributes Map
- */
- @SuppressWarnings("unchecked")
- public Map<String, Object> getControllerAttributes()
- {
- return (Map<String, Object>) _attributes.clone();
- }
-
- public State getState() { return _status; }
-
- public static enum State
- {
- Loading_parameters, Running, Shutting_down, Done_OK, Exception_thrown;
- int m_iCompletionCode = 0;
-
- Exception m_oException = null;
-
- public int getCompletionCode() {
- return m_iCompletionCode;
- };
-
- public Exception getException() {
- return m_oException;
- }
- };
-
- private ActionDefinitionFactory actionDefinitionFactory;
-
- /**
- * Package pivate default constructor.
- */
- protected GatewayListenerController() { }
-
- /**
- * Construct a Listener Manager from the named repository based
- * configuration.
- *
- * @param p_sParameterName
- * Name of the Repository entry containing the configuration.
- * @throws Exception
- * Unable to load/use the named configuration.
- */
- public GatewayListenerController(String p_sParameterName) throws Exception {
- this(GatewayListenerController.getListenerConfig(p_sParameterName));
- _sParametersName = p_sParameterName;
- }
-
- /**
- * Construct a Listener Manager using the specified listener configuration.
- *
- * @param config
- * The configuration.
- * @throws Exception
- * Unable to load/use the supplied configuration.
- */
- public GatewayListenerController(ConfigTree config) throws Exception {
- _config = config;
- _status = State.Loading_parameters;
-
- try { checkParms(_config); }
- catch (Exception e)
- {
- String configSource = config.getAttribute("configSource");
- _status = State.Exception_thrown;
- _status.m_oException = e;
- _logger.fatal("Listener configuration and startup error. Config Source: "
- + (configSource != null ? configSource
- : "unknown"), e);
- throw e;
- }
- }
-
- /**
- * Load the named listener configuration from the configured parameter
- * repository.
- *
- * @param reposParam
- * The name of the repository entry containing the Listener
- * configuration.
- * @return Listener Configuration as {@link ConfigTree}.
- * @throws IOException
- * Unable to access the repository.
- * @throws ParamRepositoryException
- * Unable to access the configuration in the repository.
- * @throws SAXException
- * Unable to parse the configuration.
- */
- private static ConfigTree getListenerConfig(String reposParam)
- throws IOException, ParamRepositoryException, SAXException {
- String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
- ConfigTree config = ConfigTree.fromXml(sXml);
-
- config.setAttribute("configSource", "param-repository:" + reposParam);
-
- return config;
- }
-
- /**
- * Check to see if all needed parameters are there, and assign default
- * values to some of them
- *
- * @param p_oP
- * ConfigTree - Where to look for the mandatory/optional
- * configuration attributes
- * @throws Exception -
- * If attributes are wrong or not enough for a proper runtime
- * configuration
- */
- public void checkParms(ConfigTree p_oP) throws Exception {
- // We've just loaded - set to false until next reload requested
- _reloadRequested = false;
- _commandQueue = createCommandQueue(p_oP);
-
- // Open the command queue...
- if (null!=_commandQueue)
- _commandQueue.open(p_oP);
-
- // if RELOAD_SECONDS_TAG not set, and no command queue
- // then reload every 10 minutes
- // If there is a command queue, run until command is received
- String sRldSecs = p_oP.getAttribute(RELOAD_SECONDS_TAG);
- _nextReload = (null != sRldSecs)
- ? System.currentTimeMillis() + 1000 * Long.parseLong(sRldSecs)
- : (null == _commandQueue)
- ? Long.MAX_VALUE
- : System.currentTimeMillis() + _defaultReloadMillis;
-
- // if END_TIME_TAG not set try to run forever
- // not a good practice if command queue is not set
- // Expected date format is "yyyyMMdd hh:mm:ss"
- String sEndT = p_oP.getAttribute(END_TIME_TAG);
- _endTime = (null == sEndT) ? Long.MAX_VALUE : _dateFormat.parse(
- sEndT).getTime();
-
- // Read and initialise the action definitions...
- ConfigTree actionConfig = p_oP.getFirstChild("Actions");
- if(actionConfig == null) {
- throw new ConfigurationException("No 'Actions' configuration.");
- }
- actionDefinitionFactory = new ActionDefinitionFactory(actionConfig);
-
- } // ________________________________
-
- /**
- * Factory method for creating the command queue.
- * @param config GatewayListener config.
- * @return GatewayListener CommandQueue instance.
- */
- private CommandQueue createCommandQueue(ConfigTree config) {
- String commandQueueClass = config.getAttribute("command-queue-class");
-
- if(commandQueueClass != null) {
- try {
- return (CommandQueue) Class.forName(commandQueueClass).newInstance();
- } catch (Exception e) {
- _logger.error("Failed to instantiate CommandQueue ["+ commandQueueClass + "]. Defaulting to no Command Queue", e);
- }
- }
-
- return _defaultCommandQueue;
- }
-
- /**
- * Allows a default command queue to be set statically for all GatewayListener instances.
- * @param defaultCommandQueue The defaultCommandQueue to set.
- */
- public static void setDefaultCommandQueue(CommandQueue defaultCommandQueue) {
- GatewayListenerController._defaultCommandQueue = defaultCommandQueue;
- }
-
- /**
- * Main execution loop <p/> Will continue to run until either <p/>a) run
- * time is expired <p/>b) quiesce command is received in command queue
- * <p/>For every child element that contains a PARM_LISTENER_CLASS
- * attribute, this method will try to launch a child thread instantiating an
- * object of that class, and will call it's run() method <p/>Once all child
- * processes are trigered, the main thread will either <p/>1) wait for a
- * message in the command queue (if one was configured) until next reload or
- * end of run period expired <p/>or 2) Just sleep if there's no command
- * queue to listen on
- */
- public void run()
- {
- while (endNotRequested())
- {
- _status = State.Running;
- for (ConfigTree oCurr : _config.getAllChildren()) {
- String sClass = oCurr.getAttribute(GATEWAY_CLASS_TAG);
- if (Util.isNullString(sClass))
- continue;
- tryToLaunchGateway(oCurr, sClass);
- }
-
- waitForCmdOrSleep();
-
- if (endRequested()) {
- break;
- }
- if (_sParametersName != null && timeToReload())
- {
- try
- {
- _status = State.Loading_parameters;
- _logger
- .info("Reloading parameters _____________________________________________________");
- ConfigTree oNew = GatewayListenerController.getListenerConfig(_sParametersName);
- checkParms(oNew);
- _config = oNew;
- } catch (Exception e) {
- _logger.error("Failed to reload parameters"
- + " - Continuing with cached version", e);
- }
- }
- }
- // _status = State.Shutting_down;
-
- _status = State.Done_OK;
- _status.m_iCompletionCode = 0;
- _logger
- .info("Finishing_____________________________________________________");
-
- // Close the command queue...
- try {
- _commandQueue.close();
- } catch (CommandQueueException e) {
- _logger.error("Error closing Command Queue.", e);
- }
- } // ________________________________
-
- private void tryToLaunchGateway(ConfigTree p_oP, String p_sClassName)
- {
- try {
- Class oListener = Class.forName(p_sClassName);
- Constructor oConst = oListener.getConstructor(new Class[] {
- this.getClass(), ConfigTree.class, ActionDefinitionFactory.class });
- Runnable oRun = (Runnable) oConst.newInstance(new Object[] { this,
- p_oP, actionDefinitionFactory });
- new Thread(oRun).start();
- } catch (Exception e) {
- _logger.error("Cannot launch <" + p_sClassName + ">\n", e);
- }
- } // ________________________________
-
- long millisToWait() {
- return Math.min(_nextReload, _endTime) - System.currentTimeMillis();
- } // ________________________________
-
- private void waitForCmdOrSleep() {
- long lToGo = millisToWait();
-
- if (null == _commandQueue) {
- _logger.debug("About to sleep " + lToGo);
- // No command queue nor topic - Just sleep until time
- // exhausted, or thread interrupted
- try {
- if (lToGo > 0)
- Thread.sleep(lToGo);
- } catch (InterruptedException e) {
- _endTime = 0; // mark as end requested and return
- }
- return;
- }
-
- // Wait for commands until time exhausted or command received
- // Note that received commands might change time variables (reload/end)
- // that's why time to go is recalculated on each cycle
- while ((lToGo = millisToWait()) > 0) {
- try {
- _logger.info("Waiting for command ... timeout=" + lToGo + " millis");
-
- String oM = _commandQueue.receiveCommand(lToGo);
- if (null == oM) {
- return;
- }
- processCommand(oM);
- if (endRequested() || timeToReload()) {
- break;
- }
- } catch (CommandQueueException eJ) {
- _logger.info("receive on command queue failed", eJ);
- }
- }
- } // ________________________________
-
- /**
- * Processes the command that has been received in the command queue (or
- * topic) <p/>_endRequested, _reloadRequested, and _endTime could be
- * changed
- *
- * <p/> <p/><TABLE border="1"> <COLGROUP> <COL width="200"/> <COL
- * width="400"/> </COLGROUP>
- * <TR>
- * <TD align="center">message text</TD>
- * <TD align="center">effect</TD>
- * </TR>
- * <TR>
- * <TD>shutdown*</TD>
- * <TD>End time will be immediately set to 'now' - quiesce process will
- * start - Child threads will be allowed to finish normally</TD>
- * </TR>
- * <TR>
- * <TD>reload param*</TD>
- * <TD>Parameters will be immediately reloaded, and listener reconfigured
- * with new values</TD>
- * </TR>
- * <TR>
- * <TD>endTime yyyyMMdd hh:mm:ss</TD>
- * <TD>End time will be set to new value. If hh:mm:ss is not supplied =>
- * end of day assumed (23:59:59)</TD>
- * </TR>
- * </TABLE> * startsWith() <p/>
- *
- * @param p_oMsg
- * Message received from the command queue.
- *
- */
- private void processCommand(String sTxt) {
- if (null == sTxt)
- return;
-
- String sLow = sTxt.trim().toLowerCase();
- if (sLow.startsWith("shutdown")) {
- _endRequested = true;
- _logger.info("Shutdown has been requested");
- return;
- }
- if (sLow.startsWith("reload param")) {
- _reloadRequested = true;
- _logger
- .info("Request for parameter reload has been received");
- return;
- }
- String[] sa = sLow.split("\\s+");
- if (sa.length > 1 && "endtime".equals(sa[0])) {
- try {
- String sDate = sa[1];
- String sTime = (sa.length < 3 || null == sa[2]) ? "23:59:59"
- : sa[2];
- Date oEnd = _dateFormat.parse(sDate + " " + sTime);
- _logger.info("New end date set to : " + oEnd);
- _endTime = oEnd.getTime();
- } catch (Exception eDat) {
- _logger.info("Problems with endTime command", eDat);
- }
- }
- } // ________________________________
-
- /**
- * Accessor to determine if execution time is expired or shutdown requested
- *
- * @return boolean if processing has to stop (all child threads will be
- * allowed to finish)
- */
- public boolean endRequested() {
- return _endRequested || System.currentTimeMillis() >= _endTime;
- }
-
- /**
- * Accessor to determine if execution time is not expired, and no shutdown
- * request received
- *
- * @return boolean - true if run time has not expired and quiesce has not
- * been requested
- */
- public boolean endNotRequested() {
- return !endRequested();
- }
-
- /**
- * Provide a common accessor to determine if parameters have to be reloaded
- * <p/> For child threads this means thread execution has to end
- * </p>
- * Child processes should only call this method when they are idle (as
- * opposed to in the middle of executing a unit of work)
- *
- * @return boolean - true if it's time to reload parameters
- */
- public boolean timeToReload() {
- return _reloadRequested
- || System.currentTimeMillis() >= _nextReload;
- }
-
- /**
- * Helper accessor for child processes that provides info to determine if
- * they can continue with yet another execution cycle
- *
- * @return boolean - true if runtime is not expired and not time yet to
- * reload parameters
- */
- public boolean continueLooping() {
- return (endNotRequested() && !timeToReload());
- } // ________________________________
-
- /**
- * Find an attribute in the tree (arg 0) or assign default value (arg 2)
- *
- * @param p_oP
- * ConfigTree - look for attributes in this Element only
- * @param p_sAtt
- * String - Name of attribute to find
- * @param p_sDefault
- * String -default value if requested attribute is not there
- * @return String - value of attribute, or default value (if null)
- * @throws Exception -
- * If requested attribute not found and no default value
- * supplied by invoker
- */
- public String obtainAtt(ConfigTree p_oP, String p_sAtt, String p_sDefault)
- throws ConfigurationException {
- String sVal = p_oP.getAttribute(p_sAtt);
- if ((null == sVal) && (null == p_sDefault))
- throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
-
- return (null != sVal) ? sVal : p_sDefault;
- } // ________________________________
-
- private static EPRManager getEprManager()
- {
- PropertyManager manager = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE);
- String sDir = manager.getProperty(Environment.REGISTRY_FILE_HELPER_DIR,".");
- return EPRManager.getInstance(sDir);
- }
-
- public EPR getEprByName (String serviceName) throws IOException
- {
- return getEprManager().loadEPR(serviceName);
- } // ________________________________
-
- public void register (String serviceName, EPR address)
- {
- try { getEprManager().saveEPR(serviceName,address); }
- catch (IOException e)
- {
- _logger.fatal("Cannot register service",e);
- }
- } // ________________________________
-
- public void unRegister (String serviceName, EPR address)
- {
- try { getEprManager().removeEPR(serviceName); }
- catch (IOException e)
- {
- _logger.fatal("Cannot un-register service",e);
- }
- } // ________________________________
-
-
- private CommandQueue _commandQueue;
- private static CommandQueue _defaultCommandQueue = null;
-
- private static Logger _logger = Logger.getLogger(GatewayListenerController.class);
- private String _sParametersName;
- private ConfigTree _config;
- private boolean _reloadRequested;
- private boolean _endRequested;
- private long _nextReload = Long.MAX_VALUE;
- private long _endTime = Long.MAX_VALUE;
- protected int _defaultReloadMillis = 180000; // default interval between parameter reloads
-
-
- public static final SimpleDateFormat _dateFormat
- = new SimpleDateFormat("yyyyMMdd hh:mm:ss");
-
- private State _status = null;
-
-
- private HashMap<String, Object> _attributes;
-} // ____________________________________________________________________________
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayListenerController.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,241 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners.gateway;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.naming.Context;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.helpers.JMSEpr;
-import org.jboss.soa.esb.couriers.Courier;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.couriers.CourierFactory;
-import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.message.Message;
-
-public class JmsGatewayListener implements Runnable
-{
-
- public JmsGatewayListener(GatewayListenerController commandListener, ConfigTree listenerConfig)
- throws Exception
- {
- _config = listenerConfig;
- _controller = commandListener;
- _sleepForRetries = 3000; // milliseconds
- checkMyParms();
- } // __________________________________
-
- public void run()
- {
- if (null!=_serviceName)
- _controller.register(_serviceName,_myEpr);
-
- while (_controller.continueLooping())
- {
- javax.jms.Message msgIn = receiveOne();
- if (null!=msgIn)
- try
- {
- Object obj = _processMethod.invoke(_composer,new Object[] {msgIn} );
- if (null==obj)
- {
- _logger.warn("Action class method <"+_processMethod.getName()+"> returned a null object");
- continue;
- }
- // try to deliver the composed message, using the appropriate courier
- // to the target service
- try
- {
- _courier.deliver((org.jboss.soa.esb.message.Message)obj);
- }
- catch (ClassCastException e)
- {
- _logger.error("Action class method <"+_processMethod.getName()+"> returned a non Message object");
- continue;
- }
- catch (CourierException e)
- {
- _logger.error("Courier <"+_courier.getClass().getName()+".deliver(Message) FAILED");
- continue;
- }
- continue;
- }
- catch (InvocationTargetException e)
- {
- _logger.error("Problems invoking method <"+_processMethod.getName()+">",e);
- }
- catch (IllegalAccessException e)
- {
- _logger.error("Problems invoking method <"+_processMethod.getName()+">",e);
- }
- catch (Exception e)
- {
- _logger.error("Unexpected problem",e);
- }
- }
-
- if (null!=_serviceName)
- _controller.unRegister(_serviceName,_myEpr);
-
- if (null != _queueSession)
- try { _queueSession.close(); }
- catch (Exception e1) {/* Tried my best - Just continue */ }
- if (null != _queueConnection)
- try { _queueConnection.close(); }
- catch (Exception e2) {/* Tried my best - Just continue */ }
- } // ________________________________
-
- /**
- * Check for mandatory and optional attributes in parameter tree
- *
- * @throws Exception -
- * if mandatory atts are not right or actionClass not in
- * classpath
- */
- protected void checkMyParms() throws Exception
- {
- // Third arg is null - Exception will be thrown if attribute is not found
- _targetServiceName = _controller.obtainAtt(_config, ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);
- _targetEpr = _controller.getEprByName(_targetServiceName);
- if (null==_targetEpr)
- throw new ConfigurationException("EPR <"+_targetServiceName+"> not found in registry");
-
- _queueName = _controller.obtainAtt(_config, JMSEpr.DESTINATION_NAME_TAG, null);
-
- // Look for first "action" element - only first one will be used
- String tagName = ListenerTagNames.ACTION_ELEMENT_TAG;
- ConfigTree actionElement = _config.getFirstChild(tagName);
- if (null==actionElement)
- throw new ConfigurationException("Missing <"+tagName+"> element");
- // class attribute
- _composerName = _controller.obtainAtt(actionElement,ListenerTagNames.ACTION_CLASS_TAG,null);
- _composerClass = Class.forName(_composerName);
- Constructor oConst = _composerClass.getConstructor(new Class[] {ConfigTree.class});
- _composer= oConst.newInstance(_config);
-
- // From here onwards, all attributes have a default value
- // process attribute
- tagName = ListenerTagNames.PROCESS_METHOD_TAG;
- String sProcessMethod = _controller.obtainAtt(_config,tagName,tagName);
- _processMethod = _composerClass.getMethod(sProcessMethod,new Class[] {Message.class});
-
- // No problem if selector is null - everything in queue will be returned
- _messageSelector = _config.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
-
- _courier = CourierFactory.getCourier(_targetEpr);
-
- prepareMessageReceiver();
- } // ________________________________
-
- private void prepareMessageReceiver() throws Exception
- {
- _queueConnection = null;
- _queueSession = null;
- _queue = null;
-
- String sJndiType = _controller.obtainAtt(_config, JMSEpr.JNDI_TYPE_TAG,"jboss");
- String sJndiURL = _controller.obtainAtt(_config, JMSEpr.JNDI_URL_TAG,"localhost");
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
-
- String sFactClass = _controller.obtainAtt(_config,JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
- _serviceName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
- _myEpr = (null==_serviceName) ? null
- : new JMSEpr(JMSEpr.QUEUE_TYPE,_queueName,sFactClass,sJndiType,sJndiURL,_messageSelector);
-
- Object tmp = oJndiCtx.lookup(sFactClass);
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
-
- _queueConnection = qcf.createQueueConnection();
- _queue = (Queue) oJndiCtx.lookup(_queueName);
- _queueSession = _queueConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
- _queueConnection.start();
-
- _messageReceiver = _queueSession.createReceiver(_queue, _messageSelector);
-
- } // ________________________________
-
- /**
- * Receive one message and retry if connection
- * @return javax.jms.Message - One input message, or null
- */
- protected javax.jms.Message receiveOne()
- {
- while (_controller.endRequested())
- try
- {
- return _messageReceiver.receive(_controller.millisToWait());
- }
- catch (JMSException oJ)
- {
- _logger.error("JMS error on receive. Attempting JMS Destination reconnect.", oJ);
- try { prepareMessageReceiver(); }
- // try to reconnect to the queue
- catch (Exception e)
- {
- _logger.error("Reconnecting to Queue", e);
- try { Thread.sleep(_sleepForRetries); }
- catch (InterruptedException e1)
- { // Just return
- _logger.error("Unexpected thread interupt exception.", e);
- return null;
- }
- }
- }
- return null;
- } //________________________________
-
- protected final static Logger _logger = Logger.getLogger(JmsGatewayListener.class);
-
- protected String _queueName;
- protected QueueConnection _queueConnection;
- protected QueueSession _queueSession;
- protected Queue _queue;
- protected MessageConsumer _messageReceiver;
- protected String _messageSelector;
- protected ConfigTree _config;
- protected GatewayListenerController _controller;
- protected final long _sleepForRetries; // milliseconds
-
- protected String _serviceName,_targetServiceName;
- protected EPR _myEpr ,_targetEpr;
-
- protected String _composerName;
- protected Class _composerClass;
- protected Object _composer;
- protected Method _processMethod;
-
- protected Courier _courier;
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,18 +0,0 @@
-<GatewayListenerControllerExample
- parameterReloadSecs="180"
->
- <JmsGatewayExample
- target-service-name="your target service name"
- service-name="JmsGatewayService"
- listenerClass="org.jboss.soa.esb.listeners.JmsGatewayListener"
- connection-factory="ConnectionFactory"
- destination-type="queue"
- destination-name="queue/A"
- jndi-type="jboss"
- jndi-URL="localhost"
- message-selector="service='composeExampleService'"
- >
- <action class="org.jboss.soa.esb.message.listeners.MockComposer" process="composeEmptyMessage" />
- </JmsGatewayExample>
-
-</GatewayListenerControllerExample>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml)
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/gatewayExample.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -0,0 +1,18 @@
+<GatewayListenerControllerExample
+ parameterReloadSecs="180"
+>
+ <JmsGatewayExample
+ target-service-name="your target service name"
+ service-name="JmsGatewayService"
+ listenerClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/A"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ message-selector="service='composeExampleService'"
+ >
+ <action class="org.jboss.soa.esb.message.listeners.MockComposer" process="composeEmptyMessage" />
+ </JmsGatewayExample>
+
+</GatewayListenerControllerExample>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,199 +0,0 @@
-package org.jboss.soa.esb.listeners.message;
-
-import java.lang.reflect.*;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.ConfigTree;
-
-
-/**
- * Action Processing Pipeline.
- * <p/>
- * Runs a list of action classes on a message
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- * @since Version 4.0
- */
-class ActionProcessingPipeline implements Runnable
-{
-
- /**
- * public constructor
- * @param message Message - The initial message to be run through the whole action
- * class chain
- */
- public ActionProcessingPipeline(Message message)
- throws ConfigurationException
- {
- if (null==_message)
- throw new IllegalArgumentException("Message must be not null");
- _message = message;
- _config = ActionUtils.getConfigTree(_message);
- if (null==_config)
- throw new IllegalArgumentException("Configuration needed for action classes");
- _actionList = _config.getChildren(ListenerTagNames.ACTION_ELEMENT_TAG);
- if (null==_actionList || _actionList.length<1)
- throw new ConfigurationException("No actions in list");
- }
-
- /**
- *
- * @return Message - current Message of this action chain processor
- */
- public Message getMessage() { return _message; }
-
- /**
- * Implement Runnable Interface
- * <p/>Uses reflection to instantiate action classes that must have a public constructor
- * that takes a single ConfigTree as argument
- * <p/>Requires each action class to have a public method that takes a Message and returns a Message
- * <br/>Default name for it is 'process' but can optionally be defined in the 'process' attribute
- * of the corresponding <action> element of the ConfigTree
- * <p/>Each <action> element can optionally define a method (taking a Message argument) to be
- * called upon successful completion of the action class (that step of the chain)
- * <br/>Default name for it is 'process' but can optionally be defined in the 'process' attribute
- * <p/>See actionClassException and actionClassFinishedOk
- * */
- public void run()
- {
- try
- {
- // Run the message through each ActionProcessor...
- _currentIndex = -1;
- for(ConfigTree oCurr : _actionList)
- {
- _currentIndex++;
- String attrName = ListenerTagNames.ACTION_CLASS_TAG;
- _currentAction = oCurr.getAttribute(attrName);
-
- attrName = ListenerTagNames.PROCESS_METHOD_TAG;
- String sProcessMethod = obtainAttribute(oCurr,attrName,attrName);
-
- _currentClass = Class.forName(_currentAction);
- Constructor oConst = _currentClass.getConstructor(new Class[] {ConfigTree.class});
- _currentProcessor = oConst.newInstance(_config);
- Method method = _currentClass.getMethod(sProcessMethod,new Class[] {Message.class});
-
- // The processing result of each action feeds into the processing of the next action...
- try
- {
- // copy currentObject in Message body to 'previous' currentObject
- ActionUtils.copyCurrentToPrevious(_message);
- Message next = (Message)method.invoke(_currentProcessor,new Object[] {_message} );
-
- actionClassFinishedOk(oCurr);
- if(next==null)
- {
- _logger.error(prematureTermination("returned <null> - Cannot continue"));
- return;
- }
- }
- catch (ClassCastException eCast)
- {
- // If action class returns non Message, log and abort chain
- _logger.error(prematureTermination("returned a non Message Object)"));
- return;
- }
- catch (Exception e)
- {
- // If action class threw exception, log and abort chain
- actionClassException(oCurr,e);
- return;
- }
- }
- // notification of action chain end can be done with a no-operation action class
- // with a proper ListenerPropertyNames.ACTION_NORMAL_COMPLETION_CALLBACK method
- // Same idea when some interaction needed with the 'esb unaware' world
- }
- catch(ClassNotFoundException e)
- { _logger.error(prematureTermination("action class is not in path"),e); }
- catch(NoSuchMethodException e)
- { _logger.error(prematureTermination("method not found"),e); }
- catch(InstantiationException e)
- { _logger.error(prematureTermination("cannot instantiate action class"),e); }
- catch(InvocationTargetException e)
- { _logger.error(prematureTermination("method not found"),e); }
- catch(IllegalAccessException e)
- { _logger.error(prematureTermination("unable to access method"),e); }
- catch (IllegalArgumentException e) {}
- }
-
- protected String prematureTermination(String s)
- {
- return new StringBuilder("Premature termination of action processing pipeline ")
- .append(getActionNames())
- .append("]. ActionProcessor [").append(_currentAction)
- .append("] ").append(s)
- .toString()
- ;
- }
-
- /**
- * If 'current' action step was configured with a 'exceptionMethod' attribute
- * that method will be called with a single argument of type Exception
- * @param tree ConfigTree - where to look for the exceptionMetod attribute
- * @param thr Exception - to be used in invocation to method (if found)
- */
- protected void actionClassException(ConfigTree tree, Exception thr)
- {
- thr.printStackTrace();
- String sMethod = obtainAttribute(tree,ListenerTagNames.EXCEPTION_METHOD_TAG,null);
- if (null!=sMethod)
- try
- {
- Method method = _currentClass.getMethod(sMethod,new Class[] {Exception.class});
- method.invoke(_currentProcessor,new Object[] {thr} );
- }
- catch (NoSuchMethodException e) {_logger.error(e); }
- catch (InvocationTargetException e) {_logger.error(e); }
- catch (IllegalAccessException e) {_logger.error(e); }
- }
-
- /**
- * If 'current' action step was configured with an 'okMethod' attribute
- * that method will be called with no arguments
- * @param tree ConfigTree - where to look for the okMetod attribute
- */
- protected void actionClassFinishedOk(ConfigTree tree)
- {
- String sMethod = obtainAttribute(tree,ListenerTagNames.NORMAL_COMPLETION_METHOD_TAG,null);
- if (null!=sMethod)
- try
- {
- Method method = _currentClass.getMethod(sMethod,new Class[] {});
- method.invoke(_currentProcessor,new Object[] {} );
- }
- catch (NoSuchMethodException e) {_logger.error(e); }
- catch (InvocationTargetException e) {_logger.error(e); }
- catch (IllegalAccessException e) {_logger.error(e); }
- }
-
- protected String[] getActionNames()
- {
- String[] sa = new String[_actionList.length];
- int i1=0;
- for (ConfigTree oCurr : _actionList)
- sa[i1++]=obtainAttribute(oCurr,ListenerTagNames.ACTION_CLASS_TAG,"NO_CLASSNAME");
- return sa;
- }
-
- private static String obtainAttribute(ConfigTree tree,String p_sAtt, String p_sDefault)
- {
- String sVal = tree.getAttribute(p_sAtt);
- return (null != sVal) ? sVal : p_sDefault;
- } // ________________________________
-
- protected ConfigTree[] _actionList;
- protected int _currentIndex;
- protected String _currentAction;
- protected Class _currentClass;
- protected Object _currentProcessor;
- protected Message _message;
- protected ConfigTree _config;
- protected Logger _logger = Logger.getLogger(this.getClass());
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,540 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners.message;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.command.CommandQueue;
-import org.jboss.internal.soa.esb.command.CommandQueueException;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.util.EPRManager;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.parameters.ParamRepositoryException;
-import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
-import org.jboss.soa.esb.util.Util;
-import org.xml.sax.SAXException;
-
-import com.arjuna.common.util.propertyservice.PropertyManager;
-
-/**
- * Controlling class that will launch 'message aware' listener child threads for supported
- * transport listener classes, as indicated in the configuration XML tree used in the constructor
- * If you use the 'main' method, configuration file is expected in arg[0]
- *
- * <p />
- * Can be launched as uppermost controller (it has a main(args) method)
- * <p />
- * Also implements Runnable, and can thus be launched in a child thread from an
- * upper controlling process
- * <p />
- * Listens on a JMS queue (with an optional message selector) for commands (e.g.
- * Quiesce, Reload Parameters, Set End Time, etc.)
- * <p />
- * Parameter reloading can also be set using the PARM_RELOAD_SECS attribute
- * <p />
- * End time for this instance can also be set using the PARM_END_TIME attribute
- * <p />
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- * @since Version 4.0
- */
-public class EsbListenerController implements Runnable {
-
- private static Logger _logger = Logger.getLogger(EsbListenerController.class);
-
- public static void main(String[] args) throws Exception {
- EsbListenerController oProc = new EsbListenerController(args[0]);
- oProc.run();
- EsbListenerController.State oS = oProc.getState();
-
- if (null != oS.getException()) {
- _logger.error("EsbListenerController <" + args[0] + "> FAILED\n", oS
- .getException());
- }
- System.exit(oS.getCompletionCode());
- } // ________________________________
-
- protected int m_iDfltReloadMillis = 180000 // default interval between
- // parameter reloads
- ;
-
- public static final String PARM_RELOAD_SECS = "parameterReloadSecs";
- public static final String PARM_END_TIME = "endTime";
-
- // Attribute name that denotes listener class to be instantiated in a child
- // thread
- // This attribute is not in the root node but in first level child
- // ConfigTrees
- public static final String PARM_LISTENER_CLASS = "listenerClass";
-
- private String m_sParmsName;
- private ConfigTree m_oParms;
-
- private HashMap<String, Object> m_oAtts;
-
- /**
- * Obtain a shallow copy of needed atributes in this object's last loaded
- * parameter tree <p/>The local bject is cloned so child threads can use it
- * as they choose to without interfering with the environment
- * <p />
- * Listener processes controlled by this object should keep a reference to
- * this object at construction time, and not call this method again unless
- * they specifically need updated values. Parameter reload could have
- * happened since last call
- *
- * @return Map - a shallow copy of the attributes Map
- */
- @SuppressWarnings("unchecked")
- public Map<String, Object> getControllerAttributes() {
- return (Map<String, Object>) m_oAtts.clone();
- }
-
- private boolean m_bReloadRequested, m_bEndRequested;
-
- private long m_lNextReload = Long.MAX_VALUE;
-
- private long m_lEndTime = Long.MAX_VALUE;
-
- public static final SimpleDateFormat s_oDateParse = new SimpleDateFormat(
- "yyyyMMdd hh:mm:ss");
-
- private State m_oState = null;
-
- public State getState() {
- return m_oState;
- }
-
- public static enum State {
- Loading_parameters, Running, Shutting_down, Done_OK, Exception_thrown;
- int m_iCompletionCode = 0;
-
- Exception m_oException = null;
-
- public int getCompletionCode() {
- return m_iCompletionCode;
- };
-
- public Exception getException() {
- return m_oException;
- }
- };
-
- private CommandQueue commandQueue;
- private static CommandQueue defaultCommandQueue = null;
-
- /**
- * No default constructor - only for child classes
- */
- protected EsbListenerController() { }
-
- /**
- * Construct a Listener Manager from the named repository based
- * configuration.
- *
- * @param p_sParameterName
- * Name of the Repository entry containing the configuration.
- * @throws Exception
- * Unable to load/use the named configuration.
- */
- public EsbListenerController(String p_sParameterName) throws Exception {
- this(EsbListenerController.getListenerConfig(p_sParameterName));
- m_sParmsName = p_sParameterName;
- }
-
- /**
- * Construct a Listener Controller using the specified listener configuration.
- *
- * @param config
- * The configuration.
- * @throws Exception
- * Unable to load/use the supplied configuration.
- */
- public EsbListenerController(ConfigTree config) throws Exception {
- m_oParms = config;
- m_oState = State.Loading_parameters;
-
- try { checkParms(m_oParms); }
- catch (Exception e)
- {
- String configSource = config.getAttribute("configSource");
-
- m_oState = State.Exception_thrown;
- m_oState.m_oException = e;
- _logger.fatal("Listener configuration and startup error. Config Source: "
- + (configSource != null ? configSource
- : "unknown"), e);
-
- throw e;
- }
- }
-
- /**
- * Load the named listener configuration from the configured parameter
- * repository.
- *
- * @param reposParam
- * The name of the repository entry containing the Listener
- * configuration.
- * @return Listener Configuration as {@link ConfigTree}.
- * @throws IOException
- * Unable to access the repository.
- * @throws ParamRepositoryException
- * Unable to access the configuration in the repository.
- * @throws SAXException
- * Unable to parse the configuration.
- */
- private static ConfigTree getListenerConfig(String reposParam)
- throws IOException, ParamRepositoryException, SAXException {
- String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
- ConfigTree config = ConfigTree.fromXml(sXml);
-
- config.setAttribute("configSource", "param-repository:" + reposParam);
-
- return config;
- }
-
- /**
- * Check to see if all needed parameters are there, and assign default
- * values to some of them
- *
- * @param p_oP
- * ConfigTree - Where to look for the mandatory/optional
- * configuration attributes
- * @throws Exception -
- * If attributes are wrong or not enough for a proper runtime
- * configuration
- */
- public void checkParms(ConfigTree p_oP) throws Exception {
- // We've just loaded - set to false until next reload requested
- m_bReloadRequested = false;
- commandQueue = createCommandQueue(p_oP);
-
- // Open the command queue...
- if (null!=commandQueue)
- commandQueue.open(p_oP);
-
- // if PARM_RELOAD_SECS not set, and no command queue
- // then reload every 10 minutes
- // If there is a command queue, run until command is received
- String sRldSecs = p_oP.getAttribute(PARM_RELOAD_SECS);
- m_lNextReload = (null != sRldSecs)
- ? System.currentTimeMillis() + 1000 * Long.parseLong(sRldSecs)
- : (null == commandQueue)
- ? Long.MAX_VALUE
- : System.currentTimeMillis() + m_iDfltReloadMillis;
-
- // if PARM_END_TIME not set try to run forever
- // not a good practice if command queue is not set
- // Expected date format is "yyyyMMdd hh:mm:ss"
- String sEndT = p_oP.getAttribute(PARM_END_TIME);
- m_lEndTime = (null == sEndT) ? Long.MAX_VALUE : s_oDateParse.parse(
- sEndT).getTime();
-
- // Read and initialise the action definitions...
- ConfigTree actionConfig = p_oP.getFirstChild("Actions");
- if(actionConfig == null) {
- throw new ConfigurationException("No 'Actions' configuration.");
- }
- } // ________________________________
-
- /**
- * Factory method for creating the command queue.
- * @param config EsbListenerController config.
- * @return EsbListenerController CommandQueue instance.
- */
- private CommandQueue createCommandQueue(ConfigTree config) {
- String commandQueueClass = config.getAttribute("command-queue-class");
-
- if(commandQueueClass != null) {
- try {
- return (CommandQueue) Class.forName(commandQueueClass).newInstance();
- } catch (Exception e) {
- _logger.error("Failed to instantiate CommandQueue ["+ commandQueueClass + "]. Defaulting to no Command Queue", e);
- }
- }
-
- return defaultCommandQueue;
- }
-
- /**
- * Allows a default command queue to be set statically for all EsbListenerController instances.
- * @param defaultCommandQueue The defaultCommandQueue to set.
- */
- public static void setDefaultCommandQueue(CommandQueue defaultCommandQueue) {
- EsbListenerController.defaultCommandQueue = defaultCommandQueue;
- }
-
- /**
- * Main execution loop <p/> Will continue to run until either <p/>a) run
- * time is expired <p/>b) quiesce command is received in command queue
- * <p/>For every child element that contains a PARM_LISTENER_CLASS
- * attribute, this method will try to launch a child thread instantiating an
- * object of that class, and will call it's run() method <p/>Once all child
- * processes are trigered, the main thread will either <p/>1) wait for a
- * message in the command queue (if one was configured) until next reload or
- * end of run period expired <p/>or 2) Just sleep if there's no command
- * queue to listen on
- */
- public void run() {
- while (endNotRequested()) {
- m_oState = State.Running;
- for (ConfigTree oCurr : m_oParms.getAllChildren()) {
- String sClass = oCurr.getAttribute(PARM_LISTENER_CLASS);
- if (Util.isNullString(sClass))
- continue;
- tryToLaunchChildListener(oCurr, sClass);
- }
-
- waitForCmdOrSleep();
-
- if (endRequested()) {
- break;
- }
- if (m_sParmsName != null && timeToReload()) {
- try {
- m_oState = State.Loading_parameters;
- _logger
- .info("Reloading parameters _____________________________________________________");
- ConfigTree oNew = EsbListenerController.getListenerConfig(m_sParmsName);
- checkParms(oNew);
- m_oParms = oNew;
- } catch (Exception e) {
- _logger.error("Failed to reload parameters"
- + " - Continuing with cached version", e);
- }
- }
- }
- // m_oState = State.Shutting_down;
-
- m_oState = State.Done_OK;
- m_oState.m_iCompletionCode = 0;
- _logger
- .info("Finishing_____________________________________________________");
-
- // Close the command queue...
- try {
- commandQueue.close();
- } catch (CommandQueueException e) {
- _logger.error("Error closing Command Queue.", e);
- }
- } // ________________________________
-
- private void tryToLaunchChildListener(ConfigTree p_oP, String p_sClassName) {
- try
- {
- Class oListener = Class.forName(p_sClassName);
- Constructor oConst = oListener.getConstructor(new Class[] {this.getClass(), ConfigTree.class});
- Runnable oRun = (Runnable) oConst.newInstance(new Object[] { this,p_oP});
- new Thread(oRun).start();
- }
- catch (Exception e)
- {
- _logger.error("Cannot launch <" + p_sClassName + ">\n", e);
- }
- } // ________________________________
-
- long millisToWait() {
- return Math.min(m_lNextReload, m_lEndTime) - System.currentTimeMillis();
- } // ________________________________
-
- private void waitForCmdOrSleep() {
- long lToGo = millisToWait();
-
- if (null == commandQueue) {
- _logger.debug("About to sleep " + lToGo);
- // No command queue nor topic - Just sleep until time
- // exhausted, or thread interrupted
- try {
- if (lToGo > 0)
- Thread.sleep(lToGo);
- } catch (InterruptedException e) {
- m_lEndTime = 0; // mark as end requested and return
- }
- return;
- }
-
- // Wait for commands until time exhausted or command received
- // Note that received commands might change time variables (reload/end)
- // that's why time to go is recalculated on each cycle
- while ((lToGo = millisToWait()) > 0) {
- try {
- _logger.info("Waiting for command ... timeout=" + lToGo + " millis");
-
- String oM = commandQueue.receiveCommand(lToGo);
- if (null == oM) {
- return;
- }
- processCommand(oM);
- if (endRequested() || timeToReload()) {
- break;
- }
- } catch (CommandQueueException eJ) {
- _logger.info("receive on command queue failed", eJ);
- }
- }
- } // ________________________________
-
- /**
- * Processes the command that has been received in the command queue (or
- * topic) <p/>m_bEndRequested, m_bReloadRequested, and m_lEndTime could be
- * changed
- *
- * <p/> <p/><TABLE border="1"> <COLGROUP> <COL width="200"/> <COL
- * width="400"/> </COLGROUP>
- * <TR>
- * <TD align="center">message text</TD>
- * <TD align="center">effect</TD>
- * </TR>
- * <TR>
- * <TD>shutdown*</TD>
- * <TD>End time will be immediately set to 'now' - quiesce process will
- * start - Child threads will be allowed to finish normally</TD>
- * </TR>
- * <TR>
- * <TD>reload param*</TD>
- * <TD>Parameters will be immediately reloaded, and listener reconfigured
- * with new values</TD>
- * </TR>
- * <TR>
- * <TD>endTime yyyyMMdd hh:mm:ss</TD>
- * <TD>End time will be set to new value. If hh:mm:ss is not supplied =>
- * end of day assumed (23:59:59)</TD>
- * </TR>
- * </TABLE> * startsWith() <p/>
- *
- * @param p_oMsg
- * Message received from the command queue.
- *
- */
- private void processCommand(String sTxt) {
- if (null == sTxt)
- return;
-
- String sLow = sTxt.trim().toLowerCase();
- if (sLow.startsWith("shutdown")) {
- m_bEndRequested = true;
- _logger.info("Shutdown has been requested");
- return;
- }
- if (sLow.startsWith("reload param")) {
- m_bReloadRequested = true;
- _logger
- .info("Request for parameter reload has been received");
- return;
- }
- String[] sa = sLow.split("\\s+");
- if (sa.length > 1 && "endtime".equals(sa[0])) {
- try {
- String sDate = sa[1];
- String sTime = (sa.length < 3 || null == sa[2]) ? "23:59:59"
- : sa[2];
- Date oEnd = s_oDateParse.parse(sDate + " " + sTime);
- _logger.info("New end date set to : " + oEnd);
- m_lEndTime = oEnd.getTime();
- } catch (Exception eDat) {
- _logger.info("Problems with endTime command", eDat);
- }
- }
- } // ________________________________
-
- /**
- * Accessor to determine if execution time is expired or shutdown requested
- *
- * @return boolean if processing has to stop (all child threads will be
- * allowed to finish)
- */
- public boolean endRequested() {
- return m_bEndRequested || System.currentTimeMillis() >= m_lEndTime;
- }
-
- /**
- * Accessor to determine if execution time is not expired, and no shutdown
- * request received
- *
- * @return boolean - true if run time has not expired and quiesce has not
- * been requested
- */
- public boolean endNotRequested() {
- return !endRequested();
- }
-
- /**
- * Provide a common accessor to determine if parameters have to be reloaded
- * <p/> For child threads this means thread execution has to end
- * </p>
- * Child processes should only call this method when they are idle (as
- * opposed to in the middle of executing a unit of work)
- *
- * @return boolean - true if it's time to reload parameters
- */
- public boolean timeToReload() {
- return m_bReloadRequested
- || System.currentTimeMillis() >= m_lNextReload;
- }
-
- /**
- * Helper accessor for child processes that provides info to determine if
- * they can continue with yet another execution cycle
- *
- * @return boolean - true if runtime is not expired and not time yet to
- * reload parameters
- */
- public boolean continueLooping() {
- return (endNotRequested() && !timeToReload());
- } // ________________________________
-
- private static EPRManager getEprManager()
- {
- PropertyManager manager = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE);
- String sDir = manager.getProperty(Environment.REGISTRY_FILE_HELPER_DIR,".");
- return EPRManager.getInstance(sDir);
- }
-
- public void register (String name, EPR address)
- {
- try { getEprManager().saveEPR(name,address); }
- catch (IOException e)
- {
- _logger.fatal("Cannot register service",e);
- }
- } // ________________________________
-
- public void unRegister (String name)
- {
- try { getEprManager().removeEPR(name); }
- catch (IOException e)
- {
- _logger.fatal("Cannot un-register service",e);
- }
- } // ________________________________
-
-} // ____________________________________________________________________________
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,233 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.listeners.message;
-
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.TopicSession;
-import javax.naming.Context;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.addressing.helpers.JMSEpr;
-
-/**
- * Esb Message aware JMS queue listener.
- * <p/> Expects an Object message whose getObject() method returns an org.jboss.soa.esb.message.Message
- * <br/>Clones the 'static' ConfigTree with which this listener was created, and stores the cloned tree
- * inside the Message (to enable all actions in the chain to use the configuration)
- * <br/>Instantiates and runs a new ActionProcessingPipeline on the received esb Message (augmented with
- * ConfigTree) that will in turn instantiate and run all action classes in the chain
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- * @since Version 4.0
- */
-
-public class JmsQueueListener implements Runnable
-{
- /**
- * public constructor
- * @param controller EsbListenerController - the controlling process
- * @param config ConfigTree - Containing 'static' configuration for this instance
- * @throws Exception
- */
- public JmsQueueListener(EsbListenerController controller, ConfigTree config)
- throws ConfigurationException
- {
- _controller = controller;
- _config = config;
- _iSleepForRetry = 3;
- checkMyParms();
- } // _______________________________
-
- /**
- * Loops until controlling process determines
- * <br/>Waits for JMS Object messages containing ESB messages
- * <br/>When one is received, instantiates an action processing pipeline to process it
- * <br/>Pipeline is started in new Thread
- */
- public void run()
- {
- _controller.register(_eprName,_epr);
-
- while (_controller.continueLooping())
- {
- org.jboss.soa.esb.message.Message message = receiveEsbMessage(_controller.millisToWait());
- if (null!=message)
- {
- ActionUtils.setConfigTree(message,_config);
- ActionProcessingPipeline chain = null;
-
- try { chain = new ActionProcessingPipeline(message); }
- catch (IllegalArgumentException e)
- { _logger.error(e); continue; }
- catch (ConfigurationException e)
- { _logger.error(e); continue; }
-
- // TODO Take care of thread pooling and (eventually) maximum child threads
- new Thread(chain).start();
- }
- }
-
- _controller.unRegister(_eprName);
- cleanup();
- } // _______________________________
-
- /**
- * Check for mandatory and optional attributes in parameter tree
- *
- * @throws Exception -
- * if mandatory atts are not right or actionClass not in
- * classpath
- */
- protected void checkMyParms() throws ConfigurationException
- {
- // Default value of obtainAttribute is null - Exception will be thrown
- String sQueue = obtainAttribute(JMSEpr.DESTINATION_NAME_TAG, null);
-
- _eprName = obtainAttribute(ListenerTagNames.SERVICE_NAME_TAG,null);
-
- // No problem if selector is null - everything in queue will be returned
- _sSelector = _config.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
-
- _oQconn = null;
- _oQsess = null;
- _oQueue = null;
-
- String sJndiType = obtainAttribute (JMSEpr.JNDI_TYPE_TAG ,"jboss");
- String sJndiURL = obtainAttribute (JMSEpr.JNDI_URL_TAG ,"localhost");
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
-
- String sFactClass = obtainAttribute(JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
- _epr = new JMSEpr(JMSEpr.QUEUE_TYPE,sQueue,sFactClass
- ,sJndiType,sJndiURL,_sSelector);
-
- Exception thrown = null;
- try
- {
- Object tmp = oJndiCtx.lookup(sFactClass);
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
-
- _oQconn = qcf.createQueueConnection();
- _oQueue = (Queue) oJndiCtx.lookup(sQueue);
- _oQsess = _oQconn.createQueueSession(false,TopicSession.AUTO_ACKNOWLEDGE);
- _oQconn.start();
- _receiver = _oQsess.createReceiver(_oQueue, _sSelector);
- }
- catch (javax.naming.NamingException e) { thrown = e; }
- catch (JMSException e) { thrown = e; }
- throw new ConfigurationException(thrown);
-
- } // ________________________________
-
- protected org.jboss.soa.esb.message.Message receiveEsbMessage(long millis)
- {
- javax.jms.Message jmsMessage = null;
- try { jmsMessage = _receiver.receive(millis); }
- catch (JMSException oJ)
- {
- _logger.error("JMS error on receive. Attempting JMS Destination reconnect.", oJ);
- for (int i1 = 0; i1 < 3; i1++)
- // try to reconnect to the queue
- try { checkMyParms(); }
- catch (Exception e)
- {
- _logger.error("Reconnecting to Queue", e);
- try { Thread.sleep(_iSleepForRetry); }
- catch (InterruptedException e1)
- { // Just return after logging
- _logger.error("Unexpected thread interupt exception.", e);
- return null;
- }
- }
- }
- if (null == jmsMessage)
- return null;
-
- if (!(jmsMessage instanceof ObjectMessage))
- {
- _logger.error("Unsupported JMS message type: " + jmsMessage.getClass().getName());
- return null;
- }
- try
- {
- return (org.jboss.soa.esb.message.Message)((ObjectMessage)jmsMessage).getObject();
- }
- catch (JMSException e1)
- { _logger.error("Failed to read Serialized Object from JMS message.", e1);
- return null;
- }
- catch (ClassCastException e2)
- { _logger.error("Object in JMS message is not a org.jboss.soa.esb.message.Message", e2);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.listeners.AbstractListener#close()
- */
-
- protected void cleanup()
- {
- if (null != _oQsess)
- try { _oQsess.close(); }
- catch (Exception e1) {/* Tried my best - Just continue */ }
- if (null != _oQconn)
- try { _oQconn.close(); }
- catch (Exception e2) {/* Tried my best - Just continue */ }
- }
-
- protected String obtainAttribute(String p_sAtt, String p_sDefault)
- throws ConfigurationException
- {
- String sVal = _config.getAttribute(p_sAtt);
- if ((null == sVal) && (null == p_sDefault))
- throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
-
- return (null != sVal) ? sVal : p_sDefault;
- } // ________________________________
-
- protected EsbListenerController _controller;
- protected ConfigTree _config;
- protected String _eprName;
- protected JMSEpr _epr;
- protected MessageConsumer _receiver;
- protected boolean _bError = false;
- protected QueueConnection _oQconn;
- protected QueueSession _oQsess;
- protected Queue _oQueue;
- protected String _sSelector;
- protected int _iSleepForRetry;
-
- protected static transient Logger _logger = Logger.getLogger(JmsQueueListener.class);
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,36 +0,0 @@
-<EsbListenerControllerExample
- parameterReloadSecs="180"
->
- <ListenJmsQueueExample
- epr-name="myEprMnemonicName"
- listenerClass="org.jboss.soa.esb.message.listeners.JmsQueueListener"
- connection-factory="ConnectionFactory"
- destination-type="queue"
- destination-name="queue/A"
- jndi-type="jboss"
- jndi-URL="localhost"
- message-selector="service='handOfGod'"
- >
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" />
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" process="process222" />
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction"
- process="noOperation" okMethod="endOfChainNotification"/>
-
- <NotificationList type="OK">
- <target class="NotifyFiles">
- <file URI="file:///E:/tmp/jbossEsb/notifyDir/GpListenerExample.notifOK"
- append="true"
- />
- </target>
- </NotificationList>
-
- <NotificationList type="err">
- <target class="NotifyFiles">
- <file URI="file:///E:/tmp/jbossEsb/notifyDir/GpListenerExample.notifErr"
- append="true"
- />
- </target>
- </NotificationList>
- </ListenJmsQueueExample>
-
-</EsbListenerControllerExample>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/easier2ReadExample.xml)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,44 +0,0 @@
-<EsbListenerControllerExample
- parameterReloadSecs="180"
->
- <ListenJmsQueueExample
- service-name="myServiceName"
- listenerClass="org.jboss.soa.esb.message.listeners.JmsQueueListener"
- connection-factory="ConnectionFactory"
- destination-type="queue"
- destination-name="queue/A"
- jndi-type="jboss"
- jndi-URL="localhost"
- message-selector="service='maradona'"
- >
- <!-- next line will call (default) process(Message) method with no notification for step -->
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" />
- <!-- next line will call process222(Message) method with no notification for step -->
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" process="process222" />
- <!-- next line will call (default) process(Message) - on success=>invoke myOkMethod1 -->
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" okMethod="myOkMethod1" />
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" process="process222"
- okMethod="myMethod2" />
- <!-- next line would be useful to notify end of action chain process=noOperation (see class)-->
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" process="noOperation" />
- <!-- example of a method that will always throw an Exception -->
- <action class="org.jboss.soa.esb.actions.templates.MockMessageAction" process="justThrow" exceptionMethod="exceptionCallback1"/>
-
- <NotificationList type="OK">
- <target class="NotifyFiles">
- <file URI="file:///E:/tmp/jbossEsb/notifyDir/GpListenerExample.notifOK"
- append="true"
- />
- </target>
- </NotificationList>
-
- <NotificationList type="err">
- <target class="NotifyFiles">
- <file URI="file:///E:/tmp/jbossEsb/notifyDir/GpListenerExample.notifErr"
- append="true"
- />
- </target>
- </NotificationList>
- </ListenJmsQueueExample>
-
-</EsbListenerControllerExample>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/example.xml)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -30,7 +30,7 @@
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.ActionProcessor;
import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
@@ -49,7 +49,7 @@
public static final String MESSAGE_PROCESSING_ACTIONS_LIST = "MESSAGE_PROCESSING_ACTIONS_LIST";
// You can override these values at constructor time of your
- // derived class after calling super(GpListener,DomElement)
+ // derived class after calling super(GpListener,ConfigTree)
protected int m_iSleepForThreads = 3000; // default sleep if no threads available
protected int m_iUpperThreadLimit = 10; // just in case - override if you wish
@@ -58,12 +58,12 @@
protected ThreadGroup m_oThrGrp = null;
protected Logger logger;
protected GpListener m_oDad;
- protected DomElement listenerConfig;
+ protected ConfigTree listenerConfig;
protected String[] m_oActions;
protected ActionDefinitionFactory m_oActionDefinitionFactory;
protected MessageFactory m_oMsgFactory;
- protected AbstractListener(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
+ protected AbstractListener(GpListener p_oDad, ConfigTree p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
logger = Logger.getLogger(this.getClass());
m_oDad = p_oDad;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -25,7 +25,7 @@
import java.util.List;
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Abstract Polling Listener.
@@ -39,7 +39,7 @@
public abstract class AbstractPoller extends AbstractListener {
// You can override these values at constructor time of your
- // derived class after calling super(GpListener,DomElement)
+ // derived class after calling super(GpListener,ConfigTree)
protected int m_iMinPollMillis = 3000 // minimum polling interval
, m_iDfltPollMillis = 20000 // default polling interval
;
@@ -55,10 +55,10 @@
* @param actionDefinitionFactory The action definition factory for the bus.
* @throws Exception
*/
- protected AbstractPoller(GpListener commandListener, DomElement listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
+ protected AbstractPoller(GpListener commandListener, ConfigTree listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
super(commandListener, listenerConfig, actionDefinitionFactory);
- String sAtt = listenerConfig.getAttr(PARM_POLL_LTCY);
+ String sAtt = listenerConfig.getAttribute(PARM_POLL_LTCY);
m_iPollMillis = (null == sAtt) ? m_iDfltPollMillis : 1000 * Integer.parseInt(sAtt);
if (m_iPollMillis < m_iMinPollMillis) {
m_iPollMillis = m_iMinPollMillis;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/DirectoryPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/DirectoryPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/DirectoryPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -31,7 +31,7 @@
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.util.Util;
public class DirectoryPoller extends AbstractPoller
@@ -45,7 +45,7 @@
public static final String FILE_POST_SFX = "postSuffix";
public static final String FILE_POST_DEL = "postDelete";
- public DirectoryPoller(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
+ public DirectoryPoller(GpListener p_oDad, ConfigTree p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
{
super(p_oDad, p_oParms, actionDefinitionFactory);
checkMyParms();
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/GpListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/GpListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/GpListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -40,7 +40,7 @@
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.notification.NotificationList;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
@@ -97,14 +97,14 @@
// Attribute name that denotes listener class to be instantiated in a child
// thread
// This attribute is not in the root node but in first level child
- // DomElements
+ // ConfigTrees
public static final String PARM_LISTENER_CLASS = "listenerClass";
public static final String PARM_ACTIONS = "actions";
public static final String PARM_MAX_THREADS = "maxThreads";
public static final String CHLD_EMAIL_PARMS = "EmailProperties";
private String m_sParmsName;
- private DomElement m_oParms;
+ private ConfigTree m_oParms;
private HashMap<String, Object> m_oAtts;
@@ -189,7 +189,7 @@
* @throws Exception
* Unable to load/use the supplied configuration.
*/
- public GpListener(DomElement config) throws Exception {
+ public GpListener(ConfigTree config) throws Exception {
m_oParms = config;
m_oState = State.Loading_parameters;
@@ -197,7 +197,7 @@
checkParms(m_oParms);
setEmailSystemProperties();
} catch (Exception e) {
- String configSource = config.getAttr("configSource");
+ String configSource = config.getAttribute("configSource");
m_oState = State.Exception_thrown;
m_oState.m_oException = e;
@@ -216,7 +216,7 @@
* @param reposParam
* The name of the repository entry containing the Listener
* configuration.
- * @return Listener Configuration as {@link DomElement}.
+ * @return Listener Configuration as {@link ConfigTree}.
* @throws IOException
* Unable to access the repository.
* @throws ParamRepositoryException
@@ -224,12 +224,12 @@
* @throws SAXException
* Unable to parse the configuration.
*/
- private static DomElement getListenerConfig(String reposParam)
+ private static ConfigTree getListenerConfig(String reposParam)
throws IOException, ParamRepositoryException, SAXException {
String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
- DomElement config = DomElement.fromXml(sXml);
+ ConfigTree config = ConfigTree.fromXml(sXml);
- config.setAttr("configSource", "param-repository:" + reposParam);
+ config.setAttribute("configSource", "param-repository:" + reposParam);
return config;
}
@@ -239,13 +239,13 @@
* values to some of them
*
* @param p_oP
- * DomElement - Where to look for the mandatory/optional
+ * ConfigTree - Where to look for the mandatory/optional
* configuration attributes
* @throws Exception -
* If attributes are wrong or not enough for a proper runtime
* configuration
*/
- public void checkParms(DomElement p_oP) throws Exception {
+ public void checkParms(ConfigTree p_oP) throws Exception {
// We've just loaded - set to false until next reload requested
m_bReloadRequested = false;
commandQueue = createCommandQueue(p_oP);
@@ -257,7 +257,7 @@
// if PARM_RELOAD_SECS not set, and no command queue
// then reload every 10 minutes
// If there is a command queue, run until command is received
- String sRldSecs = p_oP.getAttr(PARM_RELOAD_SECS);
+ String sRldSecs = p_oP.getAttribute(PARM_RELOAD_SECS);
m_lNextReload = (null != sRldSecs)
? System.currentTimeMillis() + 1000 * Long.parseLong(sRldSecs)
: (null == commandQueue)
@@ -267,12 +267,12 @@
// if PARM_END_TIME not set try to run forever
// not a good practice if command queue is not set
// Expected date format is "yyyyMMdd hh:mm:ss"
- String sEndT = p_oP.getAttr(PARM_END_TIME);
+ String sEndT = p_oP.getAttribute(PARM_END_TIME);
m_lEndTime = (null == sEndT) ? Long.MAX_VALUE : s_oDateParse.parse(
sEndT).getTime();
// Read and initialise the action definitions...
- DomElement actionConfig = p_oP.getFirstElementChild("Actions");
+ ConfigTree actionConfig = p_oP.getFirstChild("Actions");
if(actionConfig == null) {
throw new ConfigurationException("No 'Actions' configuration.");
}
@@ -285,8 +285,8 @@
* @param config GpListener config.
* @return GpListener CommandQueue instance.
*/
- private CommandQueue createCommandQueue(DomElement config) {
- String commandQueueClass = config.getAttr("command-queue-class");
+ private CommandQueue createCommandQueue(ConfigTree config) {
+ String commandQueueClass = config.getAttribute("command-queue-class");
if(commandQueueClass != null) {
try {
@@ -321,8 +321,8 @@
public void run() {
while (endNotRequested()) {
m_oState = State.Running;
- for (DomElement oCurr : m_oParms.getAllElemChildren()) {
- String sClass = oCurr.getAttr(PARM_LISTENER_CLASS);
+ for (ConfigTree oCurr : m_oParms.getAllChildren()) {
+ String sClass = oCurr.getAttribute(PARM_LISTENER_CLASS);
if (Util.isNullString(sClass))
continue;
tryToLaunchChildListener(oCurr, sClass);
@@ -338,7 +338,7 @@
m_oState = State.Loading_parameters;
m_oLogger
.info("Reloading parameters _____________________________________________________");
- DomElement oNew = GpListener.getListenerConfig(m_sParmsName);
+ ConfigTree oNew = GpListener.getListenerConfig(m_sParmsName);
checkParms(oNew);
m_oParms = oNew;
setEmailSystemProperties();
@@ -363,11 +363,11 @@
}
} // ________________________________
- private void tryToLaunchChildListener(DomElement p_oP, String p_sClassName) {
+ private void tryToLaunchChildListener(ConfigTree p_oP, String p_sClassName) {
try {
Class oListener = Class.forName(p_sClassName);
Constructor oConst = oListener.getConstructor(new Class[] {
- this.getClass(), DomElement.class, ActionDefinitionFactory.class });
+ this.getClass(), ConfigTree.class, ActionDefinitionFactory.class });
Runnable oRun = (Runnable) oConst.newInstance(new Object[] { this,
p_oP, actionDefinitionFactory });
new Thread(oRun).start();
@@ -532,10 +532,10 @@
Environment.SMTP_AUTH };
private void setEmailSystemProperties() {
- DomElement oEmail = m_oParms.getFirstElementChild(CHLD_EMAIL_PARMS);
+ ConfigTree oEmail = m_oParms.getFirstChild(CHLD_EMAIL_PARMS);
if (null != oEmail)
for (String sCurr : s_saMailProps) {
- String sProp = oEmail.getAttr(sCurr);
+ String sProp = oEmail.getAttribute(sCurr);
if (null != sProp)
ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).setProperty(sCurr, sProp);
}
@@ -545,7 +545,7 @@
* Find an attribute in the tree (arg 0) or assign default value (arg 2)
*
* @param p_oP
- * DomElement - look for attributes in this Element only
+ * ConfigTree - look for attributes in this Element only
* @param p_sAtt
* String - Name of attribute to find
* @param p_sDefault
@@ -555,9 +555,9 @@
* If requested attribute not found and no default value
* supplied by invoker
*/
- public static String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
+ public static String obtainAtt(ConfigTree p_oP, String p_sAtt, String p_sDefault)
throws ConfigurationException {
- String sVal = p_oP.getAttr(p_sAtt);
+ String sVal = p_oP.getAttribute(p_sAtt);
if ((null == sVal) && (null == p_sDefault))
throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
@@ -569,19 +569,19 @@
* 'type' that starts with "ok" (case insensitive)
*
* @param p_oP -
- * DomElement to search for "NotificationList" child Elements
+ * ConfigTree to search for "NotificationList" child Elements
* @param p_oSer
* Serializable - Will constitute the body of the notification
*/
- public static void notifyOK(DomElement p_oP, Serializable p_oSer) {
+ public static void notifyOK(ConfigTree p_oP, Serializable p_oSer) {
if(p_oSer == null) {
return;
}
try {
Serializable oNotif = p_oSer;
- for (DomElement oCurr : p_oP
- .getElementChildren(NotificationList.ELEMENT)) {
+ for (ConfigTree oCurr : p_oP
+ .getChildren(NotificationList.ELEMENT)) {
NotificationList oNL = new NotificationList(oCurr);
if (!oNL.isOK())
continue;
@@ -597,14 +597,14 @@
* set
*
* @param p_oP -
- * DomElement to search for "NotificationList" child Elements
+ * ConfigTree to search for "NotificationList" child Elements
* @param p_e -
* Exception if not null, will be appended to the body
* @param p_oSer
* Serializable - Will be included at the beginning of the body
* of the notification
*/
- public static void notifyError(DomElement p_oP, Exception p_e, Serializable p_oSer) {
+ public static void notifyError(ConfigTree p_oP, Exception p_e, Serializable p_oSer) {
if(p_oSer == null) {
return;
}
@@ -619,8 +619,8 @@
oPS.close();
String sMsg = oBO.toString();
- for (DomElement oCurr : p_oP
- .getElementChildren(NotificationList.ELEMENT)) {
+ for (ConfigTree oCurr : p_oP
+ .getChildren(NotificationList.ELEMENT)) {
NotificationList oNL = new NotificationList(oCurr);
if (!oNL.isErr())
continue;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/JmsQueueListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/JmsQueueListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/JmsQueueListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -37,7 +37,7 @@
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
public class JmsQueueListener extends AbstractListener {
@@ -56,7 +56,7 @@
protected MessageConsumer jmsMessageReceiver;
- public JmsQueueListener(GpListener commandListener, DomElement listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
+ public JmsQueueListener(GpListener commandListener, ConfigTree listenerConfig, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
super(commandListener, listenerConfig, actionDefinitionFactory);
checkMyParms();
} // __________________________________
@@ -74,7 +74,7 @@
String sQueue = GpListener.obtainAtt(listenerConfig, LISTEN_QUEUE, null);
// No problem if selector is null - everything in queue will be returned
- m_sSelector = listenerConfig.getAttr(LISTEN_MSG_SELECTOR);
+ m_sSelector = listenerConfig.getAttribute(LISTEN_MSG_SELECTOR);
m_oQconn = null;
m_oQsess = null;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -30,7 +30,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.util.FtpClientUtil;
import org.jboss.soa.esb.util.Util;
@@ -46,11 +46,11 @@
public static final String FILE_POST_SFX = "postSuffix";
public static final String FILE_POST_DEL = "postDelete";
- private DomElement _params;
+ private ConfigTree _params;
private Logger _logger = Logger.getLogger(this.getClass());
FtpClientUtil _ftpClient;
- public RemoteDirectoryPoller(GpListener p_oDad, DomElement p_oParms,ActionDefinitionFactory actionDF)
+ public RemoteDirectoryPoller(GpListener p_oDad, ConfigTree p_oParms,ActionDefinitionFactory actionDF)
throws Exception
{
super(p_oDad,p_oParms,actionDF);
@@ -189,7 +189,7 @@
};
for (String sProp : sa)
{
- String sVal = _params.getAttr(sProp);
+ String sVal = _params.getAttribute(sProp);
if (!Util.isNullString(sVal))
m_ftpProps.add(new KeyValuePair(sProp,sVal));
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/SqlTablePoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/SqlTablePoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/old/SqlTablePoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -39,7 +39,7 @@
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
import org.jboss.soa.esb.util.Util;
@@ -53,7 +53,7 @@
*
* Each retrieved row (see OPTIONAL_ATT.whereCondition) should be considered as a trigger
* that is intended to instantiate an object of "actionClass". The new instance will
- * receive the full DomElement (level 1 for each child group)
+ * receive the full ConfigTree (level 1 for each child group)
*
* @author Esteban Schifman
*/
@@ -165,10 +165,10 @@
* <br/>m_iSleepForThreads : how long to sleep if all configured threads are in use (default 3000)
* <br/>m_iUpperThreadLimit : max number of threads allowed (default 10)
* @param p_oDad GpListener - The controlling process
- * @param p_oParms DomElement - Sub tree that corresponds to this instance
+ * @param p_oParms ConfigTree - Sub tree that corresponds to this instance
* @throws Exception
*/
- public SqlTablePoller(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
+ public SqlTablePoller(GpListener p_oDad, ConfigTree p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception
{
super(p_oDad, p_oParms, actionDefinitionFactory);
try { checkMyParms(); }
@@ -179,7 +179,7 @@
}
} //__________________________________
- private void checkAndStoreAtt(DomElement p_oP, String p_sName, String p_sDflt)
+ private void checkAndStoreAtt(ConfigTree p_oP, String p_sName, String p_sDflt)
throws Exception
{
m_oVals.put(p_sName,GpListener.obtainAtt(p_oP,p_sName,p_sDflt));
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import junit.framework.TestCase;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.xml.sax.SAXException;
@@ -40,7 +40,7 @@
public class ActionDefinitionFactoryUnitTest extends TestCase {
public void test_good_config() throws SAXException, IOException, ConfigurationException {
- DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream("ActionDefinition-Config-01.xml"));
+ ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream("ActionDefinition-Config-01.xml"));
ActionDefinitionFactory factory = new ActionDefinitionFactory(config);
// ActionProcessor Impl with a non-default public constructor
@@ -79,7 +79,7 @@
}
private void test_bad_config(String configName, String exceptionMsg) throws SAXException, IOException, ConfigurationException {
- DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream(configName));
+ ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream(configName));
try {
new ActionDefinitionFactory(config);
fail("Expected ConfigurationException");
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListenerUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListenerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,198 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.listeners;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.actions.ActionDefinition;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.actions.BaseTestActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.listeners.old.AbstractListener;
-import org.jboss.soa.esb.listeners.old.GpListener;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.util.MockNonblockingListener;
-
-/**
- * AbstractListener tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class AbstractListenerUnitTest extends TestCase {
-
- private MockGpListener gpListener;
- private ActionDefinitionFactory factory;
- private DomElement listenerConfig;
- private ActionDefinition action_ActionA;
- private ActionDefinition action_ActionB;
- private ActionDefinition action_ActionC;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- gpListener = new MockGpListener();
- listenerConfig = new DomElement("listenerConfig");
-
- DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream("AbstractListener_ActionConfig.xml"));
- factory = new ActionDefinitionFactory(config);
- action_ActionA = factory.getInstance("ActionA");
- action_ActionB = factory.getInstance("ActionB");
- action_ActionC = factory.getInstance("ActionC");
- assertNotNull(action_ActionA);
- assertNotNull(action_ActionB);
- assertNotNull(action_ActionC);
- }
-
- public void test_BadActionsConfig() throws Exception {
- // Not action config of any description...
- assertActionsConfigException("message1", "No actions configuration specified either on the listener or as a Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST]. Aborting message processing.");
-
- // Bad actions config as an override attachment - wrong type...
- Message message = MessageFactory.getInstance().getMessage();
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, new Long(1));
- assertActionsConfigException(message, "Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST] must be of type java.lang.String. Received [java.lang.Long]. Aborting message processing.");
-
- // Bad actions config as an override attachment - empty...
- message = MessageFactory.getInstance().getMessage();
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, " ");
- assertActionsConfigException(message, "Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST] was specified but with an empty value. Aborting message processing.");
-
- // Bad actions config as an override attachment - unknown action...
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionX");
- assertActionsConfigException("message1", "Bad Listener Configuration. No 'Actions/Action' definition for action [ActionX].");
- }
-
- public void test_ActionsListenerConfig() throws Exception {
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionA, ActionB");
-
- // Run the listener and check that the proper actions were run...
- runListener("message1", null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_ActionsOverrideConfig() throws Exception {
- Message message = MessageFactory.getInstance().getMessage();
-
- // Set the actions on both the listener config and on the message as an attachment...
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionA, ActionB");
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, "ActionA, ActionC");
- ActionUtils.setTaskObject(message, "message1");
-
- // Run the listener and check that it was the attachment actions config that was used...
- runListener(message, null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_PrematureTermination_By_Exception() throws Exception {
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionB.getProcessor()).exception = new ActionProcessingException("Premature termination by Exception!");
-
- // Run the listener and check that it failed and raised an appropriate error on the listener...
- runListener("message1", "Premature termination by Exception!");
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_PrematureTermination_By_Null() throws Exception {
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionB.getProcessor()).returnNull = true;
-
- // Run the listener and check that it failed and raised an appropriate error on the listener...
- runListener("message1", "Premature termination of action processing pipeline [[ActionA, ActionB, ActionC]]. ActionProcessor [org.jboss.soa.esb.actions.TestActionProcessor1] returned a null message result on processing of action [ActionB].");
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_Last_Action_Returning_Null_OK() throws Exception {
- listenerConfig.setAttr(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionC.getProcessor()).returnNull = true;
-
- runListener("message1", null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- private void assertActionsConfigException(Object message, String expectedException) throws Exception {
- MockNonblockingListener listener = new MockNonblockingListener(gpListener, listenerConfig, factory);
-
- listener.messages = new Object[] {message};
- gpListener.continueLooping = true;
- listener.run();
-
- assertEquals(0, listener.messagesCompleted.size());
- assertEquals(1, listener.messagesInError.size());
- assertEquals(message, listener.messagesInError.get(0).initialMsg);
- assertEquals(null, listener.messagesInError.get(0).processor);
- assertEquals(expectedException, listener.messagesInError.get(0).error.getMessage());
- }
-
- private MockNonblockingListener runListener(Object message, String expectedException) throws Exception {
- MockNonblockingListener listener = new MockNonblockingListener(gpListener, listenerConfig, factory);
-
- listener.messages = new Object[] {message};
- gpListener.continueLooping = true;
- listener.run();
-
- if(expectedException == null) {
- assertEquals(1, listener.messagesCompleted.size());
- assertEquals(0, listener.messagesInError.size());
- assertEquals(message, listener.messagesCompleted.get(0));
- } else {
- assertEquals(0, listener.messagesCompleted.size());
- assertEquals(1, listener.messagesInError.size());
- assertEquals(message, listener.messagesInError.get(0).initialMsg);
- assertEquals(expectedException, listener.messagesInError.get(0).error.getMessage());
- }
-
- return listener;
- }
-
- /**
- * Overriding the GpListener to get control over the continueLooping method.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private class MockGpListener extends GpListener {
- private boolean continueLooping = true;
-
- public boolean continueLooping() {
- try {
- return continueLooping;
- } finally {
- continueLooping = false;
- }
- }
- }
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListener_ActionConfig.xml
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListener_ActionConfig.xml 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/AbstractListener_ActionConfig.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,11 +0,0 @@
- <Actions>
- <Action name="ActionA" processor="Processor1" />
- <Action name="ActionB" processor="Processor2" />
- <Action name="ActionC" processor="Processor3" />
-
- <ProcessorAliases>
- <Alias name="Processor1" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- <Alias name="Processor2" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- <Alias name="Processor3" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- </ProcessorAliases>
- </Actions>
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/DirectoryPollerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/DirectoryPollerUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/DirectoryPollerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,58 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.listeners.old.DirectoryPoller;
-
-/**
- * Test the DirectoryPoller
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class DirectoryPollerUnitTest extends BaseTest {
-
-
- /**
- * Basic construction test
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of DirectoryPoller");
- // This should fail
- try {
- @SuppressWarnings("unused")
- DirectoryPoller dirPoller = new DirectoryPoller(null,null, null);
- fail("GpListener should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
-
-
-
-
-
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,31 +0,0 @@
-<EsbConfig
- command-queue-class="org.jboss.internal.soa.esb.command.InMemoryCommandQueue"
- command-queue-name="test-queue"
->
-
- <ListenerConfig
- listenerClass="org.jboss.soa.esb.util.MockPoller"
- actions="String-To-Long, Long-To-Date, Route-To-Nowhere"
- maxThreads="1"
- >
- </ListenerConfig>
-
- <Actions>
- <!--
- Under the new architecture I think these will be equivalent to "Contracts Definitions"?
- -->
- <Action name="String-To-Long" processor="StringToLongConverter" />
- <Action name="Long-To-Date" processor="LongToDateConverter" />
- <Action name="Route-To-Nowhere" processor="ToNowhereRouter" />
-
- <ProcessorAliases>
- <!--
- Under the new architecture I think these will be equivalent to "Services"? The alias "name" being like the Service URN.
- -->
- <Alias name="StringToLongConverter" class="org.jboss.soa.esb.actions.converters.StringToLongConverter" />
- <Alias name="LongToDateConverter" class="org.jboss.soa.esb.actions.converters.LongToDateConverter" />
- <Alias name="ToNowhereRouter" class="org.jboss.soa.esb.actions.ToNowhereRouter" />
- </ProcessorAliases>
- </Actions>
-
-</EsbConfig>
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListenerUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListenerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,92 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners;
-
-import java.util.Date;
-
-import org.jboss.internal.soa.esb.command.InMemoryCommandQueue;
-import org.jboss.soa.esb.actions.ToNowhereRouter;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.listeners.old.GpListener;
-import org.jboss.soa.esb.util.ListenersManagerExecThread;
-import org.jboss.soa.esb.util.MockPoller;
-
-/**
- * Test the GpListener
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class GpListenerUnitTest extends BaseTest {
-
-
- /**
- * Basic construction test
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of GpListener");
- // This should fail
- @SuppressWarnings("unused")
- GpListener gpListener = null;
- try {
- gpListener = new GpListener("");
- fail("GpListener should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
-
- public void test_newGpListener() throws Exception {
- DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream("GpListener-Config-01.xml"));
- GpListener listenerManager = new GpListener(config);
- ListenersManagerExecThread execThread = new ListenersManagerExecThread(listenerManager);
- long currentTimeInMillis = System.currentTimeMillis();
-
- // Clear the routing processor at the end of the pipeline...
- ToNowhereRouter.objects.clear();
-
- // Start the GpListener command thread...
- execThread.start();
-
- // Stick the current time into the poller as a String...
- MockPoller.addToQueue("" + currentTimeInMillis);
-
- // The message has been pulled from the poller in-queue at this stage because MockPoller.addToQueue blocks.
- // Wait for a few milliseconds to allow the processor pipeline do it's thing...
- Thread.sleep(200);
-
- // Check did the "payload" get processed. The String containing the time should have been processed down the
- // pileline and into a Date object in the ToNowhereRouter (mock routing processor) at the end of the pipeline...
- assertEquals(1, ToNowhereRouter.objects.size());
- Object date = ToNowhereRouter.objects.get(0);
- assertTrue(date instanceof Date);
- assertEquals(new Date(currentTimeInMillis), date);
-
- // Send a shutdown command to the GpListener...
- InMemoryCommandQueue.getQueue("test-queue").addCommand("shutdown");
- execThread.assertShutdownOK(10000);
- }
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,74 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.listeners.old.SqlTablePoller;
-
-/**
- * Test the SqlTablePoller
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class SqlTablePollerUnitTest extends BaseTest {
-
- /**
- * Test basic construction.
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of SqlTablePoller");
- // This should fail
- @SuppressWarnings("unused")
- SqlTablePoller sqlPoller = null;
- try {
- sqlPoller = new SqlTablePoller(null, null, null);
- fail("SqlTablePoller should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
- /*
- public void test_Construction() throws Exception {
-
- DomElement domElement = DomElement.fromInputStream(
- getClass().getResourceAsStream("SqlTablePollerUnitTest.xml"));
-
-
- log.info("Loaded - " + domElement.toXml());
- }
- */
-
-
-
-
-
-
-
-
-
-
-
-}
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.xml
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.xml 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/SqlTablePollerUnitTest.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,35 +0,0 @@
-<DocumentElementName>
- <ExampleListenChapter
- maxThreads="2"
- listenerClass="org.jboss.soa.esb.listeners.SqlTablePoller"
- actionClass="org.jboss.soa.esb.actions.templates.MockSqlRowAction"
-
- driver-class="org.hsqldb.jdbcDriver"
- connection-url="jdbc:hsqldb:."
- user-name="sa"
- password=""
-
- tableName="test_notif_table"
- selectFields="oid,ref,msg"
- keyFields="oid,ref"
- inProcessField="statusCol"
- whereCondition="src='pepe'"
- orderBy="oid desc"
- >
- <NotificationList type="OK">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifOK"
- append="true"
- />
- </target>
- </NotificationList>
-
- <NotificationList type="err">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifErr"
- append="true"
- />
- </target>
- </NotificationList>
- </ExampleListenChapter>
-</DocumentElementName>
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,198 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.listeners.old;
-
-import org.jboss.soa.esb.actions.ActionDefinition;
-import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.actions.BaseTestActionProcessor;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.old.AbstractListener;
-import org.jboss.soa.esb.listeners.old.GpListener;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.util.MockNonblockingListener;
-
-import junit.framework.TestCase;
-
-/**
- * AbstractListener tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class AbstractListenerUnitTest extends TestCase {
-
- private MockGpListener gpListener;
- private ActionDefinitionFactory factory;
- private ConfigTree listenerConfig;
- private ActionDefinition action_ActionA;
- private ActionDefinition action_ActionB;
- private ActionDefinition action_ActionC;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- gpListener = new MockGpListener();
- listenerConfig = new ConfigTree("listenerConfig");
-
- ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream("AbstractListener_ActionConfig.xml"));
- factory = new ActionDefinitionFactory(config);
- action_ActionA = factory.getInstance("ActionA");
- action_ActionB = factory.getInstance("ActionB");
- action_ActionC = factory.getInstance("ActionC");
- assertNotNull(action_ActionA);
- assertNotNull(action_ActionB);
- assertNotNull(action_ActionC);
- }
-
- public void test_BadActionsConfig() throws Exception {
- // Not action config of any description...
- assertActionsConfigException("message1", "No actions configuration specified either on the listener or as a Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST]. Aborting message processing.");
-
- // Bad actions config as an override attachment - wrong type...
- Message message = MessageFactory.getInstance().getMessage();
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, new Long(1));
- assertActionsConfigException(message, "Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST] must be of type java.lang.String. Received [java.lang.Long]. Aborting message processing.");
-
- // Bad actions config as an override attachment - empty...
- message = MessageFactory.getInstance().getMessage();
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, " ");
- assertActionsConfigException(message, "Message attachement [MESSAGE_PROCESSING_ACTIONS_LIST] was specified but with an empty value. Aborting message processing.");
-
- // Bad actions config as an override attachment - unknown action...
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionX");
- assertActionsConfigException("message1", "Bad Listener Configuration. No 'Actions/Action' definition for action [ActionX].");
- }
-
- public void test_ActionsListenerConfig() throws Exception {
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionA, ActionB");
-
- // Run the listener and check that the proper actions were run...
- runListener("message1", null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_ActionsOverrideConfig() throws Exception {
- Message message = MessageFactory.getInstance().getMessage();
-
- // Set the actions on both the listener config and on the message as an attachment...
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionA, ActionB");
- message.getAttachment().put(AbstractListener.MESSAGE_PROCESSING_ACTIONS_LIST, "ActionA, ActionC");
- ActionUtils.setTaskObject(message, "message1");
-
- // Run the listener and check that it was the attachment actions config that was used...
- runListener(message, null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_PrematureTermination_By_Exception() throws Exception {
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionB.getProcessor()).exception = new ActionProcessingException("Premature termination by Exception!");
-
- // Run the listener and check that it failed and raised an appropriate error on the listener...
- runListener("message1", "Premature termination by Exception!");
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_PrematureTermination_By_Null() throws Exception {
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionB.getProcessor()).returnNull = true;
-
- // Run the listener and check that it failed and raised an appropriate error on the listener...
- runListener("message1", "Premature termination of action processing pipeline [[ActionA, ActionB, ActionC]]. ActionProcessor [org.jboss.soa.esb.actions.TestActionProcessor1] returned a null message result on processing of action [ActionB].");
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(0, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- public void test_Last_Action_Returning_Null_OK() throws Exception {
- listenerConfig.setAttribute(GpListener.PARM_ACTIONS, "ActionA, ActionB, ActionC");
-
- ((BaseTestActionProcessor)action_ActionC.getProcessor()).returnNull = true;
-
- runListener("message1", null);
- assertEquals(1, ((BaseTestActionProcessor)action_ActionA.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionB.getProcessor()).processedMessages.size());
- assertEquals(1, ((BaseTestActionProcessor)action_ActionC.getProcessor()).processedMessages.size());
- }
-
- private void assertActionsConfigException(Object message, String expectedException) throws Exception {
- MockNonblockingListener listener = new MockNonblockingListener(gpListener, listenerConfig, factory);
-
- listener.messages = new Object[] {message};
- gpListener.continueLooping = true;
- listener.run();
-
- assertEquals(0, listener.messagesCompleted.size());
- assertEquals(1, listener.messagesInError.size());
- assertEquals(message, listener.messagesInError.get(0).initialMsg);
- assertEquals(null, listener.messagesInError.get(0).processor);
- assertEquals(expectedException, listener.messagesInError.get(0).error.getMessage());
- }
-
- private MockNonblockingListener runListener(Object message, String expectedException) throws Exception {
- MockNonblockingListener listener = new MockNonblockingListener(gpListener, listenerConfig, factory);
-
- listener.messages = new Object[] {message};
- gpListener.continueLooping = true;
- listener.run();
-
- if(expectedException == null) {
- assertEquals(1, listener.messagesCompleted.size());
- assertEquals(0, listener.messagesInError.size());
- assertEquals(message, listener.messagesCompleted.get(0));
- } else {
- assertEquals(0, listener.messagesCompleted.size());
- assertEquals(1, listener.messagesInError.size());
- assertEquals(message, listener.messagesInError.get(0).initialMsg);
- assertEquals(expectedException, listener.messagesInError.get(0).error.getMessage());
- }
-
- return listener;
- }
-
- /**
- * Overriding the GpListener to get control over the continueLooping method.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private class MockGpListener extends GpListener {
- private boolean continueLooping = true;
-
- public boolean continueLooping() {
- try {
- return continueLooping;
- } finally {
- continueLooping = false;
- }
- }
- }
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListenerUnitTest.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,11 +0,0 @@
- <Actions>
- <Action name="ActionA" processor="Processor1" />
- <Action name="ActionB" processor="Processor2" />
- <Action name="ActionC" processor="Processor3" />
-
- <ProcessorAliases>
- <Alias name="Processor1" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- <Alias name="Processor2" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- <Alias name="Processor3" class="org.jboss.soa.esb.actions.TestActionProcessor1" />
- </ProcessorAliases>
- </Actions>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/AbstractListener_ActionConfig.xml)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,58 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners.old;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.listeners.old.DirectoryPoller;
-
-/**
- * Test the DirectoryPoller
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class DirectoryPollerUnitTest extends BaseTest {
-
-
- /**
- * Basic construction test
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of DirectoryPoller");
- // This should fail
- try {
- @SuppressWarnings("unused")
- DirectoryPoller dirPoller = new DirectoryPoller(null,null, null);
- fail("GpListener should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
-
-
-
-
-
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/DirectoryPollerUnitTest.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,31 +0,0 @@
-<EsbConfig
- command-queue-class="org.jboss.internal.soa.esb.command.InMemoryCommandQueue"
- command-queue-name="test-queue"
->
-
- <ListenerConfig
- listenerClass="org.jboss.soa.esb.util.MockPoller"
- actions="String-To-Long, Long-To-Date, Route-To-Nowhere"
- maxThreads="1"
- >
- </ListenerConfig>
-
- <Actions>
- <!--
- Under the new architecture I think these will be equivalent to "Contracts Definitions"?
- -->
- <Action name="String-To-Long" processor="StringToLongConverter" />
- <Action name="Long-To-Date" processor="LongToDateConverter" />
- <Action name="Route-To-Nowhere" processor="ToNowhereRouter" />
-
- <ProcessorAliases>
- <!--
- Under the new architecture I think these will be equivalent to "Services"? The alias "name" being like the Service URN.
- -->
- <Alias name="StringToLongConverter" class="org.jboss.soa.esb.actions.converters.StringToLongConverter" />
- <Alias name="LongToDateConverter" class="org.jboss.soa.esb.actions.converters.LongToDateConverter" />
- <Alias name="ToNowhereRouter" class="org.jboss.soa.esb.actions.ToNowhereRouter" />
- </ProcessorAliases>
- </Actions>
-
-</EsbConfig>
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListener-Config-01.xml)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,92 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners.old;
-
-import java.util.Date;
-
-import org.jboss.internal.soa.esb.command.InMemoryCommandQueue;
-import org.jboss.soa.esb.actions.ToNowhereRouter;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.old.GpListener;
-import org.jboss.soa.esb.util.ListenersManagerExecThread;
-import org.jboss.soa.esb.util.MockPoller;
-
-/**
- * Test the GpListener
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class GpListenerUnitTest extends BaseTest {
-
-
- /**
- * Basic construction test
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of GpListener");
- // This should fail
- @SuppressWarnings("unused")
- GpListener gpListener = null;
- try {
- gpListener = new GpListener("");
- fail("GpListener should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
-
- public void test_newGpListener() throws Exception {
- ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream("GpListener-Config-01.xml"));
- GpListener listenerManager = new GpListener(config);
- ListenersManagerExecThread execThread = new ListenersManagerExecThread(listenerManager);
- long currentTimeInMillis = System.currentTimeMillis();
-
- // Clear the routing processor at the end of the pipeline...
- ToNowhereRouter.objects.clear();
-
- // Start the GpListener command thread...
- execThread.start();
-
- // Stick the current time into the poller as a String...
- MockPoller.addToQueue("" + currentTimeInMillis);
-
- // The message has been pulled from the poller in-queue at this stage because MockPoller.addToQueue blocks.
- // Wait for a few milliseconds to allow the processor pipeline do it's thing...
- Thread.sleep(200);
-
- // Check did the "payload" get processed. The String containing the time should have been processed down the
- // pileline and into a Date object in the ToNowhereRouter (mock routing processor) at the end of the pipeline...
- assertEquals(1, ToNowhereRouter.objects.size());
- Object date = ToNowhereRouter.objects.get(0);
- assertTrue(date instanceof Date);
- assertEquals(new Date(currentTimeInMillis), date);
-
- // Send a shutdown command to the GpListener...
- InMemoryCommandQueue.getQueue("test-queue").addCommand("shutdown");
- execThread.assertShutdownOK(10000);
- }
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/GpListenerUnitTest.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,74 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.listeners.old;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.listeners.old.SqlTablePoller;
-
-/**
- * Test the SqlTablePoller
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class SqlTablePollerUnitTest extends BaseTest {
-
- /**
- * Test basic construction.
- * @throws Exception
- */
- public void test_Empty_Construction() throws Exception {
- log.info("Constructing instance of SqlTablePoller");
- // This should fail
- @SuppressWarnings("unused")
- SqlTablePoller sqlPoller = null;
- try {
- sqlPoller = new SqlTablePoller(null, null, null);
- fail("SqlTablePoller should fail with empty constructor string");
- } catch (Exception e) {
- }
- }
-
-
- /*
- public void test_Construction() throws Exception {
-
- ConfigTree domElement = ConfigTree.fromInputStream(
- getClass().getResourceAsStream("SqlTablePollerUnitTest.xml"));
-
-
- log.info("Loaded - " + domElement.toXml());
- }
- */
-
-
-
-
-
-
-
-
-
-
-
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,35 +0,0 @@
-<DocumentElementName>
- <ExampleListenChapter
- maxThreads="2"
- listenerClass="org.jboss.soa.esb.listeners.SqlTablePoller"
- actionClass="org.jboss.soa.esb.actions.templates.MockSqlRowAction"
-
- driver-class="org.hsqldb.jdbcDriver"
- connection-url="jdbc:hsqldb:."
- user-name="sa"
- password=""
-
- tableName="test_notif_table"
- selectFields="oid,ref,msg"
- keyFields="oid,ref"
- inProcessField="statusCol"
- whereCondition="src='pepe'"
- orderBy="oid desc"
- >
- <NotificationList type="OK">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifOK"
- append="true"
- />
- </target>
- </NotificationList>
-
- <NotificationList type="err">
- <target class="NotifyFiles">
- <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifErr"
- append="true"
- />
- </target>
- </NotificationList>
- </ExampleListenChapter>
-</DocumentElementName>
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml)
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/old/SqlTablePollerUnitTest.xml 2006-10-26 04:32:42 UTC (rev 7134)
@@ -0,0 +1,35 @@
+<DocumentElementName>
+ <ExampleListenChapter
+ maxThreads="2"
+ listenerClass="org.jboss.soa.esb.listeners.old.SqlTablePoller"
+ actionClass="org.jboss.soa.esb.actions.templates.MockSqlRowAction"
+
+ driver-class="org.hsqldb.jdbcDriver"
+ connection-url="jdbc:hsqldb:."
+ user-name="sa"
+ password=""
+
+ tableName="test_notif_table"
+ selectFields="oid,ref,msg"
+ keyFields="oid,ref"
+ inProcessField="statusCol"
+ whereCondition="src='pepe'"
+ orderBy="oid desc"
+ >
+ <NotificationList type="OK">
+ <target class="NotifyFiles">
+ <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifOK"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+
+ <NotificationList type="err">
+ <target class="NotifyFiles">
+ <file URI="file:///tmp/jbossEsb/notifyDir/ListenOnNotifTable.notifErr"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+ </ExampleListenChapter>
+</DocumentElementName>
\ No newline at end of file
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/AbstractMockListner.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/AbstractMockListner.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/AbstractMockListner.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -27,7 +27,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.old.AbstractListener;
import org.jboss.soa.esb.listeners.old.GpListener;
@@ -43,7 +43,7 @@
public List<MessageInError> messagesInError = new Vector<MessageInError>();
public List<Object> messagesCompleted = new Vector<Object>();
- public AbstractMockListner(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
+ public AbstractMockListner(GpListener p_oDad, ConfigTree p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
super(p_oDad, p_oParms, actionDefinitionFactory);
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNonblockingListener.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNonblockingListener.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNonblockingListener.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -22,7 +22,7 @@
package org.jboss.soa.esb.util;
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.old.GpListener;
/**
@@ -36,7 +36,7 @@
public Object[] messages;
- public MockNonblockingListener(GpListener p_oDad, DomElement p_oParms,
+ public MockNonblockingListener(GpListener p_oDad, ConfigTree p_oParms,
ActionDefinitionFactory actionDefinitionFactory) throws Exception {
super(p_oDad, p_oParms, actionDefinitionFactory);
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -7,7 +7,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.notification.NotificationTarget;
/**
@@ -29,10 +29,10 @@
private static Hashtable<String, List<Serializable>> targetLists = new Hashtable<String, List<Serializable>>();
private List<Serializable> targetList;
- public MockNotificationTarget(DomElement config) {
+ public MockNotificationTarget(ConfigTree config) {
super(config);
- String name = config.getAttr("name");
+ String name = config.getAttribute("name");
if(name == null || name.trim().equals("")) {
TestCase.fail("Mock NotificationTarget configured incorrectly. Must specify a 'name' attribute on the NotificationList/target element.");
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockPoller.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockPoller.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockPoller.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -8,7 +8,7 @@
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.old.AbstractPoller;
import org.jboss.soa.esb.listeners.old.GpListener;
@@ -24,7 +24,7 @@
public List<MessageInError> messagesInError = new Vector<MessageInError>();
public List<Object> messagesCompleted = new Vector<Object>();
- public MockPoller(GpListener p_oDad, DomElement p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
+ public MockPoller(GpListener p_oDad, ConfigTree p_oParms, ActionDefinitionFactory actionDefinitionFactory) throws Exception {
super(p_oDad, p_oParms, actionDefinitionFactory);
m_iPollMillis = 250;
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -50,7 +50,8 @@
* This needs rewriting after the interoperability workshop!
*/
-public class PortReferenceHelper {
+public class PortReferenceHelper
+{
/**
* WS-Addressing is broken in that the To field is a URI, even if the From
* field was an EPR! You have to use the EPR bits separately. So, the
@@ -63,16 +64,21 @@
org.w3c.dom.Document document,
org.w3c.dom.Element portReferenceElement,
PortReference portReference, boolean toField)
- throws MarshalException {
- try {
- if (!toField) {
+ throws MarshalException
+ {
+ try
+ {
+ if (!toField)
+ {
Element addressElement = document.createElementNS(
XMLUtil.WSA_NAMESPACE_URI, XMLUtil.ADDRESS_TAG);
addressElement.setPrefix(XMLUtil.WSA_PREFIX);
addressElement.appendChild(document
.createTextNode(portReference.getAddress()));
portReferenceElement.appendChild(addressElement);
- } else {
+ }
+ else
+ {
portReferenceElement.appendChild(document
.createTextNode(portReference.getAddress()));
}
@@ -80,7 +86,8 @@
Iterator extensions = portReference.getExtensions();
Element referenceProperties = null;
- while (extensions.hasNext()) {
+ while (extensions.hasNext())
+ {
PortReference.Extension extension = (PortReference.Extension) extensions
.next();
@@ -90,39 +97,48 @@
* separately. Doh!
*/
- if (!toField) {
- if (referenceProperties == null) {
+ if (!toField)
+ {
+ if (referenceProperties == null)
+ {
referenceProperties = document.createElementNS(
XMLUtil.WSA_NAMESPACE_URI,
XMLUtil.REFERENCE_PROPERTIES_TAG);
referenceProperties.setPrefix(XMLUtil.WSA_PREFIX);
portReferenceElement.appendChild(referenceProperties);
}
- } else
+ }
+ else
referenceProperties = header;
extensionToXML(referenceProperties, document, extension);
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
throw new MarshalException("Marshal failure: " + exception);
}
}
/** **************************** */
- public static PortReference fromXML(org.w3c.dom.Element portReferenceElement, boolean toField)
- throws MarshalException {
- PortReference portReference = new PortReference();;
-
+ public static PortReference fromXML(
+ org.w3c.dom.Element portReferenceElement, boolean toField)
+ throws MarshalException
+ {
+ PortReference portReference = new PortReference();
+
if (toField)
portReference.setAddress(portReferenceElement.getTextContent());
org.w3c.dom.NodeList elements = portReferenceElement.getChildNodes();
- for (int i = 1; i < elements.getLength(); i++) {
+ for (int i = 1; i < elements.getLength(); i++)
+ {
final Object extensionObject = elements.item(i);
-
- if (extensionObject instanceof Element) {
+
+ if (extensionObject instanceof Element)
+ {
int parentNodeType = PortReference.Extension.NEITHER;
Element extensionElement = (Element) extensionObject;
NodeList children = extensionElement.getChildNodes();
@@ -131,31 +147,40 @@
if (parentName.equals(XMLUtil.REFERENCE_PROPERTIES_TAG))
parentNodeType = PortReference.Extension.REFERENCE_PROPERTIES;
- else {
+ else
+ {
if (parentName.equals(XMLUtil.REFERENCE_PARAMETERS_TAG))
parentNodeType = PortReference.Extension.REFERENCE_PARAMETERS;
else
{
- if (!toField && parentName.equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ADDRESS_TAG))
+ if (!toField
+ && parentName.equals(XMLUtil.WSA_PREFIX + ":"
+ + XMLUtil.ADDRESS_TAG))
{
- portReference.setAddress(extensionElement.getTextContent());
+ portReference.setAddress(extensionElement
+ .getTextContent());
}
}
}
final int numChildren = children.getLength();
- for (int count = 0; count < numChildren; count++) {
+
+ for (int count = 0; count < numChildren; count++)
+ {
final Object childObject = children.item(count);
- if (childObject instanceof Element) {
+ if (childObject instanceof Element)
+ {
Element childElement = (Element) childObject;
+
portReference
.addExtension(childrenFromXML(childElement));
haveChildren = true;
}
}
- if (!haveChildren) {
+ if (!haveChildren && !parentName.equals(XMLUtil.WSA_PREFIX + ":"+ XMLUtil.ADDRESS_TAG))
+ {
PortReference.Extension ext = new PortReference.Extension(
extensionElement.getNodeName(), null, null,
extensionElement.getNodeValue(), parentNodeType);
@@ -164,12 +189,15 @@
final NamedNodeMap attrs = extensionElement.getAttributes();
final int numAttrs = attrs.getLength();
- if (numAttrs > 0) {
+ if (numAttrs > 0)
+ {
final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
- for (int count = 0; count < numAttrs; count++) {
+ for (int count = 0; count < numAttrs; count++)
+ {
final Attr attr = (Attr) attrs.item(count);
if (!"http://www.w3.org/2000/xmlns/".equals(attr
- .getNamespaceURI())) {
+ .getNamespaceURI()))
+ {
final ArjunaName name = generateName(attr);
p.put(name, attr.getValue());
}
@@ -185,27 +213,37 @@
}
private final static PortReference.Extension childrenFromXML(
- Element childRoot) {
+ Element childRoot)
+ {
final NodeList children = childRoot.getChildNodes();
final int numChildNodes = children.getLength();
final PortReference.Extension extension;
- if (numChildNodes > 0) {
+ if (numChildNodes > 0)
+ {
Object childObject = children.item(0);
- if (childObject instanceof Element) {
- extension = new PortReference.Extension(childRoot
- .getNodeName(), childRoot.getPrefix(), childRoot
- .getNamespaceURI());
- for (int count = 1; count < numChildNodes; count++) {
+ if (childObject instanceof Element)
+ {
+ extension = new PortReference.Extension(
+ childRoot.getNodeName(), childRoot.getPrefix(),
+ childRoot.getNamespaceURI());
+
+ for (int count = 1; count < numChildNodes; count++)
+ {
extension.addChild(childrenFromXML((Element) childObject));
childObject = children.item(count);
}
- } else {
- extension = new PortReference.Extension(childRoot
- .getNodeName(), childRoot.getPrefix(), childRoot
- .getNamespaceURI(), ((Node) childObject).getNodeValue());
}
- } else {
+ else
+ {
+ extension = new PortReference.Extension(
+ childRoot.getNodeName(), childRoot.getPrefix(),
+ childRoot.getNamespaceURI(), ((Node) childObject)
+ .getNodeValue());
+ }
+ }
+ else
+ {
extension = new PortReference.Extension(childRoot.getNodeName(),
childRoot.getPrefix(), childRoot.getNamespaceURI(),
childRoot.getNodeValue());
@@ -213,12 +251,15 @@
final NamedNodeMap attrs = childRoot.getAttributes();
final int numAttrs = attrs.getLength();
- if (numAttrs > 0) {
+ if (numAttrs > 0)
+ {
final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
- for (int count = 0; count < numAttrs; count++) {
+ for (int count = 0; count < numAttrs; count++)
+ {
final Attr attr = (Attr) attrs.item(count);
if (!"http://www.w3.org/2000/xmlns/".equals(attr
- .getNamespaceURI())) {
+ .getNamespaceURI()))
+ {
final ArjunaName name = generateName(attr);
p.put(name, attr.getValue());
}
@@ -231,12 +272,16 @@
private final static Element extensionToXML(Element packInto,
org.w3c.dom.Document document, PortReference.Extension toPack)
- throws MarshalException {
+ throws MarshalException
+ {
final String uri = toPack.getURI();
final Element element;
- if (uri == null) {
+ if (uri == null)
+ {
element = document.createElement(toPack.getTag());
- } else {
+ }
+ else
+ {
final String prefix = toPack.getPrefix();
element = document.createElementNS(uri, toPack.getTag());
element.setPrefix(prefix);
@@ -245,15 +290,18 @@
}
packInto.appendChild(element);
- if (toPack.getValue() != null) {
+ if (toPack.getValue() != null)
+ {
final Text text = document.createTextNode(toPack.getValue());
element.appendChild(text);
}
LinkedList extensions = toPack.getChildren();
- if (extensions != null) {
- for (int i = 0; i < extensions.size(); i++) {
+ if (extensions != null)
+ {
+ for (int i = 0; i < extensions.size(); i++)
+ {
PortReference.Extension ext = (PortReference.Extension) extensions
.get(i);
@@ -263,18 +311,23 @@
HashMap attrs = toPack.getAttributes();
- if (attrs != null) {
+ if (attrs != null)
+ {
Iterator names = attrs.entrySet().iterator();
- while (names.hasNext()) {
+ while (names.hasNext())
+ {
Map.Entry entry = (Map.Entry) names.next();
ArjunaName name = (ArjunaName) entry.getKey();
final String value = (String) entry.getValue();
final String attrURI = name.toString();
- if (attrURI != null) {
+ if (attrURI != null)
+ {
element.setAttributeNS(attrURI, name.getQualifiedName(),
value);
- } else {
+ }
+ else
+ {
element.setAttribute(name.getQualifiedName(), value);
}
}
@@ -290,7 +343,8 @@
* The current attribute.
* @return The name
*/
- private static ArjunaName generateName(final Attr attr) {
+ private static ArjunaName generateName(final Attr attr)
+ {
final String localName = attr.getNodeName();
final String uri = attr.getNamespaceURI();
final String prefix = attr.getPrefix();
@@ -326,7 +380,8 @@
* The local name.
*/
public ArjunaName(final String uri, final String prefix,
- final String localName) {
+ final String localName)
+ {
this.uri = uri;
this.prefix = prefix;
this.localName = localName;
@@ -337,7 +392,8 @@
*
* @return the uri.
*/
- public String getURI() {
+ public String getURI()
+ {
return uri;
}
@@ -346,7 +402,8 @@
*
* @return the prefix.
*/
- public String getPrefix() {
+ public String getPrefix()
+ {
return prefix;
}
@@ -355,7 +412,8 @@
*
* @return the local name.
*/
- public String getLocalName() {
+ public String getLocalName()
+ {
return localName;
}
@@ -364,7 +422,8 @@
*
* @return the qualified name.
*/
- public String getQualifiedName() {
+ public String getQualifiedName()
+ {
return (prefix == null ? localName : prefix + ":" + localName);
}
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/CommandQueue.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/CommandQueue.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/CommandQueue.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,6 +1,6 @@
package org.jboss.internal.soa.esb.command;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Command queue abstraction.
@@ -14,7 +14,7 @@
* @param config Command queue configuration.
* @throws CommandQueueException Queue exception. Check for probable chained cause exceptions.
*/
- public void open(DomElement config) throws CommandQueueException;
+ public void open(ConfigTree config) throws CommandQueueException;
/**
* Receive a message from the underlying queue implementation.
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/InMemoryCommandQueue.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/InMemoryCommandQueue.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/InMemoryCommandQueue.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -4,7 +4,7 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* In Memory Blocking Command Queue.
@@ -13,7 +13,7 @@
* <p/>
* The command queue's configuration needs to specify the
* queue name via a "command-queue-name" attribute supplied in the configuration to the
- * {@link #open(DomElement)} method. The queues are stored statically and can be accessed via the
+ * {@link #open(ConfigTree)} method. The queues are stored statically and can be accessed via the
* {@link #getQueue(String)} method using the queue name.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
* @since Version 4.0
@@ -30,12 +30,12 @@
private String name;
private BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
- public void open(DomElement config) throws CommandQueueException {
+ public void open(ConfigTree config) throws CommandQueueException {
if(config == null) {
throw new IllegalArgumentException("null 'config' arg in method call.");
}
- name = config.getAttr(COMMAND_QUEUE_NAME);
+ name = config.getAttribute(COMMAND_QUEUE_NAME);
if(name == null) {
throw new CommandQueueException("Attribute 'command-queue-name' must be specified on the command queue configuration.");
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -21,7 +21,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.AppServerContext;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.util.Util;
/**
@@ -53,7 +53,7 @@
private Connection m_oJmsConn;
- public void open(DomElement config) throws CommandQueueException {
+ public void open(ConfigTree config) throws CommandQueueException {
try {
initialiseJMS(config);
} catch (Exception e) {
@@ -94,9 +94,9 @@
return null;
}
- private void initialiseJMS(DomElement p_oP) throws Exception {
+ private void initialiseJMS(ConfigTree p_oP) throws Exception {
// Only check for JMS attributes if a queue JNDI name was specified
- String sJndiName = p_oP.getAttr(COMMAND_JNDI_NAME);
+ String sJndiName = p_oP.getAttribute(COMMAND_JNDI_NAME);
if (!Util.isNullString(sJndiName)) {
Map<String, Object> oNewAtts = new HashMap<String, Object>();
@@ -116,7 +116,7 @@
sFactClass = "ConnectionFactory";
Object oFactCls = oJndiCtx.lookup(sFactClass);
- String sMsgSelector = p_oP.getAttr(COMMAND_MSG_SELECTOR);
+ String sMsgSelector = p_oP.getAttribute(COMMAND_MSG_SELECTOR);
if (null != sMsgSelector)
oNewAtts.put(COMMAND_MSG_SELECTOR, sMsgSelector);
@@ -151,7 +151,7 @@
* Find an attribute in the tree (arg 0) or assign default value (arg 2)
*
* @param p_oP
- * DomElement - look for attributes in this Element only
+ * ConfigTree - look for attributes in this Element only
* @param p_sAtt
* String - Name of attribute to find
* @param p_sDefault
@@ -161,9 +161,9 @@
* If requested attribute not found and no default value
* supplied by invoker
*/
- private String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
+ private String obtainAtt(ConfigTree p_oP, String p_sAtt, String p_sDefault)
throws ConfigurationException {
- String sVal = p_oP.getAttr(p_sAtt);
+ String sVal = p_oP.getAttribute(p_sAtt);
if ((null == sVal) && (null == p_sDefault))
throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/notification/MacroExpander.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/notification/MacroExpander.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/notification/MacroExpander.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -22,15 +22,14 @@
package org.jboss.internal.soa.esb.notification;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
-import org.jboss.soa.esb.helpers.DomElement;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
/**
* MacroExpander class.
* <p/>
@@ -55,22 +54,17 @@
/**
* Perform a macro replacement on the DOM tree attribute values
- * of the supplied DomElement using the supplied macro token
+ * of the supplied ConfigTree using the supplied macro token
* replacement map.
* @param domTree The DOM Tree to be operated on.
* @param replacementTokenMapMap The token replacement map.
*/
- public static void replaceMacros(DomElement domTree, Map replacementTokenMapMap) {
- replaceMacros(domTree.getDomElement(), replacementTokenMapMap);
- }
-
- private static void replaceMacros(Element element, Map p_oMap) {
- NamedNodeMap attributes = element.getAttributes();
- int attribCount = attributes.getLength();
+ public static void replaceMacros(ConfigTree domTree, Map replacementTokenMap) {
- for (int i = 0; i < attribCount; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String sVal = attribute.getValue();
+ List<KeyValuePair> changed = new ArrayList<KeyValuePair>();
+ for (String currAtt : domTree.getAttributeNames())
+ {
+ String sVal = domTree.getAttribute(currAtt);
boolean bSubst = false;
int iPos = 0;
@@ -81,7 +75,7 @@
if (!sRest.startsWith(sMac)) {
continue;
}
- Object oRpl = (null != p_oMap) ? p_oMap.get(sMac) : null;
+ Object oRpl = (null != replacementTokenMap) ? replacementTokenMap.get(sMac) : null;
if (null == oRpl) {
continue;
}
@@ -90,21 +84,15 @@
break;
}
}
- if (bSubst) {
- attribute.setValue(sVal);
- }
+ if (bSubst)
+ changed.add(new KeyValuePair(currAtt,sVal));
}
+ for (KeyValuePair kvp : changed)
+ domTree.setAttribute(kvp.getKey(),kvp.getValue());
+ changed = null;
// Iterate over the child elements and recursively call this method...
- NodeList children = element.getChildNodes();
- int childCount = children.getLength();
- for (int i = 0; i < childCount; i++) {
- Node child = children.item(i);
-
- if(child.getNodeType() != Node.ELEMENT_NODE) {
- continue;
- }
- replaceMacros((Element)child, p_oMap);
- }
+ for (ConfigTree child : domTree.getAllChildren())
+ replaceMacros(child, replacementTokenMap);
}
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -231,6 +231,23 @@
_uri = uri;
_value = value;
_parent = parent;
+
+ /*
+ * If XML was loaded via DOM1 then prefix and namespace won't work!
+ */
+
+ if (_uri == null)
+ _uri = XMLUtil.WSARJADDR_NAMESPACE_URI;
+
+ if (_prefix == null)
+ _prefix = XMLUtil.WSARJADDR_PREFIX;
+
+ if (_tag.contains(":"))
+ {
+ int colon = _tag.indexOf(':');
+
+ _tag = _tag.substring(colon+1);
+ }
}
public int getParent()
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -55,6 +55,11 @@
private static final String PROTOCOL_SEPARATOR = "://";
private static final String PORT_SEPARATOR = ":";
+ public EmailEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
/**
* Create a new email EPR. The port number will be assumed to be 25,
* and there are no values for username and password.
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -47,6 +47,11 @@
public static final String USERNAME_TAG = "username";
public static final String PASSWORD_TAG = "password";
+ public FTPEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
public FTPEpr (URL url) throws URISyntaxException
{
super(new URI(url.toString()));
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -44,6 +44,11 @@
public class HTTPEpr extends EPR
{
+ public HTTPEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
public HTTPEpr (URL url) throws URISyntaxException
{
super(new URI(url.toString()));
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -49,6 +49,11 @@
public static final String SQL_TAG = "sql";
public static final String DRIVER_TAG = "driver";
+ public JDBCEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
public JDBCEpr (String url, String sql) throws URISyntaxException
{
super(new URI(url));
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -53,12 +53,21 @@
public static final String DESTINATION_TYPE_TAG = "destination-type";
public static final String DESTINATION_NAME_TAG = "destination-name";
public static final String CONNECTION_FACTORY_TAG = "connection-factory";
-
+ public static final String JNDI_TYPE_TAG = "jndi-type";
+ public static final String JNDI_URL_TAG = "jndi-URL";
+ public static final String MESSAGE_SELECTOR_TAG = "message-selector";
+
public static final String QUEUE_TYPE = "queue";
public static final String TOPIC_TYPE = "topic";
+ public JMSEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
/**
* Create a new JMS EPR. The protocol version is assumed to be 1.1.
+ * , jndi_type=jboss, jndi_url=localhost, messageSelector=null
*
* @param destinationType the type of destination (queue/topic).
* @param destinationName name of the queue/topic.
@@ -67,19 +76,39 @@
public JMSEpr (String destinationType, String destinationName, String connection)
{
- this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection);
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection
+ ,"jboss", "localhost", null);
}
/**
+ * Create a new JMS EPR. The protocol version is assumed to be 1.1.
+ *
+ * @param destinationType the type of destination (queue/topic).
+ * @param destinationName name of the queue/topic.
+ * @param connection reference to the connection factory.
+ * @param jndiType reference to the type of jndi to obtain the JMS objects from
+ * @param jndiUrl reference to the location of the jndi to obtain the JMS objects from
+ * @param messageSelector reference to the connection factory.
+ */
+
+ public JMSEpr (String destinationType, String destinationName, String connection, String jndiType, String jndiUrl, String messageSelector)
+ {
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,jndiType, jndiUrl, messageSelector);
+ }
+
+ /**
* Create a new JMS EPR.
*
* @param protocol the protocol version.
* @param destinationType the type of destination (queue/topic).
* @param destinationName name of the queue/topic.
* @param connection reference to the connection factory.
+ * @param jndiType reference to the type of jndi to obtain the JMS objects from
+ * @param jndiUrl reference to the location of the jndi to obtain the JMS objects from
+ * @param messageSelector reference to the connection factory.
*/
- public JMSEpr (String protocol, String destinationType, String destinationName, String connection)
+ public JMSEpr (String protocol, String destinationType, String destinationName, String connection, String jndiType, String jndiUrl, String messageSelector)
{
// how many of these do we really need? modify accordingly.
@@ -100,6 +129,15 @@
if (connection != null)
addr.addExtension(CONNECTION_FACTORY_TAG, connection);
+ if (jndiType != null)
+ addr.addExtension(JNDI_TYPE_TAG, jndiType);
+
+ if (jndiUrl != null)
+ addr.addExtension(JNDI_URL_TAG, jndiUrl);
+
+ if (messageSelector != null)
+ addr.addExtension(MESSAGE_SELECTOR_TAG, messageSelector);
+
setAddr(addr);
}
else
@@ -155,4 +193,34 @@
return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
}
+ /**
+ * @return the jndi type for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getJndiType () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_TYPE_TAG);
+ }
+
+ /**
+ * @return the jndi URL for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getJndiURL () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_URL_TAG);
+ }
+
+ /**
+ * @return the message selector for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getMessageSelector () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(MESSAGE_SELECTOR_TAG);
+ }
+
}
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,262 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author mark.little at jboss.com
- */
-
-package org.jboss.soa.esb.addressing.util;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.URISyntaxException;
-import java.util.Hashtable;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jboss.internal.soa.esb.addressing.PortReferenceHelper;
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
-/**
- * Allows EPRs to be saved to and loaded from files. Mainly for testing
- * purposes.
- *
- * @author marklittle
- *
- */
-
-public class EPRManager
-{
- private static final String ELEMENT_NAME = "EPR";
-
- /**
- * All EPRs are saves in files within the current working directory.
- *
- * @return the manager for the cwd.
- */
-
- public static final EPRManager getInstance()
- {
- return getInstance("");
- }
-
- /**
- * All EPRs are saves in files within a defined directory. Get the right
- * manager for that directory.
- *
- * @param domain
- * the name of the directory. If <code>null</code> then the
- * null String is assumed.
- * @return the manager for the directory. If it does not exist, then one
- * will be created.
- */
-
- public static final EPRManager getInstance(String domain)
- {
- if (domain == null)
- domain = "";
-
- synchronized (_instances)
- {
- EPRManager theInstance = _instances.get(domain);
-
- if (theInstance == null)
- {
- theInstance = new EPRManager(domain);
-
- _instances.put(domain, theInstance);
- }
-
- return theInstance;
- }
- }
-
- public final String getDomain()
- {
- return _directory;
- }
-
- public boolean equals(Object manager)
- {
- if (manager instanceof EPRManager)
- {
- EPRManager comp = (EPRManager) manager;
-
- if (_directory.equals(comp.getDomain()))
- return true;
- }
-
- return false;
- }
-
- /**
- * Save the EPR into the specified file.
- *
- * @param name
- * the name of the file to use (the logical service name).
- * @param address
- * the EPR to save.
- *
- * @throws IOException
- * thrown if there is an error.
- */
-
- public final void saveEPR(String name, EPR address) throws IOException
- {
- if ((name == null) || (address == null))
- throw new IllegalArgumentException();
-
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
- Element portReferenceElement = doc.createElement(ELEMENT_NAME);
-
- doc.appendChild(portReferenceElement);
-
- PortReferenceHelper.toXML(null, doc, portReferenceElement, address
- .getAddr(), false);
-
- StringWriter sWriter = new StringWriter();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
-
- XMLSerializer xmlS = new XMLSerializer(sWriter, format);
-
- xmlS.asDOMSerializer();
- xmlS.serialize(doc);
-
- String documentAsString = sWriter.toString();
-
- FileOutputStream output = new FileOutputStream(_directory
- + File.separator + name);
-
- output.write(documentAsString.getBytes());
- output.flush();
- output.getFD().sync(); // make sure it's on disk!
- }
- catch (ParserConfigurationException ex)
- {
- throw new IOException(ex.toString());
- }
- catch (URISyntaxException ex)
- {
- throw new IllegalArgumentException(ex.toString());
- }
- catch (MarshalException ex)
- {
- throw new IOException(ex.toString());
- }
- }
-
- /**
- * Remove the EPR-to-file association.
- *
- * @param name the logical name for the service.
- * @throws IOException thrown if there are any errors.
- */
-
- public final void removeEPR(String name) throws IOException
- {
- if (name == null)
- throw new IllegalArgumentException();
-
- File theFile = new File(_directory + File.separator + name);
-
- if (theFile.exists())
- theFile.delete();
- else
- throw new FileNotFoundException();
- }
-
- /**
- * Get the EPR specified by the logical name.
- *
- * @param name
- * the service name.
- * @return the EPR, or <code>null</code> if none exists.
- * @throws IOException
- * thrown if there is an error.
- */
-
- public final EPR loadEPR(String name) throws IOException
- {
- if (name == null)
- throw new IllegalArgumentException();
-
- File theFile = new File(_directory + File.separator + name);
-
- try
- {
- if (theFile.exists())
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(theFile);
- Element rootElement = doc.getDocumentElement();
-
- if (rootElement == null)
- throw new IOException("Cannot locate " + ELEMENT_NAME);
-
- PortReference addr = PortReferenceHelper.fromXML(rootElement,
- false);
-
- return new EPR(addr);
- }
- else
- throw new FileNotFoundException(theFile.toString());
- }
- catch (SAXException ex)
- {
- throw new IOException(ex.toString());
- }
- catch (ParserConfigurationException ex)
- {
- throw new IllegalArgumentException(ex.toString());
- }
- catch (MarshalException ex)
- {
- throw new IOException(ex.toString());
- }
- }
-
- protected EPRManager(String domain)
- {
- _directory = domain;
- }
-
- private String _directory;
-
- private static Hashtable<String, EPRManager> _instances = new Hashtable<String, EPRManager>();
-
-}
\ No newline at end of file
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -75,7 +75,10 @@
*/
public static final String REGISTRY_SCOUT_TRANSPORT_CLASS = "org.jboss.soa.esb.scout.proxy.transportClass";
-
+ /**
+ * Property that holds directory to use with the helper EPRManager class.
+ */
+ public static final String REGISTRY_FILE_HELPER_DIR = "org.jboss.soa.esb.registry.file.directory";
/*
* Connection specific properties
*/
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/DomElement.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/DomElement.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/DomElement.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,420 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.helpers;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.soa.esb.common.ModulePropertyManager;
-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.w3c.dom.Text;
-import org.xml.sax.SAXException;
-
-/**
- * Wrapper class around the W3C DOM API. <p/> This clas attempts to remove some
- * of the complexity of dealing with the W3C DOM API. It's basically a wrapper
- * class around the {@link org.w3c.dom.Element} and {@link org.w3c.dom.Document}
- * classes. <p/> It provides utility methods for constructing a DOM from a
- * stream, adding/removing elements and attributes from the DOM, and methods for
- * serializing the DOM.
- *
- * @author <a href="mailto:schifest at gmail.com">Esteban Shifman</a>
- */
-public class DomElement
-{
- protected static final String LINE_BREAK = ModulePropertyManager
- .getPropertyManager(ModulePropertyManager.CORE_MODULE).getProperty("line.separator");
-
- private static final transient String s_sCharset = "ISO-8859-1";
-
- // private static final transient String s_sEncoding = "<?xml
- // version=\"1.0\" encoding=\"ISO-8859-1\"?>";
-
- private transient static DocumentBuilder s_oDocumentBuilder;
-
- private transient static Transformer s_Transformer;
-
- private transient Element m_oRootW3CElement;
-
- private DomElement m_oParentDomElement;
-
- public DomElement getDad()
- {
- return m_oParentDomElement;
- }
-
- static
- {
- try
- {
- s_oDocumentBuilder = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder();
- s_Transformer = TransformerFactory.newInstance().newTransformer();
- s_Transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
- "yes");
- s_Transformer.setOutputProperty(OutputKeys.INDENT, "no");
- s_Transformer.setOutputProperty(OutputKeys.ENCODING, s_sCharset);
- } catch (Exception e)
- {
- }
- };
-
- private DomElement()
- {
- }
-
- protected DomElement(Element p_oE)
- {
- this();
- Document oDoc = null;
- synchronized (s_oDocumentBuilder)
- {
- oDoc = s_oDocumentBuilder.newDocument();
- }
- Node oNew = oDoc.importNode(p_oE.cloneNode(true), true);
- m_oRootW3CElement = (Element) oDoc.appendChild(oNew);
- } // __________________________________
-
- public DomElement(String p_sName)
- {
- this(p_sName, null);
- }
-
- /**
- * Construct a new DomElement object by cloning arg 1
- * <p>
- * Cloning makes it safe to work on the new object without altering the
- * contents of the argument
- * </p>
- *
- * @param p_oP
- * DomElement
- * @throws Exception
- */
- protected DomElement(DomElement p_oP) throws Exception
- {
- m_oRootW3CElement = p_oP.cloneObj().m_oRootW3CElement;
- }
-
- private DomElement(String p_sName, DomElement p_oParentDomElement)
- {
- this();
- Document oW3CDoc = null;
- if (null == p_oParentDomElement)
- {
- synchronized (s_oDocumentBuilder)
- {
- oW3CDoc = s_oDocumentBuilder.newDocument();
- }
- m_oRootW3CElement = (Element) oW3CDoc.appendChild(oW3CDoc
- .createElement(p_sName));
- } else
- {
- m_oParentDomElement = p_oParentDomElement;
- oW3CDoc = p_oParentDomElement.m_oRootW3CElement.getOwnerDocument();
- m_oRootW3CElement = (Element) p_oParentDomElement.m_oRootW3CElement
- .appendChild(oW3CDoc.createElement(p_sName));
- }
- } // __________________________________
-
- public static DomElement fromInputStream(InputStream p_oIS)
- throws SAXException, IOException
- {
- Document oDoc = null;
- synchronized (s_oDocumentBuilder)
- {
- oDoc = s_oDocumentBuilder.parse(p_oIS);
- }
- DomElement oRet = new DomElement();
- oRet.m_oRootW3CElement = oDoc.getDocumentElement();
- return oRet;
- } // __________________________________
-
- public static DomElement fromURL(String p_sFname) throws Exception
- {
- return fromInputStream(new FileInputStream(p_sFname));
- } // __________________________________
-
- public static DomElement fromXml(String p_xmlString) throws SAXException,
- IOException
- {
- // TF: Modified this constructor to use the fromInputStream method.
-
- if (p_xmlString == null || p_xmlString.trim().equals(""))
- {
- throw new IllegalArgumentException(
- "Null or empty 'p_xmlString' arg in call.");
- }
-
- InputStream oIS = new ByteArrayInputStream(p_xmlString
- .getBytes(s_sCharset));
-
- return fromInputStream(oIS);
- } // __________________________________
-
- public String toString()
- {
- return toXml().toString().replaceAll(LINE_BREAK, " ").replaceAll(
- "\t", "")
- + LINE_BREAK;
- } // ________________________________
-
- public ByteArrayOutputStream toXml()
- {
- Document oDoc = null;
- synchronized (s_oDocumentBuilder)
- {
- oDoc = s_oDocumentBuilder.newDocument();
- }
- oDoc.appendChild(oDoc.importNode(m_oRootW3CElement, true));
- oDoc.normalize();
- DOMSource src = new DOMSource(oDoc);
-
- ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
- StreamResult res = new StreamResult(oStrm);
-
- try
- {
- synchronized (s_Transformer)
- {
- s_Transformer.transform(src, res);
- }
- } catch (Exception e)
- {
- try
- {
- oStrm.write("ERROR Dom3Element.toXml()".getBytes());
- } catch (Exception e1)
- {
- }
- }
- return oStrm;
- } // __________________________________
-
- // _________ GETTERS
- // ____________________________________________________________
-
- public Element getDomElement()
- {
- return m_oRootW3CElement;
- }
-
- public String getName()
- {
- return m_oRootW3CElement.getNodeName();
- }
-
- public String[] getAttrKeys()
- {
- NamedNodeMap NM = m_oRootW3CElement.getAttributes();
- String[] saRet = new String[NM.getLength()];
- for (int i1 = 0; i1 < saRet.length; i1++)
- saRet[i1] = NM.item(i1).getNodeName();
- return saRet;
- } // __________________________________
-
- public String getAttr(String p_sAttribName)
- {
- if (!m_oRootW3CElement.hasAttribute(p_sAttribName))
- return null;
- return m_oRootW3CElement.getAttribute(p_sAttribName);
- } // __________________________________
-
- public static String getTextValue(Node p_Node)
- {
- StringBuffer sb = new StringBuffer();
- Node nCurr = p_Node.getFirstChild();
- while (null != nCurr)
- {
- if (nCurr instanceof Text)
- sb.append(nCurr.getNodeValue());
- nCurr = nCurr.getNextSibling();
- }
- return sb.toString();
- } // __________________________________
-
- public String[] getTextChildren(String p_sElementName)
- {
- NodeList NL = getElementNodeList(p_sElementName);
- List<String> oL = new ArrayList<String>();
- for (int i1 = 0; i1 < NL.getLength(); i1++)
- oL.add(getTextValue(NL.item(i1)));
- String[] saRet = new String[oL.size()];
- oL.toArray(saRet);
- return saRet;
- } // __________________________________
-
- public DomElement[] getElementChildren(String p_sElementName)
- {
- DomElement oDE = null;
-
- NodeList NL = getElementNodeList(p_sElementName);
- List<DomElement> oL = new ArrayList<DomElement>();
-
- for (int i1 = 0; i1 < NL.getLength(); i1++)
- {
- Node nCurr = NL.item(i1);
- if (nCurr instanceof Element)
- {
- oL.add(oDE = new DomElement((Element) nCurr));
- oDE.m_oParentDomElement = this;
- }
- }
- DomElement[] oaRet = new DomElement[oL.size()];
- oL.toArray(oaRet);
- return oaRet;
- } // __________________________________
-
- public DomElement getFirstElementChild(String p_sElementName)
- {
- DomElement[] children = getElementChildren(p_sElementName);
-
- if (children != null && children.length > 0)
- {
- return children[0];
- } else
- {
- return null;
- }
- } // __________________________________
-
- /**
- * Get a nodelist for the specified element name from the associated
- * Document.
- *
- * @param p_sElementName
- * Element tag name.
- * @return Nodelist.
- */
- private NodeList getElementNodeList(String p_sElementName)
- {
- // TF: Modified the following line to allow the document root element be
- // included in the lookup..
- return m_oRootW3CElement.getOwnerDocument().getElementsByTagName(
- p_sElementName);
- }
-
- public DomElement[] getAllElemChildren()
- {
- DomElement oDE = null;
- List<DomElement> oL = new ArrayList<DomElement>();
- Node nCurr = m_oRootW3CElement.getFirstChild();
-
- while (null != nCurr)
- {
- if (nCurr instanceof Element)
- {
- oL.add(oDE = new DomElement((Element) nCurr));
- oDE.m_oParentDomElement = this;
- }
- nCurr = nCurr.getNextSibling();
- }
- DomElement[] oaRet = new DomElement[oL.size()];
- oL.toArray(oaRet);
- return oaRet;
- } // __________________________________
-
- // _________ SETTERS
- // ____________________________________________________________
-
- public void setAttr(String p_sAttribName, String p_sAttribValue)
- {
- if (null == p_sAttribName)
- {
- // REVIEW: Shouldn't this throw an IllegalArgumentException???
- return;
- }
- m_oRootW3CElement.removeAttribute(p_sAttribName);
- if (null != p_sAttribValue)
- {
- m_oRootW3CElement.setAttribute(p_sAttribName, p_sAttribValue);
- }
- } // __________________________________
-
- public void addTextChild(String p_sKey, String p_sVal)
- {
- if (null == p_sKey || null == p_sVal)
- return;
- DomElement oNew = new DomElement(p_sKey, this);
- oNew.m_oRootW3CElement.appendChild(m_oRootW3CElement.getOwnerDocument()
- .createTextNode(p_sVal));
- } // __________________________________
-
- public void addTextChildren(String p_sKey, String[] p_saVal)
- {
- if (null == p_sKey || null == p_saVal)
- return;
- for (int i1 = 0; i1 < p_saVal.length; i1++)
- addTextChild(p_sKey, p_saVal[i1]);
- } // __________________________________
-
- public void addElemChild(DomElement p_oElementChild)
- {
- p_oElementChild.m_oParentDomElement = this;
- Document oDoc = m_oRootW3CElement.getOwnerDocument();
- // Need to clone the node because the Elements are from different
- // Document - you'll get
- // an exception if you simply try to append it.
- Element clonedElement = (Element) oDoc.importNode(
- p_oElementChild.m_oRootW3CElement, true);
- m_oRootW3CElement.appendChild(clonedElement);
- // Reset W3C element of the child DomElement to be the cloned element.
- p_oElementChild.m_oRootW3CElement = clonedElement;
- } // __________________________________
-
- public void rmvChildsByName(String p_sTagName)
- {
- NodeList NL = m_oRootW3CElement.getElementsByTagName(p_sTagName);
- for (int i1 = 0; i1 < NL.getLength(); i1++)
- m_oRootW3CElement.removeChild(NL.item(i1));
- } // __________________________________
-
- // _________ UTILITIES /
- // HELPERS_________________________________________________
-
- public DomElement cloneObj() throws SAXException, IOException
- {
- // REVIEW: This must be a performance killer - surely the
- // associated DOM can be cloned Vs serialising to a string and parsing
- // from scratch again!!!
- return DomElement.fromXml(this.toString());
- } // __________________________________
-
-} // ____________________________________________________________________________
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/Email.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/Email.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/Email.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -54,7 +54,7 @@
*
* <h3 id="p_oMessageParms">Message Parmeters</h3>
* The class constructor is supplied the following parameters via a
- * {@link org.jboss.soa.esb.helpers.DomElement} instance:
+ * {@link org.jboss.soa.esb.helpers.ConfigTree} instance:
* <ol>
* <li><b>FROM</b>: valid e-mail address</li>
* <li><b>SENDTO</b>: valid comma separated list of e-mail addresses</li>
@@ -63,9 +63,9 @@
* <li><b>ATTACH</b>: list (as Text children) of valid accessible filenames to
* attach to the e-mail</li>
* </ol>
- * All parameters except 'ATTACH' are attributes of the DomElement argument. ATTACH
- * parameters (attachments) are added as child DomElements of the supplied
- * DomElement.
+ * All parameters except 'ATTACH' are attributes of the ConfigTree argument. ATTACH
+ * parameters (attachments) are added as child ConfigTrees of the supplied
+ * ConfigTree.
*
* @author: Heuristica - Buenos Aires - Argentina
*/
@@ -76,35 +76,35 @@
*/
private static Logger logger = Logger.getLogger(Email.class);
/**
- * DomElement attribute : will be the contents of the From: field in the
+ * ConfigTree attribute : will be the contents of the From: field in the
* outgoing message
*/
public static final String FROM = "from";
/**
- * DomElement attribute : comma separated list of recipients
+ * ConfigTree attribute : comma separated list of recipients
*/
public static final String SENDTO = "sendTo";
/**
- * DomElement attribute : comma separated list of Copy recipients
+ * ConfigTree attribute : comma separated list of Copy recipients
*/
public static final String COPYTO = "ccTo";
/**
- * DomElement attribute : will be the contents of the Subject: field in the
+ * ConfigTree attribute : will be the contents of the Subject: field in the
* outgoing message
*/
public static final String SUBJECT = "subject";
/**
- * DomElement attribute : Value of this attribute will be the content of the
+ * ConfigTree attribute : Value of this attribute will be the content of the
* e-mail's text
*/
public static final String ATTACH = "attachment";
/**
- * DomElement child Text elements : Each child represents the name of a file
+ * ConfigTree child Text elements : Each child represents the name of a file
* to be attached in the outgoing message
*/
public static final String MESSAGE = "message";
@@ -160,10 +160,10 @@
* method.
*
* @param p_oMessageParms
- * A DomElement object containing the elements mentioned above
+ * A ConfigTree object containing the elements mentioned above
* @throws MessagingException
* @throws AddressException
- * @see DomElement
+ * @see ConfigTree
*
*/
public Email() throws AddressException, MessagingException {
@@ -290,7 +290,7 @@
private MimeMessage createMailMessage(Session oMailSess) throws AddressException, MessagingException {
MimeMessage oMessage = new MimeMessage(oMailSess);
- // Populate the message with the data supplied in the p_oMessageParms DomElement.
+ // Populate the message with the data supplied in the p_oMessageParms ConfigTree.
addMessageAddressing(oMessage);
addMessageSubject( oMessage);
addMessageContent(oMessage);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -27,7 +27,7 @@
import javax.sql.DataSource;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* <p>
@@ -40,7 +40,7 @@
*
* @version 1.0
* @see JdbcCleanConn
- * @see DomElement
+ * @see ConfigTree
*/
public class SimpleDataSource implements DataSource {
private PrintWriter m_oPW = new PrintWriter(System.out);
@@ -63,7 +63,7 @@
}
/**
- * Obtain a DataSource by providing connection parameters. DomElement
+ * Obtain a DataSource by providing connection parameters. ConfigTree
* argument must contain the following attributes
* <p>
* <li> driver-class</li>
@@ -73,16 +73,16 @@
* </p>
*
* @param p_oP
- * DomElement - Parameter tree that contains the 4 attributes
+ * ConfigTree - Parameter tree that contains the 4 attributes
* needed
* @throws Exception
- * @see DomElement
+ * @see ConfigTree
* @see SimpleDataSource#SimpleDataSource(String,String,String,String)
* @see javax.sql.DataSource
*/
- public SimpleDataSource(DomElement p_oP) throws Exception {
- this(p_oP.getAttr(DRIVER), p_oP.getAttr(URL), p_oP.getAttr(USER), p_oP
- .getAttr(PASSWORD));
+ public SimpleDataSource(ConfigTree p_oP) throws Exception {
+ this(p_oP.getAttribute(DRIVER), p_oP.getAttribute(URL), p_oP.getAttribute(USER), p_oP
+ .getAttribute(PASSWORD));
} // ________________________________
/**
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -24,7 +24,7 @@
import java.io.Serializable;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Holds lists of NotificationTarget objects so that the
@@ -43,8 +43,13 @@
*
* @version 1.0
*/
-public class NotificationList extends DomElement {
+public class NotificationList extends ConfigTree {
/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* Mnemonic name for the XML element name for the serialized form of objects
* of this class
*/
@@ -60,22 +65,22 @@
* Instantiate an object according to the contents of <arg 1>
*
* @param p_oP
- * DomElement - Parameter object containing the information
+ * ConfigTree - Parameter object containing the information
* needed to instantiate this object, including child elements
* named "target" that represent each individual
* NotificationTarget object
* @throws Exception -
* the getMessage() of the Exception explains the problem
*/
- public NotificationList(DomElement p_oP) throws Exception {
+ public NotificationList(ConfigTree p_oP){
super(p_oP);
- m_sType = p_oP.getAttr(TYPE);
+ m_sType = p_oP.getAttribute(TYPE);
if (null != m_sType)
m_sType = m_sType.toLowerCase();
} // __________________________________
private NotificationTarget[] getTargets() throws Exception {
- DomElement[] oaTgts = super.getElementChildren(CHILD_TGT);
+ ConfigTree[] oaTgts = super.getChildren(CHILD_TGT);
NotificationTarget[] oaRet = new NotificationTarget[oaTgts.length];
for (int i1 = 0; i1 < oaRet.length; i1++) {
@@ -109,9 +114,9 @@
* @return boolean - Yes, Attribute "type" of constructor parameters starts
* with "ok", OR there was no "type" attribute in the constructor
* <li>A NotificationList can be both OK and Error if no "type"
- * attribute was specified at constructor time in the DomElement
+ * attribute was specified at constructor time in the ConfigTree
* argument</li>
- * @see DomElement#getAttr(String)
+ * @see ConfigTree#getAttr(String)
*/
public boolean isOK() {
return (null == m_sType) ? true : m_sType.startsWith("ok");
@@ -123,9 +128,9 @@
* @return boolean - Yes, Attribute "type" of constructor parameters starts
* with "err", OR there was no "type" attribute in the constructor
* <li>A NotificationList can be both OK and Error if no "type"
- * attribute was specified at constructor time in the DomElement
+ * attribute was specified at constructor time in the ConfigTree
* argument</li>
- * @see DomElement#getAttr(String)
+ * @see ConfigTree#getAttr(String)
*/
public boolean isErr() {
return (null == m_sType) ? true : m_sType.startsWith("err");
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -25,7 +25,7 @@
import java.lang.reflect.Constructor;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Abstract class to define expected behaviour of all NotificationTargets and
* provide some common functionality to all of them
@@ -41,7 +41,7 @@
* @param p_o Object - The toString() method of this object will be the actual
* notification content
* @throws Exception - invoke Exception.getMessage() at runtime for this object
- * @see DomElement
+ * @see ConfigTree
*/
public abstract void sendNotification(java.io.Serializable p_o) throws Exception;
@@ -53,7 +53,7 @@
* Common object to hold details of object's information - Each derived class
* will hold it's own needs
*/
- protected DomElement m_oParms;
+ protected ConfigTree m_oParms;
/**
* Instantiate an empty NotificationTarget object
*/
@@ -61,15 +61,15 @@
/**
* Instantiate a NotificationTarget object with the information contained
* in <arg 1>
- * @param p_oP DomElement - Holds details to instantiate this object
+ * @param p_oP ConfigTree - Holds details to instantiate this object
*/
- protected NotificationTarget (DomElement p_oP)
+ protected NotificationTarget (ConfigTree p_oP)
{ m_oParms = p_oP;
} //__________________________________
/**
* A typical Factory.getInstance() method
- * @param p_oP DomElement - Contents of this argument will determine the
+ * @param p_oP ConfigTree - Contents of this argument will determine the
* type (derived class) of NotificationTarget returned
* @throws Exception - Arg 1 does not contain a valid structure for currently
* implemented NotificationTarget subclasses - invoke Exception.getMessage() at
@@ -77,8 +77,8 @@
* @return NotificationTarget - An object that instantiates the NotificationTarget
* abstract class
*/
- public static NotificationTarget fromParams (DomElement p_oP) throws Exception
- { String sClass = p_oP.getAttr(PRM_NOTIF_CLASS);
+ public static NotificationTarget fromParams (ConfigTree p_oP) throws Exception
+ { String sClass = p_oP.getAttribute(PRM_NOTIF_CLASS);
if (null==sClass) throw new Exception("Missing '"+PRM_NOTIF_CLASS
+"' attribute in parameters");
Class oCls = null;
@@ -91,10 +91,10 @@
throw new Exception("Invalid class <"+sClass+">, or missing library");
Constructor oCons = null;
- try { oCons = oCls.getConstructor(new Class[] {DomElement.class}); }
+ try { oCons = oCls.getConstructor(new Class[] {ConfigTree.class}); }
catch (Exception e) {}
if (null==oCons)
- throw new Exception("No valid constructor "+sClass+"(DomElement)");
+ throw new Exception("No valid constructor "+sClass+"(ConfigTree)");
Object oRet = null;
try { oRet = oCons.newInstance(new Object[] {p_oP}); }
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
import org.jboss.soa.esb.util.Util;
@@ -49,22 +49,22 @@
* <arg 1>
*
* @param p_oP
- * DomElement - See attributes and structure needed for the
+ * ConfigTree - See attributes and structure needed for the
* Email() constructor - The MESSAGE attribute will
* be filled in at sendNotification(Serializable) time
* @throws Exception
* @see NotifyEmail#sendNotification(Serializable)
*/
- public NotifyEmail(DomElement p_oP) throws Exception {
+ public NotifyEmail(ConfigTree p_oP) throws Exception {
super(p_oP);
- String sAtt = (String) m_oParms.getAttr(Email.FROM);
+ String sAtt = (String) m_oParms.getAttribute(Email.FROM);
if (null != sAtt)
InternetAddress.parse(sAtt);
- InternetAddress.parse(m_oParms.getAttr(Email.SENDTO));
+ InternetAddress.parse(m_oParms.getAttribute(Email.SENDTO));
- sAtt = (String) m_oParms.getAttr(Email.COPYTO);
+ sAtt = (String) m_oParms.getAttribute(Email.COPYTO);
if (null != sAtt)
InternetAddress.parse(sAtt);
} // __________________________________
@@ -79,10 +79,10 @@
*/
public void sendNotification(Serializable p_o) {
try {
- DomElement oP = m_oParms.cloneObj();
- String sMsg = oP.getAttr(Email.MESSAGE);
+ ConfigTree oP = m_oParms.cloneObj();
+ String sMsg = oP.getAttribute(Email.MESSAGE);
sMsg = ((null == sMsg) ? p_o.toString() : sMsg + "\n") + p_o.toString();
- oP.setAttr(Email.MESSAGE, sMsg);
+ oP.setAttribute(Email.MESSAGE, sMsg);
sendEmailNotification(oP);
} catch (Exception e) {
Util.getDefaultLogger(this.getClass()).error("Send Mail Failed",
@@ -97,16 +97,16 @@
* This method allows overriding for test purposes.
* @param messageParams Message parameters.
*/
- protected void sendEmailNotification(DomElement messageParams) throws AddressException, MessagingException {
+ protected void sendEmailNotification(ConfigTree messageParams) throws AddressException, MessagingException {
Email esbMail = new Email();
- esbMail.setSendTo(messageParams.getAttr(Email.SENDTO));
- esbMail.setFrom(messageParams.getAttr(Email.FROM));
- esbMail.setCopyTo(messageParams.getAttr(Email.COPYTO));
- esbMail.setSubject(messageParams.getAttr(Email.SUBJECT));
+ 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));
- esbMail.setMessage(messageParams.getAttr(Email.MESSAGE));
+ esbMail.setMessage(messageParams.getAttribute(Email.MESSAGE));
esbMail.sendMessage();
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,14 +28,14 @@
import java.io.Serializable;
import java.net.URI;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Write the notification contents into a list of files specified in the
* constructor time parameters.
* <p>
* Description: The constructor searches for all child elements of the
- * DomElement argument having "file" as element name, that will be used to store
+ * ConfigTree argument having "file" as element name, that will be used to store
* (or append) the contents of the argument to the sendNotification(Object)
* method, to each and every one of the files contained in the list
* </p>
@@ -73,14 +73,14 @@
* Instantiate a NotifyFiles object according to contents of <arg 1>
*
* @param p_oP
- * DomElement - Should contain a nonempty set of child elements
+ * ConfigTree - Should contain a nonempty set of child elements
* with elementName="file". Each child element must have a "URI"
* attribute and optionally a "append" element
* @throws Exception
*/
- public NotifyFiles(DomElement p_oP) throws Exception {
+ public NotifyFiles(ConfigTree p_oP) throws Exception {
super(p_oP);
- setFiles(p_oP.getElementChildren(CHILD_FILE));
+ setFiles(p_oP.getChildren(CHILD_FILE));
} // __________________________________
@@ -89,18 +89,18 @@
* of the input argument
*
* @param p_oaP
- * DomElement[] - Each entry must have a "URI" attribute, and can
+ * ConfigTree[] - Each entry must have a "URI" attribute, and can
* have an optional "append" attribute
* @throws Exception -
* invoke Exception.getMessage() at runtime for details
- * @see DomElement#getAttr(String)
+ * @see ConfigTree#getAttr(String)
*/
- protected void setFiles(DomElement[] p_oaP) throws Exception {
+ protected void setFiles(ConfigTree[] p_oaP) throws Exception {
m_oaOutF = new NotificationFile[p_oaP.length];
for (int i = 0; i < p_oaP.length; i++) {
- String fileURI = p_oaP[i].getAttr(ATT_URI);
- String append = p_oaP[i].getAttr(ATT_APPEND);
+ String fileURI = p_oaP[i].getAttribute(ATT_URI);
+ String append = p_oaP[i].getAttribute(ATT_APPEND);
if (null == fileURI) {
throw new IllegalArgumentException("Bad File Notification Configuration: Missing file URI attribute.");
@@ -126,7 +126,7 @@
* @param p_o
* Object - This object's toString() results will be written to
* (appended to) each one of the files in m_oaOutF
- * @see NotifyFiles#setFiles(DomElement[])
+ * @see NotifyFiles#setFiles(ConfigTree[])
* @see NotifyFiles#m_oaOutF
*/
public void sendNotification(Serializable p_o) {
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -33,7 +33,7 @@
import javax.naming.Context;
import javax.naming.InitialContext;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Abstract class that defines the behaviour of NotifyQueues and NotifyTopics
@@ -59,7 +59,7 @@
protected abstract void sendToAll(Message p_oMsg);
/**
- * Element name mnemonic to search for child elements in the DomElement at
+ * Element name mnemonic to search for child elements in the ConfigTree at
* constructor time, that will hold a "name" "value" pair to be included in
* the JMS message header
*/
@@ -113,22 +113,22 @@
* initialization tasks that are common to all derived classes
*
* @param p_oP
- * DomElement
+ * ConfigTree
* <p>
* Will contain a variable number of "messageProp" child elements
* that will be added to messages sent to
* </p>
* @throws Exception
*/
- protected NotifyJMS(DomElement p_oP) throws Exception {
+ protected NotifyJMS(ConfigTree p_oP) throws Exception {
super(p_oP);
- DomElement[] oaMsgP = p_oP.getElementChildren(CHILD_MSG_PROP);
+ ConfigTree[] oaMsgP = p_oP.getChildren(CHILD_MSG_PROP);
for (int i1 = 0; i1 < oaMsgP.length; i1++) {
- String sKey = oaMsgP[i1].getAttr(ATT_PROP_NAME);
+ String sKey = oaMsgP[i1].getAttribute(ATT_PROP_NAME);
if (null == sKey)
continue;
- String sVal = oaMsgP[i1].getAttr(ATT_PROP_VALUE);
+ String sVal = oaMsgP[i1].getAttribute(ATT_PROP_VALUE);
if (null == sVal)
continue;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -31,7 +31,7 @@
import javax.jms.QueueSession;
import javax.naming.NamingException;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
;
@@ -52,7 +52,7 @@
*/
public static final String CONNECTION_FACTORY = "ConnectionFactory";
/**
- * Element name mnemonic to search for child elements in the DomElement at
+ * Element name mnemonic to search for child elements in the ConfigTree at
* constructor time, that will hold a "jndiName" attribute specifying the
* value to look up in the JNDI context in order to obtain a queue
*
@@ -60,12 +60,12 @@
*/
public static final String CHILD_QUEUE = "queue";
- public NotifyQueues(DomElement p_oP) throws Exception {
+ public NotifyQueues(ConfigTree p_oP) throws Exception {
super(p_oP);
- setQueues(p_oP.getElementChildren(CHILD_QUEUE));
+ setQueues(p_oP.getChildren(CHILD_QUEUE));
} // __________________________________
- protected void setQueues(DomElement[] p_oaP) throws Exception {
+ protected void setQueues(ConfigTree[] p_oaP) throws Exception {
QueueConnectionFactory qcf = lookupQueueConnectionFactory();
QueueConnection oQconn = qcf.createQueueConnection();
QueueSession oQsess = oQconn.createQueueSession(false,
@@ -73,7 +73,7 @@
m_oaMssProd = new MessageProducer[p_oaP.length];
for (int i1 = 0; i1 < p_oaP.length; i1++) {
- String sAtt = p_oaP[i1].getAttr(ATT_DEST_NAME);
+ String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
if (null == sAtt)
throw new Exception("Missing queue jndiName");
Queue oQ = (Queue) m_oCtx.lookup(sAtt);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -25,7 +25,7 @@
import java.sql.PreparedStatement;
import java.util.Properties;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
@@ -44,7 +44,7 @@
protected Properties m_oCols;
- public NotifySqlTable(DomElement p_oP) throws Exception {
+ public NotifySqlTable(ConfigTree p_oP) throws Exception {
super(p_oP);
m_sDriver = getAttr(SimpleDataSource.DRIVER);
m_sURL = getAttr(SimpleDataSource.URL);
@@ -54,10 +54,10 @@
m_sDataCol = getAttr(ATT_DATA);
m_oCols = new Properties();
- DomElement[] oaP = p_oP.getElementChildren(CHILD_COLUMN);
+ ConfigTree[] oaP = p_oP.getChildren(CHILD_COLUMN);
for (int i1 = 0; i1 < oaP.length; i1++) {
- DomElement oCurr = oaP[i1];
- String sCol = oCurr.getAttr(ATT_NAME);
+ ConfigTree oCurr = oaP[i1];
+ String sCol = oCurr.getAttribute(ATT_NAME);
if (null == sCol) {
continue;
}
@@ -65,7 +65,7 @@
if (sCol.length() < 1) {
continue;
}
- String sVal = oCurr.getAttr(ATT_VALUE);
+ String sVal = oCurr.getAttribute(ATT_VALUE);
if (null == sVal) {
sVal = "";
}
@@ -74,7 +74,7 @@
} // __________________________________
private String getAttr(String p_sAtt) throws Exception {
- String sRet = m_oParms.getAttr(p_sAtt);
+ String sRet = m_oParms.getAttribute(p_sAtt);
if (null == sRet) {
throw new Exception("Missing " + p_sAtt + " attribute");
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -30,20 +30,20 @@
import javax.jms.TopicPublisher;
import javax.jms.TopicSession;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
public class NotifyTopics extends NotifyJMS {
public static final String CONNECTION_FACTORY = "ConnectionFactory";
public static final String CHILD_TOPIC = "topic";
- public NotifyTopics(DomElement p_oP) throws Exception {
+ public NotifyTopics(ConfigTree p_oP) throws Exception {
super(p_oP);
- setTopics(p_oP.getElementChildren(CHILD_TOPIC));
+ setTopics(p_oP.getChildren(CHILD_TOPIC));
} // __________________________________
- protected void setTopics(DomElement[] p_oaP) throws Exception {
+ protected void setTopics(ConfigTree[] p_oaP) throws Exception {
// REVIEW: The connection factory name is hardcoded and is the same as that of the queue connection factory.
TopicConnectionFactory qcf = (TopicConnectionFactory) m_oCtx.lookup(CONNECTION_FACTORY);
TopicConnection oTconn = qcf.createTopicConnection();
@@ -52,7 +52,7 @@
m_oaMssProd = new MessageProducer[p_oaP.length];
for (int i1 = 0; i1 < p_oaP.length; i1++) {
- String sAtt = p_oaP[i1].getAttr(ATT_DEST_NAME);
+ String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
if (null == sAtt)
throw new Exception("Missing topic jndiName");
Topic oT = (Topic) m_oCtx.lookup(sAtt);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,20 +28,20 @@
import java.util.Map;
import org.jboss.internal.soa.esb.notification.MacroExpander;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.NotificationManager;
public class NotifyUtil {
public static void notifyOK(NotificationManager p_oNH,
- DomElement p_oParent, Serializable p_o, Map p_oCtx) {
+ ConfigTree p_oParent, Serializable p_o, Map p_oCtx) {
try {
- DomElement[] oaP = p_oParent.getElementChildren(NotificationList.ELEMENT);
+ ConfigTree[] oaP = p_oParent.getChildren(NotificationList.ELEMENT);
for (int i1 = 0; i1 < oaP.length; i1++) {
NotificationList oCurr = new NotificationList(oaP[i1]);
if (!oCurr.isOK())
continue;
- DomElement oCpy = oaP[i1].cloneObj();
+ ConfigTree oCpy = oaP[i1].cloneObj();
MacroExpander.replaceMacros(oCpy, p_oCtx);
p_oNH.sendNotifications(oCpy, p_o);
}
@@ -51,7 +51,7 @@
} // __________________________________
public static void notifyError(NotificationManager p_oNH,
- DomElement p_oParent, Object p_o, Map p_oCtx, Exception p_e) {
+ ConfigTree p_oParent, Object p_o, Map p_oCtx, Exception p_e) {
ByteArrayOutputStream oBO = new ByteArrayOutputStream();
PrintStream oPS = new PrintStream(oBO);
try {
@@ -62,7 +62,7 @@
oPS.close();
String sMsg = oBO.toString();
- DomElement[] oaP = p_oParent.getElementChildren(NotificationList.ELEMENT);
+ ConfigTree[] oaP = p_oParent.getChildren(NotificationList.ELEMENT);
// if (oaP.length<1) // Uncomment this line to send only to the list
// REVIEW: What's going on here? What's the difference between sending an
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/NotificationManager.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/NotificationManager.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/NotificationManager.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -24,7 +24,7 @@
import java.io.Serializable;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* Use this interface to group all methods that can be useful to
@@ -38,9 +38,9 @@
// REVIEW: Add some Javadoc for this interface!!!
/**
- * public void sendNotifications(DomElement p_oP, Serializable p_o)
+ * public void sendNotifications(ConfigTree p_oP, Serializable p_o)
*
- * @param p_oP DomElement - A serialized NotificationList object (as a DomElement)
+ * @param p_oP ConfigTree - A serialized NotificationList object (as a ConfigTree)
* @param p_o The Serializable object that will be sent to all the
* NotificationTarget objects contained in the NotificationList
*
@@ -57,7 +57,7 @@
* (suc as contents of certain columns in SQL, or message properties for
* JMS notification targets, etc.
*/
- public void sendNotifications(DomElement p_oP, Serializable p_o) throws Exception;
+ public void sendNotifications(ConfigTree p_oP, Serializable p_o) throws Exception;
public void sendNotifications(Serializable p_o) throws Exception;
} // ____________________________________________________________________________
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -24,7 +24,7 @@
import java.io.File;
import java.util.List;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import com.enterprisedt.net.ftp.FTPClient;
@@ -61,7 +61,7 @@
,binary
};
- private DomElement m_oParms;
+ private ConfigTree m_oParms;
private String m_sFtpServer ,m_sUser ,m_sPasswd;
private String m_sRemoteDir ,m_sLocalDir;
private int m_iPort;
@@ -74,7 +74,7 @@
/**
* Checks validity and completeness of parameters, and keeps the info internally
* for subsequent FTP requests
- * @param p_oP DomElement
+ * @param p_oP ConfigTree
* @throws Exception : if parameters are invalid or incomplete
* <li>Parameters: (XML attributes at the root level) </li>
* <li> ftpServer = name or IP of FTP server </li>
@@ -85,16 +85,16 @@
* computer </li>
*/
- public FtpClientUtil (DomElement p_oP, boolean p_bConnect) throws Exception
+ public FtpClientUtil (ConfigTree p_oP, boolean p_bConnect) throws Exception
{ m_oParms = p_oP;
initialize(p_bConnect);
} //_________________________________
public FtpClientUtil (List<KeyValuePair> attribs, boolean connect) throws Exception
{
- m_oParms = new DomElement("fromProps");
+ m_oParms = new ConfigTree("fromProps");
for (KeyValuePair oCurr : attribs)
- m_oParms.setAttr(oCurr.getKey(),oCurr.getValue());
+ m_oParms.setAttribute(oCurr.getKey(),oCurr.getValue());
initialize(connect);
} //__________________________________
@@ -255,34 +255,34 @@
private void checkParms() throws Exception
{
- m_sFtpServer = m_oParms.getAttr(PARMS_FTP_SERVER);
+ m_sFtpServer = m_oParms.getAttribute(PARMS_FTP_SERVER);
if (null==m_sFtpServer) throw new Exception ("No FTP server specified");
- m_sUser = m_oParms.getAttr(PARMS_USER);
+ m_sUser = m_oParms.getAttribute(PARMS_USER);
if (null==m_sUser) throw new Exception ("No username specified for FTP");
- m_sPasswd = m_oParms.getAttr(PARMS_PASSWD);
+ m_sPasswd = m_oParms.getAttribute(PARMS_PASSWD);
if (null==m_sPasswd) throw new Exception ("No password specified for FTP");
- m_sRemoteDir = m_oParms.getAttr(PARMS_REMOTE_DIR);
+ m_sRemoteDir = m_oParms.getAttribute(PARMS_REMOTE_DIR);
if (null==m_sRemoteDir)
m_sRemoteDir = "";
- m_sLocalDir = m_oParms.getAttr(PARMS_LOCAL_DIR);
+ m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
if (null==m_sLocalDir)
m_sLocalDir = ".";
- String sAux = m_oParms.getAttr(PARMS_PORT);
+ String sAux = m_oParms.getAttribute(PARMS_PORT);
m_iPort = (null==sAux) ? 21 : Integer.parseInt(sAux);
boolean bAscii = false;
- sAux = m_oParms.getAttr(PARMS_ASCII);
+ sAux = m_oParms.getAttribute(PARMS_ASCII);
if (null!=sAux)
bAscii = Boolean.parseBoolean(sAux);
setXferType((bAscii)?XFER_TYPE.ascii:XFER_TYPE.binary);
m_bPassive = false;
- sAux = m_oParms.getAttr(PARMS_PASSIVE);
+ sAux = m_oParms.getAttribute(PARMS_PASSIVE);
m_bPassive = (null!=sAux) && Boolean.parseBoolean(sAux);
return;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/Util.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/Util.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/Util.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -22,14 +22,32 @@
package org.jboss.soa.esb.util;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintStream;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.TTCCLayout;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.jboss.internal.soa.esb.message.format.serialized.MessageImpl;
import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.message.Message;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
public class Util
{
@@ -122,5 +140,57 @@
oRet.addAppender(oApp);
return oRet;
} // __________________________________
+
+ public static Serializable serialize(Message message)
+ throws ParserConfigurationException, IOException
+ {
+ if (message.getType().equals(org.jboss.soa.esb.message.format.MessageType.JAVA_SERIALIZED))
+ return (Serializable)message;
+ Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl)message).toXML(doc);
+ StringWriter sWriter = new StringWriter();
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ XMLSerializer xmlS = new XMLSerializer(sWriter, format);
+ xmlS.asDOMSerializer();
+ xmlS.serialize(doc);
+ return sWriter.toString();
+ } //________________________________
+
+ public static Message deserialize(Serializable serial)
+ throws ParserConfigurationException,SAXException,IOException
+ {
+ if (serial instanceof MessageImpl)
+ return (Message)serial;
+ InputStream inStream = new ByteArrayInputStream(((String)serial).getBytes());
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(inStream);
+
+ org.jboss.internal.soa.esb.message.format.xml.MessageImpl message =
+ new org.jboss.internal.soa.esb.message.format.xml.MessageImpl();
+ message.fromXML(doc);
+ return message;
+ } //________________________________
+
+ public static List<KeyValuePair> propertiesFromSelector(String selector) throws Exception
+ {
+ // No problem if selector is null - everything in queue will be returned
+ List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
+ if (! Util.isNullString(selector))
+ for (String sCurr : selector.split(","))
+ {
+ String[] sa = sCurr.split("=");
+ if (sa.length!=2
+ || sa[1].charAt(0)!='\''
+ || sa[1].charAt(-1+sa[1].length())!='\'')
+ throw new Exception("Illegal message selector syntax <"+selector+">");
+ KeyValuePair oNew = new KeyValuePair
+ (sa[0],sa[1].substring(0,-1+sa[1].length()).substring(1));
+ oRet.add(oNew);
+ }
+ return oRet;
+ } //________________________________
+
} // ____________________________________________________________________________
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -39,7 +39,7 @@
{
try
{
- new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar");
+ new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar",null,null,null);
}
catch (Exception ex)
{
@@ -51,7 +51,7 @@
{
try
{
- JMSEpr jms = new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar");
+ JMSEpr jms = new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar",null,null,null);
assertEquals(jms.getVersion(), JMSEpr.ONE_ONE_PROTOCOL);
assertEquals(jms.getConnectionFactory(), "foobar");
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util)
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java 2006-10-26 00:48:46 UTC (rev 7125)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.addressing.util.tests;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.addressing.helpers.EmailEpr;
-import org.jboss.soa.esb.addressing.util.EPRManager;
-
-/**
- * Unit tests for the Class class.
- *
- * @author Mark Little
- */
-
-public class EPRManagerUnitTest extends TestCase
-{
-
- public void testCreate ()
- {
- EPRManager manager1 = EPRManager.getInstance(null);
- EPRManager manager2 = EPRManager.getInstance("");
- EPRManager manager3 = EPRManager.getInstance("/tmp");
-
- assertEquals(manager1.equals(manager2), true);
- assertEquals(manager1.equals(manager3), false);
- }
-
- public void testInputOutput ()
- {
- EmailEpr email = new EmailEpr(EmailEpr.SMTP_PROTOCOL, "foobar", "25", "me", "letmein");
-
- EPRManager manager = EPRManager.getInstance("/tmp");
-
- try
- {
- manager.saveEPR("MyEmail", email);
-
- EmailEpr loaded = new EmailEpr(manager.loadEPR("MyEmail"));
-
- assertEquals(loaded.getHost().equals("foobar"), true);
- assertEquals(loaded.getPassword().equals("letmein"), true);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
-
- fail(ex.toString());
- }
- }
-
-}
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java)
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/command/InMemoryCommandQueueUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/command/InMemoryCommandQueueUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/command/InMemoryCommandQueueUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -8,7 +8,7 @@
import org.jboss.internal.soa.esb.command.CommandQueue;
import org.jboss.internal.soa.esb.command.CommandQueueException;
import org.jboss.internal.soa.esb.command.InMemoryCommandQueue;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
public class InMemoryCommandQueueUnitTest extends TestCase {
@@ -22,7 +22,7 @@
// OK
}
- DomElement config = new DomElement("config");
+ ConfigTree config = new ConfigTree("config");
try {
commandQueue.open(config);
fail("Expected CommandQueueException.");
@@ -32,10 +32,10 @@
}
public void test_queue_open_close() throws CommandQueueException {
- DomElement config = new DomElement("config");
+ ConfigTree config = new ConfigTree("config");
InMemoryCommandQueue commandQueue = new InMemoryCommandQueue();
- config.setAttr(InMemoryCommandQueue.COMMAND_QUEUE_NAME, "test-queue");
+ config.setAttribute(InMemoryCommandQueue.COMMAND_QUEUE_NAME, "test-queue");
assertEquals(null, InMemoryCommandQueue.getQueue("test-queue"));
commandQueue.open(config);
assertEquals(commandQueue, InMemoryCommandQueue.getQueue("test-queue"));
@@ -44,7 +44,7 @@
}
public void test_queue_receive() throws CommandQueueException, InterruptedException {
- DomElement config = new DomElement("config");
+ ConfigTree config = new ConfigTree("config");
InMemoryCommandQueue commandQueue = new InMemoryCommandQueue();
// receive should fail if the queue hasn't been opened yet...
@@ -55,7 +55,7 @@
// OK
}
- config.setAttr(InMemoryCommandQueue.COMMAND_QUEUE_NAME, "test-queue");
+ config.setAttribute(InMemoryCommandQueue.COMMAND_QUEUE_NAME, "test-queue");
commandQueue.open(config);
// Start the consumer thread - it will receive the commands from the queue.
Copied: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java (from rev 7125, labs/jbossesb/workspace/eschifman/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java)
Deleted: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.helpers;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.StringUtils;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.xml.sax.SAXException;
-
-/**
- * Unit tests for the DomElement class.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class DomElementUnitTest extends BaseTest {
-
- public void test_fromInputStream_args() throws SAXException, IOException {
- try {
- DomElement.fromInputStream(null);
- fail("Expected IllegalArgumentException on null stream.");
- } catch(IllegalArgumentException e) {
- // Expected
- }
- }
-
- public void test_fromInputStream_and_toXML() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile1.xml"));
- ByteArrayOutputStream output;
- byte[] expected = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
-
- // Create the DomElement from a Stream. Then...
- // Dump the XML to a buffer and compare it with the expected - checking that the
- // Created DomElement DOM is the same as what was supplied in the stream. Also
- // tests the toXML method. If this fails, either fromInputStream is not working correctly
- // or the toXML method is not serialising correctly.
- output = domElement.toXml();
- assertTrue("DomElement creation from a stream failed, or, DomElement toXML failed - failed to produce the same XML.",
- StringUtils.equalsIgnoreLinebreaks(new String(expected), output.toString(), false));
- }
-
- public void test_fromXML_args() throws SAXException, IOException {
- try {
- DomElement.fromXml(null);
- fail("Expected IllegalArgumentException on null String.");
- } catch(IllegalArgumentException e) {
- // Expected
- }
- try {
- DomElement.fromXml(" ");
- fail("Expected IllegalArgumentException on null String.");
- } catch(IllegalArgumentException e) {
- // Expected
- }
- }
-
- public void test_fromXML_and_toXML() throws SAXException, IOException {
- byte[] source = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
- DomElement domElement = DomElement.fromXml(new String(source));
- ByteArrayOutputStream output;
- byte[] expected = source;
-
- // Create the DomElement from a String. Then...
- // Dump the XML to a buffer and compare it with the expected - checking that the
- // Created DomElement DOM is the same as what was supplied in the stream. Also
- // tests the toXML method. If this fails, either fromInputStream is not working correctly
- // or the toXML method is not serialising correctly.
- output = domElement.toXml();
- assertTrue("DomElement creation from a String failed, or, DomElement toXML failed - failed to produce the same XML.",
- StringUtils.equalsIgnoreLinebreaks(new String(expected), output.toString(), false));
- }
-
- public void test_Constructor_W3CElement() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile1.xml"));
-// ByteArrayOutputStream output;
- byte[] expected = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
-
- // Create a new DomElement from an existing one and compare it with the expected.
- domElement = new DomElement(domElement.getDomElement());
- assertTrue("DomElement creation from a stream failed, or, DomElement(Element) Constructor failed - failed to produce the same XML.",
- StringUtils.equalsIgnoreLinebreaks(new String(expected), new String(domElement.toXml().toByteArray()), false));
- }
-
- public void test_Constructor_String_withoutparent() throws SAXException, IOException {
- // Create a new DomElement from without a parent DomElement.
- DomElement domElement = new DomElement("newDomElement");
-
- assertEquals("New DomElement invalid.", "<newDomElement/>" + DomElement.LINE_BREAK, domElement.toString());
- }
-
- public void test_getName() {
- DomElement domElement = new DomElement("newDomElement");
- assertEquals("getName returned invalid data.", "newDomElement", domElement.getName());
- }
-
- public void test_getAttrKeys_hasnokeys() throws SAXException, IOException {
- DomElement domElement = new DomElement("newDomElement");
- String[] expected = new String[] {};
- String[] actual = domElement.getAttrKeys();
-
- assertTrue("invalid attribute name list", Arrays.equals(expected, actual));
- }
-
- public void test_getAttrKeys_haskeys() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile2.xml"));
- String[] expected = new String[] {"attrib1", "attrib2", "attrib3"};
- String[] actual = domElement.getAttrKeys();
-
- assertTrue("invalid attribute name list", Arrays.equals(expected, actual));
- }
-
- public void test_getAttr() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile2.xml"));
-
- assertEquals("invalid attribute value", "value2", domElement.getAttr("attrib2"));
- assertEquals("invalid attribute value", null, domElement.getAttr("attribXX"));
- }
-
- public void test_getTextChildren() throws SAXException, IOException {
- // This test also tests the static method getTextValue.
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
-
- // REVIEW: These tests capture the current behavior of the getTextChildren method. I'm not convinced this behavior is correct!!
- // I think perhaps this method should not be depending on getTextValue because getTextValue
- // concatentates the child text nodes.
- assertTrue("invalid Text Children list",
- Arrays.equals(new String[] {"Some root text... and some more root text..."}, domElement.getTextChildren("root")));
- assertTrue("invalid Text Children list",
- Arrays.equals(new String[] {"", "Some nested text..."}, domElement.getTextChildren("el")));
- }
-
- public void test_getElementChildren() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
- DomElement[] domElements;
-
- // Test the root element - of which there's only 1...
- domElements = domElement.getElementChildren("root");
- assertEquals("Wrong number of DomElement ElementChildren.", 1, domElements.length);
- String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("expected_03.xml"))).trim();
- assertEquals("Wrong DomElement ElementChild value.", expected, domElements[0].toString().trim());
-
- // Test the nested <el> elements - of which there are 2...
- domElements = domElement.getElementChildren("el");
- assertEquals("Wrong number of DomElement ElementChildren.", 2, domElements.length);
- assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElements[0].toString().trim());
- assertEquals("Wrong DomElement ElementChild value.", "<el index=\"2\">Some nested text...</el>", domElements[1].toString().trim());
-
- // Test for a non-existant element...
- domElements = domElement.getElementChildren("xxxx");
- assertEquals("Wrong number of DomElement ElementChildren.", 0, domElements.length);
- }
-
- public void test_getFirstElementChild() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
-
- // Test the root element - of which there's only 1...
- domElement = domElement.getFirstElementChild("root");
- String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("expected_03.xml"))).trim();
- assertEquals("Wrong DomElement ElementChild value.", expected, domElement.toString().trim());
-
- // Test the nested <el> elements - of which there are 2...
- domElement = domElement.getFirstElementChild("el");
- assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElement.toString().trim());
-
- // Test for a non-existant element...
- domElement = domElement.getFirstElementChild("xxxx");
- assertEquals("Expected null DomElement ElementChildren for non-existant element.", null, domElement);
- }
-
- public void test_getAllElemChildren() throws SAXException, IOException {
- DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
- DomElement[] domElements;
-
- domElements = domElement.getAllElemChildren();
- assertEquals("Wrong number of DomElement ElementChildren.", 2, domElements.length);
- assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElements[0].toString().trim());
- assertEquals("Wrong DomElement ElementChild value.", "<el index=\"2\">Some nested text...</el>", domElements[1].toString().trim());
-
- // REVIEW: Note, this method only returns DomElement instances for the child elements
- // of the document root node. Comparing this to the behaviour of getFirstElementChild
- // would seem to demonstrate an inconsitency??? To be consistent, I would expect this method
- // to return a list of 3 DomElement instances - the <root> and 2 <el> elements.
- }
-
- public void test_setAttr() throws SAXException, IOException {
- DomElement domElement = new DomElement("newDomElement");
-
- domElement.setAttr("attrib1", "value1");
- assertEquals("value1", domElement.getAttr("attrib1"));
-
- // A null value removes the attribute.
- domElement.setAttr("attrib1", null);
- assertEquals(null, domElement.getAttr("attrib1"));
-
- // null attrib name currently just causes the method to return???
- domElement.setAttr(null, null);
- }
-
- public void test_addElemChild() throws SAXException, IOException {
- DomElement domElement1 = new DomElement("newDomElement");
- DomElement domElementX = new DomElement("X");
- DomElement domElementY1 = new DomElement("Y1");
- DomElement domElementY2 = new DomElement("Y2");
-
- domElement1.addElemChild(domElementX);
- domElement1.addElemChild(domElementY1);
- domElementX.addElemChild(domElementY2);
- assertEquals("<newDomElement><X><Y2/></X><Y1/></newDomElement>", domElement1.toString().trim());
- }
-
- public void test_rmvChildsByName() throws SAXException, IOException {
- DomElement domElement1 = new DomElement("newDomElement");
- DomElement domElementX = new DomElement("X");
- DomElement domElementY1 = new DomElement("Y1");
- DomElement domElementY2 = new DomElement("Y2");
-
- domElement1.addElemChild(domElementX);
- domElement1.addElemChild(domElementY1);
- domElementX.addElemChild(domElementY2);
- assertEquals("<newDomElement><X><Y2/></X><Y1/></newDomElement>", domElement1.toString().trim());
- domElement1.rmvChildsByName("Y1");
- assertEquals("<newDomElement><X><Y2/></X></newDomElement>", domElement1.toString().trim());
- }
-
- public void test_cloneObj() throws SAXException, IOException {
- DomElement domElement1 = new DomElement("newDomElement");
- DomElement domElementX = new DomElement("X");
- DomElement domElementY = new DomElement("Y");
-
- domElement1.addElemChild(domElementX);
- domElement1.addElemChild(domElementY);
-
- DomElement clone = domElement1.cloneObj();
-
- assertTrue("Clone should produce a completely different object", (domElement1 != clone));
- assertEquals("Clone should produce the same XML", domElement1.toString(), clone.toString());
- }
-}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -38,24 +38,24 @@
*/
public class EmailUnitTest extends TestCase {
- private DomElement mailParams;
+ private ConfigTree mailParams;
@Override
protected void setUp() throws Exception {
- mailParams = DomElement.fromInputStream(getClass().getResourceAsStream("testfile4.xml"));
+ mailParams = ConfigTree.fromInputStream(getClass().getResourceAsStream("testfile4.xml"));
}
public void test_Email() throws AddressException, MessagingException, IOException {
// Look at the source message in testfile4.xml before reading this test.
Email esbMail = new Email();
- esbMail.setSendTo(mailParams.getAttr(Email.SENDTO));
- esbMail.setFrom(mailParams.getAttr(Email.FROM));
- esbMail.setCopyTo(mailParams.getAttr(Email.COPYTO));
- esbMail.setSubject(mailParams.getAttr(Email.SUBJECT));
+ esbMail.setSendTo(mailParams.getAttribute(Email.SENDTO));
+ esbMail.setFrom(mailParams.getAttribute(Email.FROM));
+ esbMail.setCopyTo(mailParams.getAttribute(Email.COPYTO));
+ esbMail.setSubject(mailParams.getAttribute(Email.SUBJECT));
esbMail.setAttachments(mailParams.getTextChildren(Email.ATTACH));
- esbMail.setMessage(mailParams.getAttr(Email.MESSAGE));
+ esbMail.setMessage(mailParams.getAttribute(Email.MESSAGE));
MimeMessage message = esbMail.getMailMessage();
Address[] addresses;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/MacroExpanderUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/MacroExpanderUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/MacroExpanderUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -27,7 +27,7 @@
import org.jboss.internal.soa.esb.notification.MacroExpander;
import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* MacroExpander unit tests.
@@ -36,14 +36,13 @@
public class MacroExpanderUnitTest extends TestCase {
public void testReplaceMacros() {
- DomElement rootDomEl = new DomElement("rootEl");
- DomElement childDomEl = new DomElement("childEl");
+ ConfigTree rootDomEl = new ConfigTree("rootEl");
HashMap<String, String> map = new HashMap<String, String>();
- rootDomEl.addElemChild(childDomEl);
- rootDomEl.setAttr("attrb1", "value1");
- rootDomEl.setAttr("attrb2", MacroExpander.CTX_BATCH_NUM + "BatchNumValue");
- childDomEl.setAttr("attrb1", MacroExpander.CTX_BATCH_UID + "UIDValue");
+ ConfigTree childDomEl = new ConfigTree("childEl",rootDomEl);
+ rootDomEl.setAttribute("attrb1", "value1");
+ rootDomEl.setAttribute("attrb2", MacroExpander.CTX_BATCH_NUM + "BatchNumValue");
+ childDomEl.setAttribute("attrb1", MacroExpander.CTX_BATCH_UID + "UIDValue");
map.put(MacroExpander.CTX_BATCH_NUM, "ReplacementBNV!");
map.put(MacroExpander.CTX_BATCH_UID, "ReplacementUIDV!");
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* NotificationList unit tests.
@@ -35,7 +35,7 @@
public class NotificationListUnitTest extends TestCase {
public void test_NotificationList() throws Exception {
- DomElement domEl = DomElement.fromInputStream(getClass().getResourceAsStream("NotificationListUnitTest_testfile1.xml"));
+ ConfigTree domEl = ConfigTree.fromInputStream(getClass().getResourceAsStream("NotificationListUnitTest_testfile1.xml"));
NotificationList nList = new NotificationList(domEl);
List<String> messageList = new ArrayList<String>();
@@ -51,23 +51,23 @@
}
public void test_assertionMethods() throws Exception {
- DomElement domEl;
+ ConfigTree domEl;
NotificationList nList;
- domEl = new DomElement("notif");
+ domEl = new ConfigTree("notif");
nList = new NotificationList(domEl);
assertTrue(nList.isOK());
assertTrue(nList.isErr());
// REVIEW: Is this behavior OK?? Can be OK and Err at the same time!!
- domEl = new DomElement("notif");
- domEl.setAttr(NotificationList.TYPE, "ok");
+ domEl = new ConfigTree("notif");
+ domEl.setAttribute(NotificationList.TYPE, "ok");
nList = new NotificationList(domEl);
assertTrue(nList.isOK());
assertTrue(!nList.isErr());
- domEl = new DomElement("notif");
- domEl.setAttr(NotificationList.TYPE, "err");
+ domEl = new ConfigTree("notif");
+ domEl.setAttribute(NotificationList.TYPE, "err");
nList = new NotificationList(domEl);
assertTrue(!nList.isOK());
assertTrue(nList.isErr());
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
/**
@@ -36,23 +36,23 @@
public class NotifyEmailUnitTest extends TestCase {
public void test_NotifyEmail() throws Exception {
- DomElement emailMessageEl = new DomElement("email");
+ ConfigTree emailMessageEl = new ConfigTree("email");
- emailMessageEl.setAttr(Email.FROM, "a.b at c.com");
- emailMessageEl.setAttr(Email.SENDTO, "d.e at f.com");
- emailMessageEl.setAttr(Email.COPYTO, "g.h at i.com");
- emailMessageEl.setAttr(Email.MESSAGE, "Hi there!!!");
+ emailMessageEl.setAttribute(Email.FROM, "a.b at c.com");
+ emailMessageEl.setAttribute(Email.SENDTO, "d.e at f.com");
+ emailMessageEl.setAttribute(Email.COPYTO, "g.h at i.com");
+ emailMessageEl.setAttribute(Email.MESSAGE, "Hi there!!!");
NotifyEmail ne = new TestNotifyEmail(emailMessageEl);
ne.sendNotification("Hello");
}
private class TestNotifyEmail extends NotifyEmail {
- public TestNotifyEmail(DomElement p_oP) throws Exception {
+ public TestNotifyEmail(ConfigTree p_oP) throws Exception {
super(p_oP);
}
- protected void sendEmailNotification(DomElement messageParams) throws AddressException, MessagingException {
- assertEquals("Hi there!!!\nHello", messageParams.getAttr(Email.MESSAGE));
+ protected void sendEmailNotification(ConfigTree messageParams) throws AddressException, MessagingException {
+ assertEquals("Hi there!!!\nHello", messageParams.getAttribute(Email.MESSAGE));
}
}
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* NotifyFiles unit tests.
@@ -35,20 +35,18 @@
public class NotifyFilesUnitTest extends TestCase {
public void test_BadFolderInfo() throws Exception {
- DomElement rootEl = new DomElement("notif");
- DomElement fileEl = new DomElement("file");
-
- rootEl.addElemChild(fileEl);
-
- // No file attribute defined on the DomElement
+ ConfigTree rootEl = new ConfigTree("notif");
+ ConfigTree fileEl = new ConfigTree("file",rootEl);
+
+ // No file attribute defined on the ConfigTree
try {
new NotifyFiles(rootEl);
fail("Expected IllegalArgumentException");
} catch(IllegalArgumentException e) {
// Expected
}
- // File attribute defined on the DomElement, but parent folder doesn't exist...
- fileEl.setAttr("URI", new File("./").toURI().toString() + "/xyzzyx/a.txt");
+ // File attribute defined on the ConfigTree, but parent folder doesn't exist...
+ fileEl.setAttribute("URI", new File("./").toURI().toString() + "/xyzzyx/a.txt");
try {
new NotifyFiles(rootEl);
fail("Expected IllegalArgumentException");
@@ -66,7 +64,7 @@
}
public void sendNotification(Serializable obj) throws Exception {
- DomElement rootEl = new DomElement("notif");
+ ConfigTree rootEl = new ConfigTree("notif");
NotifyFiles notifyFiles;
// Add the file configs to the config DOM for 4 files...
@@ -92,13 +90,12 @@
assertEquals(file1Obj.length(), file3Obj.length() * 2);
}
- private void addFileConfig(DomElement rootEl, String file, Boolean append) {
+ private void addFileConfig(ConfigTree rootEl, String file, Boolean append) {
File fileObj = getFileObject(file);
- DomElement fileEl = new DomElement("file");
+ ConfigTree fileEl = new ConfigTree("file",rootEl);
- fileEl.setAttr("URI", fileObj.toURI().toString());
- fileEl.setAttr("append", (append != null?append.toString():null));
- rootEl.addElemChild(fileEl);
+ fileEl.setAttribute("URI", fileObj.toURI().toString());
+ fileEl.setAttribute("append", (append != null?append.toString():null));
// Also want to delete the file incase the tests are being rerun...
fileObj.delete();
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -31,7 +31,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.mockejb.jms.MockQueue;
import org.mockejb.jms.MockTopic;
import org.mockejb.jms.QueueConnectionFactoryImpl;
@@ -52,7 +52,7 @@
Context ctx = new InitialContext();
ctx.rebind(NotifyQueues.CONNECTION_FACTORY, new QueueConnectionFactoryImpl());
- DomElement rootEl = new DomElement("rootEl");
+ ConfigTree rootEl = new ConfigTree("rootEl");
addMessagePropertyConfigs(rootEl);
addQueueConfig(rootEl, "queue1");
@@ -103,19 +103,18 @@
assertEquals(null, message.getStringProperty("testpropname"));
}
- private void addMessagePropertyConfigs(DomElement rootEl) {
- DomElement propEl = new DomElement(NotifyQueues.CHILD_MSG_PROP);
+ private void addMessagePropertyConfigs(ConfigTree rootEl) {
+
+ ConfigTree propEl = new ConfigTree(NotifyQueues.CHILD_MSG_PROP,rootEl);
- propEl.setAttr(NotifyJMS.ATT_PROP_NAME, "testpropname");
- propEl.setAttr(NotifyJMS.ATT_PROP_VALUE, "testpropvalue");
- rootEl.addElemChild(propEl);
+ propEl.setAttribute(NotifyJMS.ATT_PROP_NAME, "testpropname");
+ propEl.setAttribute(NotifyJMS.ATT_PROP_VALUE, "testpropvalue");
}
- private void addQueueConfig(DomElement rootEl, String queueName) {
- DomElement queueEl = new DomElement(NotifyQueues.CHILD_QUEUE);
+ private void addQueueConfig(ConfigTree rootEl, String queueName) {
+ ConfigTree queueEl = new ConfigTree(NotifyQueues.CHILD_QUEUE,rootEl);
- queueEl.setAttr(NotifyJMS.ATT_DEST_NAME, queueName);
- rootEl.addElemChild(queueEl);
+ queueEl.setAttribute(NotifyJMS.ATT_DEST_NAME, queueName);
}
private MockQueue createAndBindQueue(String queueName) throws NamingException {
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -23,7 +23,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
/**
* NotifySqlTable unit tests.
@@ -32,7 +32,7 @@
public class NotifySqlTableUnitTest extends TestCase {
public void test_NotifySqlTable() throws Exception {
- DomElement domEl = DomElement.fromInputStream(getClass().getResourceAsStream("NotifySqlTable_testfile1.xml"));
+ ConfigTree domEl = ConfigTree.fromInputStream(getClass().getResourceAsStream("NotifySqlTable_testfile1.xml"));
NotifySqlTable nst = new NotifySqlTable(domEl);
assertEquals("driver-class", nst.m_sDriver);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -31,7 +31,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.mockejb.jms.MockTopic;
import org.mockejb.jms.TopicConnectionFactoryImpl;
import org.mockejb.jndi.MockContextFactory;
@@ -51,7 +51,7 @@
Context ctx = new InitialContext();
ctx.rebind(NotifyTopics.CONNECTION_FACTORY, new TopicConnectionFactoryImpl());
- DomElement rootEl = new DomElement("rootEl");
+ ConfigTree rootEl = new ConfigTree("rootEl");
addMessagePropertyConfigs(rootEl);
addTopicConfig(rootEl, "topic1");
@@ -102,19 +102,17 @@
assertEquals(null, message.getStringProperty("testpropname"));
}
- private void addMessagePropertyConfigs(DomElement rootEl) {
- DomElement propEl = new DomElement(NotifyTopics.CHILD_MSG_PROP);
+ private void addMessagePropertyConfigs(ConfigTree rootEl) {
+ ConfigTree propEl = new ConfigTree(NotifyTopics.CHILD_MSG_PROP,rootEl);
- propEl.setAttr(NotifyJMS.ATT_PROP_NAME, "testpropname");
- propEl.setAttr(NotifyJMS.ATT_PROP_VALUE, "testpropvalue");
- rootEl.addElemChild(propEl);
+ propEl.setAttribute(NotifyJMS.ATT_PROP_NAME, "testpropname");
+ propEl.setAttribute(NotifyJMS.ATT_PROP_VALUE, "testpropvalue");
}
- private void addTopicConfig(DomElement rootEl, String topicName) {
- DomElement topicEl = new DomElement(NotifyTopics.CHILD_TOPIC);
+ private void addTopicConfig(ConfigTree rootEl, String topicName) {
+ ConfigTree topicEl = new ConfigTree(NotifyTopics.CHILD_TOPIC,rootEl);
- topicEl.setAttr(NotifyJMS.ATT_DEST_NAME, topicName);
- rootEl.addElemChild(topicEl);
+ topicEl.setAttribute(NotifyJMS.ATT_DEST_NAME, topicName);
}
private MockTopic createAndBindTopic(String topicName) throws NamingException {
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyUtilUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyUtilUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyUtilUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -28,7 +28,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.NotificationManager;
/**
@@ -38,7 +38,7 @@
public class NotifyUtilUnitTest extends TestCase {
public void test_NotifyUtil() {
- DomElement rootEl = new DomElement("rootEl");
+ ConfigTree rootEl = new ConfigTree("rootEl");
addNotificationConfig(rootEl, "message1", "ok");
addNotificationConfig(rootEl, "message2", "err");
@@ -59,18 +59,17 @@
assertTrue(handler.messages.get(2).startsWith("message4 - somemessage"));
}
- private void addNotificationConfig(DomElement rootEl, String message, String type) {
- DomElement notifEl = new DomElement(NotificationList.ELEMENT);
- notifEl.setAttr("message", message);
- notifEl.setAttr(NotificationList.TYPE, type);
- rootEl.addElemChild(notifEl);
+ private void addNotificationConfig(ConfigTree rootEl, String message, String type) {
+ ConfigTree notifEl = new ConfigTree(NotificationList.ELEMENT,rootEl);
+ notifEl.setAttribute("message", message);
+ notifEl.setAttribute(NotificationList.TYPE, type);
}
private class TestNotificationHandler implements NotificationManager {
private List<String> messages = new ArrayList<String>();
- public void sendNotifications(DomElement p_oP, Serializable p_o) throws Exception {
- messages.add(p_oP.getAttr("message") + " - " + p_o);
+ public void sendNotifications(ConfigTree p_oP, Serializable p_o) throws Exception {
+ messages.add(p_oP.getAttribute("message") + " - " + p_o);
}
public void sendNotifications(Serializable p_o) throws Exception {
messages.add(p_o.toString());
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -4,21 +4,21 @@
import java.io.Serializable;
import java.util.List;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
public class TestNotificationTarget1 extends NotificationTarget {
- private DomElement config;
+ private ConfigTree config;
public static List<String> messageList;
- public TestNotificationTarget1(DomElement targetConf) {
+ public TestNotificationTarget1(ConfigTree targetConf) {
super(targetConf);
config = targetConf;
}
@Override
public void sendNotification(Serializable obj) throws Exception {
- messageList.add(config.getAttr("message") + "-" + obj);
+ messageList.add(config.getAttribute("message") + "-" + obj);
}
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget2.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget2.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget2.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -1,10 +1,10 @@
package org.jboss.soa.esb.notification;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
public class TestNotificationTarget2 extends TestNotificationTarget1 {
- public TestNotificationTarget2(DomElement targetConf) {
+ public TestNotificationTarget2(ConfigTree targetConf) {
super(targetConf);
}
}
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -33,7 +33,7 @@
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.beans.PersistHandler;
import org.jboss.soa.esb.util.BaseBusinessObject;
import org.jboss.soa.esb.util.BobjStdDTO;
@@ -74,14 +74,14 @@
return TBL_UIDS;
}
- protected static void setStoreConfig(DomElement storeConfig) {
+ protected static void setStoreConfig(ConfigTree storeConfig) {
BobjStore.storeConfig = storeConfig;
}
private static String TBL_BATCHES;
- private static DomElement storeConfig;
+ private static ConfigTree storeConfig;
public static void setBatchTableName(String p_s) {
TBL_BATCHES = p_s;
@@ -106,7 +106,7 @@
/**
* Configure/Reconfigure the BobjStore.
* <p/>
- * The configuration is set either through a prior call to {@link #setStoreConfig(DomElement)}, or
+ * The configuration is set either through a prior call to {@link #setStoreConfig(ConfigTree)}, or
* through a URI resource lookup configured by the "org.jboss.soa.esb.objStore.configfile" System property.
* @throws SAXException
* @throws IOException
@@ -119,21 +119,21 @@
}
if(storeConfig != null) {
- setDataSourceJndi(storeConfig.getAttr(DATA_SOURCE_JNDI_NAME));
- setUidTableName(storeConfig.getAttr(UID_TABLE));
- setBatchTableName(storeConfig.getAttr(BATCH_TABLE));
+ setDataSourceJndi(storeConfig.getAttribute(DATA_SOURCE_JNDI_NAME));
+ setUidTableName(storeConfig.getAttribute(UID_TABLE));
+ setBatchTableName(storeConfig.getAttribute(BATCH_TABLE));
- for (DomElement oCurr : storeConfig.getElementChildren(CLASS_ELEMENT)) {
- String sClass = oCurr.getAttr(CLASS_NAME_ATTR);
+ for (ConfigTree oCurr : storeConfig.getChildren(CLASS_ELEMENT)) {
+ String sClass = oCurr.getAttribute(CLASS_NAME_ATTR);
boolean bCrypt = "true".equalsIgnoreCase(oCurr
- .getAttr(CLASS_ENCRYPT_ATTR));
+ .getAttribute(CLASS_ENCRYPT_ATTR));
- BobjStore oNew = new BobjStore(oCurr.getAttr(CLASS_TYPE_ATTR),
- oCurr.getAttr(CLASS_TABLE_ATTR), null,
+ BobjStore oNew = new BobjStore(oCurr.getAttribute(CLASS_TYPE_ATTR),
+ oCurr.getAttribute(CLASS_TABLE_ATTR), null,
sClass.substring(1 + sClass.lastIndexOf(".")), bCrypt);
- for (DomElement oIcurr : oCurr.getElementChildren(INDEX_ELEMENT)) {
- oNew.addLocatorTable(oIcurr.getAttr(INDEX_TABLE_ATTR));
+ for (ConfigTree oIcurr : oCurr.getChildren(INDEX_ELEMENT)) {
+ oNew.addLocatorTable(oIcurr.getAttribute(INDEX_TABLE_ATTR));
}
s_oStoreMap.put(sClass, oNew);
}
@@ -145,7 +145,7 @@
* <p/>
* Tries reading it from the classpath. If that fails, tries reading it through a URI stream.
*/
- protected static DomElement readConfiguration() throws IOException, MalformedURLException, SAXException {
+ protected static ConfigTree readConfiguration() throws IOException, MalformedURLException, SAXException {
String configPath = Configuration.getObjStoreConfigFile();
URI configURI;
InputStream configStream = null;
@@ -175,7 +175,7 @@
throw new IllegalStateException("Unable to locate and read ObjStoreConfigFile: " + configPath);
}
- return DomElement.fromInputStream(configStream);
+ return ConfigTree.fromInputStream(configStream);
}
private String m_sSnapType, m_sSnapTbl, m_sClass;
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -26,7 +26,7 @@
import javax.naming.Context;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.beans.NotificationHandler;
public class NotifHandlerBsDelegateLocal implements NotificationManager
@@ -39,7 +39,7 @@
m_oNotifH.create();
}
- public void sendNotifications(DomElement p_oP, Serializable p_o)
+ public void sendNotifications(ConfigTree p_oP, Serializable p_o)
throws Exception
{
m_oNotifH.sendNotifications(p_oP.toString(), p_o);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -27,7 +27,7 @@
import javax.naming.Context;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.beans.NotificationHandler;
public class NotifHandlerBsDelegateRemote implements NotificationManager
@@ -40,7 +40,7 @@
m_oNotifH.create();
}
- public void sendNotifications(DomElement p_oP, Serializable p_o)
+ public void sendNotifications(ConfigTree p_oP, Serializable p_o)
throws Exception
{
m_oNotifH.sendNotifications(p_oP.toString(), p_o);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/NotificationHandlerBean.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/NotificationHandlerBean.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/src/org/jboss/soa/esb/services/beans/NotificationHandlerBean.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -39,7 +39,7 @@
import javax.ejb.TransactionManagementType;
import org.apache.log4j.Logger;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.notification.NotificationList;
import org.jboss.soa.esb.util.Util;
/**
@@ -104,7 +104,7 @@
private static NotificationList s_dfltList;
static
{ try
- { s_dfltList = new NotificationList(DomElement.fromXml(s_sDfltList)); }
+ { s_dfltList = new NotificationList(ConfigTree.fromXml(s_sDfltList)); }
catch (Exception e) { e.printStackTrace(System.out); }
}
/**
@@ -115,7 +115,7 @@
public void sendNotifications(String p_sParams, Serializable p_oMsg)
throws Exception
{
- DomElement oP = (null==p_sParams)?null:DomElement.fromXml(p_sParams);
+ ConfigTree oP = (null==p_sParams)?null:ConfigTree.fromXml(p_sParams);
NotificationList m_oL = (null==oP) ? s_dfltList : new NotificationList(oP);
m_oL.sendNotification(p_oMsg);
} //__________________________________
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/internal/core/objectstore/BobjStoreUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -26,7 +26,7 @@
import java.net.MalformedURLException;
import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.xml.sax.SAXException;
/**
@@ -66,7 +66,7 @@
public void test_readConfiguration_validconfig() throws MalformedURLException, IOException, SAXException {
String resPath = getResourceClasspath("BobjStoreUnitTest_config1.xml");
- DomElement config1, config2;
+ ConfigTree config1, config2;
// Test a read from a valid classpath resource...
setObjStoreConfigFile("classpath:" + resPath);
Modified: labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/NotificationUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/NotificationUnitTest.java 2006-10-26 04:28:24 UTC (rev 7133)
+++ labs/jbossesb/workspace/dbrum/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/beans/NotificationUnitTest.java 2006-10-26 04:32:42 UTC (rev 7134)
@@ -34,7 +34,7 @@
import org.apache.log4j.Priority;
import org.jboss.soa.esb.common.tests.BaseTest;
import org.jboss.soa.esb.common.tests.EJBContainerSetup;
-import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
import org.jboss.soa.esb.notification.NotificationList;
@@ -52,20 +52,20 @@
InitialContext ctx = getInitialContext();
@SuppressWarnings("unused")
NotificationHandler local = (NotificationHandler ) ctx.lookup("NotificationHandlerBean/local");
- DomElement oEl = new DomElement("MyFileList");
- oEl.setAttr(NotificationList.TYPE,"OK");
+ ConfigTree oEl = new ConfigTree("MyFileList");
+ oEl.setAttribute(NotificationList.TYPE,"OK");
// oEl.addElemChild(fileListTarget());
// oEl.addElemChild(emailTarget());
// oEl.addElemChild(jmsQueueTarget());
// oEl.addElemChild(jmsTopicTarget());
- oEl.addElemChild(sqlTableTarget());
+ sqlTableTarget(oEl);
NotificationList oNL = new NotificationList(oEl);
// to see how the XML looks like
// this is just a unit test class
- // Typically the XML is used in a parameter object (DomElement.fromXml())
+ // Typically the XML is used in a parameter object (ConfigTree.fromXml())
System.out.println(oNL.toString());
// a simple timestamped message
@@ -102,14 +102,14 @@
return props;
}
-// static DomElement emailTarget() throws Exception
+// static ConfigTree emailTarget() throws Exception
// {
-// DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
-// oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyEmail");
-// oTgt.setAttr(Email.FROM,"sender at jboss.com");
-// oTgt.setAttr(Email.SENDTO,"receiver1 at hotmail.com,receiver2 at jboss.com");;
-// oTgt.setAttr(Email.SUBJECT,"TEST from Rosetta");
-// oTgt.setAttr(Email.MESSAGE,"This is the text of your message");
+// ConfigTree oTgt = new ConfigTree(NotificationList.CHILD_TGT);
+// oTgt.setAttribute(NotificationTarget.PRM_NOTIF_CLASS,"NotifyEmail");
+// oTgt.setAttribute(Email.FROM,"sender at jboss.com");
+// oTgt.setAttribute(Email.SENDTO,"receiver1 at hotmail.com,receiver2 at jboss.com");;
+// oTgt.setAttribute(Email.SUBJECT,"TEST from Rosetta");
+// oTgt.setAttribute(Email.MESSAGE,"This is the text of your message");
//
// // This class does NOT send the e-mails, the app server does
// // consequently these paths would have to be accessible in the
@@ -121,89 +121,89 @@
// return oTgt;
// } //________________________________
//
-// static DomElement fileListTarget() throws Exception
+// static ConfigTree fileListTarget() throws Exception
// {
-// DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
-// oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyFiles");
+// ConfigTree oTgt = new ConfigTree(NotificationList.CHILD_TGT);
+// oTgt.setAttribute(NotificationTarget.PRM_NOTIF_CLASS,"NotifyFiles");
//
// // This class does NOT write the files, the app server does
// // consequently these paths would have to be accessible in the
// // application server (filesystem / mounts)
// String[] sa = {"file:///tmp/file1.notif","file:///tmp/file2.notif"};
// for (String sCurr : sa)
-// { DomElement oFile = new DomElement(NotifyFiles.CHILD_FILE);
-// oFile.setAttr(NotifyFiles.ATT_URI,sCurr);
-// oFile.setAttr(NotifyFiles.ATT_APPEND,Boolean.toString(true));
+// { ConfigTree oFile = new ConfigTree(NotifyFiles.CHILD_FILE);
+// oFile.setAttribute(NotifyFiles.ATT_URI,sCurr);
+// oFile.setAttribute(NotifyFiles.ATT_APPEND,Boolean.toString(true));
// oTgt.addElemChild(oFile);
// }
// return oTgt;
// } //________________________________
//
-// static DomElement jmsQueueTarget() throws Exception
+// static ConfigTree jmsQueueTarget() throws Exception
// {
-// DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
-// oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyQueues");
+// ConfigTree oTgt = new ConfigTree(NotificationList.CHILD_TGT);
+// oTgt.setAttribute(NotificationTarget.PRM_NOTIF_CLASS,"NotifyQueues");
//
// String[] sa = {"queue/A","queue/B"};
// for (String sCurr : sa)
-// { DomElement oQ = new DomElement(NotifyQueues.CHILD_QUEUE);
-// oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
-// for (DomElement oProp : getMessageProperties())
+// { ConfigTree oQ = new ConfigTree(NotifyQueues.CHILD_QUEUE);
+// oQ.setAttribute(NotifyJMS.ATT_DEST_NAME,sCurr);
+// for (ConfigTree oProp : getMessageProperties())
// oQ.addElemChild(oProp);
// oTgt.addElemChild(oQ);
// }
// return oTgt;
// } //________________________________
//
-// static DomElement jmsTopicTarget() throws Exception
+// static ConfigTree jmsTopicTarget() throws Exception
// {
-// DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
-// oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyTopics");
+// ConfigTree oTgt = new ConfigTree(NotificationList.CHILD_TGT);
+// oTgt.setAttribute(NotificationTarget.PRM_NOTIF_CLASS,"NotifyTopics");
//
// String[] sa = {"topic/testTopic"};
// for (String sCurr : sa)
-// { DomElement oQ = new DomElement(NotifyTopics.CHILD_TOPIC);
-// oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
-// for (DomElement oProp : getMessageProperties())
+// { ConfigTree oQ = new ConfigTree(NotifyTopics.CHILD_TOPIC);
+// oQ.setAttribute(NotifyJMS.ATT_DEST_NAME,sCurr);
+// for (ConfigTree oProp : getMessageProperties())
// oQ.addElemChild(oProp);
// oTgt.addElemChild(oQ);
// }
// return oTgt;
// } //________________________________
//
-// static DomElement[] getMessageProperties() throws Exception
+// static ConfigTree[] getMessageProperties() throws Exception
// {
// KeyValuePair[] oaProps = new KeyValuePair[]
// {new KeyValuePair("prop1","111")
// ,new KeyValuePair("prop2","bbb")
// ,new KeyValuePair("prop3","abc123")
// };
-// DomElement[] oaRet = new DomElement[oaProps.length];
+// ConfigTree[] oaRet = new ConfigTree[oaProps.length];
// int iCurr = 0;
// for (KeyValuePair oCurr : oaProps)
-// { DomElement oElem = new DomElement(NotifyJMS.CHILD_MSG_PROP);
-// oElem.setAttr(NotifyJMS.ATT_PROP_NAME,oCurr.getKey());
-// oElem.setAttr(NotifyJMS.ATT_PROP_VALUE,oCurr.getValue());
+// { ConfigTree oElem = new ConfigTree(NotifyJMS.CHILD_MSG_PROP);
+// oElem.setAttribute(NotifyJMS.ATT_PROP_NAME,oCurr.getKey());
+// oElem.setAttribute(NotifyJMS.ATT_PROP_VALUE,oCurr.getValue());
// oaRet[iCurr++] = oElem;
// }
// return oaRet;
// } //________________________________
- static DomElement sqlTableTarget() throws Exception
+ static ConfigTree sqlTableTarget(ConfigTree dad) throws Exception
{
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifySqlTable");
+ ConfigTree oTgt = new ConfigTree(NotificationList.CHILD_TGT,dad);
+ oTgt.setAttribute(NotificationTarget.PRM_NOTIF_CLASS,"NotifySqlTable");
- oTgt.setAttr(SimpleDataSource.DRIVER,"org.postgresql.Driver");
- oTgt.setAttr(SimpleDataSource.URL,"jdbc:postgresql://localhost:5432/jbossesb");
- oTgt.setAttr(SimpleDataSource.USER,"postgres");
- oTgt.setAttr(SimpleDataSource.PASSWORD,"postgres");
+ oTgt.setAttribute(SimpleDataSource.DRIVER,"org.postgresql.Driver");
+ oTgt.setAttribute(SimpleDataSource.URL,"jdbc:postgresql://localhost:5432/jbossesb");
+ oTgt.setAttribute(SimpleDataSource.USER,"postgres");
+ oTgt.setAttribute(SimpleDataSource.PASSWORD,"postgres");
// Table name for insert - must exist in database (URL)
- oTgt.setAttr(NotifySqlTable.ATT_TABLE,"test_notif_table");
+ oTgt.setAttribute(NotifySqlTable.ATT_TABLE,"test_notif_table");
// Column that will contain the dynamic data generated by the ActionClass
// must exist in table (ATT_TABLE above)
- oTgt.setAttr(NotifySqlTable.ATT_DATA,"msg");
+ oTgt.setAttribute(NotifySqlTable.ATT_DATA,"msg");
// constant data that can be also added in the insert
// (perhaps needed for queries)
@@ -214,10 +214,9 @@
,new KeyValuePair("val1","VVVV 11111")
};
for (KeyValuePair oCurr : oaCols)
- { DomElement oElem = new DomElement(NotifySqlTable.CHILD_COLUMN);
- oElem.setAttr(NotifySqlTable.ATT_NAME,oCurr.getKey());
- oElem.setAttr(NotifySqlTable.ATT_VALUE,oCurr.getValue());
- oTgt.addElemChild(oElem);
+ { ConfigTree oElem = new ConfigTree(NotifySqlTable.CHILD_COLUMN,oTgt);
+ oElem.setAttribute(NotifySqlTable.ATT_NAME,oCurr.getKey());
+ oElem.setAttribute(NotifySqlTable.ATT_VALUE,oCurr.getValue());
}
return oTgt;
More information about the jboss-svn-commits
mailing list