[jboss-svn-commits] JBL Code SVN: r5258 - in labs/jbossesb/trunk/product: . core core/common core/common/src core/common/src/org core/common/src/org/jboss core/common/src/org/jboss/soa core/common/src/org/jboss/soa/esb core/common/src/org/jboss/soa/esb/common core/common/src/org/jboss/soa/esb/common/bizclasses core/common/src/org/jboss/soa/esb/helpers core/common/src/org/jboss/soa/esb/helpers/persist core/common/src/org/jboss/soa/esb/notification core/common/src/org/jboss/soa/esb/parameters core/common/src/org/jboss/soa/esb/services core/common/src/org/jboss/soa/esb/util core/common/tests core/common/tests/src core/common/tests/src/org core/common/tests/src/org/jboss core/common/tests/src/org/jboss/soa core/common/tests/src/org/jboss/soa/esb core/common/tests/src/org/jboss/soa/esb/common core/common/tests/src/org/jboss/soa/esb/common/tests core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses core/common/tests/src/org/jboss/soa/esb/common/tests/parameters core/common/tests/s! rc/org/jboss/soa/esb/common/tests/utils core/listeners core/listeners/src core/listeners/src/org core/listeners/src/org/jboss core/listeners/src/org/jboss/soa core/listeners/src/org/jboss/soa/esb core/listeners/src/org/jboss/soa/esb/listeners core/listeners/src/org/jboss/soa/esb/nagios core/listeners/src/org/jboss/soa/esb/nagios/monitor core/listeners/src/org/jboss/soa/esb/nagios/transport core/listeners/src/org/jboss/soa/esb/nagios/util core/listeners/tests core/listeners/tests/src core/listeners/tests/src/org core/listeners/tests/src/org/jboss core/listeners/tests/src/org/jboss/soa core/listeners/tests/src/org/jboss/soa/esb core/listeners/tests/src/org/jboss/soa/esb/listeners core/listeners/tests/src/org/jboss/soa/esb/listeners/tests core/processors core/processors/src core/processors/src/org core/processors/src/org/jboss core/processors/src/org/jboss/soa core/processors/src/org/jboss/soa/esb core/processors/src/org/jboss/soa/esb/processors core/processors/tests core/proc! essors/tests/src core/processors/tests/src/org core/processors/tests/src/org/jboss core/processors/tests/src/org/jboss/soa core/processors/tests/src/org/jboss/soa/esb core/processors/tests/src/org/jboss/soa/esb/processors core/processors/tests/src/org/jboss/soa/esb/processors/tests core/services core/services/src core/servic
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jul 23 08:58:45 EDT 2006
Author: arvinder
Date: 2006-07-23 08:55:37 -0400 (Sun, 23 Jul 2006)
New Revision: 5258
Added:
labs/jbossesb/trunk/product/core/
labs/jbossesb/trunk/product/core/ant.bat
labs/jbossesb/trunk/product/core/build.xml
labs/jbossesb/trunk/product/core/common/
labs/jbossesb/trunk/product/core/common/ant.bat
labs/jbossesb/trunk/product/core/common/build.xml
labs/jbossesb/trunk/product/core/common/src/
labs/jbossesb/trunk/product/core/common/src/org/
labs/jbossesb/trunk/product/core/common/src/org/jboss/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java
labs/jbossesb/trunk/product/core/common/tests/
labs/jbossesb/trunk/product/core/common/tests/build.xml
labs/jbossesb/trunk/product/core/common/tests/src/
labs/jbossesb/trunk/product/core/common/tests/src/org/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
labs/jbossesb/trunk/product/core/listeners/
labs/jbossesb/trunk/product/core/listeners/ant.bat
labs/jbossesb/trunk/product/core/listeners/build.xml
labs/jbossesb/trunk/product/core/listeners/src/
labs/jbossesb/trunk/product/core/listeners/src/org/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java
labs/jbossesb/trunk/product/core/listeners/tests/
labs/jbossesb/trunk/product/core/listeners/tests/build.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/processors/
labs/jbossesb/trunk/product/core/processors/ant.bat
labs/jbossesb/trunk/product/core/processors/build.xml
labs/jbossesb/trunk/product/core/processors/src/
labs/jbossesb/trunk/product/core/processors/src/org/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java
labs/jbossesb/trunk/product/core/processors/tests/
labs/jbossesb/trunk/product/core/processors/tests/build.xml
labs/jbossesb/trunk/product/core/processors/tests/src/
labs/jbossesb/trunk/product/core/processors/tests/src/org/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/services/
labs/jbossesb/trunk/product/core/services/ant.bat
labs/jbossesb/trunk/product/core/services/build.xml
labs/jbossesb/trunk/product/core/services/src/
labs/jbossesb/trunk/product/core/services/src/META-INF/
labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/ejb-jar.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/jboss.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/manifest.server
labs/jbossesb/trunk/product/core/services/src/org/
labs/jbossesb/trunk/product/core/services/src/org/jboss/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java
labs/jbossesb/trunk/product/core/services/tests/
labs/jbossesb/trunk/product/core/services/tests/build.xml
labs/jbossesb/trunk/product/core/services/tests/src/
labs/jbossesb/trunk/product/core/services/tests/src/org/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java
Removed:
labs/jbossesb/trunk/product/core/ant.bat
labs/jbossesb/trunk/product/core/build.xml
labs/jbossesb/trunk/product/core/common/
labs/jbossesb/trunk/product/core/common/ant.bat
labs/jbossesb/trunk/product/core/common/build.xml
labs/jbossesb/trunk/product/core/common/src/
labs/jbossesb/trunk/product/core/common/src/org/
labs/jbossesb/trunk/product/core/common/src/org/jboss/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java
labs/jbossesb/trunk/product/core/common/tests/
labs/jbossesb/trunk/product/core/common/tests/build.xml
labs/jbossesb/trunk/product/core/common/tests/src/
labs/jbossesb/trunk/product/core/common/tests/src/org/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
labs/jbossesb/trunk/product/core/listeners/
labs/jbossesb/trunk/product/core/listeners/ant.bat
labs/jbossesb/trunk/product/core/listeners/build.xml
labs/jbossesb/trunk/product/core/listeners/src/
labs/jbossesb/trunk/product/core/listeners/src/org/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java
labs/jbossesb/trunk/product/core/listeners/tests/
labs/jbossesb/trunk/product/core/listeners/tests/build.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/processors/
labs/jbossesb/trunk/product/core/processors/ant.bat
labs/jbossesb/trunk/product/core/processors/build.xml
labs/jbossesb/trunk/product/core/processors/src/
labs/jbossesb/trunk/product/core/processors/src/org/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java
labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java
labs/jbossesb/trunk/product/core/processors/tests/
labs/jbossesb/trunk/product/core/processors/tests/build.xml
labs/jbossesb/trunk/product/core/processors/tests/src/
labs/jbossesb/trunk/product/core/processors/tests/src/org/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/
labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/services/
labs/jbossesb/trunk/product/core/services/ant.bat
labs/jbossesb/trunk/product/core/services/build.xml
labs/jbossesb/trunk/product/core/services/src/
labs/jbossesb/trunk/product/core/services/src/META-INF/
labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/ejb-jar.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/jboss.xml
labs/jbossesb/trunk/product/core/services/src/META-INF/manifest.server
labs/jbossesb/trunk/product/core/services/src/org/
labs/jbossesb/trunk/product/core/services/src/org/jboss/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java
labs/jbossesb/trunk/product/core/services/tests/
labs/jbossesb/trunk/product/core/services/tests/build.xml
labs/jbossesb/trunk/product/core/services/tests/src/
labs/jbossesb/trunk/product/core/services/tests/src/org/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java
labs/jbossesb/trunk/product/esb/
Modified:
labs/jbossesb/trunk/product/build.xml
Log:
rename esb dir to core
Modified: labs/jbossesb/trunk/product/build.xml
===================================================================
--- labs/jbossesb/trunk/product/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -79,13 +79,13 @@
<target name="org.jboss.esb.core.compile" depends="org.jboss.esb.internal.init">
<echo message="Compiling modules"/>
- <ant dir="esb"/>
+ <ant dir="core"/>
</target>
<!-- Test targets -->
<target name="org.jboss.esb.test" depends="org.jboss.esb.compile">
<echo message="Testing modules"/>
- <ant dir="esb" target="org.jboss.esb.core.test"/>
+ <ant dir="core" target="org.jboss.esb.core.test"/>
</target>
@@ -101,7 +101,7 @@
<!-- Jar targets -->
<target name="org.jboss.esb.core.jar" depends="org.jboss.esb.compile">
<echo message="Building jar file"/>
- <ant dir="esb" target="jar"/>
+ <ant dir="core" target="jar"/>
</target>
<!-- add ear file rule -->
@@ -163,14 +163,14 @@
<target name="org.jboss.esb.clean">
<echo message="Cleaning modules"/>
- <echo message="Cleaning esb"/>
- <ant dir="esb" target="clean"/>
+ <echo message="Cleaning core"/>
+ <ant dir="core" target="clean"/>
</target>
<target name="org.jboss.esb.purge">
<echo message="Purging modules"/>
- <ant dir="esb" target="purge"/>
+ <ant dir="core" target="purge"/>
<delete dir="${org.jboss.esb.internal.dest}"/>
<delete dir="${org.jboss.esb.internal.dest.root}"/>
Copied: labs/jbossesb/trunk/product/core (from rev 5257, labs/jbossesb/branches/refactor/product/core)
Deleted: labs/jbossesb/trunk/product/core/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/product/core/ant.bat 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/ant.bat 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Copied: labs/jbossesb/trunk/product/core/ant.bat (from rev 5257, labs/jbossesb/branches/refactor/product/core/ant.bat)
Deleted: labs/jbossesb/trunk/product/core/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
- <!-- =================================================================== -->
- <!-- build.xml - Builds all subprojects in child directories -->
- <!-- =================================================================== -->
-
-<project name="JbossEsb" default="org.jboss.esb.core.compile" basedir=".">
-
- <property name="org.jboss.esb.core.name.jar" value="name.jar-NOT_SET.jar"/>
- <property environment="env"/>
-
- <!-- =================================================================== -->
- <!-- Initialize -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
- </target>
-
- <!-- =================================================================== -->
- <!-- Prepares the directory structure -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.prepare" depends="org.jboss.esb.core.init">
- <mkdir dir="${org.jboss.esb.internal.dest}/dist"/>
- <mkdir dir="${org.jboss.esb.internal.dest}/dist/lib"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles all the classes -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.compile" depends="org.jboss.esb.core.prepare" description="Compile subprojects">
- <echo message="Compiling submodules"/>
- <ant dir="common"/>
- <ant dir="services"/>
- <ant dir="processors"/>
- <ant dir="listeners"/>
- <!--
- <ant dir="tests"/>
- -->
- </target>
-
- <!-- =================================================================== -->
- <!-- Test all the classes -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.core.test" depends="org.jboss.esb.core.compile" description="Test subprojects">
- <echo message="Testing submodules"/>
- <ant dir="common" target="org.jboss.esb.common.test"/>
- <ant dir="listeners" target="org.jboss.esb.listeners.test"/>
- <ant dir="processors" target="org.jboss.esb.processors.test"/>
- <ant dir="services" target="org.jboss.esb.services.test"/>
- </target>
-
-
- <!-- =================================================================== -->
- <!-- Assemble jars -->
- <!-- =================================================================== -->
- <target name="jar" depends="org.jboss.esb.core.compile" description="Build jar files">
- <echo message="Building jar"/>
- <ant dir="common" target="jar"/>
- <ant dir="listeners" target="jar"/>
- <ant dir="processors" target="jar"/>
- <ant dir="services" target="jar"/>
- <antcall target="-ear"/>
- </target>
-
- <target name="-ear">
- <ear destfile="${org.jboss.esb.internal.dest}/dist/lib/jbossesb-appl.ear"
- appxml="services/src/META-INF/application.xml"
- >
- <fileset dir="${org.jboss.esb.internal.dest}/dist/lib"
- includes="*.jar"
- />
- </ear>
-
- </target>
-
- <!-- =================================================================== -->
- <!-- Clean all -->
- <!-- =================================================================== -->
- <target name="clean" description="Clean dist directory and cleans subprojects">
- <delete dir="${org.jboss.esb.internal.dest}"/>
- <!--
- for now I am going to delete the build directory as each module builds
- to a common place, so calling clean on each module does not make sense,
- that is unless we later configure the clean task to delete <module>
- specific classes
- -->
- <!--
- <ant dir="common" target="clean"/>
- <ant dir="listeners" target="clean"/>
- <ant dir="processors" target="clean"/>
- <ant dir="services" target="clean"/>
- -->
- <!-- tests are now per module, this will be cleaned up later
- <ant dir="tests" target="clean"/>
- -->
- </target>
-
- <target name="purge" depends="clean">
- <!--
- <delete dir="${org.jboss.esb.internal.dest}/dist"/>
- -->
- <!-- see comment above w.r.t clean and where module are build to -->
- <!--
- <ant dir="common" target="purge"/>
- <ant dir="listeners" target="purge"/>
- <ant dir="processors" target="purge"/>
- <ant dir="services" target="purge"/>
- -->
- <!-- tests are now per module, this will be cleaned up later
- <ant dir="tests" target="purge"/>
- -->
- </target>
-
- <!-- =================================================================== -->
- <!-- Rebuild everything from scratch -->
- <!-- =================================================================== -->
- <target name="all" depends="clean,jar" />
- <target name="recompile" depends="clean,org.jboss.esb.core.compile" />
-
-</project>
Copied: labs/jbossesb/trunk/product/core/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/build.xml)
Copied: labs/jbossesb/trunk/product/core/common (from rev 5257, labs/jbossesb/branches/refactor/product/core/common)
Deleted: labs/jbossesb/trunk/product/core/common/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/ant.bat 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/ant.bat 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Copied: labs/jbossesb/trunk/product/core/common/ant.bat (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/ant.bat)
Deleted: labs/jbossesb/trunk/product/core/common/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<project name="BuildJbossEsbCommon" default="org.jboss.esb.common.compile" basedir=".">
-
- <property name="org.jboss.esb.common.jar.name" value="jbossesb-common"/>
- <property name="org.jboss.esb.common.distrib.dir" value="${org.jboss.esb.internal.dest}/dist"/>
- <property name="org.jboss.esb.common.classes.dir" value="${org.jboss.esb.internal.dest}/classes/common"/>
- <property name="org.jboss.esb.common.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.common.base.classpath">
- <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="activation.jar jbossall-client.jar log4j.jar mail.jar"/>
- </path>
-
- <target name="org.jboss.esb.common.init">
- <tstamp>
- <format property="TODAY" pattern="dd-MM-yy"/>
- </tstamp>
- </target>
-
- <target name="org.jboss.esb.common.prepare" depends="org.jboss.esb.common.init">
- <mkdir dir="${org.jboss.esb.common.classes.dir}"/>
- <mkdir dir="${org.jboss.esb.common.distrib.dir}"/>
- <mkdir dir="${org.jboss.esb.common.distrib.dir}/lib"/>
- </target>
-
- <target name="clean" description="Remove classes directory">
- <delete dir="${org.jboss.esb.common.classes.dir}"/>
- </target>
-
- <target name="purge" depends="clean">
- </target>
-
-
- <target name="org.jboss.esb.common.compile">
- <!-- Compile common -->
- <antcall target="org.jboss.esb.common.internal.compile"/>
- <!-- Compile common tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.common.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.common.internal.compile" depends="org.jboss.esb.common.prepare"
- description="Compile all classes">
-
- <javac
- destdir="${org.jboss.esb.common.classes.dir}"
- classpathref="org.jboss.esb.common.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.common.src.dir}"/>
- </javac>
-
- </target>
-
- <target name="recompile" depends="clean,org.jboss.esb.common.compile"
- description="Clean and compile"/>
-
- <target name="jar" depends="org.jboss.esb.common.compile" description="Assemble jar files">
- <delete file="${org.jboss.esb.common.distrib.dir}/lib/${org.jboss.esb.common.jar.name}.jar" />
- <jar destfile="${org.jboss.esb.common.distrib.dir}/lib/${org.jboss.esb.common.jar.name}.jar"
- basedir="${org.jboss.esb.common.classes.dir}"
- includes="**/*.class"
- excludes="test/**"
- />
- </target>
-
-
-
- <target name="org.jboss.esb.common.test" description="Run tests for this module">
- <!-- Compile common tests -->
- <ant dir="tests" target="org.jboss.esb.common.internal.test"/>
- </target>
-
-
-
-
- <target name="all" depends="recompile,jar" />
-
-</project>
Copied: labs/jbossesb/trunk/product/core/common/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/build.xml)
Copied: labs/jbossesb/trunk/product/core/common/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src)
Copied: labs/jbossesb/trunk/product/core/common/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,103 +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.common;
-
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-public class EsbSysProps
-{
- public static final String SMTP_HOST = "jbossEsb.mail.smtp.host";
- public static final String SMTP_USERNAME = "jbossEsb.mail.smtp.user";
- public static final String SMTP_PASSWORD = "jbossEsb.mail.smtp.password";
- public static final String SMTP_PORT = "jbossEsb.mail.smtp.port";
-
- public static final String JNDI_SERVER_TYPE = "jbossEsb.jndi.server.type";
- public static final String JNDI_SERVER_URL = "jbossEsb.jndi.server.url";
-
- public static final String PARAMS_REPOS_FACTORY_CLASS
- = "jbossEsb.paramsRepository.factory.class";
- public static final String OBJECT_STORE_CONFIG_FILE
- = "jbossEsb.objStore.configfile";
- public static final String ENCRYPT_FACTORY_CLASS
- = "jbossEsb.encryption.factory.class";
-
- private static KeyValuePair[] s_oaKV = new KeyValuePair[]
- {new KeyValuePair(SMTP_HOST ,getSmtpHost())
- ,new KeyValuePair(SMTP_USERNAME ,getSmtpUsername())
- ,new KeyValuePair(SMTP_PASSWORD ,getSmtpPassword())
- ,new KeyValuePair(SMTP_PORT ,getSmtpPort())
- ,new KeyValuePair(JNDI_SERVER_TYPE, getJndiServerType())
- ,new KeyValuePair(JNDI_SERVER_URL,getJndiServerURL())
- ,new KeyValuePair(PARAMS_REPOS_FACTORY_CLASS, getParamsReposFactoryClass())
- ,new KeyValuePair(OBJECT_STORE_CONFIG_FILE, getObjStoreConfigFile())
- ,new KeyValuePair(ENCRYPT_FACTORY_CLASS, getEncryptionFactoryClass())
-
- };
-
- public static String dump()
- { StringBuilder sb = new StringBuilder("Dump of EsbSysProps:\n");
- for (KeyValuePair oCurr : s_oaKV)
- sb.append(oCurr.getKey()).append("=").append(oCurr.getValue()).append("\n")
- ;
- return sb.append("______________________________________").toString();
- } //________________________________
-
- public static String getSmtpHost()
- { return System.getProperty(SMTP_HOST,"localhost");
- }
-
- public static String getSmtpUsername()
- { return System.getProperty(SMTP_USERNAME,"");
- }
-
- public static String getSmtpPassword()
- { return System.getProperty(SMTP_PASSWORD,"");
- }
-
- public static String getSmtpPort()
- { return System.getProperty(SMTP_PORT,"25");
- }
-
- public static String getJndiServerType()
- { return System.getProperty(JNDI_SERVER_TYPE,"jboss"); }
-
- public static String getJndiServerURL()
- { return System.getProperty(JNDI_SERVER_URL,"localhost"); }
-
-
- public static String getParamsReposFactoryClass()
- { return System.getProperty(PARAMS_REPOS_FACTORY_CLASS
- ,"org.jboss.soa.esb.parameters.DefaultReposFactory");
- }
-
- public static String getObjStoreConfigFile()
- { return System.getProperty(OBJECT_STORE_CONFIG_FILE);
- }
-
- public static String getEncryptionFactoryClass()
- { return System.getProperty(ENCRYPT_FACTORY_CLASS
- ,"org.jboss.soa.esb.services.DefaultEncryptionFactory");
- }
-
-
-} //_____________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/EsbSysProps.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,150 +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.common.bizclasses;
-
-import java.util.*;
-
-import org.jboss.soa.esb.util.*;
-
-public class Address extends BaseBusinessObject
-{
- public enum ATTRIB
- {strNum
- ,strLine1
- ,strLine2
- ,suite
- ,twnCty1
- ,twnCty2
- ,postalZip
- ,provSt
- ,cntry
- };
- private EnumMap<ATTRIB,String>m_oData;
-
- public enum CHLD_LIST
- {Lpho
- };
- private List<Telephone> m_olPhones;
-
- public Address(String p_sElem) {super(p_sElem);}
- public Address(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
-
- @SuppressWarnings("unchecked")
- public Address(BobjStdDTO p_oDto) throws Exception
- { super(p_oDto);
-
- for (ATTRIB oCurr : ATTRIB.values())
- setField(oCurr,p_oDto.getAttr(oCurr.toString()));
- m_olPhones = (List<Telephone>)
- p_oDto.getChildObjList(CHLD_LIST.Lpho.toString() ,Telephone.class);
- } //__________________________________
-
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
-
- for (ATTRIB oCurr : ATTRIB.values())
- oRet.addAttr(oCurr.toString(), getField(oCurr));
- oRet.addDto(CHLD_LIST.Lpho.toString() ,getDtoList(Telephone.class ,m_olPhones));
-
- return oRet;
- } //__________________________________
-
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- String sRet = (null==m_oData)? null : m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- { if (null==m_oData)
- m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- m_oData.put(pKey,pVal);
- }
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-
- // Telephone List handling
-
- public int getPhoneCount ()
- { return (null == m_olPhones)? 0 : m_olPhones.size(); }
-
- public Telephone getPhoneAt (int p_i)
- { if (null == m_olPhones) return null;
- if(p_i < 0 || p_i >=m_olPhones.size()) return null;
- return m_olPhones.get(p_i);
- }//_____________________________________________
-
- public void addPhone(Telephone p_oPh)
- { if(null==p_oPh) return;
- if(null==m_olPhones)
- m_olPhones = new ArrayList<Telephone>();
- m_olPhones.add(p_oPh);
- }//_____________________________________________
-
- public Telephone rmvPhoneAt (int p_i)
- { if (null == m_olPhones) return null;
- if(p_i < 0 || p_i >=m_olPhones.size()) return null;
- return m_olPhones.remove(p_i);
- }//_____________________________________________
-
- public Telephone getPhoneRole(String p_sRole)
- { return (Telephone)BaseBusinessObject.getRoleFromList(p_sRole,m_olPhones);
- }//_____________________________________________
-
- public String toString()
- { StringBuilder sb = new StringBuilder();
- String sCurr = getField(ATTRIB.strNum);
- if (! EsbUtil.isNullString(sCurr))
- sb.append(sCurr).append(" ");
-
- ATTRIB [] oa = {ATTRIB.strLine1,ATTRIB.strLine2
- ,ATTRIB.twnCty1,ATTRIB.twnCty2 };
- for (ATTRIB oAtt : oa)
- { sCurr = getField(oAtt);
- if(! EsbUtil.isNullString(sCurr))
- sb.append(sCurr.trim()).append("\n");
- }
- StringBuilder sZprov = new StringBuilder();
- sCurr = getField(ATTRIB.postalZip);
- if (! EsbUtil.isNullString(sCurr))
- sZprov.append(sCurr.trim()).append(" ");
-
- sCurr = getField(ATTRIB.provSt);
- if (! EsbUtil.isNullString(sCurr))
- sZprov.append(sCurr.trim());
- if (sb.length()>0 && '\n'!=sb.charAt(-1+sb.length()))
- sb.append("\n");
- sb.append(sZprov);
-
- sCurr = getField(ATTRIB.cntry);
- if (! EsbUtil.isNullString(sCurr))
- { if (sb.length()>0 && '\n'!=sb.charAt(-1+sb.length()))
- sb.append("\n");
- sb.append(sCurr.trim());
- }
- return sb.toString();
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Address.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,70 +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.common.bizclasses;
-
-import java.util.*;
-import org.jboss.soa.esb.util.*;
-
-public class BankAcct extends BaseBusinessObject
-{
- public enum ATTRIB
- {acct
- ,bank
- ,branch
- ,desig
- };
- private EnumMap<ATTRIB,String>m_oData;
-
- public BankAcct(String p_sElem) {super(p_sElem);}
- public BankAcct(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
-
- public BankAcct(BobjStdDTO p_oDto) throws Exception
- { super(p_oDto);
- for (ATTRIB oCurr : ATTRIB.values())
- setField(oCurr,p_oDto.getAttr(oCurr.toString()));
- } //__________________________________
-
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
- for (ATTRIB oCurr : ATTRIB.values())
- oRet.addAttr(oCurr.toString(), getField(oCurr));
- return oRet;
- } //__________________________________
-
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- String sRet = (null==m_oData)? null : m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- { if (null==m_oData)
- m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- m_oData.put(pKey,pVal);
- }
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BankAcct.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,223 +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.common.bizclasses;
-
-import java.util.*;
-import java.text.*;
-
-import org.jboss.soa.esb.util.*;
-
-public class BatchProcess extends BaseBusinessObject
-{
- public enum ATTRIB
- {srcApp
- ,batchNum
- ,createStamp
- ,commitStamp
- };
- private EnumMap<ATTRIB,String>m_oData;
-
- public enum CHLD_LIST
- {Hdrs
- ,Itms
- };
- public List<OneValue> m_olHeaders, m_olItems;
-
- /**
- * @param p_sElem String
- * @see BaseBusinessObject#BaseBusinessObject(String)
- */
- public BatchProcess(String p_sElem) {super(p_sElem);}
- /**
- * @param p_sElem String
- * @param p_lUid long
- * @see BaseBusinessObject#BaseBusinessObject(String,long)
- */
- public BatchProcess(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
- /**
- *
- * @param p_oDto BobjStdDTO
- * @throws Exception
- * @see BaseBusinessObject#BaseBusinessObject(BobjStdDTO)
- */
-
- @SuppressWarnings("unchecked")
- public BatchProcess(BobjStdDTO p_oDto) throws Exception
- { super(p_oDto);
- for (ATTRIB oCurr : ATTRIB.values())
- setField(oCurr,p_oDto.getAttr(oCurr.toString()));
-
- m_olHeaders = (List<OneValue>)p_oDto.getChildObjList
- (CHLD_LIST.Hdrs.toString(),OneValue.class);
- m_olItems = (List<OneValue>)p_oDto.getChildObjList
- (CHLD_LIST.Itms.toString(),OneValue.class);
- }//__________________________________________
- /**
- *
- * @throws Exception
- * @return BobjStdDTO
- * @see BusinessObject#toDTO()
- */
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
- for (ATTRIB oCurr : ATTRIB.values())
- oRet.addAttr(oCurr.toString(),getField(oCurr));
-
- oRet.addDto(CHLD_LIST.Hdrs.toString() ,getDtoList(OneValue.class, m_olItems));
- oRet.addDto(CHLD_LIST.Itms.toString() ,getDtoList(OneValue.class, m_olHeaders));
- return oRet;
-
- }//_________________________________________
- //Setters
- /**
- * Add a reference to a BusinessObject (it's UID) to the list of batch
- * header BusinessObjects
- * @param p_l long - The UID of the BusinessObject to add to the header list
- * @see BatchProcess#m_olHeaders
- */
- public void addHeaderUid(long p_l)
- { if(null==m_olHeaders) m_olHeaders = new ArrayList<OneValue>();
- m_olHeaders.add(OneValue.getLongValue(p_l));
- }//_____________________________________________
- /**
- * Remove an object from the header list
- * @param p_i int - index of header to remove
- * @return long - UID of the object removed
- * @see BatchProcess#addHeaderUid(long)
- */
- public long rmvHeaderAt (int p_i)
- { if (null == m_olHeaders) return -1;
- if(p_i < 0 || p_i >=m_olHeaders.size()) return -1;
- return Long.parseLong(((OneValue) m_olHeaders.remove(p_i)).m_sVal);
- }//_____________________________________________
-
- /**
- * Add a reference to a BusinessObject (it's UID) to the list of batch
- * items BusinessObjects
- * @param p_l long - The UID of the BusinessObject to add to the item list
- * @see BatchProcess#m_olItems
- */
- public void addChildUid(long p_l)
- { if(null==m_olItems) m_olItems = new ArrayList<OneValue>();
- m_olItems.add(OneValue.getLongValue(p_l));
- }//_____________________________________________
-
- /**
- * Remove an object from the item list
- * @param p_i int - index of item to remove
- * @return long - UID of the object removed
- * @see BatchProcess#addChildUid(long)
- */
- public long rmvChildAt (int p_i)
- { if (null == m_olItems) return -1;
- if(p_i < 0 || p_i >=m_olItems.size()) return -1;
- return Long.parseLong(((OneValue) m_olItems.remove(p_i)).m_sVal);
- }//_____________________________________________
-
- //getters
- /**
- * Return the number of header objects in this batch
- * @return int - The size of the header list
- * @see BatchProcess#m_olHeaders
- */
- public int getHeaderCount ()
- { return (null == m_olHeaders)? 0 : m_olHeaders.size();
- }//_______________________________
-
- /**
- * Get an object from the header list
- * @param p_i int - index of header object to get
- * @return long - UID of the object at requested position - or minus 1 (-1) if invalid index
- * @see BatchProcess#m_olHeaders
- */
- public long getHeaderAt (int p_i)
- { if (null == m_olHeaders) return -1;
- if(p_i < 0 || p_i >=m_olHeaders.size()) return -1;
- return Long.parseLong(((OneValue) m_olHeaders.get(p_i)).m_sVal);
- }//_____________________________________________
-
- /**
- * Return the number of item objects in this batch
- * @return int - The size of the item list
- * @see BatchProcess#m_olItems
- */
- public int getChildCount ()
- { return (null == m_olItems)? 0 : m_olItems.size();
- }//_______________________________
-
- /**
- * Get an object from the item list
- * @param p_i int - index of item object to get
- * @return long - UID of the object at requested position - or minus 1 (-1) if invalid index
- * @see BatchProcess#m_olItems
- */
- public long getChildAt (int p_i)
- { if (null == m_olItems) return -1;
- if(p_i < 0 || p_i >=m_olItems.size()) return -1;
- return Long.parseLong(((OneValue) m_olItems.get(p_i)).m_sVal);
- }//_____________________________________________
-
- private static final SimpleDateFormat s_FD
- = new SimpleDateFormat("yyyyMMdd HH:mm:ss.S");
- protected final String showStamp(ATTRIB pFld)
- { long lMillis = EsbUtil.parseLong(getField(pFld));
- if (lMillis < 1) return "";
- return s_FD.format(new Date(lMillis));
- }//_____________________________________________
- /**
- * Obtain a String[] of 'human readable' attributes that will help
- * identify the BatchProcess object
- * <p>These attributes will be stored in the batch_index table in the
- * Object store to allow for standard SQL queries. Once the desired
- * object is identified, we can access the Object table using the Object's
- * that is referenced in the batch_index table UID</p>
- * @return String[] - Batch number, Creation time, Commit time
- */
- public String[] locator()
- { String sFrom = getField(ATTRIB.srcApp);
- String sNumber = getField(ATTRIB.batchNum);
- return new String[]
- { (null==sFrom) ? "":sFrom.substring(0,Math.min(50,sFrom.length()))
- ,(null==sNumber) ? "":sNumber
- ,showStamp(ATTRIB.createStamp)
- ,showStamp(ATTRIB.commitStamp)
- };
- } //__________________________________
-
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- String sRet = (null==m_oData)? null : m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- { if (null==m_oData)
- m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- m_oData.put(pKey,pVal);
- }
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/BatchProcess.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,89 +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.common.bizclasses;
-
-import org.jboss.soa.esb.util.*;
-
-/**
- * Utility class used to serialize a String within a list
- * of child BusinessObjects
- * It provides no functionality other than allowing the inclusion of
- * a String (eventually with a role and an element name) in a list of children
- */
-
-public class OneValue extends BaseBusinessObject
-{
- private static final String A_VAL = "v";
- public String m_sVal;
-
- /**
- * @see BaseBusinessObject#BaseBusinessObject(BobjStdDTO)
- * @param p_sElem String
- */
- public OneValue(String p_sElem) {super(p_sElem);}
- /**
- * @see BaseBusinessObject#BaseBusinessObject(BobjStdDTO)
- * @param p_sElem String
- * @param p_lUid long
- */
- public OneValue(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
-
- /**
- * @see BaseBusinessObject#BaseBusinessObject(BobjStdDTO)
- * @param p_oDto BobjStdDTO
- * @throws Exception
- */
- public OneValue(BobjStdDTO p_oDto) throws Exception
- {super(p_oDto);
- m_sVal = p_oDto.getAttr(A_VAL);
- } //___________________________________
-
- /**
- * @see BusinessObject#toDTO()
- * @throws Exception
- * @return BobjStdDTO
- */
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
- oRet.addAttr(A_VAL, m_sVal);
- return oRet;
- } //___________________________________
-
- public static final OneValue getLongValue(Long p_l)
- { OneValue oCurr = new OneValue((String)null);
- if (null!=p_l)
- oCurr.m_sVal = Long.toString(p_l);
- return oCurr;
- } //___________________________________
-
- public static final OneValue getStringValue(String p_sVal)
- { return getStringValue(p_sVal,null);
- } //___________________________________
-
- public static final OneValue getStringValue(String p_sVal, String p_sRole)
- { OneValue oCurr = new OneValue((String)null);
- oCurr.m_sVal = p_sVal;
- oCurr.setRole(p_sRole);
- return oCurr;
- } //___________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/OneValue.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.common.bizclasses;
-
-import java.util.*;
-
-import org.jboss.soa.esb.util.*;
-
-public class Person extends BaseBusinessObject
-{
- public enum ATTRIB
- {pfx
- ,givN
- ,midN
- ,fmlyN
- ,sfx
- ,doB
- ,gend
- ,prefLang
- };
- private EnumMap<ATTRIB,String>m_oData;
-
- public enum CHLD_LIST
- {Laddr
- ,Lemail
- ,Lpho
- };
- private List<Address> m_olAddr;
- private List<OneValue> m_olEmail;
- private List<Telephone> m_olPhones;
-
- public Person(String p_sElem) {super(p_sElem);}
- public Person(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
-
- @SuppressWarnings("unchecked")
- public Person(BobjStdDTO p_oDto) throws Exception
- {super(p_oDto);
-
- for (ATTRIB oCurr : ATTRIB.values())
- setField(oCurr,p_oDto.getAttr(oCurr.toString()));
-
- m_olPhones = (List<Telephone>)
- p_oDto.getChildObjList(CHLD_LIST.Lpho.toString() ,Telephone.class);
- m_olEmail = (List<OneValue>)
- p_oDto.getChildObjList(CHLD_LIST.Lemail.toString(),OneValue.class);
- m_olAddr = (List<Address>)
- p_oDto.getChildObjList(CHLD_LIST.Laddr.toString(),Address.class);
- } //__________________________________
-
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
-
- for (ATTRIB oCurr : ATTRIB.values())
- oRet.addAttr(oCurr.toString(), getField(oCurr));
-
- oRet.addDto(CHLD_LIST.Lpho.toString() ,getDtoList(Telephone.class ,m_olPhones));
- oRet.addDto(CHLD_LIST.Lemail.toString() ,getDtoList(OneValue.class ,m_olEmail));
- oRet.addDto(CHLD_LIST.Laddr.toString() ,getDtoList(Address.class ,m_olAddr));
-
- return oRet;
-
- }//_________________________________________
-
- public String[] locator()
- {
- return new String[]
- {nameForLocator()
- ,phoneForLocator()
- ,addressForLocator()
- };
- } //__________________________________
-
- protected String nameForLocator()
- {
- StringBuilder sb = new StringBuilder();
- String sCurr = getField(ATTRIB.pfx);
- if (null!=sCurr) sb.append(sCurr).append(" ");
-
- sCurr = getField(ATTRIB.fmlyN);
- if (null!=sCurr) sb.append(sCurr).append(", ");
-
- sCurr = getField(ATTRIB.givN);
- if (null!=sCurr) sb.append(sCurr).append(" ");
-
- sCurr = getField(ATTRIB.midN);
- if (null!=sCurr) sb.append(sCurr).append(" ");
-
-
- return (sb.length()>0) ? sb.toString() : "UNKNOWN NAME";
- } //__________________________________
-
- protected String phoneForLocator()
- {
- StringBuilder sb = new StringBuilder();
- Telephone oPh = getPhoneAt(0);
-
- if (null==oPh)
- { Address oAddr = getAddressAt(0);
- if (null!=oAddr)
- oPh = oAddr.getPhoneAt(0);
- }
-
- if (null!=oPh)
- sb.append(oPh.toString());
- return (sb.length()>0) ? sb.toString() : "";
- } //__________________________________
-
- protected String addressForLocator()
- {
- StringBuilder sb = new StringBuilder();
- Address oAddr = getAddressAt(0);
- if (null!=oAddr)
- sb.append(oAddr.toString());
- return (sb.length()>0) ? sb.toString() : "";
- } //__________________________________
-
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- String sRet = (null==m_oData)? null : m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- { if (null==m_oData)
- m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- m_oData.put(pKey,pVal);
- }
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-
- // Address List handling
-
- public int getAddressCount ()
- { return (null == m_olAddr)? 0 : m_olAddr.size(); }
-
- public Address getAddressAt (int p_i)
- { if (null == m_olAddr) return null;
- if(p_i < 0 || p_i >=m_olAddr.size()) return null;
- return m_olAddr.get(p_i);
- }//_____________________________________________
-
- public void addAddress(Address p_oAddress)
- { if(null==p_oAddress) return;
- if(null==m_olAddr)
- m_olAddr = new ArrayList<Address>();
- m_olAddr.add(p_oAddress);
- }//_____________________________________________
-
- public Address rmvAddressAt (int p_i)
- { if (null == m_olAddr) return null;
- if(p_i < 0 || p_i >=m_olAddr.size()) return null;
- return m_olAddr.remove(p_i);
- }//_____________________________________________
-
- public Address getAddressRole(String p_sRole)
- { return (Address)BaseBusinessObject.getRoleFromList(p_sRole,m_olAddr);
- }//_____________________________________________
-
- // Telephone List handling
-
- public int getPhoneCount ()
- { return (null == m_olPhones)? 0 : m_olPhones.size(); }
-
- public Telephone getPhoneAt (int p_i)
- { if (null == m_olPhones) return null;
- if(p_i < 0 || p_i >=m_olPhones.size()) return null;
- return m_olPhones.get(p_i);
- }//_____________________________________________
-
- public void addPhone(Telephone p_oPh)
- { if(null==p_oPh) return;
- if(null==m_olPhones)
- m_olPhones = new ArrayList<Telephone>();
- m_olPhones.add(p_oPh);
- }//_____________________________________________
-
- public Telephone rmvPhoneAt (int p_i)
- { if (null == m_olPhones) return null;
- if(p_i < 0 || p_i >=m_olPhones.size()) return null;
- return m_olPhones.remove(p_i);
- }//_____________________________________________
-
- public Telephone getPhoneRole(String p_sRole)
- { return (Telephone)BaseBusinessObject.getRoleFromList(p_sRole,m_olPhones);
- }//_____________________________________________
-
- // e-mail List handling
-
- public int getEmailCount ()
- { return (null == m_olEmail)? 0 : m_olEmail.size(); }
-
- public OneValue getEmailAt (int p_i)
- { if (null == m_olEmail) return null;
- if(p_i < 0 || p_i >=m_olEmail.size()) return null;
- return m_olEmail.get(p_i);
- }//_____________________________________________
-
- public void addEmail(OneValue p_oEm)
- { if(null==p_oEm) return;
- if(null==m_olEmail)
- m_olEmail = new ArrayList<OneValue>();
- m_olEmail.add(p_oEm);
- }//_____________________________________________
-
- public OneValue rmvEmailAt (int p_i)
- { if (null == m_olEmail) return null;
- if(p_i < 0 || p_i >=m_olEmail.size()) return null;
- return m_olEmail.remove(p_i);
- }//_____________________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Person.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,91 +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.common.bizclasses;
-
-import java.util.*;
-import org.jboss.soa.esb.util.*;
-
-public class Telephone extends BaseBusinessObject
-{
- public enum ATTRIB
- {cntry
- ,city
- ,num
- ,ext
- };
- private EnumMap<ATTRIB,String>m_oData;
-
- public Telephone(String p_sElem) {super(p_sElem);}
- public Telephone(String p_sElem, long p_lUid) {super(p_sElem, p_lUid);}
-
- public Telephone(BobjStdDTO p_oDto) throws Exception
- { super(p_oDto);
- for (ATTRIB oCurr : ATTRIB.values())
- setField(oCurr,p_oDto.getAttr(oCurr.toString()));
- } //__________________________________
-
- public BobjStdDTO toDTO() throws Exception
- { BobjStdDTO oRet = super.toDTO();
- for (ATTRIB oCurr : ATTRIB.values())
- oRet.addAttr(oCurr.toString(), getField(oCurr));
- return oRet;
- } //__________________________________
-
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- if (null==m_oData) m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- String sRet = m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- m_oData.put(pKey,pVal);
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-
- public String toString()
- { StringBuilder sb = new StringBuilder();
- String sCurr = getField(ATTRIB.cntry);
- if (! EsbUtil.isNullString(sCurr))
- sb.append("+").append(sCurr.trim());
-
- sCurr = getField(ATTRIB.city);
- if(EsbUtil.isNullString(sCurr)) sb.append(" ");
- else
- sb.append("(").append(sCurr.trim()).append(")");
-
- sCurr = getField(ATTRIB.num);
- if(! EsbUtil.isNullString(sCurr))
- sb.append(sCurr.trim());
-
- sCurr = getField(ATTRIB.ext);
- if(!EsbUtil.isNullString(sCurr))
- sb.append(" Ext ").append(sCurr.trim());
-
- return sb.toString();
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/common/bizclasses/Telephone.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,110 +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.util.*;
-import javax.naming.*;
-import org.apache.log4j.Logger;
-/**
- * Obtains JNDI naming context for a predefined list of 'well known' server types
- *
- */
-
-public class AppServerContext
-{
- /**
- * Logger for this class
- */
- private static final Logger m_oLogger = Logger
- .getLogger(AppServerContext.class);
-
- /**
- * Indicates that a jboss context is requested
- */
- public static final String CTX_JBOSS = "jboss";
-
- public static final int MAX_RETRIES = 10;
- public static final int WAIT_FOR_RETRY = 30;
-
- public enum SERVER_TYPE
- {
- jboss
- ,weblogic
- ,websphere
- ,oracle
- };
-
- // No public default constructor
- private AppServerContext() {}
-
- /**
- * Equivalent to calling getServerContext(CTX_JBOSS);
- */
- public static Context getServerContext(String p_sJndiServer)
- { return getServerContext(SERVER_TYPE.jboss,p_sJndiServer); }
-
- public static Context getServerContext(String pType , String p_sJndiServer)
- { return getServerContext(SERVER_TYPE.valueOf(pType),p_sJndiServer); }
-
- /**
- * Searches a predefined table of 'well known' app server types, and returns
- * the corresponding naming context
- * @param p_sServer: name or IP of server, and optionally port #
- */
- public static Context getServerContext(SERVER_TYPE pType , String p_sJndiServer)
- {
- switch (pType)
- { case jboss : return jbossContext(p_sJndiServer);
- }
-
- return null;
- } //__________________________________
-
- private static Context jbossContext(String p_sJndiServer)
- {
- Properties oPr = new Properties();
- oPr.setProperty(Context.PROVIDER_URL, p_sJndiServer);
- oPr.setProperty(Context.INITIAL_CONTEXT_FACTORY
- ,"org.jnp.interfaces.NamingContextFactory");
- oPr.setProperty(Context.URL_PKG_PREFIXES
- ,"jboss.naming:org.jnp.interfaces");
-
- boolean bCtxOK = false;
- Context oCtx = null;
- for (int i1=0; (! bCtxOK) && i1<MAX_RETRIES; i1++)
- {
- // check if context is valid
- try
- { oCtx = new InitialContext(oPr);
- oCtx.list("__dummy2@#$%");
- bCtxOK = true;
- }
- catch (NamingException nex) {bCtxOK = true; }
- }
- if (bCtxOK)
- return oCtx;
- m_oLogger.error("Can't connect to jndiServer <" + p_sJndiServer + ">") ;
- return null;
-
- } //________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/AppServerContext.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,326 +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.*;
-import java.util.*;
-import org.w3c.dom.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-public class DomElement
-{
- private static final String s_sLS = System.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_oDB;
- private transient static Transformer s_tf;
- private transient Element m_oElem;
- private DomElement m_oDad;
- public DomElement getDad() { return m_oDad; }
-
- static
- { try
- {
- s_oDB = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- s_tf = TransformerFactory.newInstance().newTransformer();
- s_tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
- s_tf.setOutputProperty(OutputKeys.INDENT,"no");
- s_tf.setOutputProperty(OutputKeys.ENCODING, s_sCharset);
- }
- catch (Exception e) {}
- };
-
- private DomElement() {}
-
- public DomElement(Element p_oE)
- { this();
- Document oDoc = null;
- synchronized (s_oDB) { oDoc = s_oDB.newDocument(); }
- Node oNew = oDoc.importNode(p_oE.cloneNode(true),true);
- m_oElem = (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_oElem = p_oP.cloneObj().m_oElem; }
-
- private DomElement(String p_sName,DomElement p_oDad)
- { this();
- Document oDoc = null;
- if (null == p_oDad)
- { synchronized(s_oDB) { oDoc = s_oDB.newDocument(); }
- m_oElem = (Element)oDoc.appendChild(oDoc.createElement(p_sName));
- }
- else
- { m_oDad = p_oDad;
- oDoc = p_oDad.m_oElem.getOwnerDocument();
- m_oElem = (Element)p_oDad.m_oElem.appendChild(oDoc.createElement(p_sName));
- }
- } //__________________________________
-
- public static DomElement fromInputStream(InputStream p_oIS) throws Exception
- { Document oDoc = null;
- synchronized(s_oDB) { oDoc = s_oDB.parse(p_oIS); }
- DomElement oRet = new DomElement();
- oRet.m_oElem = oDoc.getDocumentElement();
- return oRet;
- } //__________________________________
-
- public static DomElement fromURL(String p_sFname) throws Exception
- { Document oDoc = null;
- synchronized(s_oDB) { oDoc = s_oDB.parse(p_sFname); }
- DomElement oRet = new DomElement();
- oRet.m_oElem = oDoc.getDocumentElement();
- return oRet;
- } //__________________________________
-
- public static DomElement fromXml(String p_s) throws Exception
- { Document oDoc = null;
- StringBuffer sb = new StringBuffer(s_sEncoding).append(p_s);
- InputStream oIS = new ByteArrayInputStream (sb.toString().getBytes(s_sCharset));
- synchronized(s_oDB) { oDoc = s_oDB.parse(oIS); }
- DomElement oRet = new DomElement();
- oRet.m_oElem = oDoc.getDocumentElement();
- return oRet;
- } //__________________________________
-
- public String toString()
- { return toXml().toString()
- .replaceAll(s_sLS," ")
- .replaceAll("\t","")
- +s_sLS;
- } //________________________________
-
- public ByteArrayOutputStream toXml()
- { Document oDoc = null;
- synchronized(s_oDB) { oDoc = s_oDB.newDocument(); }
- oDoc.appendChild(oDoc.importNode(m_oElem,true));
- oDoc.normalize();
- DOMSource src = new DOMSource(oDoc);
-
- ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
- StreamResult res = new StreamResult(oStrm);
-
- try
- { synchronized (s_tf) { s_tf.transform(src,res); }
- }
- catch (Exception e)
- { try { oStrm.write("ERROR Dom3Element.toXml()".getBytes()); }
- catch (Exception e1) {}
- }
- return oStrm;
- } //__________________________________
-
-//_________ GETTERS ____________________________________________________________
-
- public Element getDomElement() { return m_oElem; }
-
- public String getName() { return m_oElem.getNodeName(); }
-
- public String[] getAttrKeys()
- { NamedNodeMap NM = m_oElem.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_sKey)
- { if (! m_oElem.hasAttribute(p_sKey)) return null;
- return m_oElem.getAttribute(p_sKey);
- } //__________________________________
-
- public String getFirstTextChild (String p_sKey)
- { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
- StringBuffer sb = new StringBuffer(100);
- if (NL.getLength()>0)
- { Node nCurr = NL.item(0).getFirstChild();
- sb.setLength(0);
- while (null != nCurr)
- { if (nCurr instanceof Text) sb.append(nCurr.getNodeValue());
- nCurr = nCurr.getNextSibling();
- }
- return sb.toString();
- }
- return null;
- } //__________________________________
-
- public static String getTextValue (Node p_n)
- { StringBuffer sb = new StringBuffer();
- Node nCurr = p_n.getFirstChild();
- while (null != nCurr)
- { if (nCurr instanceof Text) sb.append(nCurr.getNodeValue());
- nCurr = nCurr.getNextSibling();
- }
- return sb.toString();
- } //__________________________________
-
- public String [] getTextChildren (String p_sKey)
- { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
- 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_sKey)
- { DomElement oDE = null;
- NodeList NL = m_oElem.getElementsByTagName(p_sKey);
- 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_oDad = this;
- }
- }
- DomElement[] oaRet = new DomElement[oL.size()];
- oL.toArray(oaRet);
- return oaRet;
- } //__________________________________
-
- public DomElement getFirstElementChild (String p_sKey)
- { DomElement oDE = null;
- NodeList NL = m_oElem.getElementsByTagName(p_sKey);
- for (int i1=0; i1<NL.getLength();i1++)
- { Node nCurr = NL.item(i1);
- if (nCurr instanceof Element)
- { oDE = new DomElement( (Element) nCurr);
- oDE.m_oDad = this;
- return oDE;
- }
- }
- return null;
- } //__________________________________
-
- public DomElement [] getAllElemChildren ()
- { DomElement oDE = null;
- List<DomElement> oL = new ArrayList<DomElement>();
- Node nCurr = m_oElem.getFirstChild();
- while (null != nCurr)
- { if (nCurr instanceof Element)
- { oL.add(oDE = new DomElement( (Element) nCurr));
- oDE.m_oDad = this;
- }
- nCurr = nCurr.getNextSibling();
- }
- DomElement[] oaRet = new DomElement[oL.size()];
- oL.toArray(oaRet);
- return oaRet;
- } //__________________________________
-
-//_________ SETTERS ____________________________________________________________
-
- public void setAttr(String p_sKey,String p_sVal)
- { if (null==p_sKey) return;
- m_oElem.removeAttribute(p_sKey);
- if (null!=p_sVal) m_oElem.setAttribute(p_sKey,p_sVal);
- } //__________________________________
-
- public void setAttributes(Map p_oM)
- { if (null==p_oM) return;
- for (Iterator II=p_oM.keySet().iterator(); II.hasNext(); )
- { String sKey = II.next().toString();
- setAttr(sKey, p_oM.get(sKey).toString());
- }
- } //__________________________________
-
- 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_oElem.appendChild(m_oElem.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_oE)
- { p_oE.m_oDad = this;
- Document oDoc = m_oElem.getOwnerDocument();
- m_oElem.appendChild(oDoc.importNode(p_oE.m_oElem,true));
- } //__________________________________
-
- public DomElement newElemChild (String p_sKey)
- {
- DomElement oNew = new DomElement(p_sKey,this);
- oNew.m_oDad = this;
- return oNew;
- } //__________________________________
-
- public void rmvChildsByName (String p_sKey)
- { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
- for (int i1=0; i1<NL.getLength();i1++)
- m_oElem.removeChild(NL.item(i1));
- } //__________________________________
-
-//_________ UTILITIES / HELPERS_________________________________________________
-
-
- public DomElement cloneObj() throws Exception
- { return DomElement.fromXml(this.toString());
- } //__________________________________
-
- public void dump (OutputStream p_OS)
- { StringBuffer sb = new StringBuffer(toXml().toString());
- int iFrom = 0;
- while (iFrom < sb.length())
- { iFrom = sb.indexOf(">",iFrom);
- if (iFrom < 0) break;
- for (int i1=1+iFrom; i1<sb.length();i1++)
- { char cCurr = sb.charAt(i1);
- if (Character.isWhitespace(cCurr)) continue;
- if (Character.getType(cCurr) == Character.DIRECTIONALITY_WHITESPACE)
- continue;
- if ('<' == cCurr) { sb.replace(1+iFrom,i1,"\n"); iFrom++; }
- break;
- }
- iFrom++;
- }
-
- try
- { p_OS.write(sb.toString().getBytes(s_sCharset));
- p_OS.write(s_sLS.getBytes());
- }
- catch (Exception e) {}
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,155 +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.util.*;
-import javax.mail.*;
-import javax.mail.internet.*;
-import javax.activation.*;
-
-import org.jboss.soa.esb.util.*;
-
-import org.jboss.soa.esb.common.*;
-
-/**
- * Simplifies sending of e-mails with attachments from java
- * <p>Author: Heuristica - Buenos Aires - Argentina </p>
- */
-public class EsbEmail
-{
- /**
- * DomElement 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
- */
- public static final String SENDTO = "sendTo";
- /**
- * DomElement 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 outgoing message
- */
- public static final String SUBJECT = "subject";
- /**
- * DomElement 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 to be attached in the outgoing message
- */
- public static final String MESSAGE = "message";
-
- /**
- * Constructor attempts to send e-mail using the information provided
- * in the argument
- * <p>
- * <li> FROM valid e-mail address</li>
- * <li> SENDTO valid comma separated list of e-mail addresses</li>
- * <li> SUBJECT free text that will appear as subject of the e-mail</li>
- * <li> MESSAGE free text that will appear as contents of the e-mail</li>
- * <li> ATTACH list (as Text children) of valid accessible filenames to attach to the e-mail</li>
- * <li> All elements except 'ATTACH' are attributes of the DomElement argument</li>
- * </p>
- * @param p_oParms A DomElement object containing the elements mentioned above
- * @see DomElement
- *
- */
- public EsbEmail(DomElement p_oParms) throws Exception
- {
- Authenticator oAuth = null;
- String sSmtpUser = EsbSysProps.getSmtpUsername();
- if (null != sSmtpUser)
- oAuth = new MyAuth(sSmtpUser,EsbSysProps.getSmtpPassword());
-
- Properties oMailP = new Properties();
- oMailP.setProperty("mail.smtp.host",EsbSysProps.getSmtpHost());
- try
- { String sPort = EsbSysProps.getSmtpPort();
- Integer.parseInt(sPort);
- oMailP.setProperty("mail.smtp.port",sPort);
- }
- catch (Exception e) { /* OK just leave standard port */ }
-
- javax.mail.Session oMailSess = javax.mail.Session.getDefaultInstance
- (oMailP, oAuth);
- MimeMessage oMess = new MimeMessage(oMailSess);
-
- String sFrom = p_oParms.getAttr(FROM);
- InternetAddress oFrom = new InternetAddress(sFrom);
-
- String sAtt = (String)p_oParms.getAttr(SUBJECT);
- if (null != sAtt) oMess.setSubject(sAtt);
-
- oMess.setFrom(oFrom);
- oMess.setReplyTo(new Address[] {oFrom});
- InternetAddress[] oaTo = InternetAddress.parse(p_oParms.getAttr(SENDTO));
- for (int i1=0; i1<oaTo.length;i1++)
- oMess.addRecipient(MimeMessage.RecipientType.TO,oaTo[i1]);
-
- sAtt = (String)p_oParms.getAttr(COPYTO);
- if (null != sAtt)
- { oaTo = InternetAddress.parse(sAtt);
- for (int i1=0; i1<oaTo.length;i1++)
- oMess.addRecipient(MimeMessage.RecipientType.CC,oaTo[i1]);
- }
-
- BodyPart oBodyP;
- Multipart oMultiP;
- oMess.setContent(oMultiP = new MimeMultipart());
-
- oMultiP.addBodyPart(oBodyP = new MimeBodyPart());
- String sText = p_oParms.getAttr(MESSAGE);
- if (null == sText) sText = "";
- oBodyP.setText(sText+"\n");
-
- String [] saFn = p_oParms.getTextChildren(ATTACH);
- for (int i1=0; i1<saFn.length; i1++)
- { oMultiP.addBodyPart(oBodyP = new MimeBodyPart());
- String sFile = saFn[i1];
- oBodyP.setDataHandler(new DataHandler(new FileDataSource(sFile)));
- oBodyP.setFileName(sFile.substring(1 + sFile.lastIndexOf("\\")));
- }
-
- try { Transport.send(oMess); }
- catch (Exception e)
- { EsbUtil.getDefaultLogger(this.getClass()).error("Send Mail Failed",e);
- throw e;
- }
- } //__________________________________
-
- private class MyAuth extends Authenticator
- { private String m_sUser, m_sPwd;
- private MyAuth(String p_sU, String p_sP)
- { m_sUser = p_sU; m_sPwd = p_sP; }
- protected PasswordAuthentication getPasswordAuthentication()
- { return new PasswordAuthentication(m_sUser,m_sPwd);
- } //________________________________
- } //______________________________________________________
-
-} //____________________________________________________________________________
-
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/EsbEmail.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,45 +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.Serializable;
-
-public class KeyValuePair implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String mKey, mVal;
- public KeyValuePair(String pKey, String pVal)
- { mKey = pKey; mVal = pVal; }
- public String getKey() { return mKey; }
- public String getValue() { return mVal; }
- public String setKey(String arg0)
- {String sRet = mKey; mKey = arg0.toString(); return sRet; }
- public String setValue(String arg0)
- {String sRet = mVal; mVal = arg0.toString(); return sRet; }
- public String toString()
- { return mVal; }
- public String dump()
- { return "KVpair["+mKey+"="+mVal+"]"; }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/KeyValuePair.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,99 +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.util.*;
-import java.text.*;
-
- at SuppressWarnings("serial")
-public class NormalizedDate extends Date
-{
- public static final long NULL = -5361913154553L; // "1800 01 01"
-
- private static SimpleDateFormat s_odf = new SimpleDateFormat("yyyyMMdd");
-
- public NormalizedDate() { super(System.currentTimeMillis()); }
- public NormalizedDate(Date p_oD) { super(p_oD.getTime()); }
- public NormalizedDate(String p_s) throws Exception
- { super (s_odf.parse(p_s).getTime());
- } //__________________________________
- public NormalizedDate(String p_s,String p_sFormat) throws Exception
- { super (new SimpleDateFormat(p_sFormat).parse(p_s).getTime());
- } //__________________________________
-
- public String toString()
- { return (this.isNull()) ? "" : s_odf.format(this);
- } //__________________________________
- public boolean isNull()
- { return this.getTime()<=NULL;
- } //__________________________________
-
- public static String toString(Date p_oD) { return s_odf.format(p_oD); }
- public static String toString(long p_oL) { return s_odf.format(new Date(p_oL)); }
- public static NormalizedDate getNull() { return new NormalizedDate(new Date(NULL)); }
-
- static final Exception s_oInv = new Exception("Invalid Date");
-
- public String dateToString()
- {
- return NormalizedDate.dateToString(this,"dd/MM/yyyy");
- }
-
- public static String dateToString(NormalizedDate p_o,String p_sFmt)
- { return (null == p_o)?"":new SimpleDateFormat(p_sFmt).format(p_o); }
-
- public static NormalizedDate parseDate (String p_s) throws Exception
- { Calendar oCal = Calendar.getInstance();
- StringTokenizer ST = new StringTokenizer(p_s,"/");
- if (ST.countTokens() < 2)
- { StringBuffer sb = new StringBuffer(p_s);
- if (sb.length()<6)sb.append(" ");
- sb.insert(2,"/").insert(5,"/");
- ST = new StringTokenizer(sb.toString(),"/");
- }
- try
- { int iDay = Integer.parseInt(ST.nextToken());
- int iMonth = Integer.parseInt(ST.nextToken());
- int iYr = Integer.parseInt(ST.nextToken());
- iYr = (iYr < 20) ? 2000 + iYr
- : (iYr < 100)? 1900 + iYr
- : iYr;
-// if (iYr < 1920 || iYr > 2010) throw s_oInv;
- if (iMonth < 1 || iMonth > 12) throw s_oInv;
- if (iDay < 1) throw s_oInv;
- oCal.set(iYr,iMonth-1,1);
- if (iDay > oCal.getActualMaximum(Calendar.DAY_OF_MONTH)) throw s_oInv;
- oCal.set(iYr,iMonth-1,iDay);
- return new NormalizedDate(oCal.getTime());
- }
- catch (Exception pe) { throw s_oInv; }
- } //_______________________________________________
-
- public static long todayMillis()
- { Calendar oCal = Calendar.getInstance();
- oCal.set(Calendar.HOUR_OF_DAY,0);
- oCal.set(Calendar.MINUTE,0);
- oCal.set(Calendar.SECOND,0);
- oCal.set(Calendar.MILLISECOND,0);
- return oCal.getTimeInMillis();
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/NormalizedDate.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,134 +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.persist;
-
-import java.util.*;
-import java.sql.*;
-import javax.sql.*;
-
-import org.apache.log4j.*;
-
-public class JdbcCleanConn
-{
- private DataSource m_oDS=null;
- private Connection m_conn=null;
- protected List<PreparedStatement> m_olPrepSt
- = new ArrayList<PreparedStatement>();
- protected Logger m_oLogger;
-
- public JdbcCleanConn(DataSource p_oDS) throws Exception
- { m_oDS = p_oDS;
- m_oLogger = Logger.getLogger(this.getClass());
- }
-
- public void commit () throws Exception { if (null != m_conn)m_conn.commit(); }
- public void rollback () throws Exception { if (null != m_conn)m_conn.rollback(); }
-
- public void release()
- { if (null != m_conn)
- { try { m_conn.rollback(); }
- catch (Exception eRoll) {}
-
- for (PreparedStatement PS : m_olPrepSt)
- try { PS.close(); } catch (Exception e) {}
- try { m_conn.close(); }
- catch (Exception e1) {}
- }
- m_olPrepSt.clear();
- m_conn = null;
- } //__________________________________
-
- public PreparedStatement prepareStatement (String p_sSt, int p_i1, int p_i2)
- throws Exception
- {
- if (null == m_conn) connect();
- PreparedStatement PS = m_conn.prepareStatement(p_sSt, p_i1, p_i2);
- m_olPrepSt.add(PS);
- return PS;
- } //__________________________________
-
- public PreparedStatement prepareStatement (String p_sSt) throws Exception
- {
- if (null == m_conn) connect();
- PreparedStatement PS = m_conn.prepareStatement(p_sSt);
- m_olPrepSt.add(PS);
- return PS;
- } //__________________________________
-
- public ResultSet execQueryWait(PreparedStatement p_PS, int p_iQtry)
- throws Exception
- {
- Exception eRet=null;
- int iQtry = (p_iQtry<1) ? 1 : (p_iQtry < 50) ? p_iQtry : 50;
- for (int i1=0; i1<iQtry; i1++)
- { try { return p_PS.executeQuery(); }
- catch (Exception e)
- { if (null==eRet) eRet = new Exception(e.getMessage());
-// System.out.println("Retrying "+i1);
- Thread.sleep(100+(new Double(100*Math.random())).longValue());
- }
- }
- m_oLogger.error("execQueryWait() FAILED",eRet);
- throw eRet;
- } //__________________________________
-
- public void execUpdWait(PreparedStatement p_PS, int p_iQtry)
- throws Exception
- {
- Exception eRet=null;
- int iQtry = (p_iQtry<1) ? 1 : (p_iQtry < 50) ? p_iQtry : 50;
- for (int i1=0; i1<iQtry; i1++)
- { try { p_PS.executeUpdate(); return; }
- catch (Exception e)
- { if (null==eRet) eRet = new Exception(e.getMessage());
-// System.out.println("Retrying "+i1);
- Thread.sleep(100+(new Double(100*Math.random())).longValue());
- }
- }
- m_oLogger.error("execUpdWait() FAILED",eRet);
- throw eRet;
- } //__________________________________
-
- private void connect() throws Exception
- {
- Exception eRet = null;
- for (int i1=0; i1<5; i1++)
- { try { m_conn = m_oDS.getConnection(); eRet = null; break; }
- catch (Exception e)
- { if (null==eRet) eRet = new Exception(e.getMessage());
- System.out.println("Connecting "+i1);
- Thread.sleep(2000+(new Double(100*Math.random())).longValue());
- }
- }
- if (null != eRet)
- { m_oLogger.error("connect() FAILED",eRet);
- throw eRet;
- }
- m_conn.setAutoCommit(false);
- m_conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
-
- m_olPrepSt.clear();
-
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/JdbcCleanConn.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,107 +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.persist;
-
-import java.io.*;
-import java.sql.*;
-import javax.sql.*;
-
-import org.jboss.soa.esb.helpers.DomElement;
-
-/**
- * <p>Obtain a connection that implements the DataSource interface</p>
- * <p>Description: Enable compatible use of JdbcCleanConn from outside a
- * J2EE app container</p>
- * @version 1.0
- * @see JdbcCleanConn
- * @see DomElement
- */
-public class SimpleDataSource implements DataSource
-{
- private PrintWriter m_oPW = new PrintWriter(System.out);
- private int m_iTO = 10;
- private String m_sUrl , m_sUsr, m_sPwd;
- private Connection m_oConn;
-
- public static final String DRIVER = "driver-class";
- public static final String URL = "connection-url";
- public static final String USER = "user-name";
- public static final String PASSWORD = "password";
-
- private SimpleDataSource() {}
-
- /**
- * Obtain a DataSource by providing connection parameters. DomElement argument
- * must contain the following attributes
- * <p>
- * <li> driver-class</li>
- * <li> connection-url</li>
- * <li> user-name</li>
- * <li> password</li>
- * </p>
- * @param p_oP DomElement - Parameter tree that contains the 4 attributes needed
- * @throws Exception
- * @see DomElement
- * @see SimpleDataSource#SimpleDataSource(String,String,String,String)
- * @see javax.sql.DataSource
- */
- SimpleDataSource(DomElement p_oP)
- throws Exception
- { this (p_oP.getAttr(DRIVER) ,p_oP.getAttr(URL)
- ,p_oP.getAttr(USER) ,p_oP.getAttr(PASSWORD));
- } //________________________________
-
- /**
- * Obtain a connection to a DB using the provided arguments to call
- * @param p_sDriver String - Java class of the JDBC driver to use (e.g. org.postgresql.Driver)
- * @param p_sDbURL String - The URL of the database (e.g. jdbc:postgresql://chodedb1:5432/cq3)
- * @param p_sUsr String - Username
- * @param p_sPwd String - Password
- * @throws Exception
- * @see DriverManager#getConnection(String,String,String)
- * @see javax.sql.DataSource
- */
- public SimpleDataSource(String p_sDriver, String p_sDbURL, String p_sUsr, String p_sPwd)
- throws Exception
- { Class.forName(p_sDriver);
- m_sUrl = p_sDbURL;
- getConnection(p_sUsr, p_sPwd);
- } //________________________________
-
- public Connection getConnection() { return m_oConn; }
-
- public Connection getConnection(String username, String password)
- { m_sUsr = username;
- m_sPwd = password;
- try { m_oConn = DriverManager.getConnection (m_sUrl,m_sUsr,m_sPwd); }
- catch (Exception e) { m_oConn = null; }
- return m_oConn;
- } //________________________________
-
- public int getLoginTimeout() { return m_iTO; }
-
- public PrintWriter getLogWriter() { return m_oPW; }
-
- public void setLoginTimeout(int seconds) { m_iTO = seconds; }
-
- public void setLogWriter(PrintWriter out){ m_oPW = out; }
-} //______________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SimpleDataSource.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,164 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.helpers.persist;
-
-import java.sql.*;
-
-
-public abstract class SqlDbTable
-{
- protected String m_sTableName;
- protected SqlField [] m_oaFields;
-
- protected PreparedStatement[] m_oaPS;
- private JdbcCleanConn m_oConn;
- public JdbcCleanConn getConn() { return m_oConn; }
-
-
- public final String getTableName() { return m_sTableName; }
- public final SqlField[] getAllFields() { return m_oaFields; }
-
- private String m_sInsertSql, m_sUpdateSql, m_sDeleteSql;
- protected String m_sSelectSql;
-
- public SqlDbTable(JdbcCleanConn p_oC, String p_sTblNm) throws Exception
- { m_oConn = p_oC;
- m_sTableName = p_sTblNm;
- initFields();
- } //________________________________
-
- public abstract int setInsValues(PreparedStatement p_PS,Object bobj) throws Exception;
- public abstract Object getFromRS(ResultSet p_oRS) throws Exception;
-
- protected abstract String getSelectFields();
-
- public String getFldName(int p_i)
- { return (null ==m_oaFields) ? null
- : (p_i < 0) ? null
- : (p_i >= m_oaFields.length) ? null
- : m_oaFields[p_i].getFieldName();
- } //________________________________
-
- public String getSelectStatement()
- { if ( m_sSelectSql != null ) return m_sSelectSql;
- StringBuffer sb=new StringBuffer("select ").append(getSelectFields());
- m_sSelectSql = sb.append(" from ").append(getTableName()).toString();
- return m_sSelectSql;
- } //________________________________
-
- public String getInsertStatement()
- {
- if ( m_sInsertSql != null ) return m_sInsertSql;
-
- StringBuffer sb=new StringBuffer(256);
- sb.append("insert into ").append(getTableName());
-
- sb.append(" values (");
- for (int i = 0; i <m_oaFields.length; i++) ((i<1)?sb:sb.append(",")).append('?');
- sb.append(')');
-
- return (m_sInsertSql = sb.toString());
- } //________________________________
-
- public String getUpdateStatement()
- {
- if ( m_sUpdateSql != null ) return m_sUpdateSql;
-
- StringBuffer sb=new StringBuffer(256);
- sb.append("update ").append(getTableName()).append(" set ");
-
- StringBuffer sbWhere = new StringBuffer(" where ");
-
- int iVal = 0;
- int iWh = 0;
- for (int i = 0; i <m_oaFields.length; i++)
- { SqlField oCurr = m_oaFields[i];
- if (oCurr.isPrimaryKey())
- ((iWh++<1)?sbWhere:sbWhere.append(" and "))
- .append(oCurr.getFieldName()).append(" = ?");
- else
- ((iVal++<1)?sb:sb.append(","))
- .append(oCurr.getFieldName()).append(" = ?");
- }
- sb.append(sbWhere);
-
- return (m_sUpdateSql = sb.toString());
- } //________________________________
-
- public String getDeleteStatement()
- {
- if ( m_sDeleteSql != null ) return m_sDeleteSql;
-
- StringBuffer sb=new StringBuffer(256);
- sb.append("delete from ").append(getTableName())
- .append(" where ");
-
- int iWh = 0;
- for (int i = 0; i <m_oaFields.length; i++)
- { SqlField oCurr = m_oaFields[i];
- if (! oCurr.isPrimaryKey()) continue;
- ((iWh++<1)?sb:sb.append(" and "))
- .append(oCurr.getFieldName()).append(" = ?");
- }
-
- return (m_sDeleteSql = sb.toString());
- } //________________________________
-
- public void setObject(PreparedStatement p_PS, int p_iFld, Object p_sFldVal)
- throws SQLException
- { if (null!=p_sFldVal)
- if (p_sFldVal instanceof String)
- { String sTr = ((String)p_sFldVal).trim();
- p_sFldVal = (sTr.length()>0) ? sTr : null;
- }
- ;
- int iSqlIdx = 1 + p_iFld;
- if (null==p_sFldVal)p_PS.setNull (iSqlIdx, m_oaFields[p_iFld].getSqlType());
- else p_PS.setObject (iSqlIdx, p_sFldVal);
- } //________________________________
-
- public void setLong(PreparedStatement p_PS, int p_iFld, long p_lVal)
- throws SQLException
- { p_PS.setLong(1+p_iFld,p_lVal);
- } //________________________________
-
- public void setInt(PreparedStatement p_PS, int p_iFld, int p_iVal)
- throws SQLException
- { p_PS.setInt(1+p_iFld,p_iVal);
- } //________________________________
-
- private void initFields() throws Exception
- { PreparedStatement PS = m_oConn.prepareStatement(getSelectStatement());
-
- ResultSetMetaData MD = m_oConn.execQueryWait(PS,3).getMetaData();
- m_oaFields = new SqlField[MD.getColumnCount()];
- for (int i1=0; i1<m_oaFields.length;i1++)
- { int iCol = 1+i1;
- String sFN = MD.getColumnName(iCol);
- Class oCL = Class.forName(MD.getColumnClassName(iCol));
- int iTP = MD.getColumnType(iCol);
- int iSZ = MD.getColumnDisplaySize(iCol);
- m_oaFields[i1] = new SqlField(sFN,oCL,iTP,iSZ,false);
- }
- PS.close();
- } //________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,53 +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.persist;
-
-public class SqlField
-{
- private int m_sqlType;
- private Class m_javaType;
- private int m_sqlLength;
- private String m_fieldName;
- private boolean m_primaryKey;
-
- public SqlField(String pFldName,Class pJavaType,int pSqlType
- ,int pFieldLength, boolean pk)
- {
- m_fieldName = pFldName;
- m_javaType = pJavaType;
- m_sqlType = pSqlType;
- m_sqlLength = pFieldLength;
- m_primaryKey = pk;
- }
-
- public int getSqlType() { return m_sqlType; }
- public Class getJavaType() { return m_javaType; }
- public int getSqlLength() { return this.m_sqlLength; }
- public String getFieldName() { return this.m_fieldName; }
- public boolean isPrimaryKey() { return this.m_primaryKey; }
-
- public void setSqlType(int pSqlType) { m_sqlType = pSqlType; }
- public void setJavaType(Class pJavaType) { m_javaType = pJavaType; }
- public void setSqlLength(int pSqlLength) { m_sqlLength = pSqlLength; }
- public void setFieldName(String pFieldName) { m_fieldName = pFieldName; }
- public void setPrimaryKey(boolean pPrimaryKey) { m_primaryKey = pPrimaryKey; }
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/helpers/persist/SqlField.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,73 +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.notification;
-
-import java.util.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class MacroExpander
-{
- private static final String CTX_PREFIX = "@@ctx@@";
- public static final String CTX_BATCH_UID = CTX_PREFIX+"batchUid";
- public static final String CTX_BATCH_NUM = CTX_PREFIX+"batchNum";
- public static final String CTX_INPUT_FILE = CTX_PREFIX+"inputFile";
- public static final String CTX_POST_FILE = CTX_PREFIX+"postFile";
-
- private static final String[] s_saMacros =
- {CTX_BATCH_UID, CTX_BATCH_NUM ,CTX_INPUT_FILE, CTX_POST_FILE };
-
-
- public void replaceMacros(DomElement p_oParm, Map p_oMap)
- {
- String[] saAtt = p_oParm.getAttrKeys();
- for (int i1 = 0; i1 < saAtt.length; i1++)
- {
- String sKey = saAtt[i1];
- String sVal = p_oParm.getAttr(sKey);
-
- boolean bSubst = false;
- int iWh = 0;
- int iPos = 0;
- while (0 <= (iPos = sVal.indexOf(CTX_PREFIX, iWh)))
- {
- String sRest = sVal.substring(iPos);
- for (int i2 = 0; i2 < s_saMacros.length; i2++)
- {
- String sMac = s_saMacros[i2];
- if (!sRest.startsWith(sMac))continue;
- Object oRpl = (null != p_oMap) ? p_oMap.get(sMac) : null;
- if (null == oRpl)continue;
- bSubst = true;
- sVal = sVal.substring(0, iPos)
- + oRpl.toString() + sVal.substring(iPos + sMac.length());
- }
- }
- if (bSubst) p_oParm.setAttr(sKey, sVal);
- }
- DomElement[] oaChilds = p_oParm.getAllElemChildren();
- for (int i1 = 0; i1 < oaChilds.length; i1++)
- replaceMacros(oaChilds[i1], p_oMap);
- } //_________________________
-}
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,105 +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.notification;
-
-import org.jboss.soa.esb.helpers.*;
-
-/**
- * Holds lists of NotificationTarget objects so that the JbossEsbNotificationHandler
- * EJB behaviour can be controlled at runtime by client applications
- * <p>Description: Objects of this class will hold a list of objects that
- * extend the NotificationTarget base class. It's main purpose is to allow
- * Rosetta users to configure lists of recipients of specific events, and request
- * the JbossEsbNotificationHandler EJB to take care of triggering the events to
- * each object specified as a child "target" element
- * </p>
- * <p>Author: Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public class NotificationList extends DomElement
-{
- /**
- * Mnemonic name for the XML element name for the serialized form of objects
- * of this class
- */
- public static final String ELEMENT = "NotificationList";
- public static final String TYPE = "type";
- public static final String CHILD_TGT = "target";
-
- private String m_sType;
- /**
- * Instantiate an object according to the contents of <arg 1>
- * @param p_oP DomElement - 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
- { super(p_oP);
- m_sType = p_oP.getAttr(TYPE);
- if (null!=m_sType) m_sType = m_sType.toLowerCase();
- } //__________________________________
-
- private NotificationTarget[] getTargets() throws Exception
- { DomElement[] oaTgts = super.getElementChildren(CHILD_TGT);
- NotificationTarget[] oaRet = new NotificationTarget[oaTgts.length];
- for (int i1=0; i1<oaRet.length;i1++)
- oaRet[i1] = NotificationTarget.fromParams(oaTgts[i1]);
-
- return oaRet;
- } //__________________________________
- /**
- * Invoke the sendNotification() method for all targets in the list. The method
- * iterates along it's NotificationTarget child nodes and invokes the sendNotification()
- * method with the same object to all of them
- * @param p_o Object - The event to notify to all targets
- * @throws Exception - use Exception.getMessage() at runtime
- */
- public void sendNotification(Object p_o) throws Exception
- { NotificationTarget[] oaTgt = getTargets();
- for (int i1=0; i1<oaTgt.length; i1++)
- oaTgt[i1].sendNotification(p_o);
- } //__________________________________
- /**
- * Is this an OK (success) NotificationList ?
- * @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 argument</li>
- * @see DomElement#getAttr(String)
- */
- public boolean isOK()
- { return (null==m_sType) ? true : m_sType.startsWith("ok"); }
- /**
- * Is this an Error (failure) NotificationList ?
- * @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 argument</li>
- * @see DomElement#getAttr(String)
- */
- public boolean isErr()
- { return (null==m_sType) ? true : m_sType.startsWith("err"); }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotificationList.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,104 +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.notification;
-
-import java.lang.reflect.*;
-
-import org.jboss.soa.esb.helpers.*;
-/**
- * Abstract class to define expected behaviour of all NotificationTargets and
- * provide some common functionality to all of them
- * <p>Description: </p>
- * <p>Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public abstract class NotificationTarget
-{
- /**
- * Derived classes must implement this method to do what has to be done to
- * trigger that specific type of notification event
- * @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
- */
- public abstract void sendNotification(Object p_o) throws Exception;
-
- private static final String NOTIF_PFX = "org.jboss.soa.esb.notification";
-
- public static final String PRM_NOTIF_CLASS = "class";
-
- /**
- * Common object to hold details of object's information - Each derived class
- * will hold it's own needs
- */
- protected DomElement m_oParms;
- /**
- * Instantiate an empty NotificationTarget object
- */
- protected NotificationTarget() {}
- /**
- * Instantiate a NotificationTarget object with the information contained
- * in <arg 1>
- * @param p_oP DomElement - Holds details to instantiate this object
- */
- protected NotificationTarget (DomElement p_oP)
- { m_oParms = p_oP;
- } //__________________________________
-
- /**
- * A typical Factory.getInstance() method
- * @param p_oP DomElement - 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
- * runtime for details
- * @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);
- if (null==sClass) throw new Exception("Missing '"+PRM_NOTIF_CLASS
- +"' attribute in parameters");
- Class oCls = null;
- try { oCls = Class.forName(NOTIF_PFX+"."+sClass); }
- catch (Exception e) {}
- if (null==oCls)
- throw new Exception("Invalid class <"+sClass+">, or missing library");
-
- Constructor oCons = null;
- try { oCons = oCls.getConstructor(new Class[] {DomElement.class}); }
- catch (Exception e) {}
- if (null==oCons)
- throw new Exception("No valid constructor "+sClass+"(DomElement)");
-
- Object oRet = null;
- try { oRet = oCons.newInstance(new Object[] {p_oP}); }
- catch (Exception e) { e.printStackTrace();}
- if (null==oRet || (! (oRet instanceof NotificationTarget)))
- throw new Exception(sClass+" does not extend NotificationTarget");
-
- return (NotificationTarget) oRet;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotificationTarget.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,78 +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.notification;
-
-import javax.mail.internet.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-/**
- * This class will send an e-mail using the EsbEmail class
- * <p>Description: </p>
- * <p>Author: Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public class NotifyEmail extends NotificationTarget
-{
- /**
- * Instantiate a NotifyEmail object using the information contained in <arg 1>
- * @param p_oP DomElement - See attributes and structure needed for the
- * EsbEmail(DomElement) constructor - The MESSAGE attribute will be filled
- * in at sendNotification(Object) time
- * @throws Exception
- * @see EsbEmail#EsbEmail(DomElement)
- * @see NotifyEmail#sendNotification(Object)
- */
- public NotifyEmail(DomElement p_oP) throws Exception
- { super (p_oP);
-
- String sAtt = (String)m_oParms.getAttr(EsbEmail.FROM);
- if (null != sAtt) InternetAddress.parse(sAtt);
-
- InternetAddress.parse(m_oParms.getAttr(EsbEmail.SENDTO));
-
- sAtt = (String)m_oParms.getAttr(EsbEmail.COPYTO);
- if (null != sAtt) InternetAddress.parse(sAtt);
- } //__________________________________
- /**
- * Send an Email using EsbEmail() using p_o.toString() to fill in the
- * message text
- * @param p_o Object - This object's toString() method will supply contents
- * of mail message
- */
- public void sendNotification(Object p_o)
- { try
- { DomElement oP = m_oParms.cloneObj();
- String sMsg = oP.getAttr(EsbEmail.MESSAGE);
- sMsg = ((null==sMsg)?p_o.toString():sMsg+"\n")+p_o.toString();
- // HB added line for debugging
- //System.out.println("Sending Email Notification ->" +sMsg );
-
- oP.setAttr(EsbEmail.MESSAGE,sMsg);
- new EsbEmail(oP);
- }
- catch (Exception e) { e.printStackTrace();}
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyEmail.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,121 +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.notification;
-
-import org.jboss.soa.esb.helpers.*;
-
-import java.io.*;
-import java.net.*;
-/**
- * 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 (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>
- * <p>Author: Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public class NotifyFiles extends NotificationTarget
-{
- /**
- * Mnemonic for the child element name that hold the files to write ("file")
- */
- public static final String CHILD_FILE = "file";
- /**
- * Attribute name that will be interpreted as the URI of the file to write to
- */
- public static final String ATT_URI = "URI";
- /**
- * Attribute name of indicator to append to an existing file
- * @see Boolean#valueOf(String)
- */
- public static final String ATT_APPEND = "append";
- /**
- * The File[] that holds the output file list
- */
- protected File[] m_oaOutF;
- /**
- * Each entry in this array corresponds to the same index entry in the m_oaOutF array
- */
- protected boolean[] m_baAppend;
-
- /**
- * Instantiate a NotifyFiles object according to contents of <arg 1>
- * @param p_oP DomElement - 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
- { super (p_oP);
- setFiles(p_oP.getElementChildren(CHILD_FILE));
-
- } //__________________________________
-
- /**
- * Sets the value of m_oaOutF[] and m_baAppend[] to contents
- * of each element of the input argument
- * @param p_oaP DomElement[] - 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)
- */
- protected void setFiles(DomElement[] p_oaP) throws Exception
- { m_oaOutF = new File[p_oaP.length];
- m_baAppend=new boolean[m_oaOutF.length];
- for (int i1=0; i1<p_oaP.length; i1++)
- { String sAtt = p_oaP[i1].getAttr(ATT_URI);
- if (null==sAtt) throw new Exception ("Missing file URI");
- m_oaOutF[i1] = new File(new URI(sAtt));
- sAtt = p_oaP[i1].getAttr(ATT_APPEND);
- Boolean oB = Boolean.valueOf(sAtt);
- m_baAppend[i1] = (null==sAtt)?false : oB.booleanValue();
- }
- } //__________________________________
- /**
- * Writes the result of p_o.toString() into each one of the File objects
- * contained in the m_oaOutF array
- * @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#m_oaOutF
- */
- public void sendNotification(Object p_o)
- { FileOutputStream OS = null;
- int iCurr = 0;
- for (File oCurr : m_oaOutF)
- { try
- {
- OS = new FileOutputStream(oCurr,m_baAppend[iCurr++]);
- OS.write(p_o.toString().getBytes());
- OS.write("\n".getBytes());
- OS.close();
- }
- catch (Exception e) { continue; }
- finally { try { OS.close();} catch (Exception eCl) {} }
- }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyFiles.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,144 +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.notification;
-
-import java.util.*;
-import javax.jms.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-/**
- * Abstract class that defines the behaviour of NotifyQueues and NotifyTopics
- * (and in fact any other javax.jms.Destination object), and provides common
- * methods to derived classes
- * <p>Description: </p>
- * <p>Author: Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public abstract class NotifyJMS extends NotificationTarget
-{
- /**
- * Abstract method - All classes that extend NotifyJMS must implement it
- * according to their own javax.jms.Destination needs (Queue/Topic)
- * @param p_oMsg Message
- */
- protected abstract void sendToAll(Message p_oMsg);
- /**
- * Element name mnemonic to search for child elements in the DomElement
- * at constructor time, that will hold a "name" "value" pair to be
- * included in the JMS message header
- */
- public static final String CHILD_MSG_PROP = "messageProp";
- /**
- * Attribute name mnemonic for the name of the message property to
- * fill with contents of the "value" aattribute
- */
- public static final String ATT_PROP_NAME = "name";
- /**
- * Attribute name mnemonic for the value to assign to the corresponding
- * message property
- */
- public static final String ATT_PROP_VALUE = "value";
-
- /**
- * Attribute name mnemonic for the att that will hold the JNDI name
- * of the destination javax.jms.Destination object
- */
- public static final String ATT_DEST_NAME = "jndiName";
-
- /**
- * This object holds the JNDI naming context that will be used to obtain
- * a JMS destination (javax.jms.Destination) to send/publish the notification
- * at sendNotification() time
- */
- protected Context m_oCtx;
- private Properties m_oProps = new Properties();
-
- /**
- * The javax.jms.Connection instance used to talk to JMS
- */
- protected Connection m_oConn;
- /**
- * The javax.jms.Session instance used to talk to JMS
- */
- protected Session m_oSess;
- /**
- * Array with an instance of javax.jms.MessageProducer on each entry that
- * will be used to send the notification at sendNotification() time
- */
- protected MessageProducer[] m_oaMssProd;
- /**
- * Constructor that will be called by child classes to perform initialization
- * tasks that are common to all derived classes
- * @param p_oP DomElement
- * <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
- { super (p_oP);
-
- DomElement[] oaMsgP = p_oP.getElementChildren(CHILD_MSG_PROP);
- for (int i1=0; i1<oaMsgP.length; i1++)
- { String sKey = oaMsgP[i1].getAttr(ATT_PROP_NAME);
- if (null==sKey) continue;
- String sVal = oaMsgP[i1].getAttr(ATT_PROP_VALUE);
- if (null==sVal) continue;
-
- m_oProps.setProperty(sKey.trim(),sVal);
- }
-
- m_oCtx = new InitialContext();
-
- } //__________________________________
- /**
- * Performs an orderly release of all JMS resources utilized - Well behaved
- * developers should always call this method before unreferencing this object
- */
- public void release()
- { if (null!=m_oSess)
- try { m_oSess.close(); } catch (Exception e1) {}
- if (null!=m_oConn)
- try { m_oConn.close(); } catch (Exception e2) {}
- } //__________________________________
- /**
- * Send a JMS message using p_o.toString() to fill in the message text
- * and the list of message properties that will be added to the JMS
- * message header fields
- * @param p_o Object - This object's toString() method will supply contents
- * of JMS message
- * @see NotifyJMS#CHILD_MSG_PROP
- */
- public void sendNotification(Object p_o) throws Exception
- { Message oMsg = m_oSess.createTextMessage(p_o.toString());
- for (Iterator II=m_oProps.keySet().iterator(); II.hasNext(); )
- { String sKey = (String)II.next();
- String sVal = m_oProps.getProperty(sKey);
- oMsg.setStringProperty(sKey, sVal);
- }
- sendToAll(oMsg);
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyJMS.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,81 +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.notification;
-
-import javax.jms.*;
-
-import org.jboss.soa.esb.helpers.DomElement;;
-
-/**
- * This class that implements abstract methods defined in it's superclass
- * <p>Description: </p>
- * <p>Author: Heuristica - Buenos Aires - Argentina</p>
- * @version 1.0
- */
-public class NotifyQueues extends NotifyJMS
-{
- /**
- * Element name mnemonic to search for child elements in the DomElement
- * 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
- * @see NotifyJMS#ATT_DEST_NAME
- */
- public static final String CHILD_QUEUE = "queue";
-
-
- public NotifyQueues(DomElement p_oP) throws Exception
- { super (p_oP);
- setQueues(p_oP.getElementChildren(CHILD_QUEUE));
- } //__________________________________
-
- protected void setQueues(DomElement[] p_oaP) throws Exception
- {
- QueueConnectionFactory qcf = (QueueConnectionFactory)
- m_oCtx.lookup("ConnectionFactory");
- QueueConnection oQconn = qcf.createQueueConnection();
- QueueSession oQsess = oQconn.createQueueSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
-
-
- 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);
- if (null==sAtt) throw new Exception ("Missing queue jndiName");
- Queue oQ = (Queue)m_oCtx.lookup(sAtt);
- m_oaMssProd[i1] = oQsess.createSender(oQ);
- }
-
- m_oConn = oQconn;
- m_oSess = oQsess;
-// m_oConn.start(); Only for incoming messages ???
- } //__________________________________
-
- protected void sendToAll(Message p_oMsg)
- { for (int i1=0; i1<m_oaMssProd.length;i1++)
- { QueueSender oCurr = (QueueSender)m_oaMssProd[i1];
- try { oCurr.send(p_oMsg); }
- catch (Exception e) {}
- }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyQueues.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,106 +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.notification;
-
-import java.util.*;
-import java.sql.*;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.*;
-
-public class NotifySqlTable extends NotificationTarget
-{
- public static final String CHILD_COLUMN= "column";
-
- public static final String ATT_TABLE = "table";
- public static final String ATT_DATA = "dataColumn";
-
- public static final String ATT_NAME = "name";
- public static final String ATT_VALUE = "value";
-
- private String m_sDriver ,m_sURL ,m_sUser ,m_sPwd
- ,m_sTable ,m_sDataCol;
- private Properties m_oCols;
-
- public NotifySqlTable(DomElement p_oP) throws Exception
- { super (p_oP);
- m_sDriver = getAttr(SimpleDataSource.DRIVER);
- m_sURL = getAttr(SimpleDataSource.URL);
- m_sUser = getAttr(SimpleDataSource.USER);
- m_sPwd = getAttr(SimpleDataSource.PASSWORD);
- m_sTable = getAttr(ATT_TABLE);
- m_sDataCol = getAttr(ATT_DATA);
-
- m_oCols = new Properties();
- DomElement[] oaP = p_oP.getElementChildren(CHILD_COLUMN);
- for (int i1=0; i1<oaP.length;i1++)
- { DomElement oCurr = oaP[i1];
- String sCol = oCurr.getAttr(ATT_NAME);
- if (null==sCol) continue;
- sCol = sCol.trim();
- if (sCol.length()<1) continue;
- String sVal = oCurr.getAttr(ATT_VALUE);
- if (null==sVal) sVal = "";
- m_oCols.setProperty(sCol,sVal);
- }
- } //__________________________________
-
- private String getAttr(String p_sAtt) throws Exception
- { String sRet = m_oParms.getAttr(p_sAtt);
- if (null==sRet) throw new Exception ("Missing "+p_sAtt+" attribute");
- sRet = sRet.trim();
- if (p_sAtt.equals(SimpleDataSource.PASSWORD)) return sRet;
- if (sRet.length()<1) throw new Exception ("Empty "+p_sAtt+" attribute");
- return sRet;
- } //__________________________________
-
- public String getInsertStmt()
- { String[] saCols = new String[m_oCols.size()];
- m_oCols.keySet().toArray(saCols);
-
- StringBuffer sbCol = new StringBuffer("insert into ").append(m_sTable).append(" ");
- StringBuffer sbPrm = new StringBuffer(" values ");
- for (int i1=0; i1<saCols.length; i1++)
- { String sIn = (i1==0) ? "(" : ",";
- String sCurrCol = saCols[i1];
- sbCol.append(sIn).append("\"").append(sCurrCol).append("\"");
- sbPrm.append(sIn).append("'").append(m_oCols.getProperty(sCurrCol)).append("'");
- }
- return sbCol.append(")").append(sbPrm).append(")").toString();
- } //__________________________________
-
- public void sendNotification(Object p_o)
- { m_oCols.setProperty(m_sDataCol,p_o.toString());
- JdbcCleanConn oConn = null;
- try
- { oConn = new JdbcCleanConn(new SimpleDataSource
- (m_sDriver,m_sURL,m_sUser,m_sPwd));
- PreparedStatement PS = oConn.prepareStatement(getInsertStmt());
- oConn.execUpdWait(PS,3);
- oConn.commit();
- }
- catch (Exception e) {e.printStackTrace(System.err); }
- finally {if (null != oConn) oConn.release();}
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifySqlTable.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,69 +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.notification;
-
-import javax.jms.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class NotifyTopics extends NotifyJMS
-{
- public static final String CHILD_TOPIC = "topic";
-
- public NotifyTopics(DomElement p_oP) throws Exception
- { super (p_oP);
-
- setTopics(p_oP.getElementChildren(CHILD_TOPIC));
- } //__________________________________
-
- protected void setTopics(DomElement[] p_oaP) throws Exception
- {
- TopicConnectionFactory qcf = (TopicConnectionFactory)
- m_oCtx.lookup("ConnectionFactory");
- TopicConnection oTconn = qcf.createTopicConnection();
- TopicSession oTsess = oTconn.createTopicSession(false
- ,TopicSession.AUTO_ACKNOWLEDGE);
-
- 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);
- if (null==sAtt) throw new Exception ("Missing topic jndiName");
- Topic oT = (Topic)m_oCtx.lookup(sAtt);
- m_oaMssProd [i1] = oTsess.createPublisher(oT);
- }
-
- m_oConn = oTconn;
- m_oSess = oTsess;
-// m_oConn.start(); Only for incoming messages ???
-
- } //__________________________________
-
- protected void sendToAll(Message p_oMsg)
- { for (int i1=0; i1<m_oaMssProd.length;i1++)
- { TopicPublisher oCurr = (TopicPublisher)m_oaMssProd[i1];
- try { oCurr.publish(p_oMsg); }
- catch (Exception e) {}
- }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyTopics.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,80 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.notification;
-
-import java.io.*;
-import java.util.*;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.services.*;
-
-public class NotifyUtil
-{
-
- public static void notifyOK(InotificationHandler p_oNH, DomElement p_oParent
- , Object p_o, Map p_oCtx)
- { try
- { String sMsg = p_o.toString();
- DomElement[] oaP = p_oParent.getElementChildren(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();
- new MacroExpander().replaceMacros(oCpy, p_oCtx);
- p_oNH.sendNotifications(oCpy,sMsg);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- } //__________________________________
-
- public static void notifyError(InotificationHandler p_oNH, DomElement p_oParent
- , Object p_o, Map p_oCtx, Exception p_e)
- { ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try
- { oPS.println(p_o.toString());
- if (null != p_e) p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- DomElement[] oaP = p_oParent.getElementChildren(NotificationList.ELEMENT);
- // if (oaP.length<1) // Uncomment this line to send only to the list
- p_oNH.sendNotifications(sMsg);
- for (int i1=0; i1<oaP.length;i1++)
- { NotificationList oCurr = new NotificationList(oaP[i1]);
- if (! oCurr.isErr()) continue;
- new MacroExpander().replaceMacros(oaP[i1], p_oCtx);
- p_oNH.sendNotifications(oaP[i1],sMsg);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,134 +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.parameters;
-
-import java.io.*;
-import java.util.Properties;
-
-import javax.naming.CompoundName;
-import javax.naming.InvalidNameException;
-import javax.naming.Name;
-
-import org.jboss.soa.esb.helpers.DomElement;
-
-public class DefaultReposFactory
-{
- public static FileReposit getRepository(Object p_o)
- {
- return new FileReposit();
-
- } //________________________________
-
- /**
- * This is a dummy class to provide basic (extremely basic)
- * storage/retrieval of parameter trees for jboss.esb
- * in a file system
- *
- * @author Esteban
- *
- */
- public static class FileReposit implements ParamsRepository
- {
- // Only this factory can instantiate an object of this class
- private FileReposit() {}
-
- public DomElement getElement(Name pName) throws Exception
- {
- return getFromFile(pName);
- } //____________________________
-
- public DomElement removeElement(Name pName) throws Exception
- {
- File oF = fileFromName(pName);
- if (! oF.exists())
- return null;
- DomElement oRet = getFromFile(oF);
- oF.delete();
- return oRet;
- } //____________________________
-
- public void removeSubree(Name pName) throws Exception
- { purgeSubTree(fileFromName(pName));
- } //____________________________
-
- public DomElement storeElement(Name pName, DomElement p_oNew)
- throws Exception
- {
- if (pName.size() < 1)
- throw new Exception("Name has no elements");
- File oF = fileFromName(pName);
- DomElement oOld = getFromFile(oF);
- if (null==p_oNew)
- { if (oF.exists())
- oF.delete();
- return oOld;
- }
- dirFromName(pName).mkdirs();
- ByteArrayOutputStream oByStr = p_oNew.toXml();
- FileOutputStream oOut = new FileOutputStream(oF);
- oOut.write(oByStr.toByteArray());
- oOut.close();
-
- return oOld;
- } //____________________________
-
- private static DomElement getFromFile(Name pName) throws Exception
- { return getFromFile(fileFromName(pName));
- } //____________________________
-
- private static DomElement getFromFile(File p_oF) throws Exception
- { if (! p_oF.exists()) return null;
- return DomElement.fromInputStream(new FileInputStream(p_oF));
- } //____________________________
-
- public static File dirFromName(Name pName)
- { int iMax = pName.size()-1;
- StringBuilder sb = new StringBuilder();
- for (int i1=0; i1<iMax; i1++)
- ((i1<1) ? sb : sb.append("/")).append(pName.get(i1));
- return new File(sb.toString());
- } //____________________________
-
- public static File fileFromName(Name pName)
- { return new File(dirFromName(pName),pName.get(-1+pName.size()));
- } //____________________________
-
- private void purgeSubTree(File oF)
- { if (! oF.exists()) return;
- if (oF.isDirectory())
- for (File oCurr : oF.listFiles())
- purgeSubTree(oCurr);
- oF.delete();
- } //____________________________
-
- private static final Properties s_oSyntax = new Properties();
- static
- { s_oSyntax.setProperty("jndi.syntax.direction","left_to_right");
- s_oSyntax.setProperty("jndi.syntax.separator","/");
- };
-
- public Name nameFromString(String p_s)
- throws InvalidNameException
- { return new CompoundName(p_s,s_oSyntax);
- } //________________________________
- } //____________________________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/DefaultReposFactory.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.parameters;
-
-import java.lang.reflect.*;
-
-import org.jboss.soa.esb.common.EsbSysProps;
-
-public class ParamsReposUtil
-{
- private ParamsReposUtil() {};
-
- public static ParamsRepository reposFromFactory
- (String p_sFactoryName, Object p_oFactoryParam)
- throws Exception
- {
- Class oFactClass = DefaultReposFactory.class;
- if (null!=p_sFactoryName)
- oFactClass = Class.forName(p_sFactoryName);
- Method oMth = oFactClass.getMethod("getRepository"
- ,new Class[] {Object.class});
- return (ParamsRepository) oMth.invoke(null,p_oFactoryParam);
- } //________________________________
-
- public static ParamsRepository reposFromFactory
- (Object p_oFactoryParam)
- throws Exception
- {
- String sFactClass
- = System.getProperty(EsbSysProps.PARAMS_REPOS_FACTORY_CLASS);
- return reposFromFactory(sFactClass,p_oFactoryParam);
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/ParamsReposUtil.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,37 +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.parameters;
-
-import javax.naming.Name;
-import org.jboss.soa.esb.helpers.DomElement;
-
-public interface ParamsRepository
-{
- public Name nameFromString (String p_s) throws Exception;
- public DomElement storeElement
- (Name pName, DomElement p_oNew) throws Exception;
- public DomElement getElement (Name pName) throws Exception;
- public DomElement removeElement (Name pName) throws Exception;
- public void removeSubree (Name pName) throws Exception;
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/parameters/ParamsRepository.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,42 +0,0 @@
-package org.jboss.soa.esb.services;
-
-public class DefaultEncryptionFactory
-{
- public static Iencryption getEncrypter()
- {
- return new DummyEncrypter();
-
- } //________________________________
-
- public static Iencryption getEncrypter(Object p_o)
- {
- return new DummyEncrypter();
-
- } //________________________________
-
- /**
- * This is a dummy class to provide dummy
- * encrypt/decrypt methods for a byte[]
- *
- */
- private static class DummyEncrypter implements Iencryption
- {
-// private static Cipher s_oCC;
-// static
-// { try { s_oCC = Cipher.getInstance("DES"); }
-// catch (Exception e) { e.printStackTrace(); }
-// }
- public byte [] encrypt (byte [] p_ba, Object p_oParms)
- throws Exception
- {
- return p_ba;
- } //__________________________________
-
- public byte [] decrypt (byte [] p_ba, Object p_oParms)
- throws Exception
- {
- return p_ba;
- } //__________________________________
- } //___________________________________________________
-
-} //____________________________________________________________________________
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.services;
-
-import org.jboss.soa.esb.common.bizclasses.*;
-
-public interface IbatchHandler
-{
- public long newBatch () throws Exception;
- public int addToBatch (String p_s) throws Exception;
- public void finish () throws Exception;
- public void releaseHandler();
- public void commitBatch(BatchProcess p_oBP) throws Exception;
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/IbatchHandler.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,28 +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.services;
-
-public interface Iencryption
-{
- public byte [] encrypt (byte [] p_ba, Object p_oParms) throws Exception;
- public byte [] decrypt (byte [] p_ba, Object p_oParms) throws Exception;
-}
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/Iencryption.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,33 +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.services;
-
-import org.jboss.soa.esb.helpers.*;
-
-public interface InotificationHandler
-{
- public void sendNotifications (DomElement p_oP, Object p_o) throws Exception;
- public void sendNotifications (Object p_o) throws Exception;
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/InotificationHandler.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,39 +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.services;
-
-import org.jboss.soa.esb.util.*;
-import java.util.*;
-
-public interface IpersistHandler
-{
- public long getUidChunk(int p_iHowMany) throws Exception;
- public ObjLocator[] getLocatorList(Class p_oCls,Properties p_oProp) throws Exception;
-
- public long addObject(BaseBusinessObject p_oQ) throws Exception;
- public BaseBusinessObject getObject(Class p_oCls,long p_lUid) throws Exception;
- public void rplObject(BaseBusinessObject p_o) throws Exception;
- public void rmvObject(Class p_oCls,long p_lUid) throws Exception;
- public void remove() throws Exception;
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/services/IpersistHandler.java)
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,257 +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.util;
-
-import java.util.*;
-import java.lang.reflect.*;
-
-public class BaseBusinessObject
-{
- public BobjStdDTO toDTO() throws Exception { return getBaseDTO(); }
- public String classNm() { return this.getClass().getSimpleName(); }
- public boolean isNull () { return false; }
- public String toString ()
- { try { return this.toDTO().toXml(); }
- catch (Exception e) {return null; }
- } //__________________________________
-
- public String [] locator() { return new String [] {}; }
- public String [] locator(int p_i)
- { return (0==p_i) ? locator() : new String [] {};
- }
- /**
- * Get all locators for a given BaseBusinessObject
- * <p /> Override this method in your class if you have more than 1 locator array
- * @return An array of String arrays containing all locators
- */
- public String[][] allLocators() { return new String[][] {locator()}; }
-
- public final ObjLocator getObjLocator() { return getObjLocator(0); }
- public final ObjLocator getObjLocator(int p_i)
- { return new ObjLocator(m_lUid,locator(p_i)); }
-
- private enum ATTRIB
- {elem
- ,rol
- };
- enum HIDDEN
- {uid
- ,stamp
- ,type
- ,snap
- ,dtSnap
- ,batch
- };
- private EnumMap<ATTRIB,String>m_oData;
- public String setField(ATTRIB pKey, String pVal)
- { if (null==pKey) return null;
- String sRet = (null==m_oData)? null : m_oData.remove(pKey);
- if (! EsbUtil.isNullString(pVal))
- { if (null==m_oData)
- m_oData = new EnumMap<ATTRIB,String>(ATTRIB.class);
- m_oData.put(pKey,pVal);
- }
- return sRet;
- } //__________________________________
-
- public String getField(ATTRIB pKey)
- { if (null==pKey) return null;
- if (null==m_oData) return null;
- return m_oData.get(pKey);
- } //__________________________________
-
- private long m_lStamp = -1;
- private long m_lUid = -1;
- private long m_lLastSnap =0;
- private long m_lBatch =0;
- private String m_sDtSnap = null;
- private String m_sPkg = null;
-
- public boolean hasUid () { return m_lUid > 0; }
-
- public void setElemNm(String p_s){ setField(ATTRIB.elem,p_s); }
- public void setRole(String p_s) { setField(ATTRIB.rol,p_s); }
- public void setStamp (long p_l) { m_lStamp = p_l; }
- public void setUid (long p_l) { m_lUid = p_l; }
- public void setSnap (long p_l) { m_lLastSnap = p_l; }
- public void setBatchNum(long p_l) { m_lBatch = p_l; }
- public void setSnapDate(String p_s) { m_sDtSnap = p_s; }
- public void setPackage()
- { m_sPkg = this.getClass().getPackage().getName(); }
-
- public String getElemNm() { return getField(ATTRIB.elem); }
- public String getRole() { return getField(ATTRIB.rol); }
- public long getStamp() { return m_lStamp; }
- public long getUid () { return m_lUid; }
- public long getSnap () { return m_lLastSnap; }
- public long getBatchNum() { return m_lBatch; }
- public String getSnapDate() { return m_sDtSnap; }
-
- public BaseBusinessObject() {this((String)null); }
- protected BaseBusinessObject(String p_sElem) { this(p_sElem,-1); }
- protected BaseBusinessObject(String p_sElem, long p_lUid)
- { setField(ATTRIB.elem,p_sElem);
- m_lUid = p_lUid;
- if (null != getElemNm()) return;
- String sClass = getClass().getSimpleName();
- if (null == p_sElem)
- setField(ATTRIB.elem,sClass);
- } //________________________________
-
- protected BaseBusinessObject(BobjStdDTO p_oDto) throws Exception
- { this (p_oDto.elementNm());
- if (p_oDto.isList()) return;
- commonFieldsFromDTO(this,p_oDto);
- } //________________________________
-
- private static final void commonFieldsFromDTO(BaseBusinessObject p_obj,BobjStdDTO p_oDto)
- throws Exception
- { for(ATTRIB oCurr : ATTRIB.values())
- p_obj.setField(oCurr,p_oDto.getAttr(oCurr.toString()));
-
- String sAux = p_oDto.getAttr(HIDDEN.uid.toString());
- if (null != sAux) p_obj.m_lUid = Long.parseLong(sAux);
-
- sAux = p_oDto.getAttr(HIDDEN.stamp.toString());
- if (null != sAux) p_obj.m_lStamp = Long.parseLong(sAux);
-
- sAux = p_oDto.getAttr(HIDDEN.snap.toString());
- if (null != sAux) p_obj.m_lLastSnap = Long.parseLong(sAux);
-
- sAux = p_oDto.getAttr(HIDDEN.batch.toString());
- p_obj.setBatchNum((null != sAux)? Long.parseLong(sAux) : 0);
-
- // Special treatment for package - only needed for root BaseBusinessObj
- // this is so only to make XML more compact
- p_obj.m_sPkg = p_oDto.getAttr(BobjStdDTO.BOBJ_PACKAGE);
- } //________________________________
-
- public static final BaseBusinessObject getFromDTO(BobjStdDTO p_oDto)
- throws Exception
- { return new BaseBusinessObject().fromDTO(p_oDto);
- } //________________________________
-
- private BaseBusinessObject fromDTO(BobjStdDTO p_oDto)
- throws Exception
- { if (null == p_oDto) return null;
-
- Class oClass = Class.forName(p_oDto.fullClassName());
- Constructor CC=oClass.getConstructor (new Class[]{BobjStdDTO.class});
- BaseBusinessObject oRet = (BaseBusinessObject)CC.newInstance(new Object []{p_oDto});
-
- commonFieldsFromDTO(oRet,p_oDto);
- return oRet;
- } //________________________________
-
- protected BobjStdDTO getBaseDTO()
- { String sClass = getClass().getSimpleName();
- BobjStdDTO oRet = new BobjStdDTO(sClass,getElemNm(),null);
- if (hasUid())
- try { oRet.addAttr(HIDDEN.uid.toString(),Long.toString(m_lUid)); }
- catch (Exception e) {}
- putStdAtts(oRet);
- return oRet;
- } //________________________________
-
- protected void putStdAtts(BobjStdDTO p_oRet)
- { try
- { p_oRet.addAttr(ATTRIB.rol.toString(),getRole());
-// if (this instanceof XtfStorable)
-// p_oRet.addAttr(HIDDEN.type.toString(),((XtfStorable)this).getSnapType());
- if (m_lStamp > 0) p_oRet.addAttr(HIDDEN.stamp.toString()
- ,Long.toString(m_lStamp));
- if (m_lLastSnap > 0) p_oRet.addAttr(HIDDEN.snap.toString()
- ,Long.toString(m_lLastSnap));
- if (! EsbUtil.isNullString(m_sDtSnap))
- p_oRet.addAttr(HIDDEN.dtSnap.toString(),m_sDtSnap);
- if (getBatchNum() > 0)
- p_oRet.addAttr(HIDDEN.batch.toString() ,Long.toString(getBatchNum()));
- if (! EsbUtil.isNullString(m_sPkg))
- p_oRet.addAttr(BobjStdDTO.BOBJ_PACKAGE,m_sPkg);
- }
- catch (Exception e1) { }
- } //________________________________
-
- public static final BobjStdDTO getDtoList (Class p_Class
- , List<? extends BaseBusinessObject> p_oList)
- throws Exception
- { if (null == p_oList) return null;
- List<BobjStdDTO> LL = new ArrayList<BobjStdDTO>();
- for (BaseBusinessObject oCurr : p_oList)
- LL.add( oCurr.toDTO());
- String sElem = p_Class.getSimpleName();
- return (LL.size()<1) ? null : new BobjStdDTO(sElem,null,LL);
- } //__________________________________
-
- public static BaseBusinessObject getRoleFromList(String p_sRole
- , List<? extends BaseBusinessObject> p_oL)
- { if (null == p_sRole) return null;
- if (null == p_oL) return null;
- for (BaseBusinessObject oCurr : p_oL)
- if (p_sRole.equals(oCurr.getRole()))
- return oCurr;
- return null;
- } //__________________________________
-
- public static BaseBusinessObject getElemFromList
- (String p_sElemNm, List<? extends BaseBusinessObject> p_oL)
- { if (null == p_sElemNm) return null;
- if (null == p_oL) return null;
- for (BaseBusinessObject oCurr : p_oL)
- if (p_sElemNm.equals(oCurr.getElemNm()))
- return oCurr;
- return null;
- } //__________________________________
-
- public static BaseBusinessObject rmvElemFromList(String p_sElemNm, List<BaseBusinessObject> p_oL)
- { if (null == p_sElemNm) return null;
- if (null == p_oL) return null;
- for (ListIterator<BaseBusinessObject> II=p_oL.listIterator(); II.hasNext();)
- { BaseBusinessObject oCurr = II.next();
- if (p_sElemNm.equals(oCurr.getElemNm()))
- { II.remove();
- return oCurr;
- }
- }
- return null;
- } //__________________________________
-
- public static boolean anyFieldNull(String [] p_sa)
- { if (null == p_sa) return false;
- for (int i1=0; i1<p_sa.length;i1++)
- if (null == p_sa[i1]) return true;
- return false;
- } //__________________________________
-
- public static boolean allFieldsNull(String [] p_sa)
- { if (null == p_sa) return false;
- if (p_sa.length<1) return false;
- for (int i1=0; i1<p_sa.length;i1++)
- { String sCurr = p_sa[i1];
- if (null == sCurr) continue;
- if (sCurr.trim().length()>0) return false;
- }
- return true;
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/BaseBusinessObject.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,409 +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.util;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-import org.w3c.dom.*;
-
- at SuppressWarnings("serial")
-public class BobjStdDTO implements Serializable
-{
- private static final transient String s_sCharset = "ISO-8859-1";
- public static String getCharset() { return s_sCharset; }
-
- private static final transient String s_sEncoding
- = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
-
- // Some attribute names for the toXML() and fromXML()
- public final static String BOBJ_PACKAGE = "__BobjPkg";
- public final static String BOBJ_CLASS = "__Class";
-
- protected String m_sClassNm;
- protected String m_sElemNm;
- protected Map<String,Object> m_oAtts;
- protected List<BobjStdDTO> m_oChild;
- protected String[][] m_saaLocators;
- public void setLocators(String[][] p_saa) { m_saaLocators = p_saa; }
- public String[][] getLocators() { return m_saaLocators; }
-
- //Getters
- public String classNm() { return m_sClassNm; }
- public String elementNm() { return m_sElemNm; }
- public boolean isList() { return null!=m_oChild; }
- public boolean isEmpty()
- {return (isList()) ? (m_oChild).isEmpty() : m_oAtts.isEmpty(); }
-
-// protected BObjStdDTO() {}
- public BobjStdDTO(String p_sClassNm) {this(p_sClassNm,null,null); }
- public BobjStdDTO(String p_sClassNm, String p_sElemNm)
- {this(p_sClassNm,p_sElemNm,null); }
- public BobjStdDTO(String p_sClassNm, List<BobjStdDTO> p_oList)
- {this(p_sClassNm,null,p_oList); }
- protected BobjStdDTO(String p_sClassNm, String p_sElemNm, List<BobjStdDTO> p_oList)
- {initialize(p_sClassNm,p_sElemNm,p_oList); }
-
- protected BobjStdDTO(BobjStdDTO p_o)
- { if (null!=p_o)
- { m_sClassNm = p_o.m_sClassNm;
- m_sElemNm = p_o.m_sElemNm;
- if (null!=p_o.m_oChild)m_oChild = new ArrayList<BobjStdDTO>(p_o.m_oChild);
- if (null!=p_o.m_oAtts) m_oAtts = new HashMap<String,Object>(p_o.m_oAtts);
- }
- } //__________________________________
-
- private void initialize(String p_sClassNm, String p_sElemNm, List<BobjStdDTO> p_oList)
- { m_sClassNm = p_sClassNm;
- m_sElemNm = (null != p_sElemNm) ? p_sElemNm
- : m_sClassNm.substring(1+m_sClassNm.lastIndexOf("."));
- m_oChild= p_oList;
- if (null==m_oChild)
- m_oAtts = new HashMap<String,Object>();
- } //__________________________________
-
- private BobjStdDTO (Element p_n) throws Exception
- { String sElem = p_n.getNodeName();
-
- String sClass = null;
- try { sClass = p_n.getAttribute(BOBJ_CLASS); }
- catch (Exception eC) {}
- sClass = (null == sClass) ? sElem
- : ("".equals(sClass)) ? sElem : sClass;
- p_n.removeAttribute(BOBJ_CLASS);
-
- String sList = null;
- try { sList = p_n.getAttribute("List"); }
- catch (Exception eL) { }
- boolean m_bList = (null == sList) ? false
- : ("".equals(sList)) ? false : true;
- p_n.removeAttribute("List");
-
- NodeList NL = p_n.getChildNodes();
- int iQch = NL.getLength();
- if (m_bList)
- { List<BobjStdDTO> olCh = new ArrayList<BobjStdDTO>();
- for (int i1=0; i1<iQch; i1++)
- { Node oCurr = NL.item(i1);
- if (Node.ELEMENT_NODE != oCurr.getNodeType()) continue;
- BobjStdDTO oThisCh = new BobjStdDTO((Element)NL.item(i1));
- oThisCh.m_sElemNm = oThisCh.m_sClassNm = sClass;
- olCh.add(oThisCh);
- }
- initialize(sClass,sElem,olCh);
- return;
- }
-
- initialize(sClass,sElem,null);
- this.addMap(mapFromAtts(p_n.getAttributes()));
-
- for (int i1=0; i1<iQch; i1++)
- { Node oCurr = NL.item(i1);
- if (Node.ELEMENT_NODE != oCurr.getNodeType()) continue;
- this.addDto(((Element)oCurr).getNodeName()
- ,new BobjStdDTO(((Element)oCurr)));
- }
- } //__________________________________
-
- private void setLongAttr(String p_s,long pL)
- { try { addAttr(p_s,Long.toString(pL)); }
- catch (Exception e) { e.printStackTrace(); }
- } //__________________________________
- private void setStringAttr(String p_s,String pVal)
- { try { addAttr(p_s,pVal); }
- catch (Exception e) { e.printStackTrace(); }
- } //__________________________________
-
- private long attrAsLong(String p_s)
- { try
- { String sVal = getAttr(p_s);
- if (! EsbUtil.isNullString(sVal))
- return Long.parseLong(sVal);
- }
- catch (Exception e) {/* OK just fall through and return default*/ }
- return 0;
- } //__________________________________
-
- private String attrAsString(String p_s)
- { try { return getAttr(p_s); }
- catch (Exception e) {/* OK just fall through and return default*/ }
- return null;
- } //__________________________________
-
- public long getStamp(){ return attrAsLong(BaseBusinessObject.HIDDEN.stamp.toString()); }
- public long getUid() { return attrAsLong(BaseBusinessObject.HIDDEN.uid.toString()); }
- public long getSnap() { return attrAsLong(BaseBusinessObject.HIDDEN.snap.toString()); }
- public long getBatch(){ return attrAsLong(BaseBusinessObject.HIDDEN.batch.toString()); }
- public String getSnapType(){ return attrAsString(BaseBusinessObject.HIDDEN.type.toString()); }
- public String getSnapDate(){ return attrAsString(BaseBusinessObject.HIDDEN.dtSnap.toString()); }
-
- public void setStamp (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.stamp.toString(),pL); }
- public void setUid (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.uid.toString(),pL); }
- public void setSnap (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.snap.toString(),pL); }
- public void setBatch (long pL) { setLongAttr(BaseBusinessObject.HIDDEN.batch.toString(),pL); }
- public void setSnapType(String pS){ setStringAttr(BaseBusinessObject.HIDDEN.type.toString(),pS); }
- public void setSnapDate(String pS){ setStringAttr(BaseBusinessObject.HIDDEN.dtSnap.toString(),pS); }
-
- public String fullClassName()
- { String sPkg = "";
- try { sPkg = getAttr(BobjStdDTO.BOBJ_PACKAGE); }
- catch (Exception e) {/* just leave it empty */ }
- String sConstrPkg = (sPkg.endsWith(".")) ? sPkg : sPkg+".";
- return sConstrPkg+classNm();
- } //__________________________________
-
- public List<? extends BaseBusinessObject> getChildObjList(String p_sElem, Class pCls) throws Exception
- { BobjStdDTO oChDto = this.getDTO(p_sElem);
- if (null == oChDto) return null;
- if (! oChDto.isList()) throw new Exception ("Child DTO is not List");
- return oChDto.listDtoToList(pCls);
- } //__________________________________
-
- private List<BaseBusinessObject> listDtoToList(Class pCls) throws Exception
- { if (! isList()) throw new Exception("BObjStdDTO is not a List");
- Class [] oaCls = {BobjStdDTO.class};
- Constructor CC=pCls.getConstructor (oaCls);
- List<BaseBusinessObject> LL = new ArrayList<BaseBusinessObject>();
- Object [] oaParms = new BobjStdDTO[1];
- for (BobjStdDTO oCurr : m_oChild)
- { oaParms[0] = oCurr;
- LL.add((BaseBusinessObject)CC.newInstance(oaParms));
- }
- return (LL.size()>0) ? LL : null;
- } //__________________________________
-
- public Map<String,Object> getAttrMap() throws Exception
- { return m_oAtts;
- } //__________________________________
-
- public BobjStdDTO getDTO(String p_sKey) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- Object oRet = m_oAtts.get(p_sKey);
- if (null == oRet) return null;
- if (oRet instanceof BobjStdDTO) return (BobjStdDTO)oRet;
- throw new Exception ("Value is not BObjStdDTO");
- } //__________________________________
-
- public String getAttr(String p_sKey) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- Object oRet = m_oAtts.get(p_sKey);
- if (null == oRet) return null;
- if (oRet instanceof String) return (String)oRet;
- throw new Exception ("Value is not an attribute");
- } //__________________________________
-
- @SuppressWarnings("unchecked")
- public void addAttr(String p_sKey, String p_sAtt) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- if (null == p_sKey) return;
- m_oAtts.remove(p_sKey);
- if (null != p_sAtt)
- if (p_sAtt.trim().length() > 0)
- m_oAtts.put(p_sKey,p_sAtt.trim());
- } //__________________________________
-
- @SuppressWarnings("unchecked")
- public void addDto(String p_sKey, BobjStdDTO p_oDto) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- if (null == p_sKey) return;
- m_oAtts.remove(p_sKey);
- if (null == p_oDto) return;
- if (p_oDto.isEmpty()) return;
- p_oDto.m_sElemNm=p_sKey;
- m_oAtts.put(p_sKey,p_oDto);
- } //__________________________________
-
- @SuppressWarnings("unchecked")
- public void addBobj(String p_sKey, BaseBusinessObject p_oBob) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- if (null == p_sKey) return;
- m_oAtts.remove(p_sKey);
- if (null == p_oBob) return;
- BobjStdDTO oDto = p_oBob.toDTO();
- if (oDto.isEmpty()) return;
- oDto.m_sElemNm=p_sKey;
- m_oAtts.put(p_sKey,oDto);
- } //__________________________________
-
- @SuppressWarnings("unchecked")
- private void addMap(Map<String,Object> p_oM) throws Exception
- { if (isList()) throw new Exception("BObjStdDTO is a List");
- if (null == p_oM) return;
- for (Map.Entry<String,Object> oCurr : p_oM.entrySet())
- m_oAtts.put(oCurr.getKey(), oCurr.getValue());
- } //__________________________________
-
- public String toXml() throws Exception { return toXml(false); }
-
- public String toXml(boolean p_bDecl) throws Exception
- { Document oDoc = toDoc();
- oDoc.normalize();
- DOMSource src = new DOMSource(oDoc);
-
- OutputStream oStrm = new ByteArrayOutputStream(1000);
- StreamResult res = new StreamResult(oStrm);
-
- Transformer oTf = TransformerFactory.newInstance().newTransformer();
- oTf.setOutputProperty(OutputKeys.INDENT, "no");
- oTf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION
- ,(p_bDecl)? "no":"yes");
-
- oTf.setOutputProperty(OutputKeys.ENCODING, s_sCharset);
- oTf.transform(src,res);
- return oStrm.toString();
- } //__________________________________
-
- public BaseBusinessObject getBobj(String p_sObj)
- { if (null == p_sObj) return null;
- try
- { BobjStdDTO oDto = this.getDTO(p_sObj);
- return BaseBusinessObject.getFromDTO(oDto);
- }
- catch (Exception e) {return null; }
- } //__________________________________
-
- public Document toDoc()
- {
- DocumentBuilder oDB = null;
- try { oDB = DocumentBuilderFactory.newInstance().newDocumentBuilder(); }
- catch (Exception e) {}
- Document oDoc = oDB.newDocument();
- oDoc.appendChild(toElement(oDoc));
- return oDoc;
- } //__________________________________
-
- public Node toElement(Document p_oDoc)
- { return (isList()) ? listToElement(p_oDoc)
- : mapToElement (p_oDoc);
- } //__________________________________
-
- private Node mapToElement(Document p_oDoc)
- { if (null == m_oAtts) return null;
- Element onRet = p_oDoc.createElement(m_sElemNm);
- for (Map.Entry<String,Object> oCurr: m_oAtts.entrySet())
- { if (oCurr.getValue() instanceof BobjStdDTO)
- { onRet.appendChild(((BobjStdDTO)oCurr.getValue()).toElement(p_oDoc));
- continue;
- }
- else
-// System.out.println("Elem<"+sKey+"> Val<"+oVal.toString()+">");
- onRet.setAttribute(oCurr.getKey(),oCurr.getValue().toString());
- }
-
- boolean bPutClass = (null != m_sClassNm) && (! m_sElemNm.equals(m_sClassNm));
- if (bPutClass)onRet.setAttribute(BOBJ_CLASS,m_sClassNm);
- else onRet.removeAttribute(BOBJ_CLASS);
-
- return onRet;
- } //__________________________________
-
- private Node listToElement(Document p_oDoc)
- { if (null == m_oChild) return null;
- if (m_oChild.isEmpty()) return null;
-
- Element onRet = p_oDoc.createElement(m_sElemNm);
- onRet.setAttribute("List","yes");
- if ( ! m_sElemNm.equals(m_sClassNm))
- onRet.setAttribute(BOBJ_CLASS,m_sClassNm);
-
- for (BobjStdDTO oCurr : m_oChild)
- { oCurr.m_sClassNm=null;
- oCurr.m_sElemNm="it";
- onRet.appendChild(oCurr.toElement(p_oDoc));
- }
- return onRet;
- } //__________________________________
-
- public static synchronized BobjStdDTO getFromXml(String p_s) throws Exception
- {StringBuffer sb = new StringBuffer(s_sEncoding)
- .append("\n").append(p_s);
- DocumentBuilder oDB = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document oDoc = oDB.parse(new ByteArrayInputStream (sb.toString()
- .getBytes(s_sCharset)));
- return new BobjStdDTO(oDoc.getDocumentElement());
- } //__________________________________
-
- @SuppressWarnings("unused")
- private static synchronized List<BobjStdDTO> getChildList
- (String p_sClass, NodeList p_nl, String p_sPkgPfx)
- throws Exception
- { int iQel = p_nl.getLength();
- if (iQel < 1) return null;
- Class oClass = Class.forName(p_sPkgPfx+p_sClass);
- Class [] oaCls = new Class[] {String.class};
- Object [] oaStr = new Object[] {p_sClass};
- Constructor CC = oClass.getConstructor(oaCls);
- List<BobjStdDTO> olRet = new ArrayList<BobjStdDTO>(2*iQel);
- for (int i1=0; i1<iQel; i1++)
- { Node onCurr = p_nl.item(i1);
- if (Node.ELEMENT_NODE != onCurr.getNodeType()) continue;
- BobjStdDTO oDto = ((BaseBusinessObject)CC.newInstance(oaStr)).toDTO();
- oDto.addMap(BobjStdDTO.mapFromAtts(onCurr.getAttributes()));
- olRet.add(oDto);
- }
- return olRet;
- } //__________________________________
-
- private static synchronized Map<String,Object> mapFromAtts(NamedNodeMap p_oNnm)
- { if (null == p_oNnm) return null;
- int iQatt = p_oNnm.getLength();
- if (iQatt < 1) return null;
- Map<String,Object> omAtts = new HashMap<String,Object>();
- for (int i2=0; i2<iQatt;i2++)
- { Node nAtt = p_oNnm.item(i2);
- omAtts.put(nAtt.getNodeName(),nAtt.getNodeValue());
- }
- return omAtts;
- } //__________________________________
-
- public void Dump(String p_s) throws Exception { System.out.println(p_s);Dump(0); }
-
- public void Dump(int p_iLev) throws Exception
- { byte[] ba = new byte[3*p_iLev]; Arrays.fill(ba,(byte)' ');
- String sTab = new String(ba);
- System.out.print(sTab+"Elem "+m_sElemNm+" Class "+m_sClassNm);
- if (isList())
- { System.out.println(" LIST");
- for (BobjStdDTO oCurr : m_oChild)
- oCurr.Dump(1+p_iLev);
- return;
- }
- System.out.print("\n"+sTab);
-
- for (EnumMap.Entry<String,Object> oCurr : m_oAtts.entrySet())
- { if (oCurr.getValue() instanceof String)
- System.out.print(" " + oCurr.getKey()+"<"+oCurr.getValue()+">");
- }
- System.out.println();
- for (EnumMap.Entry<String,Object> oCurr : m_oAtts.entrySet())
- { if (oCurr.getValue() instanceof BobjStdDTO)
- ((BobjStdDTO)oCurr.getValue()).Dump(1+p_iLev);
- }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/BobjStdDTO.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,119 +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.util;
-
-import java.util.*;
-import java.io.*;
-import javax.naming.*;
-import org.apache.log4j.*;
-
-public class EsbUtil
-{
- private EsbUtil() {}
-
- public static void dumpSysProps(PrintStream p_OS)
- { String[] sa = new String[System.getProperties().size()];
- System.getProperties().keySet().toArray(sa);
- Arrays.sort(sa);
- for (String sCurr : sa)
- p_OS.println(sCurr+"<"+System.getProperty(sCurr)+">");
- } //__________________________________
-
- public static boolean isNullString(String p_s)
- { return (null==p_s) ? true : p_s.trim().length()<1;
- } //__________________________________
-
- public static boolean isLong(String p_s)
- { if (isNullString(p_s)) return false;
- try
- { Long.parseLong(p_s);
- return true;
- }
- catch (Exception e) { return false; }
- } //__________________________________
-
- public static boolean isPositiveLong(String p_s)
- { if (isNullString(p_s)) return false;
- try
- { long lBk = Long.parseLong(p_s);
- return lBk > 0;
- }
- catch (Exception e) { return false; }
- } //__________________________________
-
- public static int parseInt(String s)
- {
- if ( s == null) return 0;
- String sVal = s.trim();
- if (sVal.length() < 1)
- return 0;
- else
- try { return Integer.parseInt(s); }
- catch (NumberFormatException ex) { return 0; }
- } //__________________________________
-
- public static long parseLong(String s)
- {
- if ( s == null) return 0;
- String sVal = s.trim();
- if (sVal.length() < 1)
- return 0;
- else
- try { return Long.parseLong(s); }
- catch (NumberFormatException ex) { return 0; }
- } //__________________________________
-
-
- public static Context getJndiContext()
- { return jndiContextFromSysProp(null);
- } //__________________________________
-
- public static Context jndiContextFromSysProp(String p_sSysProp)
- { String sProp = (null==p_sSysProp) ? "appServer" : p_sSysProp;
- return getJbossJndiContext(System.getProperty(sProp));
- } //__________________________________
-
- public static Context getJbossJndiContext(String p_sServer)
- { if (null==p_sServer) return null;
- Properties oPr = new Properties();
- oPr.setProperty(Context.PROVIDER_URL,p_sServer);
- oPr.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
- oPr.setProperty(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
- try { return new InitialContext(oPr); }
- catch (Exception e) { e.printStackTrace(); return null; }
- } //__________________________________
-
- public static String classSuffix(Class pCls)
- { return pCls.getSimpleName();
- } //__________________________________
-
- public static Logger getDefaultLogger(Class p_oCls)
- { Logger oRet = Logger.getLogger(p_oCls.getName());
- Appender oApp = new ConsoleAppender(new TTCCLayout("ISO8601"));
- oRet.addAppender(oApp);
- return oRet;
-} //__________________________________
-
-
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/EsbUtil.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,38 +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.util;
-
-public class NagiosStandaloneHeartbeat
-{
- public NagiosStandaloneHeartbeat
- (String pNagiosServer
- ,int pPort
- ,String pService
- ,String pDescription
- )
- {
-
- }
-}
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/NagiosStandaloneHeartbeat.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,93 +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.util;
-
-import java.io.Serializable;
-
- at SuppressWarnings("serial")
-public class ObjLocator implements Serializable
-{
- private long m_lUid;
- private Object [] m_oaLocs;
-
- public long getUid() { return m_lUid; }
- public String [] getStrings() { return (String []) m_oaLocs; }
- public int getColumnCount()
- { return (null == m_oaLocs) ? 0 : m_oaLocs.length;
- } //__________________________________
-
- public ObjLocator(long p_lUid, Object [] p_sa)
- { m_lUid = p_lUid;
- m_oaLocs = (null == p_sa) ? new Object [0] : p_sa;
- for (int i1=0; i1<m_oaLocs.length;i1++)
- if (null == m_oaLocs[i1]) m_oaLocs[i1]="";
- } //__________________________________
-
- public Object get(int p_iCol)
- { return (null == m_oaLocs) ? ""
- :(p_iCol < 0 || p_iCol >= m_oaLocs.length) ? ""
- : m_oaLocs[p_iCol];
- } //__________________________________
-
- public void set(int p_iCol, Object p_o)
- { if (null == m_oaLocs) return;
- if (p_iCol < 0 || p_iCol >= m_oaLocs.length) return;
- m_oaLocs[p_iCol] = p_o;
- } //__________________________________
-
- public boolean equals(Object p_o)
- { return (p_o instanceof ObjLocator)
- ? m_lUid == ((ObjLocator)p_o).getUid()
- : false;
- } //__________________________________
-
- public static ObjLocator find(long p_l, ObjLocator[] p_ola)
- { ObjLocator oRet;
- if (null != p_ola)
- for (int i1=0; i1<p_ola.length;i1++)
- if (p_l == (oRet = p_ola[i1]).getUid()) return oRet;
- return null;
- } //__________________________________
-
- public String toString()
- { StringBuffer sb = new StringBuffer(200);
- sb.append("ObjLocator: ").append(m_lUid).append(" <");
- for (int i1=0; i1<m_oaLocs.length;i1++)
- { if (i1 > 0) sb.append(" ");
- sb.append(m_oaLocs[i1].toString());
- }
- sb.append(">");
- return sb.toString();
- } //__________________________________
-
- public static long [] getUids(ObjLocator[] p_ola)
- { long [] laRet = new long [] {};
- if (null == p_ola) return laRet;
- if (p_ola.length<1) return laRet;
- laRet = new long[p_ola.length];
- for (int i1=0; i1<laRet.length; i1++)
- laRet[i1] = p_ola[i1].getUid();
-
- return laRet;
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/ObjLocator.java)
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,86 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.soa.esb.util;
-
-import java.util.*;
-
-public class ObjLocatorSorter
-{
- private java.util.List<ObjLocator> m_olRows;
- private int m_iQcols;
- private char[] m_caSrt;
-
- public ObjLocatorSorter(ObjLocator[] p_oa)
- { m_iQcols = (null==p_oa) ? 0
- : p_oa.length<1 ? 0
- : p_oa[0].getColumnCount();
- m_olRows = Arrays.asList(p_oa);
- } //________________________________
-
- public ObjLocator[] sort (int p_iCol)
- { if (null == m_caSrt)
- { m_caSrt = new char[m_iQcols];
- for (int i1=0; i1<m_caSrt.length; i1++) m_caSrt[i1]='d';
- }
- ObjLocator [] oaLoc = new ObjLocator[m_olRows.size()];
- m_olRows.toArray(oaLoc);
- Arrays.sort(oaLoc,new RowCmp(p_iCol,ascOrDesc(oaLoc,p_iCol)));
- m_olRows = Arrays.asList(oaLoc);
- return oaLoc;
- } //________________________________
- private static char ascOrDesc(ObjLocator[] p_oa, int p_iCol)
- {
- String sMin = "";
- for (int i1=0; i1<p_oa.length;i1++)
- { Object oCurr = p_oa[i1].get(p_iCol);
- if (! (oCurr instanceof String)) continue;
- if (sMin.compareToIgnoreCase((String)oCurr) > 0)
- return 'a';
- sMin = (String) oCurr;
- }
- return 'd';
- } //________________________________
-
- // ---------------------------------------------------------
- // Comparator for Table Columns
- // ---------------------------------------------------------
- private class RowCmp implements Comparator<ObjLocator>
- {
- int m_iCol;
- boolean m_bAsc;
-
- RowCmp(int p_i, char p_c)
- {
- m_iCol = p_i;
- m_bAsc = 'a'==Character.toLowerCase(p_c);
- } //______________________________
-
- public int compare(ObjLocator o1, ObjLocator o2)
- {
- String s1 = (String) o1.get(m_iCol);
- String s2 = (String) o2.get(m_iCol);
- int iCmp = s1.compareToIgnoreCase(s2);
- return (m_bAsc) ? iCmp : -iCmp;
- } //______________________________
- } //_______________________________________________
-} //______________________________________________________
-
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/src/org/jboss/soa/esb/util/ObjLocatorSorter.java)
Copied: labs/jbossesb/trunk/product/core/common/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests)
Deleted: labs/jbossesb/trunk/product/core/common/tests/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,117 +0,0 @@
-<?xml version="1.0"?>
-<project name="build.common.tests" default="org.jboss.esb.common.tests.compile" basedir=".">
-
- <property name="org.jboss.esb.tests.classes.dir" value="${org.jboss.esb.internal.dest}/tests"/>
- <property name="org.jboss.esb.tests.report.dir" value="${org.jboss.esb.internal.dest}/tests/junit"/>
- <property name="org.jboss.esb.core.classes.dir" value="${org.jboss.esb.internal.dest}/classes/common"/>
- <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.tests.base.classpath">
- <fileset dir="../${org.jboss.esb.ext.lib.dir}"
- includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
- <pathelement location="${org.jboss.esb.core.classes.dir}"/>
- </path>
-
- <target name="org.jboss.esb.tests.init">
- <tstamp>
- <format property="TODAY" pattern="dd-MM-yy"/>
- </tstamp>
-
- <mkdir dir="${org.jboss.esb.tests.classes.dir}"/>
- <mkdir dir="${org.jboss.esb.tests.report.dir}"/>
- </target>
-
- <target name="clean"/>
-
- <target name="purge" depends="clean">
- <delete dir="${org.jboss.esb.tests.classes.dir}"/>
- </target>
-
- <target name="org.jboss.esb.common.tests.compile" if="org.jboss.esb.buildtests" depends="org.jboss.esb.tests.init">
-
- <javac
- destdir="${org.jboss.esb.tests.classes.dir}"
- classpathref="org.jboss.esb.tests.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.tests.src.dir}"/>
- </javac>
-
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- T E S T -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.common.internal.test">
- <antcall target="org.jboss.esb.common.internal.test.unit"/>
- <antcall target="org.jboss.esb.common.internal.test.functional"/>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- U N I T T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.common.internal.test.unit">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.classes.dir}">
- <include name="**/**/common/**/**UnitTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.classes.dir}"/>
- <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- F U NC T I O N A L T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.common.internal.test.functional">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.classes.dir}">
- <include name="**/**/common/**/**FuncTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.classes.dir}"/>
- <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/core/common/tests/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/build.xml)
Copied: labs/jbossesb/trunk/product/core/common/tests/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests)
Deleted: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.common.tests;
-
-import junit.framework.TestCase;
-import org.jboss.logging.Logger;
-
-/**
- * Base test class for esb test classes, uses jboss logging.
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class BaseTest extends TestCase {
-
- /**
- * The Logger.
- */
- protected Logger log = Logger.getLogger(getClass());
-
- /**
- * Default class constructor.
- */
- public BaseTest() {
- }
-
- /**
- * Utility constructor.
- * @param name The test name.
- */
- public BaseTest(String name) {
- super(name);
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses)
Deleted: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,124 +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.common.tests.bizclasses;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.common.bizclasses.Address;
-import org.jboss.soa.esb.common.bizclasses.Telephone;
-import org.jboss.soa.esb.util.BaseBusinessObject;
-import org.jboss.soa.esb.util.BobjStdDTO;
-
-/**
- * Unit test for the address class.
- *
- * @author <a href="mailto:schifest at gmail.com">Esteban Shifman</a>
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class AddressUnitTest extends BaseTest {
-
-
- public void testAddress() throws Exception {
- Address address = getAddress();
- assertTrue("Expecting Address.strNum to be 50. Actual was " +
- address.getField(Address.ATTRIB.strNum), address.getField(Address.ATTRIB.strNum).equals("50"));
- assertTrue("Expecting Address.strLine1 to be Balcarce. Actual was " +
- address.getField(Address.ATTRIB.strLine1), address.getField(Address.ATTRIB.strLine1).equals("Balcarce"));
- assertTrue("Expecting Address.twnCty1 to be San Isidro. Actual was " +
- address.getField(Address.ATTRIB.twnCty1), address.getField(Address.ATTRIB.twnCty1).equals("San Isidro"));
- assertTrue("Expecting Address.postalZip to be 1642. Actual was " +
- address.getField(Address.ATTRIB.postalZip), address.getField(Address.ATTRIB.postalZip).equals("1642"));
- assertTrue("Expecting Address.provSt to be Buenos Aires. Actual was " +
- address.getField(Address.ATTRIB.provSt), address.getField(Address.ATTRIB.provSt).equals("Buenos Aires"));
- assertTrue("Expecting Address.cntry to be Argentina. Actual was " +
- address.getField(Address.ATTRIB.cntry), address.getField(Address.ATTRIB.cntry).equals("Argentina"));
-
- // Phone
- assertTrue("Expecting Address.phone[0].role to be torIP. Actual was " +
- address.getPhoneAt(0).getRole(), address.getPhoneAt(0).getRole().equals("torIP"));
- assertTrue("Expecting Address.phone[0].country to be null. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.cntry), address.getPhoneAt(0).getField(Telephone.ATTRIB.cntry) == null);
- assertTrue("Expecting Address.phone[0].city to be 416. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.city), address.getPhoneAt(0).getField(Telephone.ATTRIB.city).equals("416"));
- assertTrue("Expecting Address.phone[0].num to be 555-1212. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.num), address.getPhoneAt(0).getField(Telephone.ATTRIB.num).equals("555-1212"));
- assertTrue("Expecting Address.phone[0].ext to be null. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.ext), address.getPhoneAt(0).getField(Telephone.ATTRIB.ext) == null);
-
- assertTrue("Expecting Address.phone[1].role to be home. Actual was " +
- address.getPhoneAt(1).getRole(), address.getPhoneAt(1).getRole().equals("home"));
- assertTrue("Expecting Address.phone[1].country to be 54. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.cntry), address.getPhoneAt(1).getField(Telephone.ATTRIB.cntry).equals("54"));
- assertTrue("Expecting Address.phone[1].city to be 11. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.city), address.getPhoneAt(1).getField(Telephone.ATTRIB.city).equals("11"));
- assertTrue("Expecting Address.phone[1].num to be 4555-1111. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.num), address.getPhoneAt(1).getField(Telephone.ATTRIB.num).equals("4555-1111"));
- assertTrue("Expecting Address.phone[1].ext to be 7. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.ext), address.getPhoneAt(1).getField(Telephone.ATTRIB.ext).equals("7"));
-
- }
-
-
- public void testToDTO() throws Exception {
- BaseBusinessObject addressA = getAddress();
- addressA.setPackage();
-
- BobjStdDTO oDto = addressA.toDTO();
- System.out.println(oDto.toXml());
-
- Address addressB = (Address) BaseBusinessObject.getFromDTO(oDto);
- System.out.println(addressB.toDTO().toXml());
-
- assertTrue("Expecting AddressA == AddressB", addressA.toDTO().toXml().equals(addressB.toDTO().toXml()));
- }
-
-
- static Address getAddress() throws Exception {
- Address oP = new Address((String) null);
- oP.setField(Address.ATTRIB.strNum, "50");
- oP.setField(Address.ATTRIB.strLine1, "Balcarce");
- oP.setField(Address.ATTRIB.twnCty1, "San Isidro");
- oP.setField(Address.ATTRIB.postalZip, "1642");
- oP.setField(Address.ATTRIB.provSt, "Buenos Aires");
- oP.setField(Address.ATTRIB.cntry, "Argentina");
-
- oP.addPhone(newPhone("torIP", null, "416", "555-1212", null));
- oP.addPhone(newPhone("home", "54", "11", "4555-1111", "7"));
-
- return oP;
- }
-
- public static Telephone newPhone(String p_sRole, String p_sCtry, String p_sCity,
- String p_sNum, String p_sExt) {
- Telephone oP = new Telephone((String) null);
- oP.setRole(p_sRole);
- oP.setField(Telephone.ATTRIB.cntry, p_sCtry);
- oP.setField(Telephone.ATTRIB.city, p_sCity);
- oP.setField(Telephone.ATTRIB.num, p_sNum);
- oP.setField(Telephone.ATTRIB.ext, p_sExt);
-
- return oP;
- }
-
-
-}
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/AddressUnitTest.java)
Deleted: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,204 +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.common.tests.bizclasses;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.common.bizclasses.Person;
-import org.jboss.soa.esb.common.bizclasses.OneValue;
-import org.jboss.soa.esb.common.bizclasses.Address;
-import org.jboss.soa.esb.common.bizclasses.Telephone;
-import org.jboss.soa.esb.util.BaseBusinessObject;
-import org.jboss.soa.esb.util.BobjStdDTO;
-
-/**
- * Unit test for the person class.
- *
- * @author <a href="mailto:schifest at gmail.com">Esteban Shifman</a>
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class PersonUnitTest extends BaseTest {
-
-
- public void testPerson() throws Exception {
-
- Person person = getPerson();
-
- assertTrue("Expecting Person.pfx to be Mr. Actual was " +
- person.getField(Person.ATTRIB.pfx), person.getField(Person.ATTRIB.pfx).equals("Mr."));
- assertTrue("Expecting Person.fmlyN to be Brum. Actual was " +
- person.getField(Person.ATTRIB.fmlyN), person.getField(Person.ATTRIB.fmlyN).equals("Brum"));
- assertTrue("Expecting Person.givN to be Daniel. Actual was " +
- person.getField(Person.ATTRIB.givN), person.getField(Person.ATTRIB.givN).equals("Daniel"));
- assertTrue("Expecting Person.sfx to be the 1st.. Actual was " +
- person.getField(Person.ATTRIB.sfx), person.getField(Person.ATTRIB.sfx).equals("the 1st."));
-
- }
-
- public void testPersonEmail() throws Exception {
-
- Person person = getPerson();
-
- String expectedEmail0 = "<OneValue rol=\"home\" v=\"myaddr at gmail.com\"/>";
- assertTrue("Expecting Person.email[0] to be Actual was " +
- person.getEmailAt(0).toString(), person.getEmailAt(0).toString().equals(expectedEmail0));
-
- String expectedEmail1 = "<OneValue rol=\"work\" v=\"john.smith at jboss.com\"/>";
- assertTrue("Expecting Person.email[0] to be Actual was " +
- person.getEmailAt(1).toString(), person.getEmailAt(1).toString().equals(expectedEmail1));
- }
-
- public void testPersonTelephone() throws Exception {
-
- Person person = getPerson();
-
- assertTrue("Expecting Person.phone[0].role to be basement. Actual was " +
- person.getPhoneAt(0).getRole(), person.getPhoneAt(0).getRole().equals("basement"));
- assertTrue("Expecting Person.phone[0].country to be 1. Actual was " +
- person.getPhoneAt(0).getField(Telephone.ATTRIB.cntry), person.getPhoneAt(0).getField(Telephone.ATTRIB.cntry).equals("1"));
- assertTrue("Expecting Person.phone[0].city to be 416. Actual was " +
- person.getPhoneAt(0).getField(Telephone.ATTRIB.city), person.getPhoneAt(0).getField(Telephone.ATTRIB.city).equals("416"));
- assertTrue("Expecting Person.phone[0].num to be 555-1212. Actual was " +
- person.getPhoneAt(0).getField(Telephone.ATTRIB.num), person.getPhoneAt(0).getField(Telephone.ATTRIB.num).equals("555-1212"));
- assertTrue("Expecting Person.phone[0].ext to be null. Actual was " +
- person.getPhoneAt(0).getField(Telephone.ATTRIB.ext), person.getPhoneAt(0).getField(Telephone.ATTRIB.ext) == null);
-
- assertTrue("Expecting Person.phone[1].role to be basement. Actual was " +
- person.getPhoneAt(1).getRole(), person.getPhoneAt(1).getRole().equals("cell"));
- assertTrue("Expecting Person.phone[1].country to be null. Actual was " +
- person.getPhoneAt(1).getField(Telephone.ATTRIB.cntry), person.getPhoneAt(1).getField(Telephone.ATTRIB.cntry) == null);
- assertTrue("Expecting Person.phone[1].city to be 416. Actual was " +
- person.getPhoneAt(1).getField(Telephone.ATTRIB.city), person.getPhoneAt(1).getField(Telephone.ATTRIB.city).equals("416"));
- assertTrue("Expecting Person.phone[1].num to be 666-4444. Actual was " +
- person.getPhoneAt(1).getField(Telephone.ATTRIB.num), person.getPhoneAt(1).getField(Telephone.ATTRIB.num).equals("666-4444"));
- assertTrue("Expecting Person.phone[1].ext to be null. Actual was " +
- person.getPhoneAt(1).getField(Telephone.ATTRIB.ext), person.getPhoneAt(1).getField(Telephone.ATTRIB.ext) == null);
-
- }
-
- public void testPersonAddress() throws Exception {
-
- Address address = getPerson().getAddressAt(0);
- assertTrue("Expecting Address.strNum to be 50. Actual was " +
- address.getField(Address.ATTRIB.strNum), address.getField(Address.ATTRIB.strNum).equals("50"));
- assertTrue("Expecting Address.strLine1 to be Balcarce. Actual was " +
- address.getField(Address.ATTRIB.strLine1), address.getField(Address.ATTRIB.strLine1).equals("Balcarce"));
- assertTrue("Expecting Address.twnCty1 to be San Isidro. Actual was " +
- address.getField(Address.ATTRIB.twnCty1), address.getField(Address.ATTRIB.twnCty1).equals("San Isidro"));
- assertTrue("Expecting Address.postalZip to be 1642. Actual was " +
- address.getField(Address.ATTRIB.postalZip), address.getField(Address.ATTRIB.postalZip).equals("1642"));
- assertTrue("Expecting Address.provSt to be Buenos Aires. Actual was " +
- address.getField(Address.ATTRIB.provSt), address.getField(Address.ATTRIB.provSt).equals("Buenos Aires"));
- assertTrue("Expecting Address.cntry to be Argentina. Actual was " +
- address.getField(Address.ATTRIB.cntry), address.getField(Address.ATTRIB.cntry).equals("Argentina"));
-
- // Phone
- assertTrue("Expecting Address.phone[0].role to be torIP. Actual was " +
- address.getPhoneAt(0).getRole(), address.getPhoneAt(0).getRole().equals("torIP"));
- assertTrue("Expecting Address.phone[0].country to be null. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.cntry), address.getPhoneAt(0).getField(Telephone.ATTRIB.cntry) == null);
- assertTrue("Expecting Address.phone[0].city to be 416. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.city), address.getPhoneAt(0).getField(Telephone.ATTRIB.city).equals("416"));
- assertTrue("Expecting Address.phone[0].num to be 555-1212. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.num), address.getPhoneAt(0).getField(Telephone.ATTRIB.num).equals("555-1212"));
- assertTrue("Expecting Address.phone[0].ext to be null. Actual was " +
- address.getPhoneAt(0).getField(Telephone.ATTRIB.ext), address.getPhoneAt(0).getField(Telephone.ATTRIB.ext) == null);
-
- assertTrue("Expecting Address.phone[1].role to be home. Actual was " +
- address.getPhoneAt(1).getRole(), address.getPhoneAt(1).getRole().equals("home"));
- assertTrue("Expecting Address.phone[1].country to be 54. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.cntry), address.getPhoneAt(1).getField(Telephone.ATTRIB.cntry).equals("54"));
- assertTrue("Expecting Address.phone[1].city to be 11. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.city), address.getPhoneAt(1).getField(Telephone.ATTRIB.city).equals("11"));
- assertTrue("Expecting Address.phone[1].num to be 4555-1111. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.num), address.getPhoneAt(1).getField(Telephone.ATTRIB.num).equals("4555-1111"));
- assertTrue("Expecting Address.phone[1].ext to be 7. Actual was " +
- address.getPhoneAt(1).getField(Telephone.ATTRIB.ext), address.getPhoneAt(1).getField(Telephone.ATTRIB.ext).equals("7"));
-
-
- }
-
-
-
-
-
- public void testToDTO() throws Exception {
- BaseBusinessObject personA = getPerson();
- personA.setPackage();
-
- BobjStdDTO oDto = personA.toDTO();
- System.out.println(oDto.toXml());
-
- Person personB = (Person) BaseBusinessObject.getFromDTO(oDto);
- System.out.println(personB.toDTO().toXml());
-
- assertTrue("Expecting PersonA == PersonB", personA.toDTO().toXml().equals(personB.toDTO().toXml()));
- }
-
-
- public static Person getPerson() throws Exception {
- Person oP = new Person((String) null);
- oP.setField(Person.ATTRIB.pfx, "Mr.");
- oP.setField(Person.ATTRIB.fmlyN, "Brum");
- oP.setField(Person.ATTRIB.givN, "Daniel");
- oP.setField(Person.ATTRIB.sfx, "the 1st.");
-
- oP.addAddress(getAddress());
-
- oP.addEmail(OneValue.getStringValue("myaddr at gmail.com", "home"));
- oP.addEmail(OneValue.getStringValue("john.smith at jboss.com", "work"));
-
- oP.addPhone(newPhone("basement", "1", "416", "555-1212", null));
- oP.addPhone(newPhone("cell", null, "416", "666-4444", null));
-
- return oP;
- }
-
- public static Address getAddress() throws Exception {
- Address oP = new Address((String) null);
- oP.setField(Address.ATTRIB.strNum, "50");
- oP.setField(Address.ATTRIB.strLine1, "Balcarce");
- oP.setField(Address.ATTRIB.twnCty1, "San Isidro");
- oP.setField(Address.ATTRIB.postalZip, "1642");
- oP.setField(Address.ATTRIB.provSt, "Buenos Aires");
- oP.setField(Address.ATTRIB.cntry, "Argentina");
-
- oP.addPhone(newPhone("torIP", null, "416", "555-1212", null));
- oP.addPhone(newPhone("home", "54", "11", "4555-1111", "7"));
-
- return oP;
- }
-
- public static Telephone newPhone(String p_sRole,
- String p_sCtry, String p_sCity, String p_sNum, String p_sExt) {
- Telephone oP = new Telephone((String) null);
- oP.setRole(p_sRole);
- oP.setField(Telephone.ATTRIB.cntry, p_sCtry);
- oP.setField(Telephone.ATTRIB.city, p_sCity);
- oP.setField(Telephone.ATTRIB.num, p_sNum);
- oP.setField(Telephone.ATTRIB.ext, p_sExt);
-
- return oP;
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters)
Deleted: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,65 +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.common.tests.parameters;
-
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.common.tests.BaseTest;
-
-public class ParamsRepositoryUnitTest extends BaseTest
-{
- ParamsRepository m_oRepos;
-
- /*
- public ParamsRepositoryUnitTest() throws Exception
- {
- m_oRepos = ParamsReposUtil.reposFromFactory(null,null);
- performTest();
- } //________________________________
-
- @SuppressWarnings("unused")
- private void performTest() throws Exception
- {
- String sDir = "/tmp/jbossEsb/paramsDir";
- Name oInpName = m_oRepos.nameFromString(sDir)
- .add("FileMoverConfigExample.xml");
-
- DomElement oElem = m_oRepos.getElement(oInpName);
-
- Name oOutName = m_oRepos.nameFromString(sDir)
- .add("outputTest.xml");
- m_oRepos.storeElement(oOutName,oElem);
-
- oElem = m_oRepos.getElement(oOutName);
- System.out.println(oElem.toString());
- } //________________________________
- */
-
- public void testNotImplementedUnitTest() {
- log.info("*******************************************");
- log.info("Requires Implementation");
- log.info("*******************************************");
- }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java)
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils)
Deleted: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,92 +0,0 @@
-package org.jboss.soa.esb.common.tests.utils;
-
-import javax.jms.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class DrainQueuesAndTopics
-{
- private static final int MAX_TIMES_NOMSG = 10;
- private static final String JNDI_URL = "localhost";
- private static final String JNDI_TYPE
- = AppServerContext.SERVER_TYPE.jboss.toString();
-
- private Context m_oCtx;
-
- public DrainQueuesAndTopics() throws Exception
- {
- purgeQueueTopic("queue/A");
- purgeQueueTopic("queue/B");
- purgeQueueTopic("topic/testTopic");
- } //__________________________________
-
- public int purgeQueueTopic(String p_sName) throws Exception
- {
- int iRet = 0;
- m_oCtx = AppServerContext.getServerContext(JNDI_TYPE,JNDI_URL);
-
- System.out.println(p_sName);
- MessageConsumer oCns = null;
- switch(p_sName.toLowerCase().charAt(0))
- { case 't' : oCns = getTopic(p_sName); break;
- case 'q' : oCns = getQueue(p_sName); break;
- }
- if (null==oCns)
- return 0;
-
- for (int iNoRcv=0; iNoRcv < MAX_TIMES_NOMSG; )
- { Message oMsg = oCns.receive(200);
- if (null==oMsg)
- { iNoRcv++;
- System.out.print(".");
- continue;
- }
- iRet++;
- dumpMessage(oMsg);
- iNoRcv = 0;
- }
- System.out.println();
- return iRet;
- } //__________________________________
-
- void dumpMessage(Message pM)
- {
- System.out.println(pM);
- } //__________________________________
-
- QueueReceiver getQueue(String p_sJndi) throws Exception
- {
- QueueConnection oQconn = null;
- QueueSession oQsess = null;
- QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx
- .lookup("ConnectionFactory");
-
- oQconn = qcf.createQueueConnection();
- oQsess = oQconn.createQueueSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
- Queue oQueue
- = (Queue) m_oCtx.lookup(p_sJndi);
-
- QueueReceiver oRcv = oQsess.createReceiver(oQueue);
- oQconn.start();
- return oRcv;
- } //__________________________________
-
- TopicSubscriber getTopic(String p_sJndi) throws Exception
- {
- TopicConnection oTconn = null;
- TopicSession oTsess = null;
- TopicConnectionFactory qcf = (TopicConnectionFactory) m_oCtx
- .lookup("ConnectionFactory");
-
- oTconn = qcf.createTopicConnection();
- oTsess = oTconn.createTopicSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
- Topic oT = (Topic) m_oCtx.lookup(p_sJndi);
-
- TopicSubscriber oRcv = oTsess.createSubscriber(oT);
- oTconn.start();
- return oRcv;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java)
Copied: labs/jbossesb/trunk/product/core/listeners (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners)
Deleted: labs/jbossesb/trunk/product/core/listeners/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/ant.bat 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/ant.bat 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Copied: labs/jbossesb/trunk/product/core/listeners/ant.bat (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/ant.bat)
Deleted: labs/jbossesb/trunk/product/core/listeners/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,94 +0,0 @@
-<?xml version="1.0"?>
-<project name="BuildJbossEsbListeners" default="org.jboss.esb.listeners.compile" basedir=".">
-
- <property name="org.jboss.esb.listeners.jar.name" value="jbossesb-listeners"/>
- <property name="org.jboss.esb.listeners.distrib.dir" value="${org.jboss.esb.internal.dest}/dist"/>
- <property name="org.jboss.esb.listeners.classes.dir" value="${org.jboss.esb.internal.dest}/classes/listeners"/>
- <property name="org.jboss.esb.listeners.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.listeners.base.classpath">
- <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="activation.jar jbossall-client.jar log4j.jar mail.jar"/>
- </path>
-
- <path id="org.jboss.esb.listeners.default.classpath">
- <path refid="org.jboss.esb.listeners.base.classpath"/>
- <pathelement location="${org.jboss.esb.classes.dir}"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/common"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/processors"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/services"/>
- </path>
-
- <target name="org.jboss.esb.listeners.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
- </target>
-
- <target name="org.jboss.esb.listeners.prepare" depends="org.jboss.esb.listeners.init">
- <mkdir dir="${org.jboss.esb.listeners.classes.dir}"/>
- <mkdir dir="${org.jboss.esb.listeners.distrib.dir}"/>
- <mkdir dir="${org.jboss.esb.listeners.distrib.dir}/lib"/>
- </target>
-
- <target name="clean" description="Remove classes directory">
- <delete dir="${org.jboss.esb.listeners.classes.dir}"/>
- </target>
-
- <target name="purge" depends="clean">
- </target>
-
-
-
- <target name="org.jboss.esb.listeners.compile">
- <!-- Compile listeners -->
- <antcall target="org.jboss.esb.listeners.internal.compile"/>
- <!-- Compile listener tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.listeners.tests.compile"/>
- </target>
-
-
-
- <target name="org.jboss.esb.listeners.internal.compile" depends="org.jboss.esb.listeners.prepare"
- description="Compile all classes">
-
- <javac
- destdir="${org.jboss.esb.listeners.classes.dir}"
- classpathref="org.jboss.esb.listeners.default.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.listeners.src.dir}"/>
- </javac>
-
- </target>
-
- <target name="recompile" depends="clean,org.jboss.esb.listeners.compile"
- description="Clean and compile"/>
-
- <target name="jar" depends="org.jboss.esb.listeners.compile" description="Assemble jar files">
- <delete file="${org.jboss.esb.listeners.distrib.dir}/lib/${org.jboss.esb.listeners.jar.name}.jar" />
- <jar destfile="${org.jboss.esb.listeners.distrib.dir}/lib/${org.jboss.esb.listeners.jar.name}.jar"
- basedir="${org.jboss.esb.listeners.classes.dir}"
- includes="**/*.class"
- excludes="test/**"
- />
- </target>
-
-
-
- <target name="org.jboss.esb.listeners.test" description="Run tests for this module">
- <!-- Compile listener tests -->
- <ant dir="tests" target="org.jboss.esb.listeners.internal.test"/>
- </target>
-
-
- <target name="all" depends="recompile,jar" />
-
-</project>
Copied: labs/jbossesb/trunk/product/core/listeners/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/build.xml)
Copied: labs/jbossesb/trunk/product/core/listeners/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,369 +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.*;
-
-import org.apache.log4j.*;
-
-import javax.naming.*;
-import javax.jms.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.processors.EsbAbstractProcessor;
-
-public abstract class AbstractPoller
-{
-
- protected abstract GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception;
-
- // You can override these three values at constructor time of your
- // derived class after calling super(String)
- protected int m_iMinPollMillis = 3000 // minimum polling interval
- ,m_iDfltPollMillis = 20000 // default polling interval
- ,m_iDfltReloadMillis= 180000 // default interval between
- // parameter reloading
- ;
-
- public static final String PARM_ACTION_CLASS = "actionClass";
-
- public static final String PARM_POLL_LTCY = "pollLatencySecs";
- public static final String PARM_RELOAD_LTCY = "parmsReloadSecs";
-
- public static final String PARM_TOPIC_CONN_FACT = "topicConnFactoryClass";
- public static final String PARM_QUIESCE_TOPIC = "quiesceTopic";
- public static final String PARM_QUIESCE_SELECTOR = "quiesceSelector";
-
- protected ThreadGroup m_oThrGrp = Thread.currentThread().getThreadGroup();
- protected Map<String,GroupOfChilds> m_omChildPrc
- = new HashMap<String,GroupOfChilds>();
-
- protected ParamsRepository m_oParmRepos;
- protected Name m_oParmsName;
- protected Logger m_oLogger;
-
- protected DomElement m_oParms;
- protected boolean m_bEndRequested;
-
- protected TopicConnection m_oTopicConn;
- protected TopicSession m_oSession;
- protected Topic m_oTopic;
- protected TopicSubscriber m_oTopicSubs;
-
-
-
- protected AbstractPoller(String p_sParamsUid) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
-
- String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
- m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- m_oParmsName = m_oParmRepos.nameFromString(p_sParamsUid);
- } //__________________________________
-
- protected void runUntilEndRequested() throws Exception
- { while (! m_bEndRequested)
- { try
- { String sMsg = (null == m_oParms)
- ? "Initial Parameter loading" : "Reloading Params";
- m_oLogger.info(formatLogMsg(sMsg));
- m_oParms = m_oParmRepos.getElement(m_oParmsName);
- }
- catch (Exception e)
- {
- StringBuilder sb = new StringBuilder ("Problems loading params ")
- .append(m_oParmsName)
- .append((null==m_oParms)? " exiting..." : "continuing to use cached params")
- ;
- m_oLogger.error(formatLogMsg(sb.toString()));
- if (null==m_oParms)
- throw e;
- }
- quiesceTopicSubscribe();
- executeOneCycle();
- }
- } //__________________________________
-
- private void executeOneCycle() throws Exception
- {
- String sAtt = m_oParms.getAttr(PARM_RELOAD_LTCY);
- long lNewLoad = System.currentTimeMillis()
- + ( (null != sAtt)
- ? (1000 * Integer.parseInt(sAtt))
- : m_iDfltReloadMillis
- );
-
- DomElement[] oaParms = m_oParms.getAllElemChildren();
-
- sAtt = m_oParms.getAttr(PARM_POLL_LTCY);
- long lPollLtcy = (null != sAtt)
- ? (1000 * Integer.parseInt(sAtt))
- : m_iDfltPollMillis;
-
- if (lPollLtcy < m_iMinPollMillis)
- lPollLtcy = m_iMinPollMillis;
-
- boolean bFirst = true;
- while (System.currentTimeMillis() <= lNewLoad)
- {
- for (DomElement oCurr : oaParms)
- {
- oneScan(oCurr, bFirst);
- }
- long lSlack = lNewLoad - System.currentTimeMillis();
- if (lSlack < 0)
- {
- break;
- }
- if (waitForQuiesce(Math.min(lSlack, lPollLtcy)))
- { m_bEndRequested = true;
- return;
- }
- bFirst = false;
- }
- } //_________________________________________
-
- protected String formatLogMsg(String p_s)
- { return new StringBuilder("Processor '")
- .append(getClass().getSimpleName()).append("' <")
- .append(p_s).append(">")
- .toString();
- } //__________________________________
-
- private final void quiesceTopicSubscribe() throws JMSException, NamingException
- {
- try
- {
- m_oTopicConn = null;
- m_oSession = null;
- m_oTopic = null;
- m_oTopicSubs = null;
-
- String sStopTopic = m_oParms.getAttr(PARM_QUIESCE_TOPIC);
- if (EsbUtil.isNullString(sStopTopic))
- return;
- String sFactClass = m_oParms.getAttr(PARM_TOPIC_CONN_FACT);
- if (EsbUtil.isNullString(sFactClass))
- sFactClass = "ConnectionFactory";
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
- Object tmp = oJndiCtx.lookup(sFactClass);
- TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
-
- m_oTopicConn = tcf.createTopicConnection();
- m_oTopic = (Topic) oJndiCtx.lookup(sStopTopic);
- m_oSession = m_oTopicConn.createTopicSession
- (false,TopicSession.AUTO_ACKNOWLEDGE);
- m_oTopicConn.start();
-
- String sSelector = m_oParms.getAttr(PARM_QUIESCE_SELECTOR);
- if (EsbUtil.isNullString(sSelector))
- sSelector = "processor='"+getClass().getSimpleName()+"'";
- m_oTopicSubs = m_oSession.createSubscriber(m_oTopic, sSelector,true);
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
- } //_________________________________________
-
- protected boolean waitForQuiesce(long p_lMillis) throws Exception
- {
- try
- { boolean bSleep = (null== m_oTopicSubs);
- Object oMsg = (bSleep) ? null : secureReceive(p_lMillis);
-
- if (null!=oMsg)
- { m_oLogger.info("Starting Quiesce of "
- +getClass().getSimpleName());
- return true;
- }
- if (bSleep)
- Thread.sleep(p_lMillis);
- return false;
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems with waitForQuiesce. ",e);
- Thread.sleep(p_lMillis);
- return false;
- }
- } //_________________________________________
-
- private Message secureReceive(long p_lMillis) throws Exception
- {
- while (true)
- try
- { return (null==m_oTopicSubs) ? null : m_oTopicSubs.receive(p_lMillis); }
- catch (JMSException e)
- {
- // put here your recovery code
- return null;
- }
-
- } //_________________________________________
-
-
- protected void oneScan(DomElement p_oP, boolean p_bFirst) throws Exception
- {
- String sPrcName = p_oP.getName();
- if (!m_omChildPrc.containsKey(sPrcName))
- {
- ThreadGroup[] oaCh = new ThreadGroup[m_oThrGrp.activeGroupCount()];
- int iMax = m_oThrGrp.enumerate(oaCh);
-
- ThreadGroup oThG = null;
- for (int i1 = 0; null == oThG && i1 < iMax; i1++)
- { if (m_oThrGrp.getName().equals(sPrcName))
- oThG = oaCh[i1];
- }
- if (null == oThG)
- oThG = new ThreadGroup(sPrcName);
- m_omChildPrc.put(sPrcName, newChildGroup(oThG));
- }
- GroupOfChilds oChildGrp = m_omChildPrc.get(sPrcName);
-
- if (null == oChildGrp) return;
- if (p_bFirst)
- oChildGrp.m_bError = false;
-
- try
- {
- oChildGrp.execute(p_oP);
- }
- catch (Exception e)
- {
- oChildGrp.m_bError = true;
- m_oLogger.error(formatLogMsg("GroupOfChilds.execute"), e);
- }
- } //_________________________________________
-
- protected String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
- throws Exception
- {
- String sVal = p_oP.getAttr(p_sAtt);
- if (null==sVal)
- sVal = p_sDefault;
- if (EsbUtil.isNullString(sVal) && (null==p_sDefault))
- throw new Exception(formatLogMsg("Missing or invalid <"+p_sAtt+"> attribute"));
-
- return sVal;
- } //________________________________
-
- protected abstract class GroupOfChilds implements Observer
- {
- protected abstract void doYourJob(DomElement p_oP) throws Exception;
-
- public static final String PARM_MAX_THREADS = "maxThreads";
-
- protected ThreadGroup m_oThrGrp;
- protected boolean m_bError = false;
-
- protected Class m_oExecClass;
- protected DomElement m_oChParms;
-
- protected int m_iQthr = 0, m_iMaxThr;
- protected StringBuilder m_sb;
- protected int m_iSbIni;
-
- protected GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception
- {
- m_oThrGrp = p_oThrGrp;
- m_sb = new StringBuilder("GroupOfThreads ")
- .append(m_oThrGrp.getName()).append(" : ");
- m_iSbIni = m_sb.length();
- } //________________________________
-
- public void update(Observable p_oObs, Object p_oUsrObj)
- {
- if (p_oUsrObj instanceof Integer)
- {
- updQthreads( ( (Integer) p_oUsrObj).intValue());
- }
- } //________________________________
-
- private synchronized void updQthreads(int p_i)
- {
- m_iQthr += p_i;
- } //________________________________
-
- private void execute(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- if (m_bError)
- {
- m_oLogger.warn(m_sb.append(" Skipping execution due to previous errors")
- .toString());
- return;
- }
- checkParms(p_oP);
- doYourJob (p_oP);
- } //________________________________
-
- protected void setMaxThreads(DomElement p_oP,int p_iMax)
- {
- String sAtt = p_oP.getAttr(PARM_MAX_THREADS);
- m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt);
- m_iMaxThr = (m_iMaxThr < 1) ? 1
- : (m_iMaxThr > p_iMax) ? p_iMax
- : m_iMaxThr;
-
- } //________________________________
-
- protected Class checkActionClass(String p_sName) throws Exception
- {
- Class oCls;
- try { oCls = Class.forName(p_sName); }
- catch (ClassNotFoundException e)
- { throw new Exception(formatLogMsg("Class "+p_sName
- +" not found in classpath"));
- }
- try { oCls.getConstructor(new Class[] {DomElement.class}); }
- catch (NoSuchMethodException eN)
- { throw new Exception(formatLogMsg("No appropriate constructor "
- +p_sName+"(DomElement) found for class "));
- }
- return oCls;
- } //_________________________________________
-
- // Very basic checkParms method
- // Remember to call super.checkParms(p_oP) in derived checkParms() methods
- // so your parameters will be cloned
- // and to add REAL parameter checking
- protected void checkParms(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- m_oChParms = p_oP.cloneObj();
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- setMaxThreads(p_oP,10);
- } //________________________________
-
- } //______________________________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,184 +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.*;
-import java.lang.reflect.Constructor;
-import java.net.*;
-import java.util.Observable;
-import java.util.Observer;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.processors.*;
-
-public class BetterDirListener extends AbstractPoller
-{
- public static void main(String[] args) throws Exception
- {
- new BetterDirListener(args[0]);
- } //________________________________
-
- public BetterDirListener(String p_sParamsUid) throws Exception
- {
- super(p_sParamsUid);
- m_iDfltReloadMillis = 180000;
- m_iDfltPollMillis = 20000;
- m_iMinPollMillis = 5000;
-// See superclass - It provides ability to request end by subscribing to a Topic
- runUntilEndRequested();
- } //__________________________________
-
- protected GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception
- {
- return new MyChildGroup(pThG);
- } //_________________________________________
-
- private class MyChildGroup extends AbstractPoller.GroupOfChilds
- {
- public static final String PARM_FILE_PROCESSOR_CLASS = "fileProcessorClass";
- public static final String PARM_INPUT_DIR = "inputDirURI";
- public static final String PARM_SUFFIX = "inputSuffix";
-
- private File m_oInpDir;
- private FileFilter m_oFFilt;
-
- private MyChildGroup(ThreadGroup p_oThrGrp) throws Exception
- { super(p_oThrGrp);
- } //________________________________
-
- @Override
- protected void doYourJob(DomElement p_oP) throws Exception
- {
- File[] oaF = m_oInpDir.listFiles(m_oFFilt);
-
- for (File oFcurr : oaF)
- {
- if (m_iQthr >= m_iMaxThr)
- {
- m_oLogger.info(m_sb.append("Waiting for available threads").toString());
- Thread.sleep(5000);
- break;
- }
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- DomElement oThisProc = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- oThisProc.setAttr(ParamsFileProcessor.FPRC_FILENAME, oFcurr.getName());
- m_oChParms.addElemChild(oThisProc);
-
- new Thread(m_oThrGrp,
- new FileChildProcess(m_oExecClass, this, m_oChParms)).start();
- Thread.sleep(500);
- }
- } //________________________________
-
- protected void checkParms(DomElement p_oP) throws Exception
- {
- super.checkParms(p_oP);
-
- String sAtt = m_oChParms.getAttr(PARM_INPUT_DIR);
- if (null == sAtt)
- { throw new Exception(formatLogMsg(
- m_sb.append("Missing ").append(PARM_INPUT_DIR)
- .append(" attribute in -parameters ")
- .toString()));
- }
- m_oInpDir = new File(new URI(sAtt));
- if (!m_oInpDir.isDirectory())
- { throw new Exception(formatLogMsg(
- m_sb.append(sAtt).append(" is not a directory").toString()));
- }
- if (!m_oInpDir.canRead())
- { throw new Exception(formatLogMsg(
- m_sb.append("Can't read directory ").append(sAtt).
- toString()));
- }
-
- sAtt = m_oChParms.getAttr(PARM_SUFFIX);
- if (null == sAtt)
- { throw new Exception(formatLogMsg(
- m_sb.append("Missing ").append(PARM_SUFFIX)
- .append(" attribute in -parameters ")
- .toString()));
- }
-
- m_oFFilt = new FileEndsWith(sAtt);
-
- sAtt = p_oP.getAttr(PARM_FILE_PROCESSOR_CLASS);
- m_oExecClass = null;
- if (null == sAtt)
- { throw new Exception(formatLogMsg(
- m_sb.append("Missing fileProcessorClass attribute").
- toString()));
- }
- m_oExecClass = super.checkActionClass(sAtt);
-
- } //________________________________
-
-
- private class FileEndsWith implements FileFilter
- {
- String m_sSuffix;
- FileEndsWith(String p_sEnd) throws Exception
- {
- m_sSuffix = p_sEnd;
- if (EsbUtil.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;
- } //_________________________________________
- } //___________________________________________________
- } //______________________________________________________
-
- protected static class FileChildProcess extends Observable implements Runnable
- { private Class m_oExecClass;
- private DomElement m_oParms;
- private Logger m_oLogger;
- public FileChildProcess(Class p_oExec, Observer p_oObs, DomElement p_oP)
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oExecClass = p_oExec;
- this.addObserver(p_oObs);
- m_oParms = p_oP;
- setChanged();
- notifyObservers(new Integer(1));
- } //__________________________________
-
- public void run()
- { try
- { Constructor oCnst = m_oExecClass.getConstructor(new Class[] {DomElement.class});
- Object oProc = oCnst.newInstance(new Object[] {m_oParms});
- ((EsbFileProcessor)oProc).execute();
- }
- catch (Exception e) { m_oLogger.error("run() FAILED",e); }
-
- setChanged();
- notifyObservers(new Integer(-1));
- } //__________________________________
- } //______________________________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/BetterDirListener.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,531 +0,0 @@
-package org.jboss.soa.esb.listeners;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Observer;
-import java.util.Observable;
-
-import org.apache.log4j.*;
-
-import javax.naming.*;
-import javax.jms.*;
-
-//import org.jboss.soa.esb.samples.loanbroker.domain.LoanBrokerConstants;
-import org.jboss.soa.esb.services.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.processors.*;
-
-public class JmsQueueListener
-{
- // You can override this value at constructor time of your
- // derived class after calling super(String)
- protected int m_iDfltReloadMillis= 180000 // default interval between
- // parameter reloading
- ;
-
- //attributes that need to be set in the xml parameter file for the service
- public static final String PARM_ACTION_CLASS = "actionClass";
-
- public static final String PARM_RELOAD_LTCY = "parmsReloadSecs";
-
- public static final String PARM_TOPIC_CONN_FACT = "topicConnFactoryClass";
- public static final String PARM_QUIESCE_TOPIC = "quiesceTopic";
- public static final String PARM_QUIESCE_SELECTOR = "quiesceSelector";
-
- public static final String LISTEN_QUEUE_CONN_FACT = "queueConnFactoryClass";
- public static final String LISTEN_QUEUE = "listenQueue";
- public static final String LISTEN_MSG_SELECTOR = "listenMsgSelector";
-
- protected ThreadGroup m_oThrGrp = Thread.currentThread().getThreadGroup();
- protected Map<String,GroupOfChilds> m_omChildPrc
- = new HashMap<String,GroupOfChilds>();
-
- protected ParamsRepository m_oParmRepos;
- protected Name m_oParmsName;
- protected Logger m_oLogger;
-
- protected DomElement m_oParms;
- protected boolean m_bEndRequested;
-
- protected TopicConnection m_oTopicConn;
- protected TopicSession m_oSession;
- protected Topic m_oTopic;
- protected TopicSubscriber m_oTopicSubs;
-
- protected long m_lNextReload;
-
-
-
- protected JmsQueueListener(String p_sParamsUid) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
-
- String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
- m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- m_oParmsName = m_oParmRepos.nameFromString(p_sParamsUid);
- runUntilEndRequested();
- } //__________________________________
-
- protected void runUntilEndRequested() throws Exception
- { while (! m_bEndRequested)
- { try
- { String sMsg = (null == m_oParms)
- ? "Initial Parameter loading" : "Reloading Params";
- m_oLogger.info(formatLogMsg(sMsg));
- m_oParms = m_oParmRepos.getElement(m_oParmsName);
- }
- catch (Exception e)
- {
- StringBuilder sb = new StringBuilder ("Problems loading params ")
- .append(m_oParmsName)
- .append((null==m_oParms)? " exiting..." : "continuing to use cached params")
- ;
- m_oLogger.error(formatLogMsg(sb.toString()));
- if (null==m_oParms)
- throw e;
- }
- quiesceTopicSubscribe();
- executeOneCycle();
- }
- } //__________________________________
-
- private void executeOneCycle() throws Exception
- {
- String sAtt = m_oParms.getAttr(PARM_RELOAD_LTCY);
- m_lNextReload = System.currentTimeMillis()
- + ( (null != sAtt)
- ? (1000 * Integer.parseInt(sAtt))
- : m_iDfltReloadMillis
- );
-
- DomElement[] oaParms = m_oParms.getAllElemChildren();
-
- boolean bFirst = true;
- while (System.currentTimeMillis() <= m_lNextReload)
- {
- for (DomElement oCurr : oaParms)
- {
- oneScan(oCurr, bFirst);
- }
- if (waitForQuiesce(1000))
- { m_bEndRequested = true;
- return;
- }
- bFirst = false;
- }
- } //_________________________________________
-
- protected String formatLogMsg(String p_s)
- { return new StringBuilder("Processor '")
- .append(getClass().getSimpleName()).append("' <")
- .append(p_s).append(">")
- .toString();
- } //__________________________________
-
- private final void quiesceTopicSubscribe() throws JMSException, NamingException
- {
- try
- {
- m_oTopicConn = null;
- m_oSession = null;
- m_oTopic = null;
- m_oTopicSubs = null;
-
- String sStopTopic = m_oParms.getAttr(PARM_QUIESCE_TOPIC);
- if (EsbUtil.isNullString(sStopTopic))
- return;
- String sFactClass = m_oParms.getAttr(PARM_TOPIC_CONN_FACT);
- if (EsbUtil.isNullString(sFactClass))
- sFactClass = "ConnectionFactory";
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
- Object tmp = oJndiCtx.lookup(sFactClass);
- TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
-
- m_oTopicConn = tcf.createTopicConnection();
- m_oTopic = (Topic) oJndiCtx.lookup(sStopTopic);
- m_oSession = m_oTopicConn.createTopicSession
- (false,TopicSession.AUTO_ACKNOWLEDGE);
- m_oTopicConn.start();
-
- String sSelector = m_oParms.getAttr(PARM_QUIESCE_SELECTOR);
- if (EsbUtil.isNullString(sSelector))
- sSelector = "processor='"+getClass().getSimpleName()+"'";
- m_oTopicSubs = m_oSession.createSubscriber(m_oTopic, sSelector,true);
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
- } //_________________________________________
-
- protected boolean waitForQuiesce(long p_lMillis) throws Exception
- {
- try
- { boolean bSleep = (null== m_oTopicSubs);
- Object oMsg = (bSleep) ? null : secureQuiesceReceive(p_lMillis);
-
- if (null!=oMsg)
- { m_oLogger.info("Starting Quiesce of "
- +getClass().getSimpleName());
- return true;
- }
- if (bSleep)
- Thread.sleep(p_lMillis);
- return false;
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems with waitForQuiesce. ",e);
- Thread.sleep(p_lMillis);
- return false;
- }
- } //_________________________________________
-
- private Message secureQuiesceReceive(long p_lMillis) throws Exception
- {
- while (true)
- try
- { return (null==m_oTopicSubs) ? null : m_oTopicSubs.receive(p_lMillis); }
- catch (JMSException e)
- {
- // put here your recovery code
- return null;
- }
-
- } //_________________________________________
-
-
- protected void oneScan(DomElement p_oP, boolean p_bFirst) throws Exception
- {
- String sPrcName = p_oP.getName();
- if (!m_omChildPrc.containsKey(sPrcName))
- {
- ThreadGroup[] oaCh = new ThreadGroup[m_oThrGrp.activeGroupCount()];
- int iMax = m_oThrGrp.enumerate(oaCh);
-
- ThreadGroup oThG = null;
- for (int i1 = 0; null == oThG && i1 < iMax; i1++)
- { if (m_oThrGrp.getName().equals(sPrcName))
- oThG = oaCh[i1];
- }
- if (null == oThG)
- oThG = new ThreadGroup(sPrcName);
- m_omChildPrc.put(sPrcName, newChildGroup(oThG));
- }
- GroupOfChilds oChildGrp = m_omChildPrc.get(sPrcName);
-
- if (null == oChildGrp) return;
- if (p_bFirst)
- oChildGrp.m_bError = false;
-
- try
- {
- oChildGrp.execute(p_oP);
- }
- catch (Exception e)
- {
- oChildGrp.m_bError = true;
- m_oLogger.error(formatLogMsg("GroupOfChilds.execute"), e);
- }
- } //_________________________________________
-
- protected GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception
- { return new GroupOfChilds(pThG); }
-
- protected class GroupOfChilds implements Observer
- {
- public static final String PARM_MAX_THREADS = "maxThreads";
-
- protected ThreadGroup m_oThrGrp;
- protected boolean m_bError = false;
-
- protected Class m_oExecClass;
- protected DomElement m_oChParms;
-
- protected int m_iQthr = 0, m_iMaxThr;
- protected StringBuilder m_sb;
- protected int m_iSbIni;
-
- protected QueueConnection m_oQconn;
- protected QueueSession m_oQsess;
- protected Queue m_oQueue;
-
- protected String m_sSelectorService;
-
- protected GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception
- {
- m_oThrGrp = p_oThrGrp;
- m_sb = new StringBuilder("GroupOfThreads ")
- .append(m_oThrGrp.getName()).append(" : ");
- m_iSbIni = m_sb.length();
- } //________________________________
-
- public void update(Observable p_oObs, Object p_oUsrObj)
- {
- if (p_oUsrObj instanceof Integer)
- {
- updQthreads( ( (Integer) p_oUsrObj).intValue());
- }
- } //________________________________
-
- private synchronized void updQthreads(int p_i)
- {
- m_iQthr += p_i;
- } //________________________________
-
- private void execute(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- if (m_bError)
- {
- m_oLogger.warn(m_sb.append(" Skipping execution due to previous errors")
- .toString());
- return;
- }
- checkParms(p_oP);
- doYourJob (p_oP);
- } //________________________________
-
- protected void setMaxThreads(DomElement p_oP,int p_iMax)
- {
- String sAtt = p_oP.getAttr(PARM_MAX_THREADS);
- m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt);
- m_iMaxThr = (m_iMaxThr < 1) ? 1
- : (m_iMaxThr > p_iMax) ? p_iMax
- : m_iMaxThr;
-
- } //________________________________
-
- protected Class checkActionClass(String p_sName) throws Exception
- {
- Class oCls;
- try { oCls = Class.forName(p_sName); }
- catch (ClassNotFoundException e)
- { throw new Exception(formatLogMsg("Class "+p_sName
- +" not found in classpath"));
- }
- try { oCls.getConstructor(new Class[] {DomElement.class}); }
- catch (NoSuchMethodException eN)
- { throw new Exception(formatLogMsg("No appropriate constructor "
- +p_sName+"(DomElement) found for class "));
- }
- return oCls;
- } //_________________________________________
-
- protected String obtainAtt(DomElement p_oP, String p_sAtt, String p_sDefault)
- throws Exception
- {
- String sVal = p_oP.getAttr(p_sAtt);
- if (null==sVal)
- sVal = p_sDefault;
- if (EsbUtil.isNullString(sVal) && (null==p_sDefault))
- throw new Exception(formatLogMsg("Missing or invalid <"+p_sAtt+"> attribute"));
-
- return sVal;
- } //________________________________
-
- protected void checkParms(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- m_oChParms = p_oP.cloneObj();
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- setMaxThreads(p_oP,1);
-
- obtainAtt(p_oP,LISTEN_QUEUE,null);
-
- m_sSelectorService = obtainAtt(p_oP,LISTEN_MSG_SELECTOR,null);
-
-
-
-
- String sClass = obtainAtt(p_oP,PARM_ACTION_CLASS,null);
- if (EsbUtil.isNullString(sClass))
- throw new Exception(formatLogMsg("Missing value for "+PARM_ACTION_CLASS));
- m_oExecClass = Class.forName(sClass);
- } //________________________________
-
- protected final void obtainQueue(DomElement p_oP) throws JMSException, NamingException
- {
- try
- {
- m_oQconn = null;
- m_oQsess = null;
- m_oQueue = null;
-
- String sQueue = p_oP.getAttr(LISTEN_QUEUE);
- String sFactClass = p_oP.getAttr(LISTEN_QUEUE_CONN_FACT);
- if (EsbUtil.isNullString(sFactClass))
- sFactClass = "ConnectionFactory";
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
- 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();
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
- } //_________________________________________
-
- protected void doYourJob(DomElement p_oP) throws Exception
- {
- while(System.currentTimeMillis() < m_lNextReload)
- {
- if (m_iQthr > m_iMaxThr)
- { m_oLogger.info(m_sb.append("Waiting for available threads").toString());
- m_sb.setLength(m_iSbIni);
- Thread.sleep(5000);
- continue;
- }
- obtainQueue(p_oP);
- //String sSelector = m_oParms.getAttr(LISTEN_MSG_SELECTOR);
- MessageConsumer oReader = m_oQsess.createReceiver(m_oQueue, m_sSelectorService);
- Message oMsg = (null==oReader) ? null
- : oReader.receiveNoWait();
- if (null==oMsg)
- { Thread.sleep(1000);
- continue;
- }
-
- MsgChildProcess oNew = getMsgChildProcess(this,oMsg);
- new Thread(m_oThrGrp,oNew).start();
- // Wait a little bit, so thread count will be updated
- // at some point in the past, this sleep was indispensable
- // new thread control classes in Java 5 might have solved the problem
- Thread.sleep(500);
- }
- } //________________________________
-
- protected MsgChildProcess getMsgChildProcess
- (GroupOfChilds pDad, Message pMsg) throws Exception
- { return new MsgChildProcess (pDad,pMsg); }
-
- } //______________________________________________________
-
- protected class MsgChildProcess extends Observable implements Runnable
- {
- protected GroupOfChilds m_oParent; // you can always go there for common stuff
- protected Message m_oMsg;
-
- public MsgChildProcess(GroupOfChilds p_oGrp, Message p_oMsg)
- throws Exception
- {
- m_oParent = p_oGrp;
- m_oMsg = p_oMsg;
- this.addObserver(m_oParent);
- setChanged();
- // add 1 to child thread count
- notifyObservers(new Integer(1));
- } //__________________________________
-
- public void run()
- {
- Exception oAbend = null;
- try
- {
- Constructor oCnst = m_oParent.m_oExecClass
- .getConstructor (new Class[] {DomElement.class});
- DomElement oParms = m_oParent.m_oChParms.cloneObj();
- Object oInst = oCnst.newInstance (new Object[] {oParms});
- EsbMsgProcessor oMP = (EsbMsgProcessor)oInst;
- oMP.processMessage(m_oMsg);
-
- }
- catch (Exception e)
- { m_oLogger.error("run() FAILED",e);
- oAbend = e;
- }
-
- if (null==oAbend)
- notifyOK();
- else
- notifyError(oAbend);
-
- setChanged();
- // decrease child thread count in parent group
- notifyObservers(new Integer(-1));
- } //______________________________
-
- public void notifyOK()
- { try
- {
- String sNotif = getOkNotifContent();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isOK()) continue;
- getNotifHandler().sendNotifications(oCurr,sNotif);
- }
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void notifyError(Exception p_e)
- {
- String sNotif = getErrorNotifContent();
- ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try
- { oPS.println(sNotif);
- if (null != p_e) p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isErr()) continue;
- getNotifHandler().sendNotifications(oNL,sMsg);
- }
- }
- catch (Exception e) { }
- } //__________________________________
-
- protected InotificationHandler getNotifHandler()
- {
- try { return NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- }
- catch (Exception e)
- { m_oLogger.error(formatLogMsg("Notification FAILED"),e);
- return null;
- }
- } //______________________________
-
- // These methods to be overriden by you own derived class
- protected String getOkNotifContent()
- {
- return "Success";
- }
- protected String getErrorNotifContent()
- {
- return "FAILURE";
- }
-
- } //______________________________________________________
-
- public static void main(String[] args) throws Exception
- {
- new JmsQueueListener(args[0]);
- }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,440 +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.*;
-import java.lang.reflect.Constructor;
-import java.net.*;
-import java.util.*;
-
-import org.apache.log4j.*;
-
-import javax.naming.*;
-import javax.jms.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.parameters.*;
-import org.jboss.soa.esb.processors.*;
-
-//import org.jboss.soa.esb.nagios.*;
-
-public class OldDirListener
-{
- public static void main(String[] args) throws Exception
- {
- new OldDirListener(args[0]);
- } //________________________________
-
- public static final String PARM_POLL_LTCY = "pollLatency";
- public static final String PARM_RELOAD_LTCY = "reloadLatency";
-
- public static final String PARM_MAX_THREADS = "maxThreads";
- public static final String PARM_FILE_PROCESSOR_CLASS = "fileProcessorClass";
-
- public static final String PARM_INPUT_DIR = "inputDirURI";
- public static final String PARM_SUFFIX = "inputSuffix";
-
- private Map<String,GroupOfChilds> m_omChildPrc
- = new HashMap<String,GroupOfChilds>();
-
- private ThreadGroup m_oThrGrp = Thread.currentThread().getThreadGroup();
-
- private Logger m_oLogger;
- private DomElement m_oParms;
- private ParamsRepository m_oParmRepos;
-
- private TopicConnection m_oTopicConn = null;
- private TopicSession m_oSession = null;
- private Topic m_oTopic = null;
- private TopicSubscriber m_oTopicSub = null;
-
- public OldDirListener(String p_sParamsUid) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
-// setupSubscribe();
- /*
- * Removing Nagios integration
- try
- {
- String sNagServer = System.getProperty("jbossEsb.nagios.server");
- if (sNagServer != null)
- {
- int iNagPort = Integer.parseInt
- (System.getProperty("jbossEsb.nagios.port","5667"));
- String sNagService =
- System.getProperty("jbossEsb.nagios.service");
- new NagiosStandaloneHeartbeat(
- sNagServer, iNagPort, sNagService, "rosetta-listener-service");
- }
- }
- catch (Exception eNagios)
- {
- m_oLogger.info("Problems with Nagios Notification", eNagios);
- }
- */
-
- String sFactoryClass = EsbSysProps.getParamsReposFactoryClass();
- m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
-
- Name oParms = m_oParmRepos.nameFromString(p_sParamsUid);
- while (loadParmsCycle(oParms))
- {
- }
- } //__________________________________
-
- protected boolean loadParmsCycle(Name p_oParams) throws Exception
- {
- String sMsg = (null == m_oParms)
- ? "Initial Parameter loading" : "Reloading Params";
- m_oLogger.info(sMsg);
-
- try
- {
- m_oParms = m_oParmRepos.getElement(p_oParams);
- }
- catch (Exception e)
- {
- m_oLogger.warn("Failed to load parameters");
- if (null == m_oParms)
- {
- throw e;
- }
- }
-
- String sAtt = m_oParms.getAttr(PARM_RELOAD_LTCY);
- long lNewLoad = System.currentTimeMillis()
- + ( (null != sAtt) ? (1000 * Integer.parseInt(sAtt)) : 180000);
- DomElement[] oaParms = m_oParms.getAllElemChildren();
-
- sAtt = m_oParms.getAttr(PARM_POLL_LTCY);
- long lPollLtcy = (null != sAtt) ? (1000 * Integer.parseInt(sAtt)) : 20000;
- if (lPollLtcy < 3000)
- {
- lPollLtcy = 3000;
-
- }
- boolean bFirst = true;
- while (System.currentTimeMillis() <= lNewLoad)
- {
- for (DomElement oCurr : oaParms)
- {
- oneScan(oCurr, bFirst);
- }
- long lSlack = lNewLoad - System.currentTimeMillis();
- if (lSlack < 0)
- {
- break;
- }
- if (waitForQuiesce(Math.min(lSlack, lPollLtcy)))
- {
- return false;
- }
- bFirst = false;
- }
- return true;
- } //_________________________________________
-
- public void setupSubscribe() throws JMSException, NamingException
- {
- try
- {
- String sStopTopic = "topic/quiesce";
- StringBuilder sb = new StringBuilder("processor='OldDirListener'");
-
- String sJndiType = EsbSysProps.getJndiServerType();
- String sJndiServer = EsbSysProps.getJndiServerURL();
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiServer);
-
- Object tmp = oJndiCtx.lookup("UIL2ConnectionFactory");
- TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
- m_oTopicConn = tcf.createTopicConnection();
- m_oTopic = (Topic) oJndiCtx.lookup(sStopTopic);
- m_oSession = m_oTopicConn.createTopicSession
- (false,TopicSession.AUTO_ACKNOWLEDGE);
- m_oTopicConn.start();
- m_oTopicSub = m_oSession.createSubscriber(m_oTopic, sb.toString(),true);
- }
- catch (Exception e)
- { m_oLogger.error("Problems connecting to JMS. ",e);
- }
-
-
- } //_________________________________________
-
- private boolean waitForQuiesce(long p_lMillis) throws Exception
- {
- try
- { boolean bRec = false;
-
- if (null != secureReceive(p_lMillis))
- { bRec = true;
- m_oLogger.info("Starting Quiesce of Listener. ");
- }
- else
- Thread.sleep(p_lMillis);
- return bRec;
-
- }
- catch (Exception e)
- { m_oLogger.error("Problems with waitForQuiesce. ",e);
- Thread.sleep(p_lMillis);
- return false;
- }
- } //_________________________________________
-
- private Object secureReceive(long p_lMillis) throws Exception
- {
- while (true)
- try
- { return (null==m_oTopicSub) ? null : m_oTopicSub.receive(p_lMillis); }
- catch (JMSException e)
- {
- // put here your recovery code
- return null;
- }
-
- } //_________________________________________
-
-
- private void oneScan(DomElement p_oP, boolean p_bFirst) throws Exception
- {
- String sPrcName = p_oP.getName();
- if (!m_omChildPrc.containsKey(sPrcName))
- {
- ThreadGroup[] oaCh = new ThreadGroup[m_oThrGrp.activeGroupCount()];
- int iMax = m_oThrGrp.enumerate(oaCh);
-
- ThreadGroup oThG = null;
- for (int i1 = 0; null == oThG && i1 < iMax; i1++)
- { if (m_oThrGrp.getName().equals(sPrcName))
- oThG = oaCh[i1];
- }
- if (null == oThG)
- oThG = new ThreadGroup(sPrcName);
- m_omChildPrc.put(sPrcName, new GroupOfChilds(oThG));
- }
- GroupOfChilds oCnt = m_omChildPrc.get(sPrcName);
-
- if (null == oCnt) return;
- if (p_bFirst)
- oCnt.m_bError = false;
-
- try
- {
- oCnt.execute(p_oP);
- }
- catch (Exception e)
- {
- oCnt.m_bError = true;
- m_oLogger.error("GroupOfChilds.execute", e);
- }
- } //_________________________________________
-
- private class GroupOfChilds implements Observer
- {
- private ThreadGroup m_oThrGrp;
- private boolean m_bError = false;
-
- private File m_oInpDir;
- private FileFilter m_oFFilt;
- private Class m_oExecClass;
- private DomElement m_oChParms;
- private int m_iQthr = 0, m_iMaxThr;
- private StringBuilder m_sb;
- private int m_iSbIni;
-
- private GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception
- {
- m_oThrGrp = p_oThrGrp;
- m_sb = new StringBuilder("GroupOfThreads ")
- .append(m_oThrGrp.getName()).append(" : ");
- m_iSbIni = m_sb.length();
- } //________________________________
-
- public void update(Observable p_oObs, Object p_oUsrObj)
- {
- if (p_oUsrObj instanceof Integer)
- {
- updQthreads( ( (Integer) p_oUsrObj).intValue());
- }
- } //________________________________
-
- private synchronized void updQthreads(int p_i)
- {
- m_iQthr += p_i;
- } //________________________________
-
- private void execute(DomElement p_oP) throws Exception
- {
- m_sb.setLength(m_iSbIni);
- if (m_bError)
- {
- m_oLogger.warn(m_sb.append(" Skipping execution due to previous errors")
- .toString());
- return;
- }
- checkParms(p_oP);
-
- File[] oaF = m_oInpDir.listFiles(m_oFFilt);
-
- for (File oFcurr : oaF)
- {
- if (m_iQthr >= m_iMaxThr)
- {
- m_oLogger.info(m_sb.append("Waiting for available threads").toString());
- Thread.sleep(5000);
- break;
- }
- m_oChParms.rmvChildsByName(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- DomElement oThisProc = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- oThisProc.setAttr(ParamsFileProcessor.FPRC_FILENAME, oFcurr.getName());
- m_oChParms.addElemChild(oThisProc);
-
- new Thread(m_oThrGrp,
- new ChildProcess(m_oExecClass, this, m_oChParms)).start();
- Thread.sleep(500);
- }
- } //________________________________
-
- protected void checkParms(DomElement p_oP) throws Exception
- {
- String sAtt = p_oP.getAttr(PARM_MAX_THREADS);
- m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt);
- if (m_iMaxThr > 10)
- {
- m_iMaxThr = 10;
- }
- String sUid = p_oP.getName();
- m_oChParms = p_oP.cloneObj();
- sAtt = m_oChParms.getAttr(PARM_INPUT_DIR);
- if (null == sAtt)
- {
- throw new Exception(m_sb.append("Missing ").append(PARM_INPUT_DIR)
- .append(" attribute in -parameters ")
- .append(sUid).toString());
- }
- m_oInpDir = new File(new URI(sAtt));
- if (!m_oInpDir.isDirectory())
- {
- throw new Exception(m_sb.append(sAtt).append(" is not a directory").
- toString());
- }
- if (!m_oInpDir.canRead())
- {
- throw new Exception(m_sb.append("Can't read directory ").append(sAtt).
- toString());
- }
-
- sAtt = m_oChParms.getAttr(PARM_SUFFIX);
- if (null == sAtt)
- {
- throw new Exception(m_sb.append("Missing ").append(PARM_SUFFIX)
- .append(" attribute in -parameters ")
- .append(sUid).toString());
- }
-
- m_oFFilt = new FileEndsWith(sAtt);
-
- do
- {
- sAtt = p_oP.getAttr(PARM_FILE_PROCESSOR_CLASS);
- m_oExecClass = null;
- if (null == sAtt)
- {
- throw new Exception(m_sb.append("Missing actionClass attribute").
- toString());
- }
- try
- {
- m_oExecClass = Class.forName(sAtt);
- }
- catch (ClassNotFoundException e)
- {
- throw new Exception(m_sb.append("Class ").append(sAtt)
- .append(" not found in classpath").toString());
- }
- try
- {
- m_oExecClass.getConstructor(new Class[] {DomElement.class});
- }
- catch (NoSuchMethodException eN)
- {
- throw new Exception(m_sb.append("No appropriate constructor")
- .append(" (DomElement) found for class").toString());
- }
- }
- while (false);
- } //________________________________
-
- private class FileEndsWith implements FileFilter
- {
- String m_sSuffix;
- FileEndsWith(String p_sEnd) throws Exception
- {
- m_sSuffix = p_sEnd;
- if (null == m_sSuffix)
- {
- throw new Exception("Must specify file extension");
- }
- } //_________________________________________
-
- public boolean accept(File p_f)
- {
- if (!p_f.isFile())
- {
- return false;
- }
- return p_f.toString().endsWith(m_sSuffix);
- } //_________________________________________
- } //___________________________________________________
- } //______________________________________________________
-
- private static class ChildProcess extends Observable implements Runnable
- { private Class m_oExecClass;
- private DomElement m_oParms;
- private Logger m_oLogger;
- public ChildProcess(Class p_oExec, Observer p_oObs, DomElement p_oP)
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oExecClass = p_oExec;
- this.addObserver(p_oObs);
- m_oParms = p_oP;
- setChanged();
- notifyObservers(new Integer(1));
- } //__________________________________
-
- public void run()
- { try
- { Constructor oCnst = m_oExecClass.getConstructor(new Class[] {DomElement.class});
- Object oProc = oCnst.newInstance(new Object[] {m_oParms});
- ((EsbFileProcessor)oProc).execute();
- }
- catch (Exception e) { m_oLogger.error("run() FAILED",e); }
-
- setChanged();
- notifyObservers(new Integer(-1));
- } //__________________________________
- } //____________________________________________________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/OldDirListener.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,601 +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.*;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.*;
-import java.sql.*;
-import javax.sql.*;
-
-import org.jboss.soa.esb.services.InotificationHandler;
-import org.jboss.soa.esb.services.NotificationHandlerFactory;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.EsbSysProps;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.notification.NotificationList;
-import org.jboss.soa.esb.processors.*;
-/**
- * SqlTablePoller class
- *
- * the "main(args)" static method of this class will:
- * 1) load the parameters from the Name supplied in args[0] into a DomElement
- * (See org.jboss.soa.esb.parameters package for options on parameter repositories)
- * 2) for each child element (1st level) of the DomElement, it will try to initiate
- * a Thread group that can start a maximum of simultaneous child threads
- * "maxThreads" supplied in parameters - default=1
- * 3) each thread group will poll a SQL table with parameters defined in the corresponding
- * DomElement (example below has only 1 child element, but you can have several)
- * 4) Execution will orderly finish when a message is received in the "quiesceTopic"
- * with an optional "quiesceSelector" (please see AbstractPoller class constants)
- *
- * The SQL table(s) that is (are) 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)
- * this column will be updated by the SqlChildProcess.run() method (see internal
- * protected class SqlChildProcess)
- *
- * 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), with an added child
- * DomElement (see EsbAbstractProcessor.PARMS_THIS_INSTANCE) containing attributes
- * corresponding to the values of the "selectFields" columns in the row that triggered
- * the "actionClass"
- *
- * The ZZDummyProcessor (in this package) is a trivial actionClass included with the
- * sole purpose of illustrating what the actionClass will receive, and the entry points
- * where users can insert their logic
- *
- * GOOD LUCK !!
- *
- * @author Esteban Schifman
- */
-public class SqlTablePoller extends AbstractPoller
-{
-/* ___________________ Example XML configuration file for a SqlTablePoller_______________
- *
-<DocumentElementName>
- <ExampleListenChapter
- pollLatencySecs="20"
- parmsReloadSecs="300"
-
- maxThreads="2"
-
- actionClass="org.jboss.soa.esb.listeners.ZZDummyProcessor"
-
- 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>();
-
- /**
- * Main program for SqlTablePoller
- * @param args - String[] First parameter must be path to configuration XML file
- * @throws Exception
- */
- public static void main(String[] args) throws Exception
- {
- new SqlTablePoller(args[0]);
- } //________________________________
-
-
- public SqlTablePoller(String p_sParamsUid) throws Exception
- {
- super(p_sParamsUid);
- m_iDfltReloadMillis = 180000;
- m_iDfltPollMillis = 20000;
- m_iMinPollMillis = 5000;
-// See superclass - It provides ability to request end by subscribing to a Topic
- runUntilEndRequested();
- } //__________________________________
-
- /**
- * Override this method if you wish to extend the SqlChildProcess class
- * (for example with ad-hoc notifications for OK list or Error list)
- * @param p_oParms = DomElement containing attributes of trigger
- * @return the SqlChildProcess to be started
- * @throws Exception
- */
- protected SqlChildProcess getSqlChildProcess
- (SqlPollerChildGroup pDad, DomElement p_oParms) throws Exception
- {
- return new SqlChildProcess(pDad, p_oParms);
- } //________________________________
-
- @Override
- protected GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception
- {
- return new SqlPollerChildGroup(pThG);
- } //__________________________________
-
- protected class SqlPollerChildGroup extends AbstractPoller.GroupOfChilds
- {
- JdbcCleanConn m_oConn;
- String[] m_saKeys;
-
- protected SqlPollerChildGroup(ThreadGroup p_oThrGrp) throws Exception
- { super(p_oThrGrp);
- } //________________________________
-
- protected void checkAtt(DomElement p_oP,String p_sAtt, String p_sDefault)
- throws Exception
- { m_oVals.put(p_sAtt,obtainAtt(p_oP,p_sAtt,p_sDefault));
- } //________________________________
-
- protected void checkParms(DomElement p_oP) throws Exception
- {
- super.checkParms(p_oP);
-
- checkAtt(p_oP,SimpleDataSource.DRIVER ,null);
- checkAtt(p_oP,SimpleDataSource.URL ,null);
- checkAtt(p_oP,SimpleDataSource.USER ,"");
- checkAtt(p_oP,SimpleDataSource.PASSWORD ,"");
-
- for (TABLE_ATT oCurr : TABLE_ATT.values())
- checkAtt(p_oP,oCurr.toString(),null);
-
- checkAtt(p_oP,OPTIONAL_ATT.whereCondition.toString(),"");
- checkAtt(p_oP,OPTIONAL_ATT.orderBy.toString(),"");
-
- String sAtt = OPTIONAL_ATT.inProcessVals.toString();
- checkAtt(p_oP,sAtt,DEFAULT_STATES);
- String sStates = m_oVals.get(sAtt);
- if (sStates.length()<4)
- throw new Exception(formatLogMsg
- ("Parameter <"+sAtt+"> must be at least 4 characters long (PWED)"
- ));
-
- checkAtt(p_oP,PARM_ACTION_CLASS,null);
- m_oExecClass = super.checkActionClass(m_oVals.get(PARM_ACTION_CLASS));
-
- StringTokenizer ST = new StringTokenizer
- (m_oVals.get(TABLE_ATT.selectFields.toString()),",");
- Set<String> oSelFlds = new HashSet<String>();
- while (ST.hasMoreElements())
- oSelFlds.add(ST.nextToken().trim());
-
- ST = new StringTokenizer
- (m_oVals.get(TABLE_ATT.keyFields.toString()),",");
- m_saKeys = new String[ST.countTokens()];
- if (m_saKeys.length < 1)
- throw new Exception(formatLogMsg("Empty list of keyFields"));
-
- for (int iCurr = 0; ST.hasMoreTokens(); iCurr++)
- { String sKey = ST.nextToken().trim();
- if (! oSelFlds.contains(sKey))
- throw new Exception(formatLogMsg("Key field <"+ sKey + "> must also be in select list"));
- m_saKeys[iCurr] = sKey;
- }
-
- } //________________________________
-
- @Override
- protected void doYourJob(DomElement p_oP) throws Exception
- {
- for (DomElement oCurr : getTriggers())
- {
- if (m_iQthr >= m_iMaxThr)
- {
- m_oLogger.info(m_sb.append("Waiting for available threads").toString());
- Thread.sleep(5000);
- break;
- }
-
- SqlChildProcess oNew = getSqlChildProcess(this,oCurr);
- new Thread(m_oThrGrp,oNew).start();
- // Wait a little bit, so thread count will be updated
- // at some point in the past, this sleep was indispensable
- // new thread control classes in Java 5 might have solved the problem
- Thread.sleep(500);
- }
-
- } //________________________________
-
- protected List<DomElement> getTriggers() throws Exception
- {
- JdbcCleanConn oConn = newDbConn();
- String sScan = scanStatement();
-
- PreparedStatement PS = oConn.prepareStatement(sScan);
- ResultSet RS = oConn.execQueryWait(PS,1);
-
- ResultSetMetaData oMeta = RS.getMetaData();
- String[] saColName = new String[oMeta.getColumnCount()];
- for (int i1=0; i1<saColName.length; i1++)
- saColName[i1] = oMeta.getColumnName(1+i1);
-
- List<DomElement> oResults = new ArrayList<DomElement>();
- while (RS.next())
- { DomElement oNew = new DomElement(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- for (String sCurrCol : saColName)
- oNew.setAttr(sCurrCol,RS.getString(sCurrCol));
- oResults.add(oNew);
- }
- oConn.release();
-
- 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 = ! EsbUtil.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 (! EsbUtil.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();
- } //________________________________
-
- } //______________________________________________________
-
- /**
- * The child process group will try to start a new thread for each
- * element in the ResultSet returned by the scanStatement()
- * The controlling SqlPollerChildGroup will not start a thread if
- * "maxThreads" is exceeded
- * The idea is to obtain a new instance of the "actionClass" for each
- * row of the resultSet
- * Contents of the table field indicated by the "inProcessField" parameter are used
- * to control concurrency (see enum ROW_STATE for details)
- *
- * @author Esteban
- *
- */
- protected class SqlChildProcess extends Observable implements Runnable
- {
- protected SqlPollerChildGroup m_oParent; // you can always go there for common stuff
- protected DomElement m_oInstP; // values for this instance
- protected JdbcCleanConn m_oConn; // each child has it's own DB connection
- protected PreparedStatement m_PSsel4U ,m_PSupd;
- protected String m_sUpdStates;
- protected String getStatus(ROW_STATE p_oState)
- { int iPos = p_oState.ordinal();
- return m_sUpdStates.substring(iPos,++iPos);
- } //________________________________
-
- public SqlChildProcess(SqlPollerChildGroup p_oGrp, DomElement p_oP)
- throws Exception
- {
- m_oParent = p_oGrp;
- this.addObserver(m_oParent);
- setChanged();
- // add 1 to child thread count
- notifyObservers(new Integer(1));
-
- m_oInstP = p_oP;
- m_oConn = p_oGrp.newDbConn();
- m_sUpdStates = m_oVals.get(OPTIONAL_ATT.inProcessVals.toString());
- } //__________________________________
-
- public void run()
- {
- Exception oAbend = null;
- try
- { m_PSsel4U = m_oConn.prepareStatement(m_oParent.selectForUpdStatement());
- m_PSupd = m_oConn.prepareStatement(m_oParent.updateStatement());
-
- int iParm=1;
- for (String sCurr : m_oParent.m_saKeys)
- { String sVal = m_oInstP.getAttr(sCurr);
- m_PSsel4U.setString (iParm ,sVal);
- // parameters are +1 in update statement
- // autoincrement leaves things ready for next SQL parameter
- m_PSupd.setString (++iParm,sVal);
- }
- // will only continue if it can change status to "Working"
- if (! changeStatus(ROW_STATE.Pending,ROW_STATE.Working))
- oAbend = new Exception("Unable to change status to Working");
- }
- catch (Exception e)
- { m_oLogger.error("Problems with update statements",e);
- if (null!=m_oConn)
- { try { m_oConn.rollback(); }
- catch (Exception eR) { /* OK do nothing */}
- m_oConn.release();
- }
- oAbend = e;
- }
-
- if (null==oAbend)
- try
- {
- Constructor oCnst = m_oParent.m_oExecClass
- .getConstructor (new Class[] {DomElement.class});
- DomElement oParms = m_oParent.m_oChParms.cloneObj();
- oParms.addElemChild(m_oInstP);
- Object oInst = oCnst.newInstance (new Object[] {oParms});
- ((EsbAbstractProcessor)oInst).execute();
- changeStatus(ROW_STATE.Working,ROW_STATE.Done);
- }
- catch (Exception e)
- { m_oLogger.error("run() FAILED",e);
- try
- { m_oConn.rollback();
- changeStatus(null,ROW_STATE.Error);
- }
- catch (Exception CS) { /* What could we do here ? */}
- oAbend = e;
- }
-
- finally
- { if (null!=m_oConn)
- m_oConn.release();
- }
-
- if (null==oAbend)
- notifyOK();
- else
- notifyError(oAbend);
-
- setChanged();
- // decrease child thread count in parent group
- notifyObservers(new Integer(-1));
- } //______________________________
-
- private boolean changeStatus (ROW_STATE pFrom, ROW_STATE pTo) throws Exception
- { ResultSet RS = m_oConn.execQueryWait(m_PSsel4U,5);
- if (! RS.next())
- return false;
- if (null!=pFrom)
- { String sOldStatus = RS.getString(1).substring(0,1);
- if (!sOldStatus.equalsIgnoreCase(getStatus(pFrom)))
- { m_oConn.rollback();
- return false;
- }
- }
- m_PSupd.setString(1,getStatus(pTo));
- m_oConn.execUpdWait(m_PSupd,5);
- m_oConn.commit();
-
- return true;
- } //______________________________
-
- public void notifyOK()
- { try
- {
- String sNotif = getOkNotifContent();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isOK()) continue;
- getNotifHandler().sendNotifications(oCurr,sNotif);
- }
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void notifyError(Exception p_e)
- {
- String sNotif = getErrorNotifContent();
- ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try
- { oPS.println(sNotif);
- if (null != p_e) p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- for (DomElement oCurr : m_oParms.getElementChildren(NotificationList.ELEMENT))
- { NotificationList oNL = new NotificationList(oCurr);
- if (! oNL.isErr()) continue;
- getNotifHandler().sendNotifications(oNL,sMsg);
- }
- }
- catch (Exception e) { }
- } //__________________________________
-
- protected InotificationHandler getNotifHandler()
- {
- try { return NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- }
- catch (Exception e)
- { m_oLogger.error(formatLogMsg("Notification FAILED"),e);
- return null;
- }
- } //______________________________
-
- // These methods to be overriden by you own derived class
- protected String getOkNotifContent()
- {
- return "Success";
- }
- protected String getErrorNotifContent()
- {
- return "FAILURE";
- }
-
- } //______________________________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/SqlTablePoller.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,25 +0,0 @@
-package org.jboss.soa.esb.listeners;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.processors.*;
-
-public class ZZDummyProcessor extends EsbAbstractProcessor
-{
- public ZZDummyProcessor(DomElement p_oParms) throws Exception
- { super(p_oParms);
- }
-
- @Override
- public void execute() throws Exception
- {
- System.out.println(getClass().getName()+" "
- + m_oParms.toString()
- );
- }
-
- @Override
- protected void checkParms() throws Exception
- {
- }
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZDummyProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,53 +0,0 @@
-package org.jboss.soa.esb.listeners;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class ZZderivedSqlTablePoller extends SqlTablePoller
-{
- public static void main(String[] args) throws Exception
- { new ZZderivedSqlTablePoller(args[0]); }
-
- public ZZderivedSqlTablePoller(String pParamsUid) throws Exception
- { super(pParamsUid);
- } //________________________________
-
- protected SqlChildProcess getSqlChildProcess
- (SqlPollerChildGroup pDad, DomElement p_oParms) throws Exception
- {
- return new ZZChildProcess(pDad, p_oParms);
- } //________________________________
-
- private static final SimpleDateFormat s_oFmt
- = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.mmm");
-
- protected class ZZChildProcess extends SqlChildProcess
- {
- public ZZChildProcess(SqlPollerChildGroup p_oGrp, DomElement p_oP)
- throws Exception
- { super(p_oGrp,p_oP); }
-
- protected String getMsgPfx()
- { return ZZderivedSqlTablePoller.class.getSimpleName()
- +" "+s_oFmt.format(new Date(System.currentTimeMillis()))+" ";
- }
-
- // object m_oInstP contains parameters unique to this instance
- // object m_oParent.m_oChParms contains parameters common to all child threads
- // of the parent child group
- protected String getOkNotifContent()
- {
- return getMsgPfx()+" OK "+m_oInstP.toString();
- }
-
- protected String getErrorNotifContent()
- {
- return getMsgPfx()+" eeeeerrrrrrrrr "+m_oInstP.toString();
- }
-
- } //__________________________________________________
-
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/listeners/ZZderivedSqlTablePoller.java)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,41 +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.nagios;
-
-/**
- * A few constant values synchronized from the C NSCA client/server source.
- */
-public class Constants {
-
- public static final int TRANSMITTED_IV_SIZE = 128;
-
- public static final int MAX_HOSTNAME_LENGTH = 64;
- public static final int MAX_DESCRIPTION_LENGTH = 128;
- public static final int MAX_PLUGINOUTPUT_LENGTH = 512;
-
- public static final int NSCA_PACKET_VERSION_3 = 3;
-
- public static final String FICTICIOUS_TEST_HOST = "ficticious.test.host";
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/Constants.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,200 +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.nagios;
-
-import java.util.*;
-import java.util.logging.*;
-
-import org.jboss.soa.esb.nagios.monitor.*;
-import org.jboss.soa.esb.nagios.transport.*;
-
-/**
- * The MonitorManager is the core of the Java Nagios client software. It provides
- * the infrastructure for reporting information and the background process for sending
- * those reports to the NSCA daemon process on the Nagios server.
- *
- * When instantiated without a valid nagiosHost, it will sit and do nothing until a
- * host has been provided - at which point it will begin cycling to send information
- * to that Nagios server.
- *
- * The no-argument constructer is used in JMX environments where JMX systems aren't
- * able to initialize the MonitorManager except through calling Setter methods for
- * the core parameters such as nagiosHost.
- *
- * Typical usage in stand-alone applications:
- *
- * MonitorManager mm = new MonitorManager("XXXXXXXXXXXX", 5667);
- * ServiceMonitor heartbeat = new HeartbeatMonitor("hostname", "servicename");
- * mm.addMonitor(heartbeat);
- * mm.start();
- */
-public class MonitorManager {
-
- // LOCK object for synchronization
- private final Object LOCK = new Object();
-
- private final Logger logger_
- = Logger.getLogger(MonitorManager.class.getName());
- private final List monitors_ = new ArrayList();
- private final BackgroundTask backgroundTask_ = new BackgroundTask();
- private Thread backgroundThread_ = null;
-
- private String nagiosHost = null;
- private int nagiosPort = 0;
-
- private long SLEEP_INTERVAL = 5000; // millisecond sleep time between checks
-
- public MonitorManager() {
- init();
- }
-
- public MonitorManager(String nagiosHost, int nagiosPort) {
- this.nagiosHost = nagiosHost;
- this.nagiosPort = nagiosPort;
- init();
- }
-
- private void init() {
- logger_.setLevel(Level.ALL);
- ConsoleHandler conh = new ConsoleHandler();
- SimpleFormatter form = new SimpleFormatter();
- conh.setFormatter(form);
- logger_.addHandler(conh);
- }
-
- public String getStatus() {
- if (backgroundTask_.running) {
- return "Running - cycle "+backgroundTask_.CYCLE;
- } else {
- return "Stopped";
- }
- }
-
- public String getNagiosHost() {
- return nagiosHost;
- }
-
- public void setNagiosHost(String nagiosHost) {
- this.nagiosHost = nagiosHost;
- }
-
- public int getNagiosPort() {
- return nagiosPort;
- }
-
- public void setNagiosPort(int nagiosPort) {
- this.nagiosPort = nagiosPort;
- }
-
- @SuppressWarnings("unchecked")
- public void addMonitor(ServiceMonitor monitor) {
- monitors_.add(monitor);
- }
-
- public void removeMonitor(ServiceMonitor monitor) {
- monitors_.remove(monitor);
- }
-
- public void start() {
- synchronized (LOCK) {
- if (backgroundThread_ == null) {
- backgroundThread_ = new Thread(backgroundTask_);
- }
- }
- if (!backgroundThread_.isAlive()) {
- backgroundTask_.running = true;
- backgroundTask_.CYCLE = 0;
- backgroundThread_.start();
- }
- }
-
- public void stop() {
- if (backgroundThread_ != null && backgroundThread_.isAlive()) {
- backgroundTask_.stop();
- }
- try {
- backgroundThread_.join();
- backgroundThread_ = null;
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- public long getInterval() {
- return SLEEP_INTERVAL;
- }
-
- public void setInterval(long interval) {
- SLEEP_INTERVAL = interval;
- }
-
- protected class BackgroundTask implements Runnable {
-
- private boolean running = true;
- private int CYCLE = 0;
-
- public void run() {
-
- System.out.println("Nagios Background Monitor thread started.");
-
- while (running) {
- try {
-
- Thread.sleep(SLEEP_INTERVAL);
- CYCLE++;
-
- if (nagiosHost != null) {
-
- final Iterator iter = monitors_.iterator();
-
- while (iter.hasNext()) {
- final ServiceMonitor monitor = (ServiceMonitor) iter.next();
- @SuppressWarnings("unused")
- final ServiceResponse response = monitor.getResponse();
- final NagiosNSCAPacket packet =
- new NagiosNSCAPacket(monitor.getHost()
- , monitor.getService()
- , monitor.getResponse());
- if (nagiosHost != Constants.FICTICIOUS_TEST_HOST)
- NagiosNSCATransport.send(nagiosHost, nagiosPort, packet);
- }
-
- }
-
- } catch (InterruptedException e) {
- // ok if interrupted
- }
- }
-
- running = false;
- System.out.println("Nagios Background Monitor thread exiting.");
-
- }
-
- public void stop() {
- running = false;
- }
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/MonitorManager.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,96 +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.nagios;
-
-import org.jboss.soa.esb.nagios.monitor.*;
-
-public class NagiosAgent implements NagiosAgentMBean {
-
- private static final MonitorManager monitor_ = new MonitorManager();
- private ServiceMonitor service_ = null;
-
- private static final String DEFAULT_HOST = "javatest";
- private static final String DEFAULT_SERVICE = "java-heartbeat-service";
-
- private String host = DEFAULT_HOST;
- private String service = DEFAULT_SERVICE;
-
- public NagiosAgent() {
- service_ = new MemoryMonitor(host, service);
- monitor_.addMonitor(service_);
- }
-
- public void start() {
- monitor_.start();
- }
-
- public void stop() {
- monitor_.stop();
- }
-
- public int getPort() {
- return monitor_.getNagiosPort();
- }
-
- public void setPort(int port) {
- monitor_.setNagiosPort(port);
- }
-
- public String getServer() {
- return monitor_.getNagiosHost();
- }
-
- public void setServer(String host) {
- monitor_.setNagiosHost(host);
- }
-
- public long getInterval() {
- return monitor_.getInterval();
- }
-
- public void setInterval(long interval) {
- monitor_.setInterval(interval);
- }
-
- public String getStatus() {
- return monitor_.getStatus();
- }
-
- public String getHost() {
- return service_.getHost();
- }
-
- public void setHost(String host) {
- service_.setHost(host);
- }
-
- public String getService() {
- return service_.getService();
- }
-
- public void setService(String service) {
- service_.setService(service);
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgent.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,48 +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.nagios;
-
-public interface NagiosAgentMBean {
-
- public void start();
- public void stop();
-
- public String getHost();
- public void setHost(String host);
-
- public String getService();
- public void setService(String service);
-
- public String getServer();
- public void setServer(String server);
-
- public int getPort();
- public void setPort(int port);
-
- public long getInterval();
- public void setInterval(long interval);
-
- public String getStatus();
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/NagiosAgentMBean.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,45 +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.nagios;
-
-public class Runner
-{
- private static final String MONITOR_PROP = "jbossEsb.nagios.monitor.host";
- private static final String DEFAULT_HOST = "localhost";
-
- public static void main(String[] args) {
-
- NagiosAgent agent = new NagiosAgent();
- agent.setInterval(5000);
- String sNagiosMonitor
- = System.getProperty(MONITOR_PROP,DEFAULT_HOST);
- agent.setHost(sNagiosMonitor);
- agent.setPort(5667);
-
- agent.start();
-
- while (true);
-
- }
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,56 +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.nagios;
-
-/**
- * Holder class for response information from a monitored service
- */
-public class ServiceResponse {
-
- private int returncode = 0;
- private String message = null;
-
- public ServiceResponse(int returncode, String message) {
- this.returncode = returncode;
- this.message = message;
- }
-
- public ServiceResponse() {}
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public int getReturncode() {
- return returncode;
- }
-
- public void setReturncode(int returncode) {
- this.returncode = returncode;
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/ServiceResponse.java)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,64 +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.nagios.monitor;
-
-import org.jboss.soa.esb.nagios.ServiceResponse;
-
-public class HeartbeatMonitor implements ServiceMonitor {
-
- private static int CYCLE = 0;
-
- private String host;
- private String service;
-
- public HeartbeatMonitor(String host, String service) {
- this.host = host;
- this.service = service;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public ServiceResponse getResponse() {
- ServiceResponse sr = new ServiceResponse();
- sr.setReturncode(0);
- sr.setMessage("Service heartbeat - index " + (++CYCLE));
- return sr;
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/HeartbeatMonitor.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,66 +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.nagios.monitor;
-
-import org.jboss.soa.esb.nagios.ServiceResponse;
-
-public class MemoryMonitor implements ServiceMonitor {
-
-// private static int CYCLE = 0;
-
- private String host;
- private String service;
-
- public MemoryMonitor(String host, String service) {
- this.host = host;
- this.service = service;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public ServiceResponse getResponse() {
- ServiceResponse sr = new ServiceResponse();
- sr.setReturncode(0);
- long free = Runtime.getRuntime().freeMemory();
- long total = Runtime.getRuntime().totalMemory();
- long max = Runtime.getRuntime().maxMemory();
- sr.setMessage("Java Memory Status (free/total/max) = "+free+"/"+total+"/"+max);
- return sr;
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/MemoryMonitor.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,38 +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.nagios.monitor;
-
-import org.jboss.soa.esb.nagios.ServiceResponse;
-
-public interface ServiceMonitor
-{
- public ServiceResponse getResponse();
-
- public String getHost();
- public void setHost(String host);
-
- public String getService();
- public void setService(String service);
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/monitor/ServiceMonitor.java)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/transport)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,160 +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.nagios.transport;
-
-
-import org.jboss.soa.esb.nagios.*;
-import org.jboss.soa.esb.nagios.util.ByteOps;
-
-
-/**
- * Representation of a Nagios NSCA data packet. The C implementation of Nagios NSCA uses a struct to represent this data. This class
- * constructs a byte array that mirrors that struct. There are some tricky bits here that may need adjustment for new versions of
- * Java, new versions of GCC, or different versions of the Nagios NSCA daemon process compiled on different hardware architectures.
- */
-public class NagiosNSCAPacket {
-
- private long timestamp;
- private int returncode;
- private String host;
- private String servicename;
- private String message;
-
- /**
- * Construct a new packet with the provided information
- *
- * @param timestamp
- * use the one provided upon first connection unless time on server and client are accurately synchronized
- * @param returncode
- * the returncode of the check
- * @param host
- * the Nagios host name we are reporting for
- * @param servicename
- * the Nagios service name we are reporting for
- * @param message
- * a message to Nagios from the monitor
- */
- public NagiosNSCAPacket(long timestamp, int returncode, String host, String servicename, String message) {
- this.timestamp = timestamp;
- this.returncode = returncode;
- this.host = host;
- this.servicename = servicename;
- this.message = message;
- }
-
- public NagiosNSCAPacket(String host, String servicename, ServiceResponse response) {
- this.host = host;
- this.servicename = servicename;
- this.returncode = response.getReturncode();
- this.message = response.getMessage();
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public int getReturncode() {
- return returncode;
- }
-
- public void setReturncode(int returncode) {
- this.returncode = returncode;
- }
-
- public String getServicename() {
- return servicename;
- }
-
- public void setServicename(String servicename) {
- this.servicename = servicename;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public byte[] getData() {
- // 16 bit version
- // 32 bit crc
- // 32 bit timestamp
- // 16 bit returncode
- // 64 byte hostname
- // 128 byte description
- // 512 byte plugin output
-
- byte[] data = new byte[4 + 4 + 4 + 4 + 64 + 128 + 512];
-
- // 16 bit version (padded to 32 for C typedef?)
- ByteOps.copyIntoArray(ByteOps.intToBytes(Constants.NSCA_PACKET_VERSION_3, 2, null, 0), data, 0, 4, false);
-
- // 32 bit crc goes in last
-
- // 32 bit timestamp (in Unix epoch format)
- int epoch = (int) (timestamp / 1000);
- ByteOps.copyIntoArray(ByteOps.intToBytes(epoch, 4, null, 0), data, 8, 4, false);
-
- // 16 bit returncode (padded to 32 for C typedef?)
- ByteOps.copyIntoArray(ByteOps.intToBytes(returncode, 2, null, 0), data, 12, 4, false);
-
- // 64 byte hostname
- ByteOps.copyIntoArray(host.getBytes(), data, 14, Constants.MAX_HOSTNAME_LENGTH, true);
-
- // 128 byte description
- ByteOps.copyIntoArray(servicename.getBytes(), data, 14 + 64, Constants.MAX_DESCRIPTION_LENGTH, true);
-
- // 512 byte plugin output
- ByteOps.copyIntoArray(message.getBytes(), data, 14 + 64 + 128, Constants.MAX_PLUGINOUTPUT_LENGTH, true);
-
- // 32 bit crc
- clearChecksumInPacket(data);
- long crc = org.jboss.soa.esb.nagios.util.CRC32.calculate(data);
- ByteOps.copyIntoArray(ByteOps.longToBytes(crc, 4, null, 0), data, 4, 4, false);
-
- return data;
-
- }
-
- public static void clearChecksumInPacket(byte[] packet) {
- packet[4] = 0;
- packet[5] = 0;
- packet[6] = 0;
- packet[7] = 0;
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCAPacket.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,115 +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.nagios.transport;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.util.logging.Logger;
-
-import org.jboss.soa.esb.nagios.Constants;
-import org.jboss.soa.esb.nagios.util.ByteOps;
-
-/**
- * Transport class sends the data string from the monitor into the Nagios NSCA
- * monitor
- */
-public class NagiosNSCATransport {
-
- private static final Logger logger_
- = Logger.getLogger(NagiosNSCATransport.class.getName());
-
- /**
- * Transport a packet to the Nagios server
- *
- * @param host
- * @param port
- * @param message
- */
- public static void send(String host, int port, NagiosNSCAPacket packet) {
-
- Socket socket = null;
-
- try {
-
- logger_.fine("Connecting to " + host + " : " + port);
-
- socket = new Socket(host, port);
- InputStream in = socket.getInputStream();
-
- // Read IV data from socket on initial connect
- byte[] data = new byte[Constants.TRANSMITTED_IV_SIZE];
- readBytes(data, in);
-
- // Read timestamp data from socket
- byte[] tsdata = new byte[4];
- readBytes(tsdata, in);
-
- long timestamp = (long) ByteOps.bytesToInt(tsdata, 0, 4) * 1000;
-
- logger_.finest("Got timestamp " + timestamp);
- packet.setTimestamp(timestamp);
-
- OutputStream out = socket.getOutputStream();
-
- byte[] pdata = packet.getData();
-
- logger_.finest("Writing packet length " + pdata.length
- + " with message: " + packet.getMessage());
-
- out.write(pdata);
-
- out.flush();
-
- out.close();
- socket.close();
-
- logger_.finest("Done.");
-
- } catch (Exception e) {
- logger_.severe("Failure transmitting packet to Nagios (host="+host+", port="+port+" - " + e.getMessage());
- e.printStackTrace();
- }
-
- }
-
- /**
- * Fills the provided byte array with bytes from the InputStream
- *
- * @param data array to fill
- * @param in input stream
- * @throws IOException
- */
- public static void readBytes(byte[] data, InputStream in)
- throws IOException {
- int total = 0;
- while (total < data.length) {
- int readlen = in.read(data, total, data.length - total);
- if (readlen == -1) throw new IOException("Unable to read!");
- total += readlen;
- }
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/transport/NagiosNSCATransport.java)
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/util)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,123 +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.nagios.util;
-
-/**
- * Byte manipulation utility methods
- */
-public class ByteOps {
-
- /**
- * Convert portion of an array of bytes into an int
- *
- * @param b byte array containing data
- * @param offset offset into array to start conversion
- * @param size number of bytes in array to use for conversion
- * @return the int value
- */
- public static int bytesToInt(byte[] b, int offset, int size) {
- int num = 0;
- int sw = 8 * (size - 1);
-
- for (int loop = 0; loop < size; loop++) {
- num |= ((int) b[offset + loop] & 0x00ff) << sw;
- sw -= 8;
- }
-
- return num;
- }
-
- /**
- * Convert an int to some number of bytes and store them in an array.
- * If no array is provided (ie null) a new one will be allocated.
- *
- * @param num number to convert
- * @param len length of bytes to use
- * @param b array to store value into (optional, if null one will be created)
- * @param offset position in array to store into
- * @return original array provided, or new array created (if none provided)
- */
- public static byte[] intToBytes(int num, int len, byte[] b, int offset) {
-
- if (b == null) {
- b = new byte[len];
- offset = 0;
- }
- int sw = ((len - 1) * 8);
- int mask = (0xff << sw);
-
- for (int l = 0; l < len; l++) {
- b[offset + l] = (byte) ((num & mask) >>> sw);
-
- sw -= 8;
- mask >>>= 8;
- }
-
- return b;
- }
-
- public static final byte[] longToBytes(long num, int len, byte[] b,
- int offset) {
-
- if (b == null) {
- b = new byte[len];
- offset = 0;
- }
- long sw = ((len - 1) * 8);
- long mask = (0xffL << sw);
-
- for (int l = 0; l < len; l++) {
- b[offset + l] = (byte) ((num & mask) >>> sw);
-
- sw -= 8;
- mask >>>= 8;
- }
-
- return b;
- }
-
- /**
- * Convert a long to some number of bytes and store them in an array.
- * If no array is provided (ie null) a new one will be allocated.
- *
- * @param num number to convert
- * @param len length of bytes to use
- * @param b array to store value into (optional, if null one will be created)
- * @param offset position in array to store into
- * @return original array provided, or new array created (if none provided)
- */
- public static void copyIntoArray(byte[] src, byte[] dst, int offset,
- int length, boolean terminator) {
-
- for (int i = 0; i < length && i < src.length && i + offset < dst.length; i++) {
- if (i + offset < dst.length)
- dst[i + offset] = src[i];
- }
-
- if (terminator && offset + length + 1 < dst.length)
- dst[offset + length + 1] = 0;
-
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/util/ByteOps.java)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,89 +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.nagios.util;
-
-/**
- * CRC32 Implementation
- *
- * Uses lazy-initialization technique, and pre-built value table
- * for accelerating calculations.
- */
-public class CRC32 {
-
- /**
- * Internal use only, initialization locking.
- */
- private static final Object LOCK = new Object();
-
- /**
- * Internal use only, pre-computed value table.
- */
- private static long[] crc32_table = null;
-
- /**
- * Internal use only, initialize pre-computed value table. There is no
- * need to call this directly.
- */
- private static void init() {
- synchronized (LOCK) {
- if (crc32_table == null) {
- // Initialize CRC value table
- crc32_table = new long[256];
- long crc, poly;
- int i, j;
- poly = 0xEDB88320L;
- for (i = 0; i < 256; i++) {
- crc = i;
- for (j = 8; j > 0; j--) {
- if ((crc & 1) > 0) {
- crc = (crc >> 1) ^ poly;
- } else {
- crc >>= 1;
- }
- }
- crc32_table[i] = crc;
- }
- }
- }
- }
-
- /**
- * Compute the CRC32 checksum of the provided byte array buffer.
- * @param buffer - the buffer on which to do the computation
- * @return the calculated CRC32 checksum
- */
- public static long calculate(byte[] buffer) {
- init();
- long crc;
- int this_char;
- int current_index;
- crc = 0xFFFFFFFF;
- for (current_index = 0; current_index < buffer.length; current_index++) {
- this_char = (int) buffer[current_index];
- crc = ((crc >> 8) & 0x00FFFFFF)
- ^ crc32_table[((int)crc ^ this_char) & 0xFF];
- }
- return (crc ^ 0xFFFFFFFF);
- }
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/src/org/jboss/soa/esb/nagios/util/CRC32.java)
Copied: labs/jbossesb/trunk/product/core/listeners/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests)
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/tests/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/tests/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,117 +0,0 @@
-<?xml version="1.0"?>
-<project name="build.listeners.tests" default="org.jboss.esb.listeners.tests.compile" basedir=".">
-
- <property name="org.jboss.esb.tests.bin.dir" value="${org.jboss.esb.internal.dest}/tests"/>
- <property name="org.jboss.esb.tests.report.dir" value="${org.jboss.esb.internal.dest}/tests/junit"/>
- <property name="org.jboss.esb.core.bin.dir" value="${org.jboss.esb.internal.dest}/classes"/>
- <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.tests.base.classpath">
- <fileset dir="../${org.jboss.esb.ext.lib.dir}"
- includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- </path>
-
- <target name="org.jboss.esb.tests.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
-
- <mkdir dir="${org.jboss.esb.tests.bin.dir}"/>
- <mkdir dir="${org.jboss.esb.tests.report.dir}"/>
- </target>
-
- <target name="clean"/>
-
- <target name="purge" depends="clean">
- <delete dir="${org.jboss.esb.tests.bin.dir}"/>
- </target>
-
- <target name="org.jboss.esb.listeners.tests.compile" if="org.jboss.esb.buildtests" depends="org.jboss.esb.tests.init">
-
- <javac
- destdir="${org.jboss.esb.tests.bin.dir}"
- classpathref="org.jboss.esb.tests.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.tests.src.dir}"/>
- </javac>
-
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- T E S T -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.listeners.internal.test">
- <antcall target="org.jboss.esb.listeners.internal.test.unit"/>
- <antcall target="org.jboss.esb.listeners.internal.test.functional"/>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- U N I T T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.listeners.internal.test.unit">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/listeners/**/**UnitTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- F U NC T I O N A L T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.listeners.internal.test.functional">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/listeners/**/**FuncTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/build.xml)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa/esb/listeners)
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests)
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,45 +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.tests;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-
-/**
- * Dummy test file.
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class DummyUnitTest extends BaseTest {
-
- /**
- * Remove me
- * @throws Exception
- */
- public void testDummyCompileAndInvoke() throws Exception {
- log.info("****************************************************************");
- log.info(" Dummy unit test called. Replace this with module level tests");
- log.info("****************************************************************");
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/tests/DummyUnitTest.java)
Copied: labs/jbossesb/trunk/product/core/processors (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors)
Deleted: labs/jbossesb/trunk/product/core/processors/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/ant.bat 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/ant.bat 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Copied: labs/jbossesb/trunk/product/core/processors/ant.bat (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/ant.bat)
Deleted: labs/jbossesb/trunk/product/core/processors/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<project name="BuildJbossEsbProcessors" default="org.jboss.esb.processors.compile" basedir=".">
-
- <property name="org.jboss.esb.processors.jar.name" value="jbossesb-processors"/>
- <property name="org.jboss.esb.processors.distrib.dir" value="${org.jboss.esb.internal.dest}/dist"/>
- <property name="org.jboss.esb.processors.classes.dir" value="${org.jboss.esb.internal.dest}/classes/processors"/>
- <property name="org.jboss.esb.processors.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.processors.base.classpath">
- <fileset dir="${org.jboss.esb.ext.lib.dir}" includes="activation.jar jbossall-client.jar log4j.jar mail.jar"/>
- </path>
-
- <path id="org.jboss.esb.processors.default.classpath">
- <path refid="org.jboss.esb.processors.base.classpath"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/common"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/listeners"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/services"/>
- </path>
-
- <target name="org.jboss.esb.processors.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
- </target>
-
- <target name="org.jboss.esb.processors.prepare" depends="org.jboss.esb.processors.init">
- <mkdir dir="${org.jboss.esb.processors.classes.dir}"/>
- <mkdir dir="${org.jboss.esb.processors.distrib.dir}"/>
- <mkdir dir="${org.jboss.esb.processors.distrib.dir}/lib"/>
- </target>
-
- <target name="clean" description="Remove classes directory">
- <delete dir="${org.jboss.esb.processors.classes.dir}"/>
- </target>
-
- <target name="purge" depends="clean">
- </target>
-
-
- <target name="org.jboss.esb.processors.compile">
- <!-- Compile processors -->
- <antcall target="org.jboss.esb.processors.internal.compile"/>
- <!-- Compile processors tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.processors.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.processors.internal.compile" depends="org.jboss.esb.processors.prepare"
- description="Compile all classes">
-
- <javac
- destdir="${org.jboss.esb.processors.classes.dir}"
- classpathref="org.jboss.esb.processors.default.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.processors.src.dir}"/>
- </javac>
-
- </target>
-
- <target name="recompile" depends="clean,org.jboss.esb.processors.compile"
- description="Clean and compile"/>
-
- <target name="jar" depends="org.jboss.esb.processors.compile" description="Assemble jar files">
- <delete file="${org.jboss.esb.processors.distrib.dir}/lib/${org.jboss.esb.processors.jar.name}.jar" />
- <jar destfile="${org.jboss.esb.processors.distrib.dir}/lib/${org.jboss.esb.processors.jar.name}.jar"
- basedir="${org.jboss.esb.processors.classes.dir}"
- includes="**/*.class"
- excludes="test/**"
- />
- </target>
-
-
- <target name="org.jboss.esb.processors.test" description="Run tests for this module">
- <!-- Compile processors tests -->
- <ant dir="tests" target="org.jboss.esb.processors.internal.test"/>
- </target>
-
-
-
- <target name="all" depends="recompile,jar" />
-
-</project>
Copied: labs/jbossesb/trunk/product/core/processors/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/build.xml)
Copied: labs/jbossesb/trunk/product/core/processors/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src)
Copied: labs/jbossesb/trunk/product/core/processors/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org)
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,82 +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.processors;
-
-import java.io.EOFException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.soa.esb.helpers.*;
-
-public abstract class EsbAbstractAggregator extends EsbFileProcessor
-{
- public abstract Object nextInputLine () throws Exception;
- public abstract Object getGroupKey (Object p_oInp) throws Exception;
- protected abstract Object composeObj (List p_oLout) throws Exception;
-
- private Object m_oGroupKey = null;
- protected List<Object> m_olGroup = new ArrayList<Object>();
- ParamsFileProcessor m_oFPparm;
-
- protected EsbAbstractAggregator(DomElement p_oP) throws Exception
- { super(p_oP);
- } //__________________________________
-
- private boolean isSameGroup(Object p_o)
- { return (null == m_oGroupKey) ? false
- :(null == p_o) ? false
- : p_o.equals(m_oGroupKey)
- ;
- } //__________________________________
-
- private long sendComposedObj() throws Exception
- { if (null == m_oGroupKey) return -1;
- return super.sendObject(composeObj(m_olGroup));
- } //__________________________________
-
- public void execute() throws Exception
- { m_oFPparm.checkFile();
- renameToWrk();
- while (true)
- try
- { Object oInp = nextInputLine();
- Object oGrpK = getGroupKey(oInp);
- if (! isSameGroup(oGrpK))
- { sendComposedObj();
- m_olGroup.clear();
- m_oGroupKey = getGroupKey(oInp);
- }
- m_olGroup.add(oInp);
- }
- catch (EOFException eEOF)
- { sendComposedObj();
- break;
- }
- catch (Exception e)
- { m_oLogger.fatal("Exception in EsbFileProcessor",e);
- renameToErr();
- throw e;
- }
- renameToOK();
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractAggregator.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,383 +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.processors;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import javax.sql.*;
-
-import org.apache.log4j.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
-
-import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.services.*;
-
-public abstract class EsbAbstractProcessor
-{
- public abstract void execute() throws Exception;
- protected abstract void checkParms() throws Exception;
-
- public static final String PARMS_THIS_INSTANCE = "__thisInstance";
-
- private static final String POSTPRC_ELEMENT= "postProcess";
- private static final String POSTPRC_CLASS = "actionClass";
-
- private static final String CTX_PREFIX = "@@ctx@@";
- public static final String CTX_BATCH_UID = CTX_PREFIX+"batchUid";
- public static final String CTX_BATCH_NUM = CTX_PREFIX+"batchNum";
- public static final String CTX_INPUT_FILE = CTX_PREFIX+"inputFile";
- public static final String CTX_POST_FILE = CTX_PREFIX+"postFile";
-
- private static final String[] s_saMacros =
- {CTX_BATCH_UID, CTX_BATCH_NUM ,CTX_INPUT_FILE, CTX_POST_FILE };
-
- private Map m_oContext = new Hashtable();
- public void clearContext () { m_oContext.clear(); }
- public Object rmvContextObj (String p_sKey) { return m_oContext.remove(p_sKey); }
- public Object getContextObj (String p_sKey) { return m_oContext.get(p_sKey); }
- @SuppressWarnings("unchecked")
-public Object setContextObj (String p_sKey, Object p_oVal)
- { return m_oContext.put(p_sKey,p_oVal); }
-
- protected DomElement m_oParms ,m_oInstP;
- protected Logger m_oLogger;
-
- private InotificationHandler m_oNotifH;
- protected InotificationHandler getNotifHandler() throws Exception
- { if (null == m_oNotifH)
- {
- String sJndiType= EsbSysProps.getJndiServerType();
- String sJndiURL = EsbSysProps.getJndiServerURL();
- m_oNotifH = NotificationHandlerFactory.getNotifHandler
- ("remote",sJndiType,sJndiURL);
- }
- return m_oNotifH;
- } //________________________________
-
-
- private EsbAbstractProcessor() {}
-
- protected EsbAbstractProcessor(DomElement p_oParms) throws Exception
- { this(p_oParms,true);
- } //__________________________________
-
- protected EsbAbstractProcessor(DomElement p_oParms, boolean p_bLogInit) throws Exception
- {
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oParms = p_oParms;
-
- try { m_oInstP = m_oParms.getFirstElementChild(PARMS_THIS_INSTANCE); }
- catch (Exception eNo) {}
- if (null==m_oInstP)
- { m_oInstP = new DomElement(PARMS_THIS_INSTANCE);
- m_oParms.addElemChild(m_oInstP);
- }
-
- checkParms();
- } //__________________________________
-
-
- public DomElement cloneParams() throws Exception {return m_oParms.cloneObj();}
-
- private Integer m_oiType;
-
- protected static final int TYP_UNKNOWN = -1;
- protected static final int TYP_BATCHER = 0;
- protected static final int TYP_FEEDER = 1;
- protected static final int TYP_COPIER = 2;
-
- protected boolean isBatcher() { return TYP_BATCHER == getOutputType(); }
- protected boolean isFeeder () { return TYP_FEEDER == getOutputType(); }
- protected boolean isCopier () { return TYP_COPIER == getOutputType(); }
-
- protected void setOutputType(int p_i)
- { if (null != m_oiType)
- m_oLogger.info("Redefining Processor Type from "+m_oiType.toString()
- +" to "+p_i);
- m_oiType = new Integer(p_i);
- } //__________________________________
-
- protected int getOutputType()
- { if (null == m_oiType)
- { // m_oLogger.info("Requesting unknown processor type (forgot to set it ?)");
- return TYP_UNKNOWN;
- }
- return m_oiType.intValue();
- } //__________________________________
-
- protected long getBatchNumber() throws Exception
- { if (! isBatcher()) throw new Exception ("'this' is not a Batcher");
- return getBatcher().getBatchNumber();
- } //__________________________________
-
- private static final Class[] s_oaPostCnst = new Class[] {DomElement.class};
- protected void postProcess() throws Exception
- { InotificationHandler oNH =
- NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- DomElement[] oaPost = m_oParms.getElementChildren(POSTPRC_ELEMENT);
- for (int i1=0; i1<oaPost.length;i1++)
- { DomElement oCpy = oaPost[i1].cloneObj();
- replaceMacros(oCpy);
- try
- { Class oCls = Class.forName(oCpy.getAttr(POSTPRC_CLASS));
- Constructor oConst = oCls.getConstructor(s_oaPostCnst);
- oConst.newInstance(new Object[] {oCpy});
- NotifyUtil.notifyOK(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Succeeded")
- ,null);
-
- }
- catch (Exception e)
- { m_oLogger.error("postProcess() <"+i1+"> FAILED :"+e.getMessage());
- NotifyUtil.notifyError(oNH,oaPost[i1].getDad(),("postProcess() <"+i1+"> Failed")
- ,null,e);
- }
- }
- }//_________________________
-
- void replaceMacros(DomElement p_oParm)
- { String[] saAtt = p_oParm.getAttrKeys();
- for (int i1=0; i1<saAtt.length;i1++)
- { String sKey = saAtt[i1];
- String sVal = p_oParm.getAttr(sKey);
-
- boolean bSubst = false;
- int iWh = 0;
- int iPos = 0;
- while (0 <= (iPos=sVal.indexOf(CTX_PREFIX,iWh)))
- { String sRest = sVal.substring(iPos);
- for (int i2=0; i2<s_saMacros.length; i2++)
- { String sMac = s_saMacros[i2];
- if (! sRest.startsWith(sMac)) continue;
- Object oRpl = getContextObj(sMac);
- if (null == oRpl) continue;
- bSubst = true;
- sVal = sVal.substring(0,iPos)
- +oRpl.toString()+sVal.substring(iPos+sMac.length());
- }
- }
- if (bSubst) p_oParm.setAttr(sKey,sVal);
- }
- DomElement[] oaChilds = p_oParm.getAllElemChildren();
- for (int i1=0; i1<oaChilds.length;i1++)
- replaceMacros(oaChilds[i1]);
- }//_________________________
-
- protected void release()
- { switch (getOutputType())
- { case TYP_BATCHER: getBatcher().release(); break;
- }
- } //__________________________________
-
- protected void finish(BatchProcess p_oBP) throws Exception
- {
- switch (getOutputType())
- { case TYP_BATCHER:
- if (p_oBP.getUid() <1) p_oBP.setUid(assignUid());
- if (p_oBP.getSnap()<1) p_oBP.setSnap(p_oBP.getUid());
- p_oBP.setField(BatchProcess.ATTRIB.createStamp
- ,Long.toString(System.currentTimeMillis()));
- getPersistHandler().addObject(p_oBP);
- getBatcher().finish();
- setContextObj(CTX_BATCH_UID,new Long(p_oBP.getUid()));
- setContextObj(CTX_BATCH_NUM,new Long(p_oBP.getBatchNum()));
- break;
- }
- } //__________________________________
-
- protected void commitBatch(BatchProcess p_oBP) throws Exception
- { switch (getOutputType())
- { case TYP_BATCHER: getBatcher().commitBatch(p_oBP); break;
- }
- } //________________________________
-
- protected BatchProcess getBatchObj()
- { return (this.isBatcher()) ? getBatcher().m_oBP : null;
- } //________________________________
-
- protected long sendObject(Object p_o) throws Exception
- { BaseBusinessObject BO = null;
- if (p_o instanceof BaseBusinessObject)
- { BO = (BaseBusinessObject) p_o;
- if (BO.getUid() <1) BO.setUid(assignUid());
- if (BO.getSnap()<1) BO.setSnap(BO.getUid());
- }
-
- switch (getOutputType())
- { case TYP_BATCHER: getBatcher().addRow(p_o); break;
- case TYP_FEEDER: getFeeder ().addRow(p_o); break;
- }
- return (null==BO) ? -1 : BO.getUid();
- } //________________________________
-
- public void notifyOK(Object p_o)
- { try
- { String sMsg = p_o.toString();
- DomElement[] oaP = m_oParms.getElementChildren(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();
- m_oLogger.info("BEFORE EXPAND <"+m_oContext.get(CTX_BATCH_UID)+">");
- replaceMacros(oCpy);
- m_oLogger.info("AFTER EXPAND \n"+oCpy.toString()+"\n");
- getNotifHandler().sendNotifications(oCpy,sMsg);
- }
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void notifyError(Exception p_e, Object p_o)
- { ByteArrayOutputStream oBO = new ByteArrayOutputStream();
- PrintStream oPS = new PrintStream(oBO);
- try
- { oPS.println(p_o.toString());
- if (null != p_e) p_e.printStackTrace(oPS);
- oPS.close();
-
- String sMsg = oBO.toString();
- DomElement[] oaP = m_oParms.getElementChildren(NotificationList.ELEMENT);
- if (oaP.length<1) // Uncomment this line to send only to the list
- getNotifHandler().sendNotifications(sMsg);
- for (int i1=0; i1<oaP.length;i1++)
- { NotificationList oCurr = new NotificationList(oaP[i1]);
- if (! oCurr.isErr()) continue;
- getNotifHandler().sendNotifications(oaP[i1],sMsg);
- }
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- }
- } //__________________________________
-
- private int m_iChunkLeft = 0;
- private long m_lNewUid = -1;
-
- public long assignUid() throws Exception
- { if (m_iChunkLeft < 1)
- { int iChunk = 100;
- m_lNewUid = getPersistHandler().getUidChunk(iChunk);
- m_iChunkLeft = iChunk;
- }
- m_iChunkLeft--;
- return ++m_lNewUid;
- } //__________________________________
-
- private IpersistHandler m_oPHandler;
- private IpersistHandler getPersistHandler() throws Exception
- { if (null == m_oPHandler)
- m_oPHandler = PersistHandlerFactory
- .getPersistHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- return m_oPHandler;
- } //________________________________
-
- public static DataSource getDataSource(String p_sDriver, String p_sConnURL
- ,String p_sUser, String p_sPassowrd) throws Exception
- { return new SimpleDataSource(p_sDriver, p_sConnURL, p_sUser, p_sPassowrd);
- } //__________________________________
-
- protected Feeder m_oFeeder;
- protected Feeder getFeeder()
- { if (! this.isFeeder()) return null;
- if (null==m_oFeeder) m_oFeeder = new Feeder();
- return m_oFeeder;
- } //__________________________________
-
- class Feeder
- {
- private Long m_olNum;
- public long getBatchNumber() { return m_olNum.longValue(); }
-
- private long addRow(Object p_o) throws Exception
- { return getPersistHandler().addObject((BaseBusinessObject)p_o);
- } //________________________________
- } //______________________________________________________
-
- protected Batcher m_oBatcher;
- protected Batcher getBatcher()
- { if (! this.isBatcher()) return null;
- if (null==m_oBatcher) m_oBatcher = new Batcher();
- return m_oBatcher;
- } //__________________________________
-
- class Batcher
- {
- private IbatchHandler m_oBHandler;
- private BatchProcess m_oBP;
-
- private IbatchHandler getBatchHandler() throws Exception
- { if (null == m_oBHandler)
- m_oBHandler = BatchHandlerFactory
- .getBatchHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
- return m_oBHandler;
- } //________________________________
-
- private Long m_olNum = null;
- private long getBatchNumber() throws Exception
- { if (null==m_olNum) m_olNum = new Long(getBatchHandler().newBatch());
- return m_olNum.longValue();
- }
-
- private int addRow(Object p_o) throws Exception
- { if (null==m_olNum)
- { Exception oEx = new Exception("No batch number was requested");
- m_oLogger.error("Batcher.addRow() - "+oEx.getMessage());
- throw oEx;
- }
- return getBatchHandler().addToBatch(p_o.toString());
- } //________________________________
-
- private void release()
- { try {m_oBHandler.releaseHandler(); }
- catch (Exception e) {}
- } //________________________________
-
- private void finish() throws Exception
- { m_olNum = null;
- m_oBHandler.finish();
- } //________________________________
-
- private void commitBatch(BatchProcess p_oBP) throws Exception
- { m_oBP = p_oBP;
- getBatchHandler().commitBatch(p_oBP);
- } //________________________________
- } //______________________________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,137 +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.processors;
-
-import java.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.apache.log4j.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-
-public abstract class EsbAbstractSaxProcessor extends DefaultHandler
-{
- protected abstract String getDocElemName();
- protected abstract boolean handleElement(Element p_oElem) throws Exception;
- protected abstract void wrapUp(EsbAbstractProcessor p_oProc) throws Exception;
-
- protected EsbAbstractProcessor m_oProcessor;
- protected Logger m_oLogger;
- protected BatchProcess m_oBatchP;
-
- private DocumentBuilder m_oDB;
- private SAXParser m_oSaxPrs;
-
- static
- { try
- { System.setProperty("javax.xml.parsers.SAXParserFactory",
- "org.apache.xerces.jaxp.SAXParserFactoryImpl");
- }
- catch (Exception eX) { eX.printStackTrace(System.err); }
- }
- private Stack <Element> m_oElemStk;
-
- protected EsbAbstractSaxProcessor(File p_oF, EsbAbstractProcessor p_oProc, int p_iOutType)
- throws Exception
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oProcessor = p_oProc;
- m_oProcessor.setOutputType(p_iOutType);
-
- m_oDB =DocumentBuilderFactory.newInstance().newDocumentBuilder();
- m_oSaxPrs = SAXParserFactory.newInstance().newSAXParser();
- XMLReader oXmlRd = null;
- oXmlRd = m_oSaxPrs.getXMLReader();
- oXmlRd.setContentHandler(this);
-
- InputStream oIstr = new FileInputStream(p_oF);
- InputSource oIsrc = new InputSource(oIstr);
- m_oElemStk = new Stack<Element>();
-
- try
- { if (m_oProcessor.isBatcher())
- { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
- m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
- }
-
- oXmlRd.parse(oIsrc);
-
- wrapUp(m_oProcessor);
- }
- catch (Exception e)
- { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
- throw e;
- }
- finally
- { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
- }
- } //__________________________________
-
- public void characters(char [] p_ca, int p_iSt, int p_iLn)
- throws SAXException
- { Element nTop = (Element)m_oElemStk.peek();
- String sTxt = new String(p_ca,p_iSt,p_iLn);
- nTop.appendChild(nTop.getOwnerDocument().createTextNode(sTxt));
- } //_________________________________
-
- public void startElement (String namespaceURI, String localName,
- String qName ,Attributes attr ) throws SAXException
- { Element onDad = (m_oElemStk.isEmpty())
- ? null : m_oElemStk.peek();
- if (null == onDad)
- { if (! (getDocElemName().equals(qName)))
- { m_oLogger.error("Invalid Document Element <" + qName + ">");
- throw new SAXException(getClass().getName()+"Invalid Document Element <" + qName + ">");
- }
- Document oDoc = m_oDB.newDocument();
- oDoc.appendChild(onDad=oDoc.createElement("root"));
- }
-
- Element eNew = onDad.getOwnerDocument().createElement(qName);
- onDad.appendChild(eNew);
-
- int iQ = attr.getLength();
- for (int i1=0; i1<iQ; i1++)
- eNew.setAttribute(attr.getQName(i1),attr.getValue(i1));
- m_oElemStk.push(eNew);
- } //_________________________________
-
- public void endElement( String namespaceURI,
- String localName, String qName ) throws SAXException
- {
- Element nCurr = m_oElemStk.pop();
- if (m_oElemStk.isEmpty()) return;
-
- try
- { if (handleElement(nCurr))
- nCurr.getParentNode().removeChild(nCurr);
- }
- catch (Exception e) { throw new SAXException(e); }
- } //_________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSaxProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,93 +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.processors;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.net.URI;
-import java.sql.PreparedStatement;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.sql.DataSource;
-
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.helpers.*;
-
-
-public abstract class EsbAbstractSqlPassthrough extends EsbAbstractSqlProcessor
-{
- public JdbcCleanConn m_oConn;
- public String[] m_saColNames;
- public PreparedStatement m_oPSinsert;
- public File m_oOutTrigger;
- public long m_lGroupUid;
-
- public EsbAbstractSqlPassthrough(File p_oF, EsbAbstractProcessor p_oProc) throws Exception
- { super(p_oF, p_oProc,EsbAbstractProcessor.TYP_COPIER);
- } //__________________________________
-
- public void wrapUp (EsbAbstractProcessor p_oProc) throws Exception
- {
- if (null != m_oConn) {
- m_oConn.commit();
- m_oConn.release();
- }
- if (null!=m_oOutTrigger)
- try
- { FileOutputStream oF = new FileOutputStream(m_oOutTrigger);
- oF.close();
- }
- catch (Exception e) {}
- } //__________________________________
-
- public void checkParms() throws Exception
- {
-
- DomElement oCh = m_oParms.getFirstElementChild("output");
- DataSource oDS = EsbAbstractProcessor.getDataSource
- (oCh.getAttr("driver-class") ,oCh.getAttr("connection-url")
- ,oCh.getAttr("user-name") ,oCh.getAttr("password") );
- m_oConn = new JdbcCleanConn(oDS);
-
- String sTrigger = oCh.getAttr("outputTriggerURI");
- if (null!= sTrigger)
- m_oOutTrigger = new File(new URI(sTrigger));
-
- String sTable = oCh.getAttr("table");
- StringTokenizer ST = new StringTokenizer(oCh.getAttr("columns"),",");
-
- m_saColNames = new String[ST.countTokens()];
- for (int i1=0;i1<m_saColNames.length;i1++) m_saColNames[i1]=ST.nextToken();
-
-
- String sIns = EsbAbstractSqlProcessor.getInsertStmt(sTable,m_saColNames);
- m_oPSinsert = m_oConn.prepareStatement(sIns);
-
- m_lGroupUid = m_oProcessor.assignUid();
-
- } //_________________________________
-
- public abstract boolean handleTblRow(Properties p_oProw) throws Exception;
-
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlPassthrough.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,137 +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.processors;
-
-import java.io.*;
-import java.sql.*;
-import java.util.*;
-
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.*;
-
-public abstract class EsbAbstractSqlProcessor
-{
- protected abstract boolean handleTblRow (Properties p_opRow) throws Exception;
- protected abstract void wrapUp (EsbAbstractProcessor p_oProc) throws Exception;
-
- public static final String QPARM_TABLE = "table";
- public static final String QPARM_CONDITION = "condition";
- public static final String QPARM_ORDER_BY = "orderBy";
-
- protected DomElement m_oParms;
- protected EsbAbstractProcessor m_oProcessor;
- protected Logger m_oLogger;
- protected BatchProcess m_oBatchP;
- public JdbcCleanConn m_oConn;
-
- private String[] m_saColNames;
- protected String[] getColNames() { return m_saColNames; }
-
- protected EsbAbstractSqlProcessor(File p_oF, EsbAbstractProcessor p_oProc, int p_iOutType)
- throws Exception
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oProcessor= p_oProc;
- m_oProcessor.setOutputType(p_iOutType);
- m_oParms = m_oProcessor.cloneParams();
-
- InputStream oIstr = null;
- try
- { connectToDB();
- oIstr = new FileInputStream(p_oF);
-
- if (m_oProcessor.isBatcher())
- { m_oBatchP = new BatchProcess(null,m_oProcessor.assignUid());
- m_oBatchP.setBatchNum(m_oProcessor.getBatchNumber());
- }
-
- processRows(oIstr);
-
- wrapUp(m_oProcessor);
- }
- catch (Exception e)
- { m_oLogger.fatal(this.getClass().getName()+" FAILED",e);
- throw e;
- }
- finally
- { if (null != oIstr) try { oIstr.close(); } catch (Exception e) {}
- if (null != m_oConn) m_oConn.release();
- }
- } //__________________________________
-
- protected void connectToDB() throws Exception
- {
- DataSource oDS = EsbAbstractProcessor.getDataSource
- (m_oParms.getAttr(SimpleDataSource.DRIVER)
- ,m_oParms.getAttr(SimpleDataSource.URL)
- ,m_oParms.getAttr(SimpleDataSource.USER)
- ,m_oParms.getAttr(SimpleDataSource.PASSWORD)
- );
- m_oConn = new JdbcCleanConn(oDS);
- } //__________________________________
-
- private void processRows(InputStream p_oIS) throws Exception
- { StringBuilder sb = new StringBuilder("select * from ")
- .append(m_oParms.getAttr(QPARM_TABLE));
-
- String sCond = m_oParms.getAttr(QPARM_CONDITION);
- if (null != sCond) sb.append(" ").append(sCond);
-
- String sOrder = m_oParms.getAttr(QPARM_ORDER_BY);
- if (null != sOrder) sb.append(" order by ").append(sOrder);
-
- PreparedStatement PS = m_oConn.prepareStatement(sb.toString());
- ResultSet RS = m_oConn.execQueryWait(PS,10);
- ResultSetMetaData MD = RS.getMetaData();
- m_saColNames = new String[MD.getColumnCount()];
- for (int i1=0; i1<m_saColNames.length; i1++)
- m_saColNames[i1] = MD.getColumnName(1+i1);
-
- Properties oP = new Properties();
- while (RS.next())
- { oP.clear();
- for (int i1=0; i1<m_saColNames.length; i1++)
- { String sVal = RS.getString(1 + i1);
- if (null != sVal) oP.setProperty(m_saColNames[i1], sVal);
- }
- handleTblRow(oP);
- }
- } //__________________________________
-
- public static final String getInsertStmt(String p_sTbl, String[] p_saCols)
- { StringBuilder sbCol = new StringBuilder("insert into ").append(p_sTbl).append(" ");
- StringBuilder sbPrm = new StringBuilder(" values ");
- for (int i1=0; i1<p_saCols.length; i1++)
- { String sIn = (i1==0) ? "(" : ",";
- sbCol.append(sIn).append("\"").append(p_saCols[i1]).append("\"");
- sbPrm.append(sIn).append("?");
- }
- return sbCol.append(")").append(sbPrm).append(")").toString();
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbAbstractSqlProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,110 +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.processors;
-
-import java.io.File;
-import java.lang.reflect.Constructor;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class EsbFileProcessor extends EsbAbstractProcessor
-{
- ParamsFileProcessor m_oFPparm;
-
- public EsbFileProcessor(DomElement p_oP) throws Exception
- { super(p_oP);
- } //______________________comment____________
-
- protected File renameToWrk() throws Exception
- { File oWrk = File.createTempFile
- (m_oFPparm.m_sInpFile,"",m_oFPparm.m_oInpDir);
- oWrk.delete();
- m_oFPparm.m_oWorkF = oWrk;
- if (m_oFPparm.m_oIF.renameTo(oWrk)) return oWrk;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oIF.toString()+" to "+oWrk.toString());
- } //__________________________________
-
- protected File renameToOK() throws Exception
- { File oOK = File.createTempFile
- (m_oFPparm.m_sInpFile,m_oFPparm.m_sPostSfx,m_oFPparm.m_oPostDir);
- oOK.delete();
- if (m_oFPparm.m_oWorkF.renameTo(oOK)) return oOK;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oOK.toString());
- } //__________________________________
-
- protected File renameToErr() throws Exception
- { File oErr = File.createTempFile
- (m_oFPparm.m_sInpFile,m_oFPparm.m_sErrorSfx,m_oFPparm.m_oErrorDir);
- oErr.delete();
- if (m_oFPparm.m_oWorkF.renameTo(oErr)) return oErr;
- throw new Exception ("Cannot rename "+m_oFPparm.m_oWorkF.toString()+" to "+oErr.toString());
- } //__________________________________
-
- protected void checkParms() throws Exception
- { try { m_oFPparm = new ParamsFileProcessor(super.m_oParms); }
- catch (Exception e)
- { m_oLogger.fatal("checkParms() FAILED",e);
- throw e;
- }
- } //__________________________________
-
- public void execute() throws Exception
- { try
- {
- m_oFPparm.checkFile();
- super.setContextObj(CTX_INPUT_FILE,m_oFPparm.m_oIF.getName());
- try { renameToWrk(); }
- catch (Exception eRn)
- {
- m_oLogger.info("Skipping rename to wrk "+m_oFPparm.m_oIF.getName(),eRn);
- return;
- }
-
- try
- { Class oCls = Class.forName(m_oParms.getAttr(ParamsFileProcessor.FPRC_ACTION));
- Constructor oCns = oCls.getConstructor(new Class[] {File.class,EsbAbstractProcessor.class});
- oCns.newInstance(new Object[] {m_oFPparm.m_oWorkF,this});
-
- File oFok = renameToOK();
-
- super.setContextObj(EsbAbstractProcessor.CTX_POST_FILE,oFok.getName());
- super.postProcess();
- super.notifyOK("File "+m_oFPparm.m_sInpFile+" processed successfully");
- }
- catch (Exception e)
- { renameToErr();
- m_oLogger.fatal("Input File processor FAILED",e);
- throw e;
- }
- finally
- { super.release();
- }
- }
- catch (Exception eGen)
- {
-// super.notifyError(eGen,"PROBLEMS processing File "+m_oFPparm.m_sInpFile);
- eGen.printStackTrace();
- }
- }//_________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbFileProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,78 +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.processors;
-
-import java.lang.reflect.Constructor;
-
-import javax.jms.Message;
-import javax.jms.TextMessage;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class EsbMsgProcessor extends EsbAbstractProcessor
-{
- public EsbMsgProcessor(DomElement p_oP) throws Exception
- { super(p_oP,false);
- } //__________________________________
-
- protected void checkParms() throws Exception {}
- public void execute() throws Exception {}
-
- public void processMessage(Message p_oMsg) throws Exception
- {
- String sPrc = this.getClass().getName();
- sPrc = sPrc.substring(1+sPrc.lastIndexOf("."));
-
- StringBuffer sb = new StringBuffer("Message ");
- if (p_oMsg instanceof TextMessage)
- sb.append("<").append(((TextMessage)p_oMsg).getText()).append("> ");
- String sNotifMsg = sb.toString();
-
- sb.setLength(0);
- try
- {
- try
- { Class oCls = Class.forName(m_oParms.getAttr("actionClass"));
- Constructor oCns = oCls.getConstructor(new Class[] {Message.class,EsbAbstractProcessor.class});
- oCns.newInstance(new Object[] {p_oMsg,this});
-
- super.postProcess();
-
- sb.append(sPrc).append(" processed ").append(sNotifMsg).append(" successfully");
- super.notifyOK(sb.toString());
- }
- catch (Exception e)
- { m_oLogger.fatal("Message processor FAILED",e);
- throw e;
- }
- finally { super.release(); }
- }
-
- catch (Exception eGen)
- {
- System.out.println("test catch for rollback here..");
- super.notifyError(eGen," " + sPrc+" PROBLEMS processing "+sNotifMsg);
- throw eGen;
- }
- }//_________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,103 +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.processors;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.net.URI;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class FileCopier
-{
- private static final String TMP_SUFFIX = ".notReady";
- private static final String PARMS_COPY_TO = "CopyTo";
- private static final String PARMS_OUTDIR = "copyToDirURI";
- private static final String PARMS_OUTSFX = "copyToSuffix";
-
- EsbFileProcessor m_oProc;
- private File [] m_oaTmpFile;
- private File [] m_oaOutFile;
-
- public FileCopier(File p_oF, EsbAbstractProcessor p_oProc) throws Exception
- { m_oProc = (EsbFileProcessor)p_oProc;
- checkParms();
- if (m_oaTmpFile.length> 0) execute();
- } //__________________________________
-
- public void execute() throws Exception
- {
- try
- {
- // Open
- FileInputStream oFI = new FileInputStream(m_oProc.m_oFPparm.m_oWorkF);
- FileOutputStream []oaFO = new FileOutputStream[m_oaTmpFile.length];
- for (int i1=0; i1<oaFO.length;i1++)
- oaFO[i1] = new FileOutputStream(m_oaTmpFile[i1]);
-
- // Perform Copy
- byte[] ba = new byte[50000];
- while (true)
- { int iQ = oFI.read(ba);
- if (iQ < 0) break;
- for (int i1=0; i1<oaFO.length; i1++)
- oaFO[i1].write(ba,0,iQ);
- }
- // Close
- oFI.close();
- for (int i1=0; i1<oaFO.length; i1++) oaFO[i1].close();
-
- // Rename
- for (int i1=0; i1<m_oaTmpFile.length;i1++)
- { m_oaOutFile[i1].delete();
- m_oaTmpFile[i1].renameTo(m_oaOutFile[i1]);
- }
- }
- catch (Exception eGen)
- { throw eGen;
- }
- } //__________________________________
-
- protected void checkParms() throws Exception
- { DomElement[] oaPout = m_oProc.m_oParms.getElementChildren(PARMS_COPY_TO);
- if (oaPout.length<1)
- { m_oProc.m_oLogger.warn("No output files specified for FileCopier");
- return;
- }
- String sFile = m_oProc.m_oFPparm.m_sInpFile;
- int iSfxLen = m_oProc.m_oFPparm.m_sInpSfx.length();
- String sNoSuffix = sFile.substring(0,sFile.length()-iSfxLen);
-
- m_oaTmpFile = new File[oaPout.length];
- m_oaOutFile = new File[oaPout.length];
- for (int i1=0; i1<m_oaTmpFile.length;i1++)
- { File oDir = new File(new URI(oaPout[i1].getAttr(PARMS_OUTDIR)));
- m_oaTmpFile[i1] = File.createTempFile(sFile, TMP_SUFFIX, oDir);
- String sCpySuffix = oaPout[i1].getAttr(PARMS_OUTSFX);
- m_oaOutFile[i1] = new File(oDir,sNoSuffix+sCpySuffix);
- }
- return;
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/FileCopier.java)
Deleted: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,145 +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.processors;
-
-import java.io.File;
-import java.net.URI;
-
-import org.jboss.soa.esb.helpers.DomElement;
-
-public class ParamsFileProcessor
-{
- public static final String FPRC_ACTION = "actionClass";
-
- public static final String FPRC_INP_DIR = "inputDirURI";
- public static final String FPRC_INP_SFX = "inputSuffix";
- public static final String FPRC_ERR_DIR = "errorDirURI";
- public static final String FPRC_ERR_SFX = "errorSuffix";
- public static final String FPRC_POST_DIR = "postDirURI";
- public static final String FPRC_POST_SFX = "postSuffix";
- public static final String FPRC_POST_DEL = "postDelete";
-
- private DomElement m_oParms;
-
- public File m_oInpDir ,m_oPostDir ,m_oErrorDir;
- public File m_oWorkF;
- public File m_oIF;
-
- public String m_sInpFile ,m_sInpSfx ,m_sPostSfx ,m_sErrorSfx;
-
- public boolean m_bPostDel;
-
- public static final String FPRC_FILENAME = "filename";
-
- public ParamsFileProcessor(DomElement p_oP) throws Exception
- { m_oParms = p_oP;
-
- checkInput();
- checkError();
- checkPost();
- } //__________________________________
-
- private void checkInput() throws Exception
- { String sAtt = m_oParms.getAttr(FPRC_INP_DIR);
- if (null == sAtt)throw new Exception ("Missing or invalid "+FPRC_INP_DIR+" attribute");
-
- m_oInpDir = new File(new URI(sAtt));
- if (! m_oInpDir.exists()) throw new Exception ("Directory "+m_oInpDir.toString()+" not found");
- if (! m_oInpDir.isDirectory())throw new Exception (m_oInpDir.toString()+" is not a directory");
- if (! m_oInpDir.canRead()) throw new Exception ("Can't read "+m_oInpDir.toString());
- if (! m_oInpDir.canWrite()) throw new Exception ("Can't rename within "+m_oInpDir.toString());
-
- m_sInpSfx = m_oParms.getAttr(FPRC_INP_SFX);
- if (null == m_sInpSfx)throw new Exception ("Missing "+FPRC_INP_SFX+" attribute");
- m_sInpSfx = m_sInpSfx.trim();
- if (m_sInpSfx.trim().length()<1)throw new Exception ("Invalid "+FPRC_INP_SFX+" attribute");
-
- return;
- } //__________________________________
-
- private void checkPost() throws Exception
- { String sAtt = m_oParms.getAttr(FPRC_POST_DIR);
- if (null == sAtt) sAtt = m_oParms.getAttr(FPRC_INP_DIR);
-
- m_oPostDir = new File(new URI(sAtt));
- if (! m_oPostDir.exists()) throw new Exception ("Directory "+m_oPostDir.toString()+" not found");
- if (! m_oPostDir.isDirectory())throw new Exception (m_oPostDir.toString()+" is not a directory");
- if (! m_oPostDir.canRead()) throw new Exception ("Can't read "+m_oPostDir.toString());
- if (! m_oPostDir.canWrite()) throw new Exception ("Can't write to "+m_oPostDir.toString());
-
- m_sPostSfx = m_oParms.getAttr(FPRC_POST_SFX);
- if (null == m_sPostSfx) m_sPostSfx = m_sInpSfx;
- else m_sPostSfx = m_sPostSfx.trim();
- if (m_sPostSfx.length()<1)throw new Exception ("Invalid "+FPRC_POST_SFX+" attribute");
-
- sAtt = m_oParms.getAttr(FPRC_POST_DEL);
- if (null == sAtt)sAtt = "no";
- else sAtt = sAtt.trim().toLowerCase();
- m_bPostDel = (sAtt.startsWith("y")) ? true : false;
-
- do
- { if (! m_oPostDir.equals(m_oInpDir)) break;
- if (! m_sPostSfx.equals(m_sInpSfx)) break;
- if (m_bPostDel) break;
- throw new Exception("Input might be reprocessed forever (see post parameters)");
- } while (false);
-
- return;
- } //__________________________________
-
- private void checkError() throws Exception
- { String sAtt = m_oParms.getAttr(FPRC_ERR_DIR);
- if (null == sAtt) sAtt = m_oParms.getAttr(FPRC_INP_DIR);
-
- m_oErrorDir = new File(new URI(sAtt));
- if (! m_oErrorDir.exists()) throw new Exception ("Directory "+m_oErrorDir.toString()+" not found");
- if (! m_oErrorDir.isDirectory())throw new Exception (m_oErrorDir.toString()+" is not a directory");
- if (! m_oErrorDir.canRead()) throw new Exception ("Can't read "+m_oErrorDir.toString());
- if (! m_oErrorDir.canWrite()) throw new Exception ("Can't write to "+m_oErrorDir.toString());
-
- m_sErrorSfx = m_oParms.getAttr(FPRC_ERR_SFX);
- if (null == m_sErrorSfx) m_sErrorSfx = m_sInpSfx;
- else m_sErrorSfx = m_sErrorSfx.trim();
- if (m_sErrorSfx.length()<1)throw new Exception ("Invalid "+FPRC_ERR_SFX+" attribute");
-
- do
- { if (! m_oErrorDir.equals(m_oInpDir)) break;
- if (! m_sErrorSfx.equals(m_sInpSfx)) break;
- throw new Exception("Input might be reprocessed forever (see error parameters)");
- } while (false);
-
- return;
- } //__________________________________
-
- public void checkFile() throws Exception
- { DomElement oPthis = m_oParms.getFirstElementChild(EsbAbstractProcessor.PARMS_THIS_INSTANCE);
- m_sInpFile = oPthis.getAttr(FPRC_FILENAME);
- m_oIF = new File((new File(m_oInpDir,m_sInpFile)).getAbsolutePath());
- if (! m_oIF.exists()) throw new Exception ("File "+m_oIF.toString()+" not found");
- if (! m_oIF.isFile()) throw new Exception (m_oIF.toString()+" is not a file");
- if (! m_oIF.canRead()) throw new Exception ("Can't read "+m_oIF.toString());
- if (! m_oIF.canWrite()) throw new Exception ("Can't rename "+m_oIF.toString());
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/src/org/jboss/soa/esb/processors/ParamsFileProcessor.java)
Copied: labs/jbossesb/trunk/product/core/processors/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests)
Deleted: labs/jbossesb/trunk/product/core/processors/tests/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/tests/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/tests/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,117 +0,0 @@
-<?xml version="1.0"?>
-<project name="build.processors.tests" default="org.jboss.esb.processors.tests.compile" basedir=".">
-
- <property name="org.jboss.esb.tests.bin.dir" value="${org.jboss.esb.internal.dest}/tests"/>
- <property name="org.jboss.esb.tests.report.dir" value="${org.jboss.esb.internal.dest}/tests/junit"/>
- <property name="org.jboss.esb.core.bin.dir" value="${org.jboss.esb.internal.dest}/classes"/>
- <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <path id="org.jboss.esb.tests.base.classpath">
- <fileset dir="../${org.jboss.esb.ext.lib.dir}"
- includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- </path>
-
- <target name="org.jboss.esb.tests.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
-
- <mkdir dir="${org.jboss.esb.tests.bin.dir}"/>
- <mkdir dir="${org.jboss.esb.tests.report.dir}"/>
- </target>
-
- <target name="clean"/>
-
- <target name="purge" depends="clean">
- <delete dir="${org.jboss.esb.tests.bin.dir}"/>
- </target>
-
- <target name="org.jboss.esb.processors.tests.compile" if="org.jboss.esb.buildtests" depends="org.jboss.esb.tests.init">
-
- <javac
- destdir="${org.jboss.esb.tests.bin.dir}"
- classpathref="org.jboss.esb.tests.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.tests.src.dir}"/>
- </javac>
-
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- T E S T -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.processors.internal.test">
- <antcall target="org.jboss.esb.processors.internal.test.unit"/>
- <antcall target="org.jboss.esb.processors.internal.test.functional"/>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- U N I T T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.processors.internal.test.unit">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/processors/**/**UnitTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- F U NC T I O N A L T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.processors.internal.test.functional">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/processors/**/**FuncTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/core/processors/tests/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/build.xml)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa/esb/processors)
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests)
Deleted: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,45 +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.processors.tests;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-
-/**
- * Dummy test file.
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class DummyUnitTest extends BaseTest {
-
- /**
- * Remove me
- * @throws Exception
- */
- public void testDummyCompileAndInvoke() throws Exception {
- log.info("****************************************************************");
- log.info(" Dummy unit test called. Replace this with module level tests");
- log.info("****************************************************************");
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java)
Copied: labs/jbossesb/trunk/product/core/services (from rev 5257, labs/jbossesb/branches/refactor/product/core/services)
Deleted: labs/jbossesb/trunk/product/core/services/ant.bat
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/ant.bat 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/ant.bat 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,12 +0,0 @@
- at echo off
-set ANT_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-:doneStart
-%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
-
Copied: labs/jbossesb/trunk/product/core/services/ant.bat (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/ant.bat)
Deleted: labs/jbossesb/trunk/product/core/services/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<project name="JbossEsbServices" default="org.jboss.esb.services.compile" basedir=".">
-
- <property name="org.jboss.esb.services.name.jar" value="${ant.project.name}.jar"/>
- <property name="org.jboss.esb.services.dist.dir" value="${org.jboss.esb.internal.dest}/dist"/>
- <property name="org.jboss.esb.services.appl.dir" value="../.."/>
- <property name="org.jboss.esb.services.metainf.dir" value="src/META-INF"/>
-
- <property name="org.jboss.esb.services.classes.dir" value="${org.jboss.esb.internal.dest}/classes/services"/>
- <property name="org.jboss.esb.services.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.serverlib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.serverlib.dir" value="{org.jboss.esb.jboss.home}/server/all/lib">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <property name="org.jboss.esb.services.xdoclet.lib" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.serverlib.dir" value="${env.XDOCLET_HOME}/lib">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/lib">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
- <!-- =================================================================== -->
- <!-- Define the class path -->
- <!-- =================================================================== -->
- <path id="org.jboss.esb.services.base.classpath">
- <fileset dir="${org.jboss.esb.services.appl.dir}/lib" includes="*.jar,*.zip"/>
- <fileset dir="${org.jboss.esb.ext.serverlib.dir}"
- includes="*.jar,*.zip"
- />
- <fileset dir="${org.jboss.esb.ext.lib.dir}"
- includes="jboss-jmx.jar"
- />
- </path>
-
- <!-- =================================================================== -->
- <!-- Initialize -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.services.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
- </target>
-
- <!-- =================================================================== -->
- <!-- Prepares the directory structure -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.services.prepare" depends="org.jboss.esb.services.init">
- <mkdir dir="${org.jboss.esb.services.classes.dir}"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles all the classes -->
- <!-- =================================================================== -->
-
-
- <target name="org.jboss.esb.services.compile">
- <!-- Compile services -->
- <antcall target="org.jboss.esb.services.internal.compile"/>
- <!-- Compile services tests -->
- <ant inheritAll="true" dir="tests" target="org.jboss.esb.services.tests.compile"/>
- </target>
-
-
- <target name="org.jboss.esb.services.internal.compile" depends="org.jboss.esb.services.prepare"
- description="Compile all classes">
-
- <javac
- destdir="${org.jboss.esb.services.classes.dir}"
- classpathref="org.jboss.esb.services.default.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.services.src.dir}"/>
- </javac>
-
- </target>
-
- <!-- =================================================================== -->
- <!-- Recompiles all the classes -->
- <!-- =================================================================== -->
-
- <target name="recompile" depends="clean,org.jboss.esb.services.compile"
- description="Clean and compile"/>
-
- <!-- =================================================================== -->
- <!-- Clean -->
- <!-- =================================================================== -->
- <target name="clean" description="Remove classes directory">
- <delete dir="${org.jboss.esb.services.classes.dir}"/>
- </target>
-
- <target name="purge" depends="clean">
- </target>
-
- <!-- =================================================================== -->
- <!-- Rebuild everything from scratch -->
- <!-- =================================================================== -->
- <target name="all" depends="recompile,jar" />
-
- <path id="org.jboss.esb.services.default.classpath">
- <path refid="org.jboss.esb.services.base.classpath"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/common"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/processors"/>
- <pathelement location="${org.jboss.esb.internal.dest}/classes/listeners"/>
- </path>
-
- <path id="xdoclet.class.path">
- <fileset dir="${org.jboss.esb.services.xdoclet.lib}">
- <include name="*.jar"/>
- </fileset>
- <path refid="org.jboss.esb.services.default.classpath"/>
- </path>
-
- <!-- =================================================================== -->
- <!-- Initialise xdoclet tasks -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.services.initXdoclet">
- <taskdef
- name="ejbdoclet"
- classname="xdoclet.modules.ejb.EjbDocletTask"
- classpathref="xdoclet.class.path"
- />
- </target>
-
-
- <!-- =================================================================== -->
- <!-- Initialise -->
- <!-- =================================================================== -->
- <target name="ejbdoclet" depends="org.jboss.esb.services.initXdoclet">
-
- <echo>+---------------------------------------------------+</echo>
- <echo>| |</echo>
- <echo>| R U N N I N G E J B D O C L E T |</echo>
- <echo>| |</echo>
- <echo>+---------------------------------------------------+</echo>
-
- <ejbdoclet
- destdir="src"
- mergedir="parent-fake-to-debug"
- ejbspec="2.0"
- excludedTags="@version, at author, at todo"
- force="false"
- verbose="false"
- addedTags="@xdoclet-generated at ${TODAY}, at copyright The XDoclet Team, at author XDoclet, at version ${version}"
- >
-
- <remoteinterface/>
- <localinterface/>
- <homeinterface/>
- <localhomeinterface/>
-
- <fileset dir="src">
- <include name="**/*Bean.java"/>
- </fileset>
-
- <deploymentdescriptor
- destdir="${org.jboss.esb.services.metainf.dir}"
- validatexml="true"
- mergedir="fake-to-debug"
- description="Jboss ESB"
- >
- </deploymentdescriptor>
-
- <jboss
- version="3.2"
- xmlencoding="iso-8859-1"
- destdir="${org.jboss.esb.services.metainf.dir}"
- validatexml="true"
- />
-
- </ejbdoclet>
- </target>
-
- <!-- =================================================================== -->
- <!-- Jar -->
- <!-- =================================================================== -->
- <target name="jar" description="Assemble jar files"
- depends="org.jboss.esb.services.compile,ejbdoclet"
- >
- <jar destfile="${org.jboss.esb.services.dist.dir}/lib/jbossesb-services-client.jar"
- basedir="${org.jboss.esb.services.classes.dir}"
- includes="**/*.class"
- excludes="**/EJBs/*Bean*"
- />
- <jar destfile="${org.jboss.esb.services.dist.dir}/lib/jbossesb-services.jar"
- basedir="${org.jboss.esb.services.classes.dir}"
- includes="**/EJBs/*.class"
- manifest="${org.jboss.esb.services.metainf.dir}/manifest.server"
- >
- <metainf dir="${org.jboss.esb.services.metainf.dir}" includes="*.xml"
- excludes="application.xml"
- />
- </jar>
-
- <antcall target="-ear"/>
- </target>
-
- <target name="-ear">
- <ear destfile="${org.jboss.esb.services.dist.dir}/lib/jbossesb-appl.ear"
- appxml="${org.jboss.esb.services.metainf.dir}/application.xml">
- <fileset dir="${org.jboss.esb.services.dist.dir}"
- includes="jbossesb-common.jar
- ,CQ3ServicesClient.jar
- ,CQ3Services.jar
- "/>
- </ear>
-
- </target>
-
-
- <!-- =================================================================== -->
- <!-- Test -->
- <!-- =================================================================== -->
- <target name="org.jboss.esb.services.test" description="Run tests for this module">
- <!-- Compile processors tests -->
- <ant dir="tests" target="org.jboss.esb.services.internal.test"/>
- </target>
-
-
-
-
-</project>
Copied: labs/jbossesb/trunk/product/core/services/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/build.xml)
Copied: labs/jbossesb/trunk/product/core/services/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src)
Copied: labs/jbossesb/trunk/product/core/services/src/META-INF (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/META-INF)
Deleted: labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/META-INF/application.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<application version="1.4"
- xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
- <display-name>JbossEsb AppServer basic services</display-name>
- <module>
- <ejb>jbossesb-services.jar</ejb>
- </module>
-</application>
Copied: labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/META-INF/application.xml)
Deleted: labs/jbossesb/trunk/product/core/services/src/META-INF/ejb-jar.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/META-INF/ejb-jar.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/META-INF/ejb-jar.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
-
-<ejb-jar >
-
- <description><![CDATA[Jboss ESB]]></description>
- <display-name>Generated by XDoclet</display-name>
-
- <enterprise-beans>
-
- <!-- Session Beans -->
- <session >
- <description><![CDATA[JbossEsbNotificationHandler]]></description>
- <display-name>Jboss_Esb_Notification_Handler</display-name>
-
- <ejb-name>JbossEsbNotificationHandler</ejb-name>
-
- <home>org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandlerHome</home>
- <remote>org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandler</remote>
- <local-home>org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandlerLocalHome</local-home>
- <local>org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandlerLocal</local>
- <ejb-class>org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandlerBean</ejb-class>
- <session-type>Stateless</session-type>
- <transaction-type>Container</transaction-type>
-
- </session>
-
- <session >
- <description><![CDATA[]]></description>
- <display-name>Jboss_ESB_PERSIST_HANDLER</display-name>
-
- <ejb-name>JbossEsbPersistHandler</ejb-name>
-
- <home>org.jboss.soa.esb.services.EJB.JbossEsbPersistHandlerHome</home>
- <remote>org.jboss.soa.esb.services.EJB.JbossEsbPersistHandler</remote>
- <local-home>org.jboss.soa.esb.services.EJB.JbossEsbPersistHandlerLocalHome</local-home>
- <local>org.jboss.soa.esb.services.EJB.JbossEsbPersistHandlerLocal</local>
- <ejb-class>org.jboss.soa.esb.services.EJB.JbossEsbPersistHandlerBean</ejb-class>
- <session-type>Stateless</session-type>
- <transaction-type>Bean</transaction-type>
-
- </session>
-
- <session >
- <description><![CDATA[]]></description>
- <display-name>Jboss_Esb_Batch_Handler</display-name>
-
- <ejb-name>JbossEsbBatchHandler</ejb-name>
-
- <home>org.jboss.soa.esb.services.EJB.JbossEsbBatchHandlerHome</home>
- <remote>org.jboss.soa.esb.services.EJB.JbossEsbBatchHandler</remote>
- <local-home>org.jboss.soa.esb.services.EJB.JbossEsbBatchHandlerLocalHome</local-home>
- <local>org.jboss.soa.esb.services.EJB.JbossEsbBatchHandlerLocal</local>
- <ejb-class>org.jboss.soa.esb.services.EJB.JbossEsbBatchHandlerBean</ejb-class>
- <session-type>Stateful</session-type>
- <transaction-type>Bean</transaction-type>
-
- </session>
-
- <!--
- To add session beans that you have deployment descriptor info for, add
- a file to your XDoclet merge directory called session-beans.xml that contains
- the <session></session> markup for those beans.
- -->
-
- <!-- Entity Beans -->
- <!--
- To add entity beans that you have deployment descriptor info for, add
- a file to your XDoclet merge directory called entity-beans.xml that contains
- the <entity></entity> markup for those beans.
- -->
-
- <!-- Message Driven Beans -->
- <!--
- To add message driven beans that you have deployment descriptor info for, add
- a file to your XDoclet merge directory called message-driven-beans.xml that contains
- the <message-driven></message-driven> markup for those beans.
- -->
-
- </enterprise-beans>
-
- <!-- Relationships -->
-
- <!-- Assembly Descriptor -->
- <!--
- To specify your own assembly descriptor info here, add a file to your
- XDoclet merge directory called assembly-descriptor.xml that contains
- the <assembly-descriptor></assembly-descriptor> markup.
- -->
-
- <assembly-descriptor >
- <!--
- To specify additional security-role elements, add a file in the merge
- directory called ejb-security-roles.xml that contains them.
- -->
-
- <!-- method permissions -->
- <!--
- To specify additional method-permission elements, add a file in the merge
- directory called ejb-method-permissions.ent that contains them.
- -->
-
- <!-- transactions -->
- <!--
- To specify additional container-transaction elements, add a file in the merge
- directory called ejb-container-transactions.ent that contains them.
- -->
- <container-transaction >
- <method >
- <ejb-name>JbossEsbNotificationHandler</ejb-name>
- <method-name>*</method-name>
- </method>
- <trans-attribute>Required</trans-attribute>
- </container-transaction>
-
- <!-- finder transactions -->
-
- <!-- message destinations -->
- <!--
- To specify additional message-destination elements, add a file in the merge
- directory called ejb-message-destinations.ent that contains them.
- -->
-
- <!-- exclude list -->
- <!--
- To specify an exclude-list element, add a file in the merge directory
- called ejb-exclude-list.xml that contains it.
- -->
- </assembly-descriptor>
-
-</ejb-jar>
Copied: labs/jbossesb/trunk/product/core/services/src/META-INF/ejb-jar.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/META-INF/ejb-jar.xml)
Deleted: labs/jbossesb/trunk/product/core/services/src/META-INF/jboss.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/META-INF/jboss.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/META-INF/jboss.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
-
-<jboss>
-
- <enterprise-beans>
-
- <!--
- To add beans that you have deployment descriptor info for, add
- a file to your XDoclet merge directory called jboss-beans.xml that contains
- the <session></session>, <entity></entity> and <message-driven></message-driven>
- markup for those beans.
- -->
-
- <session>
- <ejb-name>JbossEsbNotificationHandler</ejb-name>
- <jndi-name>JbossEsbNotificationHandler</jndi-name>
- <local-jndi-name>JbossEsbNotificationHandlerLocal</local-jndi-name>
-
- <method-attributes>
- </method-attributes>
- </session>
- <session>
- <ejb-name>JbossEsbPersistHandler</ejb-name>
- <jndi-name>JbossEsbPersistHandler</jndi-name>
- <local-jndi-name>JbossEsbPersistHandlerLocal</local-jndi-name>
-
- <method-attributes>
- </method-attributes>
- </session>
- <session>
- <ejb-name>JbossEsbBatchHandler</ejb-name>
- <jndi-name>JbossEsbBatchHandler</jndi-name>
- <local-jndi-name>JbossEsbBatchHandlerLocal</local-jndi-name>
-
- <method-attributes>
- </method-attributes>
- </session>
-
- <!--
- write a merge file jboss-webservices.ent for webservice-description
- -->
-
- </enterprise-beans>
-
- <resource-managers>
- </resource-managers>
-
- <!--
- | for container settings, you can merge in jboss-container.xml
- | this can contain <invoker-proxy-bindings/> and <container-configurations/>
- -->
-
-</jboss>
Copied: labs/jbossesb/trunk/product/core/services/src/META-INF/jboss.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/META-INF/jboss.xml)
Deleted: labs/jbossesb/trunk/product/core/services/src/META-INF/manifest.server
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/META-INF/manifest.server 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/META-INF/manifest.server 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path: jbossesb-common.jar jbossesb-services-client.jar
-
Copied: labs/jbossesb/trunk/product/core/services/src/META-INF/manifest.server (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/META-INF/manifest.server)
Copied: labs/jbossesb/trunk/product/core/services/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,193 +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.internal.core.objectstore;
-
-import org.jboss.soa.esb.util.BaseBusinessObject;
-
-public abstract class AbstractBobjStore
-{
- public static AbstractBobjStore getInstance()
- { throw new UnsupportedOperationException(
- "getInstance() must be implemented in the derived class");
- } //__________________________________
-
- /**
- * Array of BobjStore objects.
- * @return AbstractBobjStore[]
- */
- public abstract AbstractBobjStore[] getBobjStoreTable();
-
- /**
- * String names for BobjStoreTable.
- * @return String[]
- */
- public abstract String[] getBobjStoreIndex();
-
- protected String m_sSnapType , m_sSnapTbl , m_sLocTbl, m_sClass;
- protected boolean m_bEncrypt=false;
-
- /**
- * Snapshot type getter - The value assigned to this attribute will help if
- * standard SQL queries are required to surf the Object Store's snapshot tables
- * @return String - Value of snapshot type
- */
- public String getSnapType() { return m_sSnapType; }
- /**
- * Snapshot tablename getter - The value assigned to this attribute is the
- * name of the snapshot table for this object
- * @return String - name of SQL table where snapshots of objects will be stored
- */
- public String getSnapTable() { return m_sSnapTbl; }
- /**
- * Locator tablename getter - Locator table are also called index tables.
- * The value assigned to this attribute is the name of the locator table for
- * this object
- * @return String - name of SQL table where locators for objects will be stored
- * @see BusinessObject#getObjLocator()
- */
- public String getLocatorTable() { return m_sLocTbl; }
- /**
- * Encryption requirement getter
- * @return boolean - true if Objects stored using this descriptor have to be
- * encrypted - decrypted at storage/retrieval time
- */
- public boolean isEncrypted() { return m_bEncrypt; }
- /**
- * Static helper method to obtain the snapshot type by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapType()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapType(int p_i) { return getBobjStoreTable()[p_i].m_sSnapType; }
- /**
- * Static helper method to obtain the snapshot SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getSnapTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getSnapTable(int p_i) { return getBobjStoreTable()[p_i].m_sSnapTbl; }
- /**
- * Static helper method to obtain the locator SQL tablename by index mnemonic
- * @param p_i int - Index of descriptor in static descriptor table
- * @return String
- * @see BobjStore#getLocatorTable()
- * @see BobjStore#getIndex(Class)
- */
- public String getLocatorTable(int p_i){ return getBobjStoreTable()[p_i].m_sLocTbl; }
-
- /**
- *
- */
- protected AbstractBobjStore() {}
-
- /**
- * Constructor using all fields required by a BobjStore object
- * @param p_sSnapType String - Snapshot type
- * @param p_sSnapTbl String - Snapshot SQL tablename
- * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
- * @param p_sCls String - Class name excluding package prefix
- * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
- * @see BusinessObject#classNm()
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls, boolean p_bCrypt)
- { m_sSnapType = p_sSnapType;
- m_sSnapTbl = p_sSnapTbl;
- m_sLocTbl = p_sLocTbl;
- m_sClass = p_sCls;
- m_bEncrypt = p_bCrypt;
- } //________________________________
-
- /**
- * Constructor for non encrypted BobjStore
- * @param p_sSnapType String
- * @param p_sSnapTbl String
- * @param p_sLocTbl String
- * @param p_sCls String
- * @see BobjStore#BobjStore(String,String,String,String,boolean)
- */
- protected AbstractBobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls)
- { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
- } //________________________________
-
- /**
- * Index in static descriptor table for objects of class <arg 1>
- * @param p_oCls Class - BusinessObject class to search for in descriptor table
- * @throws Exception
- * @return int - index in static descriptor table
- */
- public int getIndex (Class p_oCls) throws Exception
- { String sClassName = p_oCls.getName()
- .substring(1+p_oCls.getName().lastIndexOf("."));
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- if (getBobjStoreIndex()[i1].equals(sClassName)) return i1;
- throw new Exception("No BobjStore for class "+p_oCls.getName());
- } //__________________________________
- /**
- * Get a BobjStore object that describes persistence details for objects of
- * class <arg 1>
- * @param p_sClassName String Classname to search for in descriptor table
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(BusinessObject)
- */
- public AbstractBobjStore getStore (String p_sClassName)
- { if (null == p_sClassName) return null;
- for (int i1 = 0; i1 < getBobjStoreTable().length; i1++)
- { String sTblCls = getBobjStoreIndex()[i1];
- if (p_sClassName.equals(sTblCls)) return getStore(i1);
- }
- return null;
- } //__________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for the
- * object specified in arg 1
- * @param p_o BusinessObject The object whose storage descriptor is requested
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (BaseBusinessObject p_o)
- { return (null != p_o) ? getStore(p_o.classNm()) : null;
- } //__________________________________
-
- /**
- * Get a BobjStore object by mnemonic name (index in the static descriptor table)
- * @param p_i int - typically a mnemonic name will be used (see CQ3 constants)
- * @return BobjStore - A descriptor that will provide persistence info
- * @see PersistHandler
- * @see BobjStore#getStore(String)
- */
- public AbstractBobjStore getStore (int p_i)
- {
- AbstractBobjStore oRet = getBobjStoreTable()[p_i];
-
- try { return (AbstractBobjStore)oRet.clone(); }
- catch (Exception e) {return oRet;}
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/AbstractBobjStore.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,206 +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.internal.core.objectstore;
-
-import java.util.*;
-
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.util.*;
-
-public class BobjStore
-{
- private static String DATASRC_JNDI_NAME;
- public static void setDataSourceJndi(String p_s){ DATASRC_JNDI_NAME = p_s; }
- public static String getDataSourceJndi() { return DATASRC_JNDI_NAME; }
-
- private static String TBL_UIDS;
- public static void setUidTableName(String p_s) { TBL_UIDS = p_s; }
- public static String getUidTableName() { return TBL_UIDS; }
-
- private static String TBL_BATCHES;
- public static void setBatchTableName(String p_s) { TBL_BATCHES = p_s; }
- public static String getBatchTableName() { return TBL_BATCHES; }
-
- private static final Map<String,BobjStore> s_oStoreMap
- = new HashMap<String,BobjStore>();
-
- static
- { try
- { DomElement oConf = DomElement.fromURL(EsbSysProps.getObjStoreConfigFile());
- if (null!=oConf)
- {
- setDataSourceJndi (oConf.getAttr("dataSourceJndiName"));
- setUidTableName (oConf.getAttr("uidTable"));
- setBatchTableName (oConf.getAttr("batchTable"));
- for (DomElement oCurr : oConf.getElementChildren("Class"))
- { String sClass = oCurr.getAttr("name");
- boolean bCrypt = "true".equalsIgnoreCase(oCurr.getAttr("encrypt"));
-
- BobjStore oNew = new BobjStore
- (oCurr.getAttr("type")
- ,oCurr.getAttr("table")
- ,null
- ,sClass.substring(1+sClass.lastIndexOf("."))
- ,bCrypt
- );
-
- for (DomElement oIcurr : oCurr.getElementChildren("Index"))
- oNew.addLocatorTable(oIcurr.getAttr("table"));
- s_oStoreMap.put(sClass,oNew);
- }
- }
- }
- catch (Exception e)
- { EsbUtil.getDefaultLogger(BobjStore.class).error("BobjStore configuration FAILED"
- ,e);
- }
-
- };
-
- private String m_sSnapType , m_sSnapTbl , m_sClass;
- private List<String> m_olLocators;
- private boolean m_bEncrypt=false;
-
- /**
- * Snapshot type getter - The value assigned to this attribute will help if
- * standard SQL queries are required to surf the Object Store's snapshot tables
- * @return String - Value of snapshot type
- * @see Istorable#getSnapType()
- */
- public String getSnapType() { return m_sSnapType; }
- /**
- * Snapshot tablename getter - The value assigned to this attribute is the
- * name of the snapshot table for this object
- * @return String - name of SQL table where snapshots of objects will be stored
- * @see Istorable#getSnapTable()
- */
- public String getSnapTable() { return m_sSnapTbl; }
- /**
- * First locator tablename getter - Locator tables are also called index tables.
- * @return String - name of SQL table where locators(0) will be stored
- * @see Istorable#getLocatorTable()
- * @see BusinessObject#getObjLocator()
- */
- public String getLocatorTable() { return getLocatorTable(0); }
- /**
- * Obtain Nth locator table
- * @param p_n - Index for desired locator table
- * @return String - name of Nth SQL table where for objects will be stored
- * @see BaseBusinessObject#locator(p_i)
- */
- public String getLocatorTable(int p_n)
- { return (null==m_olLocators) ? null
- : (m_olLocators.size() <= p_n) ? null
- : m_olLocators.get(p_n);
- }
-
- /**
- * Obtain all locator table names
- * @return Names of all locator tables
- */
- public String[] allLocatorTables()
- { return (null==m_olLocators) ? new String[] {}
- : m_olLocators.toArray(new String[m_olLocators.size()]);
- }
- /**
- * Class suffix getter - Deprecated - Left here for backwards compatibility
- * @return String - Class suffix
- * @see Istorable#getLocatorTable()
- * @see BusinessObject#getObjLocator()
- */
- public String getClassSuffix() { return m_sClass; }
- /**
- * Encryption requirement getter
- * @return boolean - true if Objects stored using this descriptor have to be
- * encrypted - decrypted at storage/retrieval time
- */
- public boolean isEncrypted() { return m_bEncrypt; }
-
- /**
- * Constructor using all fields required by a BobjStore object
- * @param p_sSnapType String - Snapshot type
- * @param p_sSnapTbl String - Snapshot SQL tablename
- * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
- * @param p_sCls String - Class name excluding package prefix
- * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
- * @see Istorable
- * @see BusinessObject#classNm()
- */
- protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls, boolean p_bCrypt)
- { m_sSnapType = p_sSnapType;
- m_sSnapTbl = p_sSnapTbl;
- addLocatorTable(p_sLocTbl);
- m_sClass = p_sCls;
- m_bEncrypt = p_bCrypt;
- } //________________________________
-
- private void addLocatorTable(String p_s)
- { if (EsbUtil.isNullString(p_s)) return;
- if (null==m_olLocators)
- m_olLocators = new ArrayList<String>();
- m_olLocators.add(p_s);
- } //________________________________
-
- /**
- * Constructor for non encrypted BobjStore
- * @param p_sSnapType String
- * @param p_sSnapTbl String
- * @param p_sLocTbl String
- * @param p_sCls String
- * @see BobjStore#BobjStore(String,String,String,String,boolean)
- */
- protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
- ,String p_sCls)
- { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
- } //________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for objects of
- * class <arg 1>
- * @param p_sClassName Class to search for in descriptor table
- * @return BobjStore - A descriptor that will provide persistence info
- * @see JbossEsbPersistHandler
- * @see BobjStore#getStore(BusinessObject)
- */
- public static BobjStore getStore (String p_sClassName)
- { if (EsbUtil.isNullString(p_sClassName)) return null;
- return s_oStoreMap.get(p_sClassName);
- } //__________________________________
-
- /**
- * Get a BobjStore object that describes persistence details for
- * BobjStdDTO <arg 1>
- * @param p_sClassName BobjStdDTO for which we need an object store
- * @return BobjStore - A descriptor that will provide persistence info
- * @see JbossEsbPersistHandler
- * @see BobjStore#getStore(String)
- */
- public static BobjStore getStore (BobjStdDTO p_oDto)
- { if (null == p_oDto) return null;
- return getStore(p_oDto.fullClassName());
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,219 +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.internal.core.objectstore;
-
-import java.sql.*;
-import org.apache.log4j.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-
-/**
- * Data access object for the SQL table where batches are temporarily stored
- * until they are committed
- *
- */
-public class DaoBatchTable extends SqlDbTable
-{
- private Logger m_oLog;
- private JdbcCleanConn m_oConn;
-
- private DaoBatchTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoBatchTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoBatchTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoBatchTable(JdbcCleanConn p_oConn,String p_sTblName) throws Exception
- { super(p_oConn,p_sTblName);
- m_oLog = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "batch_num,seq,data";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for field representing batch number
- */
- public static final int BATCH_NUM = s_iFld++;
- /**
- * Column index for field representing sequence number within batch number
- */
- public static final int BATCH_SEQ = s_iFld++;
- /**
- * XML string that will be used to instantiate the BusinessObject
- * @see BusinessObject#BusinessObject(BobjStdDTO)
- * @see BobjStdDTO#getFromXml(String)
- */
- public static final int STR_DATA = s_iFld++;
-
- private static final int QFIELDS = s_iFld;
-
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_BATCHROW)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of RowBatch</li>
- * </p>
- * @throws Exception
- * @return int
- * @see DaoBatchTable#getPS(int)
- * @see RowBatch
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof RowBatch)) throw
- new Exception ("Parameter must be RowBatch");
-
- p_PS.clearParameters();
- RowBatch oBR = (RowBatch)p_o;
- setLong (p_PS, BATCH_NUM ,oBR.m_lBatch); // Batch Number
- setInt (p_PS, BATCH_SEQ ,oBR.m_iSeq); // Batch Sequence
- setObject (p_PS ,STR_DATA ,oBR.m_sData); // Batch Data
-
- return QFIELDS;
- }
- catch (Exception e)
- { m_oLog.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
- /**
- * Returns a RowBatch object containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - A RowBatch object
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoBatchTable#getPS(int)
- * @see DaoBatchTable#PS_GET_BATCH_ROWS
- * @see RowBatch
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- { RowBatch oRet = new RowBatch();
- oRet.m_lBatch = p_oRS.getLong(1+BATCH_NUM);
- oRet.m_iSeq = p_oRS.getInt (1+BATCH_SEQ);
- oRet.m_sData = p_oRS.getString(1+STR_DATA);
- return oRet;
- }
- catch (Exception e)
- { m_oLog.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_BATCHROW = 0;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_DELETE_BATCH = 1;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO (it has a where batch_num = ?)
- */
- public static final int PS_GET_BATCH_ROWS = 2;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_BATCHROW: return getInsBatchRow (p_i);
- case PS_DELETE_BATCH: return deleteBatch (p_i);
- case PS_GET_BATCH_ROWS: return getBatchRows (p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLog.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsBatchRow(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement deleteBatch(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer("delete from ").append(m_sTableName)
- .append(" where ")
- .append(m_oaFields[BATCH_NUM].getFieldName()).append(" = ?")
- ;
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getBatchRows(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ")
- .append(m_oaFields[BATCH_NUM].getFieldName()).append(" = ?")
- .append(" order by 1,2")
- ;
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoBatchTable.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,312 +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.internal.core.objectstore;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-import java.sql.*;
-import org.apache.log4j.*;
-
-/**
- * Data access object for all SQL tables that the ROS (Rosetta Object Store)
- * uses as locator tables
- * <p>Number of actual columns in all of these tables equals 4 + the
- * length of the String[] returned by the BusinessObject locator() method</p>
- * <p>It is responsibility of rosetta core developers to ensure
- * synchronization between these two, as well as to add a corresponding
- * entry in the BobjStore static descriptor table</p>
- *
- * @see BobjStore
- * @see BusinessObject#locator()
- */
-public class DaoIndexTable extends SqlDbTable
-{
-
- public static final String LOCATOR_TABLE_INDEX = "__whichLocator";
-
- private Logger m_oLog;
- private JdbcCleanConn m_oConn;
-
- private DaoIndexTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoIndexTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoIndexTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoIndexTable(JdbcCleanConn p_oConn,String p_sTbl) throws Exception
- { super(p_oConn,p_sTbl);
- m_oLog = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- if (null != m_oaFields)
- { m_oaFields[OBJECT_UID].setPrimaryKey(true);
- m_sSelectSql = null;
- }
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
-
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { if (null==m_oaFields) return "*";
- StringBuffer sb = new StringBuffer(256);
- for (int i1=0; i1<m_oaFields.length;i1++)
- ((i1 < 1)?sb:sb.append(","))
- .append(m_oaFields[i1].getFieldName());
- return sb.toString();
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for the BusinessObject UID represented in the corresponding
- * SQL table row
- */
- public static final int OBJECT_UID = s_iFld++;
- /**
- * Column index for the latest Object snapshot taken for the BusinessObject
- */
- public static final int TIMESTAMP = s_iFld++;
- /**
- * Column index for the latest snapshot's UID for the BusinessObject the row
- * represents
- */
- public static final int UID_SNAP = s_iFld++;
- /**
- * Column index for the latest Object snapshot's date (yyyymmdd)
- */
- public static final int SNAP_DATE = s_iFld++;
- /**
- * Column index for the first field in the String array returned by the
- * BusinessObject's locator() method - Subsequent fields in the array will
- * have consecutive sequential indices
- * @see BusinessObject#locator()
- */
- public static final int FIRST_FIELD = s_iFld++;
-
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { return setInsValues (p_PS,p_o,0); }
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_INDEX)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of BobjStdDTO</li>
- * </p>
- * @param p_iNum int - Index of which locator String[] should be used
- * @throws Exception
- * @return int
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_INS_INDEX
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o, int p_iNum)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
-
- p_PS.clearParameters();
- setLong (p_PS, OBJECT_UID ,oDto.getUid()); // Object's UID
- long lStamp = oDto.getStamp();
- setLong (p_PS, TIMESTAMP ,lStamp); // Timestamp
- setLong (p_PS, UID_SNAP ,oDto.getSnap()); // Snap UID
- setObject(p_PS, SNAP_DATE ,oDto.getSnapDate()); // Snap Date
-
- int iFld = FIRST_FIELD;
- String[] sa = oDto.getLocators()[p_iNum];
- for (int i1=0; i1<sa.length;i1++)
- if (iFld < m_oaFields.length) setObject(p_PS,iFld++,sa[i1]);
-
- return iFld;
- }
- catch (Exception e)
- { m_oLog.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- public void setUpdValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { setUpdValues(p_PS,p_o,0); }
-
- /**
- * Set values for update statement
- * @param p_PS PreparedStatement - The prepared SQL statement for update in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_UPD_INDEX)</p>
- * @param p_o Object - Object to get values from
- * <li>For this particular class, arg 2 MUST be an instance of BaseBusinessObject</li>
- * </p>
- * @param p_iNum int - Index of which locator String[] should be used
- * @throws Exception
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_UPD_INDEX
- */
- public void setUpdValues(PreparedStatement p_PS,Object p_o, int p_iNum)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
-
- int iFld = 0;
- p_PS.clearParameters();
- setLong (p_PS, iFld++ ,oDto.getStamp()); // Timestamp
- setLong (p_PS, iFld++ ,oDto.getSnap()); // Snap UID
- setObject(p_PS, iFld++ ,oDto.getSnapDate());
-
- String[] sa = oDto.getLocators()[p_iNum];
- for (int i1=0; i1<sa.length;i1++)
- if (iFld < m_oaFields.length) setObject(p_PS,iFld++,sa[i1]);
-
- setLong(p_PS, iFld++, oDto.getUid());
- }
- catch (Exception e)
- { m_oLog.error("setUpdValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- /**
- * Returns an ObjLocator object containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - An ObjLocator object
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoIndexTable#getPS(int)
- * @see DaoIndexTable#PS_SEL_INDEX
- * @see ObjLocator
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- {
- long lUid = p_oRS.getLong(1+OBJECT_UID);
- String[] sa = new String[m_oaFields.length-FIRST_FIELD];
- int iFld = FIRST_FIELD;
- for (int i1=0; i1<sa.length;i1++) sa[i1] = p_oRS.getString(++iFld);
-
- return new ObjLocator(lUid,sa);
- }
- catch (Exception e)
- { m_oLog.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
-
-
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_INDEX = 0;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_SEL_INDEX = 1;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_RMV_INDEX = 2;
- /**
- * Index of the 'update' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_UPD_INDEX = 3;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_INDEX: return getInsIndex(p_i);
- case PS_SEL_INDEX: return getSelIndex(p_i);
- case PS_RMV_INDEX: return getRmvIndex(p_i);
- case PS_UPD_INDEX: return getUpdIndex(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLog.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSelIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(OBJECT_UID)).append(" = ? ");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getRmvIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getDeleteStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getUpdIndex(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getUpdateStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoIndexTable.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,398 +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.internal.core.objectstore;
-
-import java.lang.reflect.Method;
-import java.sql.*;
-import org.apache.log4j.*;
-
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.util.EsbUtil;
-import org.jboss.soa.esb.util.BobjStdDTO;
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.services.*;
-
-
-/**
- * Data access object for all SQL tables that the ROS (Rosetta Object Store)
- * uses as snapshot tables
- *
- * @see BobjStore
- */
-public class DaoSnapTable extends SqlDbTable
-{
- private Logger m_oLogger;
- private JdbcCleanConn m_oConn;
- private BobjStore m_oST;
-
- private DaoSnapTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoSnapTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_oST BobjStore - Descriptor that holds information of what physical
- * SQL tables to use both for the snapshot and the locator tables for
- * BusinessObjects sent to this DAO
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- * @see BobjStore
- * @see Istorable
- */
- public DaoSnapTable(JdbcCleanConn p_oConn,BobjStore p_oST) throws Exception
- { super(p_oConn,p_oST.getSnapTable());
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oConn = p_oConn;
- m_oST = p_oST;
- if (null != m_oaFields)m_oaFields[UID_SNAP].setPrimaryKey(true);
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
-
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "uid,stamp,snap_type,object_uid,batch_num,xml_data";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for the SQL table field representing snapshot's unique identifier
- * <p>This would be the 'natural' primary key for all snapshot tables, and the
- * number should only be assigned by the JbossEsbPersistHandler EJB at insert time</p>
- * <p>There could potentially be several snapshots for the same
- * BusinessObject - In that case, there would be several rows in the
- * snapshot table with the same OBJECT_UID value and different UID_SNAP
- * values
- * </p>
- * @see DaoSnapTable#OBJECT_UID
- */
- public static final int UID_SNAP = s_iFld++;
- /**
- * Column index for the SQL table field representing this snapshot's timestamp, expressed
- * in milliseconds since the start of the 'epoch'
- * @see java.util.Date
- */
- public static final int TIMESTAMP = s_iFld++;
- /**
- * Column index for the SQL table field representing this snapshot's
- * underlying BusinessObject type - This is a Rosetta Core design level decision
- * <p>Having this field as an SQL column will enable SQL 'visibility' and thus
- * can be used in the 'where' clause of any SQL statement</p>
- * <p>An example of when this field could potentially be used is if a
- * decision is made by Rosetta Administrators to move all objects of a specific
- * type to a different SQL snapshot table</p>
- */
- public static final int SNAP_TYPE = s_iFld++;
- /**
- * Column index for the SQL table field representing BusinessObject unique identifier
- * <p>There could potentially be several snapshots for the same
- * BusinessObject - In that case, there would be several rows in the
- * snapshot table with the same OBJECT_UID value and different UID_SNAP
- * values
- * </p>
- * @see DaoSnapTable#OBJECT_UID
- */
- public static final int OBJECT_UID = s_iFld++;
- /**
- * Column index for the SQL table field representing the batch number
- * as a result of which this snapshot was added to the store
- * <p>If this snapshot was not added as part of a batch process (meaning a
- * group of BusinessObjects added using the JbossEsbBatchHandler EJB), then it
- * will hold a null value</p>
- */
- public static final int BATCH_NUM = s_iFld++;
- /**
- * Column index for the SQL table field representing the XML representation
- * of the BusinessObject stored in this SQL table
- * <p>The contents of this field are going to be the result of invoking
- * the BusinessObject.toDTO().toXml() method</p>
- * @see BusinessObject#toDTO()
- * @see BobjStdDTO#toXml()
- * @see DaoSnapTable#setInsValues(PreparedStatement,Object)
- */
- public static final int XML_OBJECT = s_iFld++;
-
- private static final int QFIELDS = s_iFld++;
-
- /**
- * Set values for insert statement
- * @param p_PS PreparedStatement - The prepared SQL statement for insert in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_INS_SNAP)</p>
- * @param p_o Object - Object to get values from
- * <p>arg 2 is Object to comply with SqlDbTable abstract method setInsValues()
- * <li>For this particular class, arg 2 MUST be an instance of BusinessObject</li>
- * </p>
- * @throws Exception
- * @return int
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_INS_SNAP
- * @see BusinessObject
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
- long lSnapUid = oDto.getSnap();
-
- p_PS.clearParameters();
- setLong (p_PS, UID_SNAP ,lSnapUid);
- setLong (p_PS, TIMESTAMP ,oDto.getStamp()); // Timestamp
- setObject(p_PS, SNAP_TYPE ,m_oST.getSnapType()); // Snap Type
- setLong (p_PS, OBJECT_UID ,oDto.getUid()); // Object's UID
- setLong (p_PS, BATCH_NUM ,oDto.getBatch()); // Batch Number
- byte[] baXml = oDto.toXml().getBytes();
- p_PS.setBytes(1+XML_OBJECT,seeCrypt(baXml,lSnapUid));
-
- return QFIELDS;
- }
- catch (Exception e)
- { m_oLogger.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- /**
- * Set values for update statement
- * @param p_PS PreparedStatement - The prepared SQL statement for updates in this
- * table
- * <p>Must be the result of a previous call to this.getPS(PS_UPD_SNAP)</p>
- * @param p_o Object - Object to get values from
- * <li>For this particular class, arg 2 MUST be an instance of BobjStdDTO</li>
- * </p>
- * @throws Exception
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_UPD_SNAP
- * @see BobjStdDTO
- */
- public void setUpdValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { try
- { if (! (p_o instanceof BobjStdDTO)) throw
- new Exception ("Parameter must be BobjStdDTO");
-
- BobjStdDTO oDto = (BobjStdDTO)p_o;
- long lSnapUid = oDto.getSnap();
-
- p_PS.clearParameters();
-
- int iFld = 0;
- setLong (p_PS, iFld++ ,oDto.getStamp()); // Timestamp
- setObject(p_PS, iFld++ ,m_oST.getSnapType()); // Snap Type
- setLong (p_PS, iFld++ ,oDto.getUid()); // Object's UID
- setLong (p_PS, iFld++ ,oDto.getBatch()); // Batch Number
- byte[] baXml = oDto.toXml().getBytes();
- p_PS.setBytes(1+iFld++ ,seeCrypt(baXml,lSnapUid));
- setLong (p_PS, iFld++ ,lSnapUid);
- }
- catch (Exception e)
- { m_oLogger.error("setInsValues() Failed",e);
- throw e;
- }
- } //________________________________
-
- private Iencryption m_oMangler;
- private static final Object s_oSync = new Integer(0);
- private Iencryption getMangler() throws Exception
- { return getMangler(null); }
- private Iencryption getMangler(Object p_oFactParms) throws Exception
- { if (null!=m_oMangler)
- return m_oMangler;
- synchronized(s_oSync)
- { if (null!=m_oMangler)
- return m_oMangler;
-
- String sFactoryName = EsbSysProps.getEncryptionFactoryClass();
- Class oFactClass = DefaultEncryptionFactory.class;
- if (null!=sFactoryName)
- oFactClass = Class.forName(sFactoryName);
- Method oMth = oFactClass.getMethod("getEncrypter"
- ,new Class[] {Object.class});
- m_oMangler = (Iencryption) oMth.invoke(null,p_oFactParms);
- }
-
- return m_oMangler;
- } //________________________________
-
- /**
- * Encrypt if you have to or just return your first argument
- * <p />
- * You'll probably override this method if you have your own Iencryption implementation
- * @param p_ba the byte array to be encrypted (if the store so indicates)
- * @param p_l an object for the encrypt method of the Iencryption object
- * @return the value to be stored in the column
- * @throws Exception
- */
-
- protected byte[] seeCrypt(byte[] p_ba,Object p_l) throws Exception
- { if (! m_oST.isEncrypted()) return p_ba;
- return getMangler().encrypt(p_ba,p_l);
- } //________________________________
-
- /**
- * Decrypt if you have to or just return your first argument
- * <p />
- * You'll probably override this method if you have your own Iencryption implementation
- * @param p_ba the byte array to be decrypted (if the store so indicates)
- * @param p_l an object for the decrypt method of the Iencryption object
- * @return the value to be used to construct the XML string
- * @throws Exception
- */
- protected byte[] seeDecrypt(byte[] p_ba,Object p_l) throws Exception
- { if (! m_oST.isEncrypted()) return p_ba;
- return getMangler().decrypt(p_ba,p_l);
- } //________________________________
-
- /**
- * Returns a BobjStdDTO containing data from the row in the current
- * cursor position of the ResultSet object <arg 1>
- * @param p_oRS ResultSet - The current ResultSet
- * <p>Must be the result of a previous execution of
- * JdbcCleanConn.execQueryWait() method on a 'select' prepared statement for
- * this object</p>
- * @throws Exception
- * @return Object - A BobjStdDTO
- * @see JdbcCleanConn#execQueryWait(PreparedStatement, int)
- * @see DaoSnapTable#getPS(int)
- * @see DaoSnapTable#PS_SEL_SNAP
- * @see DaoSnapTable#PS_SEL_4UPD
- * @see BobjStdDTO
- */
- public Object getFromRS (ResultSet p_oRS) throws Exception
- { try
- { long lUid = p_oRS.getLong(1+UID_SNAP);
- String sXml = (m_oST.isEncrypted())
- ? new String(seeDecrypt(p_oRS.getBytes(1+XML_OBJECT),lUid),"ISO-8859-1")
- : p_oRS.getString(1+XML_OBJECT);
- Object oRet = BobjStdDTO.getFromXml(sXml);
- return oRet;
- }
- catch (Exception e)
- { m_oLogger.error("getFromRS() Failed",e);
- throw e;
- }
- } //________________________________
-
-
- /**
- * Index of the 'insert' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_INS_SNAP = 0;
- /**
- * Index of the 'select' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_SEL_SNAP = 1;
- /**
- * Index of the 'delete' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_RMV_SNAP = 2;
- /**
- * Index of the 'update' statement in the list of PreparedStatement objects
- * for this DAO
- */
- public static final int PS_UPD_SNAP = 3;
- /**
- * Index of the 'select for update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_SEL_4UPD = 4;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_INS_SNAP: return getInsSnap(p_i);
- case PS_SEL_SNAP: return getSelSnap(p_i);
- case PS_RMV_SNAP: return getRmvSnap(p_i);
- case PS_UPD_SNAP: return getUpdSnap(p_i);
- case PS_SEL_4UPD: return getSel4UpdSnap(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLogger.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getInsSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getInsertStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSelSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(UID_SNAP)).append(" = ? ");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getRmvSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getDeleteStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getUpdSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- m_oaPS[p_i] = m_oConn.prepareStatement(getUpdateStatement());
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement getSel4UpdSnap(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(UID_SNAP)).append(" = ? ")
- .append(" for update");
- m_oaPS[p_i] = m_oConn.prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.internal.core.objectstore;
-
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.util.*;
-import java.sql.*;
-import org.apache.log4j.*;
-
-/**
- * Data access object for the SQL table that the Object Store
- * uses to assign Unique Identifiers (UID) to any object in the framework
- * @see IpersistHandler#getUidChunk(int)
- */
-public class DaoUidTable extends SqlDbTable
-{
- /**
- * Key value for the row in the UID table that holds UIDs for BusinessObjects
- * "jbossEsb_objuid"
- */
- public static final String SEQUENCE_OBJ = "jbossEsb_objuid";
- /**
- * Key value for the row in the UID table that holds UIDs for BatchProcess
- * "jbossEsb_batchuid"
- */
- public static final String SEQUENCE_BATCH = "jbossEsb_batchuid";
-
- private Logger m_oLogger;
-
- private DaoUidTable() throws Exception {this(null,null); }
- /**
- * Instantiate a DaoUidTable object using the javax.sql.DataSource object
- * within <arg 1>, with table name held in <arg 2>
- * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
- * all SQL statements in this DAO
- * @param p_sTblName String - SQL table name to use in the context of this
- * DaoUidTable object
- * @throws Exception - pass through from invoked methods - see Exception.getMessage()
- * at runtime for details
- * @see JdbcCleanConn
- */
- public DaoUidTable(JdbcCleanConn p_oConn,String p_sTblName) throws Exception
- { super(p_oConn,p_sTblName);
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- if (null != m_oaFields)
- { m_oaFields[UID].setPrimaryKey(true);
- }
- m_oaPS = new PreparedStatement[PS_MAX];
- } //________________________________
- /**
- * List of fields for select statement - provided only to avoid time
- * consuming 'select *' statements
- * @return String - a Comma separated list of fields
- */
- protected String getSelectFields()
- { return "uid,sequence_name,last_used_uid";
- } //________________________________
-
- // -------------------------------------------------------------
- // Column constants
- // -------------------------------------------------------------
- private static int s_iFld = 0;
- /**
- * Column index for field representing the UID of this table row
- */
- public static final int UID = s_iFld++;
- /**
- * Column index for field representing the sequence name of this row
- * @see DoiUidTable#SEQUENCE_OBJ
- * @see DoiUidTable#SEQUENCE_BATCH
- */
- public static final int SEQ_NAME = s_iFld++;
- /**
- * Column index for field representing the last used UID number for this
- * particular sequence name
- */
- public static final int LAST_USED_UID = s_iFld++;
-
-
- /**
- * This method is supplied to comply with the parent class but it should
- * NEVER be used
- * @param p_PS PreparedStatement
- * @param p_o Object
- * @throws Exception - This will ALWAYS throw an Exception - Inserts to
- * this table class should be handled ONLY by the Rosetta Administrator
- * @return int - It will never return a value
- */
- public int setInsValues(PreparedStatement p_PS,Object p_o)
- throws Exception
- { String sErr = "No Inserts to UID table";
- m_oLogger.error(sErr);
- throw new Exception (sErr);
- } //________________________________
- /**
- * Provided for compatibility - Never used - Will always return null
- * @param p_oRS ResultSet
- * @throws Exception
- * @return Object
- */
- public Object getFromRS(ResultSet p_oRS) throws Exception
- { return null;
- } //________________________________
-
- /**
- * Index of the 'select for update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_GET_SEQ_4_UPD = 0;
- /**
- * Index of the 'update' statement in the list of PreparedStatement
- * objects for this DAO
- */
- public static final int PS_UPDATE_LAST_USED = 1;
-
- private static final int PS_MAX = 10;
-
- /**
- * Obtain a prepared statement for this DAO from the list of available PStmts
- * <p>Uses lazy instantiation of requested objects</p>
- * @param p_i int - Index of PreparedStatement object to obtain
- * @throws Exception - If an invalid index is passed or there are problems
- * during the prepareStatement() invocation
- * @return PreparedStatement
- */
- public PreparedStatement getPS (int p_i) throws Exception
- { try
- { switch (p_i)
- { case PS_GET_SEQ_4_UPD: return getSeq4Upd(p_i);
- case PS_UPDATE_LAST_USED: return updateLastUsed(p_i);
- }
- ;
- throw new Exception("Invalid Index "+p_i);
- }
- catch (Exception e)
- { m_oLogger.error("Request for Prepared Statement Failed",e);
- throw e;
- }
- } //__________________________________
-
- private PreparedStatement getSeq4Upd(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer(getSelectStatement())
- .append(" where ").append(getFldName(SEQ_NAME))
- .append(" = ? for update");
- m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- private PreparedStatement updateLastUsed(int p_i) throws Exception
- { if (null == m_oaPS[p_i])
- { StringBuffer sb = new StringBuffer("update ").append(m_sTableName)
- .append(" set ").append(getFldName(LAST_USED_UID)).append(" = ?")
- .append(" where ").append(getFldName(SEQ_NAME)).append(" = ?")
- ;
- m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
- }
- return m_oaPS[p_i];
- } //__________________________________
-
- /**
- * This is an exception to the standard behaviour of derived classes that
- * extend the SqlDbTable abstract class
- * <p>This method is called by the JbossEsbPersistHandler and JbossEsbBatchHandler EJBs
- * and makes their life easier when they need to obtain UID chunks</p>
- * <p>These EJBs rely on this table to ensure no duplicate UIDs across all of
- * Rosetta</p>
- * <p>It could also be invoked from a different context, provided that the
- * Rosetta Administrators have added a row with a unique sequence name to
- * the underlying SQL table that holds the last used UIDs for all numbering
- * sequences</p>
- * @param p_sSeqName String - Key to the sequence name to get the chunk from
- * @param p_iQuids int - Number of UIDs to return
- * @throws Exception
- * @return long - First UID in the chunk assigned by this method
- */
- public long getUidChunk(String p_sSeqName, int p_iQuids) throws Exception
- {
- try
- { PreparedStatement PS = getPS(DaoUidTable.PS_GET_SEQ_4_UPD);
- PS.setString(1,p_sSeqName);
- ResultSet rs = getConn().execQueryWait(PS,30);
-
- boolean bOK=false;
- try
- { if (rs.next())
- bOK = true;
- }
- catch (Exception e1) { getConn().rollback(); }
- if (! bOK) throw new Exception("Select FAILED jbossEsb.getChunk()");
-
- int iSqlFld = 1+DaoUidTable.LAST_USED_UID;
- long lUid = rs.getLong(iSqlFld);
- if (lUid < 1) lUid = 1;
- long lNewLast = lUid + p_iQuids;
-
- PS = getPS(DaoUidTable.PS_UPDATE_LAST_USED);
- PS.setLong (1,lNewLast);
- PS.setString(2,p_sSeqName);
- getConn().execUpdWait(PS,10);
-
- getConn().commit();
-
- return lUid;
- }
- catch (Exception e)
- { m_oLogger.error(e.getMessage());
- throw e;
- }
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,38 +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.internal.core.objectstore;
-
-/**
- * Provides methods to learn about how and where a BusinessObject will be stored
- * and retrieved from a BobjStore
- * @see BobjStore
- */
-
-public interface ItfStorable
-{
- public String getSnapType ();
- public String getSnapTable ();
- public String getLocatorTable ();
- public String getLocatorTable (int p_i);
- public boolean isEncrypted ();
-} // ___________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/ItfStorable.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,42 +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.internal.core.objectstore;
-
-public class RowBatch
-{
- public long m_lBatch;
- public int m_iSeq;
- public long m_lCommitTS;
- public String m_sData;
-
- public RowBatch()
- { this(0,0,0,null);
- } //__________________________________
-
- public RowBatch (long p_lBatch, int p_iSeq, long p_lTS, String p_sData)
- { m_lBatch = p_lBatch;
- m_iSeq = p_iSeq;
- m_lCommitTS = p_lTS;
- m_sData = p_sData;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/RowBatch.java)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.services;
-
-import javax.naming.*;
-
-import org.jboss.soa.esb.services.EJB.*;
-import org.jboss.soa.esb.common.bizclasses.BatchProcess;
-
-public class BatchHandlerBsDelegateLocal implements IbatchHandler
-{
- private JbossEsbBatchHandlerLocal m_oBatchH;
-
- public BatchHandlerBsDelegateLocal(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbBatchHandlerLocal");
-
- JbossEsbBatchHandlerLocalHome oHu = (JbossEsbBatchHandlerLocalHome) ref;
- m_oBatchH = oHu.create();
- } //__________________________________
-
- public long newBatch () throws Exception
- { return m_oBatchH.newBatch(); }
-
- public int addToBatch (String p_s) throws Exception
- { return m_oBatchH.addToBatch(p_s); }
-
- public void finish () throws Exception
- { m_oBatchH.finish(); }
-
- public void releaseHandler()
- { try { m_oBatchH.remove(); }
- catch (Exception e) {}
- } //__________________________________
- public void commitBatch(BatchProcess p_oBP) throws Exception
- { m_oBatchH.commitBatch(p_oBP);
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.services;
-
-import javax.naming.*;
-import javax.rmi.*;
-
-import org.jboss.soa.esb.services.EJB.*;
-import org.jboss.soa.esb.common.bizclasses.BatchProcess;
-
-public class BatchHandlerBsDelegateRemote implements IbatchHandler
-{
- private JbossEsbBatchHandler m_oBatchH;
-
- public BatchHandlerBsDelegateRemote(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbBatchHandler");
- Object oNarr = PortableRemoteObject.narrow(ref, JbossEsbBatchHandlerHome.class);
- JbossEsbBatchHandlerHome oHu = (JbossEsbBatchHandlerHome) oNarr;
- m_oBatchH = oHu.create();
- } //__________________________________
-
- public long newBatch () throws Exception
- { return m_oBatchH.newBatch(); }
- public int addToBatch (String p_s) throws Exception
- { return m_oBatchH.addToBatch(p_s); }
- public void finish () throws Exception
- { m_oBatchH.finish(); }
- public void releaseHandler()
- { try { m_oBatchH.remove(); }
- catch (Exception e) {}
- } //__________________________________
- public void commitBatch(BatchProcess p_oBP) throws Exception
- { m_oBatchH.commitBatch(p_oBP.toDTO());
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerBsDelegateRemote.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,53 +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.services;
-
-import java.util.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class BatchHandlerFactory
-{
- private static final String [] s_saTypes = {"local","remote"};
- private final static int LCL=0;
- private final static int REM=1;
-
- public static IbatchHandler getBatchHandler
- (String p_sLocRem, String p_sJndiType, String p_sJndiServer) throws Exception
- {
- int iIndex = Arrays.binarySearch(s_saTypes,p_sLocRem.toLowerCase());
- if (iIndex < 0) return null;
- switch (iIndex)
- {
- case REM: return getBatchHandler
- (AppServerContext.getServerContext(p_sJndiType,p_sJndiServer));
- case LCL: return new BatchHandlerBsDelegateLocal(new InitialContext());
- }
- throw new Exception("Invalid Batch Handler Delegate <" + p_sLocRem + ">");
- } //__________________________________
-
- public static IbatchHandler getBatchHandler(Context p_oCtx) throws Exception
- { return new BatchHandlerBsDelegateRemote(p_oCtx);
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/BatchHandlerFactory.java)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,32 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Remote interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbBatchHandler
- extends javax.ejb.EJBObject
-{
-
- public long newBatch( )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public long getBatchNum( )
- throws java.rmi.RemoteException;
-
- public int addToBatch( java.lang.String p_s )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public void finish( )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public void commitBatch( org.jboss.soa.esb.util.BobjStdDTO p_oDto )
- throws java.lang.Exception, java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandler.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,318 +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.services.EJB;
-
-import java.sql.*;
-import java.text.*;
-import javax.ejb.*;
-import javax.naming.*;
-import javax.sql.*;
-
-import org.apache.log4j.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.internal.core.objectstore.*;
-import org.jboss.soa.esb.common.bizclasses.*;
-/**
- * @ejb.bean
- * name="JbossEsbBatchHandler"
- * display-name="Jboss_Esb_Batch_Handler"
- * type="Stateful"
- * view-type="both"
- * jndi-name="JbossEsbBatchHandler"
- * local-jndi-name="JbossEsbBatchHandlerLocal"
- * transaction-type="Bean"
- * @author
- */
-public class JbossEsbBatchHandlerBean implements SessionBean
-{
- private static final long serialVersionUID = 1L;
- SessionContext m_oSessCtx;
-
- public void setSessionContext(SessionContext p_oSessCtx)
- { this.m_oSessCtx = p_oSessCtx; }
-
- private Logger m_oLogger;
- private JdbcCleanConn m_oUidConn;
- private JdbcCleanConn m_oDataConn;
-
- private DaoUidTable m_oDaoUid;
- private DaoBatchTable m_oDaoBatch;
- private DaoIndexTable m_oDaoIndex;
- private DaoSnapTable m_oDaoSnap;
-
- private long m_lBatchNum = -1;
- private int m_iSeq;
-
-/**
- * @ejb.create-method
- * @throws CreateException
- */
- public void ejbCreate() throws CreateException
- {
- try
- { getResources();
- m_oLogger.info(this.toString()+" Created");
- }
- catch (Exception e)
- { m_oLogger.error("Failed to Create : <"+e.getMessage()+">");
- throw new CreateException(e.getMessage());
- }
- } //__________________________________
-
- public void ejbActivate()
- { try
- { getResources();
- m_oLogger.info("EJB Activated");
- }
- catch (Exception e)
- { m_oLogger.error("Failed to Activate : <"+e.getMessage()+">");
- }
- } //__________________________________
-
- public void ejbPassivate()
- { m_oLogger.info("EJB Passivated");
- releaseResources();
- m_oLogger = null;
- m_oUidConn = null;
- m_oDataConn = null;
- } //__________________________________
-
- public void ejbRemove()
- { releaseResources();
- m_oLogger.info("EJB Removed");
- } //__________________________________
-
- private void getResources() throws Exception
- { Context oCtx = new InitialContext();
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- m_oUidConn = new JdbcCleanConn ((DataSource)oCtx.lookup("java:JbossEsbDS"));
- m_oDataConn = new JdbcCleanConn ((DataSource)oCtx.lookup("java:JbossEsbDS"));
- } //__________________________________
-
- private void releaseResources()
- { if (null != m_oDataConn) m_oDataConn.release();
- if (null != m_oUidConn) m_oUidConn.release();
- m_oDaoBatch = null;
- m_oDaoUid = null;
- m_oDaoIndex = null;
- m_oDaoSnap = null;
- } //__________________________________
-
-// Utility Methods
-
- private DaoUidTable getDaoUid() throws Exception
- { if (null==m_oDaoUid)
- m_oDaoUid = new DaoUidTable(m_oUidConn,BobjStore.getUidTableName());
- return m_oDaoUid;
- } //__________________________________
-
- private DaoBatchTable getDaoBatch(String p_sTbl) throws Exception
- { if (null==m_oDaoBatch)
- m_oDaoBatch = new DaoBatchTable(m_oDataConn,p_sTbl);
- return m_oDaoBatch;
- } //__________________________________
-
- private DaoIndexTable getDaoIndex(String p_sTbl) throws Exception
- { if (null==m_oDaoIndex)
- m_oDaoIndex = new DaoIndexTable(m_oDataConn,p_sTbl);
- return m_oDaoIndex;
- } //__________________________________
-
- private DaoSnapTable getDaoSnap(BobjStore p_o) throws Exception
- { if (null==m_oDaoSnap)
- m_oDaoSnap = new DaoSnapTable(m_oDataConn,p_o);
- return m_oDaoSnap;
- } //__________________________________
-
- private void doCommitBatch(BatchProcess p_oBP) throws Exception
- { String sPrevClass = null;
- BobjStore oStore = null;
-
- PreparedStatement PSbatch = getDaoBatch(BobjStore.getBatchTableName())
- .getPS(DaoBatchTable.PS_GET_BATCH_ROWS);
- PSbatch.setLong(1,p_oBP.getBatchNum());
-
- long lNow = System.currentTimeMillis();
- String sSnapDt = new SimpleDateFormat("yyyyMMdd").format(new Date(lNow));
-
- // Get all Batch rows
- ResultSet RS = m_oDataConn.execQueryWait(PSbatch,10);
- while (RS.next())
- { String sXml = RS.getString(1+DaoBatchTable.STR_DATA);
- BobjStdDTO oDto = BobjStdDTO.getFromXml(sXml);
- // Get proper Dao's for Index and Snap table
- String sNewClass = oDto.fullClassName();
- if (! sNewClass.equals(sPrevClass))
- { oStore = BobjStore.getStore(sNewClass);
- sPrevClass = sNewClass;
- m_oDaoIndex = null;
- m_oDaoSnap = null;
- }
- // Set batch number to current batch
- oDto.setBatch (p_oBP.getBatchNum());
- oDto.setStamp (lNow);
- oDto.setSnapDate(sSnapDt);
-
- // Insert Snap row
- PreparedStatement PSins = getDaoSnap(oStore).getPS(DaoSnapTable.PS_INS_SNAP);
- m_oDaoSnap.setInsValues(PSins,oDto);
- try { m_oDataConn.execUpdWait(PSins,10); }
- catch (Exception e) { m_oLogger.error(e.getMessage()); }
-
- // Insert row in all index tables
- String[][] saa = oDto.getLocators();
- for (int i1=0; i1<saa.length; i1++)
- { m_oDaoIndex = getDaoIndex(oStore.getLocatorTable(i1));
- PSins = m_oDaoIndex.getPS(DaoIndexTable.PS_INS_INDEX);
- m_oDaoIndex.setInsValues(PSins,oDto,i1);
- try { m_oDataConn.execUpdWait(PSins,10); }
- catch (Exception e) { m_oLogger.error(e.getMessage()); }
- }
- }
- PSbatch.close();
-
- // Delete batch rows we just used
- PreparedStatement PSdel = getDaoBatch(BobjStore.getBatchTableName())
- .getPS(DaoBatchTable.PS_DELETE_BATCH);
- PSdel.setLong(1,p_oBP.getBatchNum());
- m_oDataConn.execUpdWait(PSdel,10);
-
- p_oBP.setField (BatchProcess.ATTRIB.commitStamp,Long.toString(lNow));
- p_oBP.setStamp (lNow);
- p_oBP.setSnapDate(sSnapDt);
-
- oStore = BobjStore.getStore(BatchProcess.class.getName());
-
- // Update snap table with proper timestamp
- m_oDaoSnap = null;
- PreparedStatement PSupd = getDaoSnap(oStore).getPS(DaoSnapTable.PS_UPD_SNAP);
- getDaoSnap(oStore).setUpdValues(PSupd,p_oBP);
- m_oDataConn.execUpdWait(PSupd,10);
-
- // Update index table with proper timestamp
- m_oDaoIndex = null;
- PSupd = getDaoIndex(oStore.getLocatorTable()).getPS(DaoIndexTable.PS_UPD_INDEX);
- getDaoIndex(oStore.getLocatorTable()).setUpdValues(PSupd,p_oBP);
- m_oDataConn.execUpdWait(PSupd,10);
-
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local and remote interface methods
-/**
- * @ejb.interface-method
- * view-type="both"
- */
- public long newBatch() throws Exception
- { if (m_lBatchNum > 0) throw
- new Exception ("Must finish with previous batch before opening new");
- m_iSeq = 0;
- try
- { return m_lBatchNum = getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_BATCH, 1);
- }
- catch (Exception e)
- { m_oLogger.error("BatchHandlerBean.newBatch() FAILED "+ e.getMessage());
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-/**
- * @ejb.interface-method
- * view-type="both"
- * @return
- */
- public long getBatchNum()
- { return m_lBatchNum;
- } //__________________________________
-
-/**
- * @ejb.interface-method
- * view-type="both"
- * @param p_s
- * @return
- * @throws Exception
- */
- public int addToBatch(String p_s) throws Exception
- { if (null==p_s) throw
- new Exception ("Tryng to add a null String to a batch");
- if (m_lBatchNum < 1) throw
- new Exception ("Must request batch number before adding objects");
- try
- { RowBatch oRow = new RowBatch(m_lBatchNum,++m_iSeq,0,p_s);
- getDaoBatch(BobjStore.getBatchTableName());
- PreparedStatement PS = m_oDaoBatch.getPS(DaoBatchTable.PS_INS_BATCHROW);
- m_oDaoBatch.setInsValues(PS,oRow);
- m_oDataConn.execUpdWait(PS,1);
- m_oDataConn.commit();
- return m_iSeq;
- }
- catch (Exception e)
- { if (null != m_oDataConn) m_oDataConn.rollback();
- m_oLogger.error("addToBatch() failed",e);
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type="both"
- * @throws Exception
- */
- public void finish() throws Exception
- { if (m_lBatchNum < 1) return;
- m_lBatchNum = -1;
- m_iSeq = 0;
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local interface methods
-
-/**
- * @ejb.interface-method
- * view-type="local"
- */
- public void commitBatch(BatchProcess p_oBO) throws Exception
- { try { doCommitBatch(p_oBO); m_oDataConn.commit(); }
- catch (Exception e)
- { if (null != m_oDataConn) m_oDataConn.rollback();
- m_oLogger.error("commitBatch(BatchProcess) FAILED ",e);
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-//______________________________________________________________________________
-// Public remote interface methods
-/**
- * @ejb.interface-method
- * view-type="both"
- */
- public void commitBatch(BobjStdDTO p_oDto) throws Exception
- { commitBatch (new BatchProcess(p_oDto));
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerBean.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Home interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbBatchHandlerHome
- extends javax.ejb.EJBHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbBatchHandler";
- public static final String JNDI_NAME="JbossEsbBatchHandler";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbBatchHandler create()
- throws javax.ejb.CreateException,java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,29 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbBatchHandlerLocal
- extends javax.ejb.EJBLocalObject
-{
-
- public long newBatch( ) throws java.lang.Exception;
-
- public long getBatchNum( ) ;
-
- public int addToBatch( java.lang.String p_s ) throws java.lang.Exception;
-
- public void finish( ) throws java.lang.Exception;
-
- public void commitBatch( org.jboss.soa.esb.common.bizclasses.BatchProcess p_oBO ) throws java.lang.Exception;
-
- public void commitBatch( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local home interface for JbossEsbBatchHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbBatchHandlerLocalHome
- extends javax.ejb.EJBLocalHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbBatchHandlerLocal";
- public static final String JNDI_NAME="JbossEsbBatchHandlerLocal";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbBatchHandlerLocal create()
- throws javax.ejb.CreateException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbBatchHandlerLocalHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,20 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Remote interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbNotificationHandler
- extends javax.ejb.EJBObject
-{
-
- public void sendNotifications( java.lang.String p_sParams,java.lang.String p_sMsg )
- throws java.lang.Exception, java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,118 +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.services.EJB;
-
-import javax.ejb.*;
-import javax.naming.*;
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.notification.*;
-
-import org.apache.log4j.*;
-/**
- * @ejb.bean description="JbossEsbNotificationHandler"
- * display-name="Jboss_Esb_Notification_Handler"
- * jndi-name="JbossEsbNotificationHandler"
- * local-jndi-name="JbossEsbNotificationHandlerLocal"
- * name="JbossEsbNotificationHandler"
- * type="Stateless"
- * view-type="both"
- * transaction-type="Container"
- * @ejb.transaction type="Required"
- * @author
- */
-public class JbossEsbNotificationHandlerBean implements SessionBean
-{
- private static final long serialVersionUID = 1L;
- private Logger m_oLogger;
- SessionContext m_ctxSess;
-
- public void ejbActivate() {}
- public void ejbPassivate() {}
- public void setSessionContext(SessionContext sessionContext)
- { m_ctxSess = sessionContext; }
-/**
- * @ejb.create-method
- * @throws CreateException
- */
- public void ejbCreate() throws CreateException
- { try
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
-// Context oCtxInit =
- new InitialContext();
-
- m_oLogger.info(this.toString()+" Created");
- }
- catch (Exception e)
- { m_oLogger.error("EJB Create Failed <"+e.getMessage()+">");
- throw new CreateException(e.getMessage());
- }
- } //__________________________________
-
- public void ejbRemove()
- { m_oLogger.info(this.toString()+" Removed");
- } //__________________________________
-
-// Utility Methods
-
- protected void releaseResources()
- {
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local and remote interface methods
-
- private static final String s_sDfltList =
- "<NotificationList type=\"Error\" >"
- +" <target"
- +" class = \"NotifyEmail\""
- +" from = \"JbossEsbDefault at myOrg.com\""
- +" sendTo = \"\""
- +" subject = \"Default JBoss ESB Notification\""
- +" message = \" Message from JBoss ESB :\""
- +" />"
- +" </NotificationList>"
- ;
- private static NotificationList s_dfltList;
- static
- { try
- { s_dfltList = new NotificationList(DomElement.fromXml(s_sDfltList)); }
- catch (Exception e) { e.printStackTrace(System.out); }
- }
-/**
- * @ejb.interface-method
- * @param p_sParams
- * @param p_sMsg
- * @throws Exception
- */
- public void sendNotifications(String p_sParams, String p_sMsg)
- throws Exception
- {
- DomElement oP = (null==p_sParams)?null:DomElement.fromXml(p_sParams);
- NotificationList m_oL = (null==oP) ? s_dfltList : new NotificationList(oP);
- m_oL.sendNotification(p_sMsg);
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerBean.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Home interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbNotificationHandlerHome
- extends javax.ejb.EJBHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbNotificationHandler";
- public static final String JNDI_NAME="JbossEsbNotificationHandler";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandler create()
- throws javax.ejb.CreateException,java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,19 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbNotificationHandlerLocal
- extends javax.ejb.EJBLocalObject
-{
-
- public void sendNotifications( java.lang.String p_sParams,java.lang.String p_sMsg ) throws java.lang.Exception;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local home interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbNotificationHandlerLocalHome
- extends javax.ejb.EJBLocalHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbNotificationHandlerLocal";
- public static final String JNDI_NAME="JbossEsbNotificationHandlerLocal";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbNotificationHandlerLocal create()
- throws javax.ejb.CreateException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,32 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Remote interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbPersistHandler
- extends javax.ejb.EJBObject
-{
-
- public long getUidChunk( int p_iQ )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public void rmvObject( java.lang.String p_sClassName,long p_lUid )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public long addDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public org.jboss.soa.esb.util.BobjStdDTO getDTO( java.lang.String p_sClassName,long p_lUid )
- throws java.lang.Exception, java.rmi.RemoteException;
-
- public void rplDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto )
- throws java.lang.Exception, java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,367 +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.services.EJB;
-
-import javax.ejb.*;
-import javax.naming.*;
-import java.sql.*;
-import javax.sql.*;
-
-import java.text.*;
-import java.io.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.helpers.persist.*;
-import org.jboss.soa.esb.internal.core.objectstore.*;
-
-import org.apache.log4j.*;
-
-/**
- * @ejb.bean
- * name="JbossEsbPersistHandler"
- * display-name="Jboss_ESB_PERSIST_HANDLER"
- * type="Stateless"
- * view-type="both"
- * jndi-name="JbossEsbPersistHandler"
- * local-jndi-name="JbossEsbPersistHandlerLocal"
- * transaction-type="Bean"
- * @author Esteban
- */
-public class JbossEsbPersistHandlerBean implements SessionBean
-{
- private static final long serialVersionUID = 1L;
- private Logger m_oLogger;
- SessionContext m_ctxSess;
-
- private JdbcCleanConn m_oUidConn;
- private JdbcCleanConn m_oDataConn;
-
- private static final int s_iChunkSize=100;
- private long m_lUid;
- private int m_iChunkLeft=0;
-
- private DaoUidTable m_oDaoUid;
- private DaoSnapTable m_oDaoSnap;
- private DaoIndexTable[] m_oaDaoIndex;
-
- public void ejbActivate() {}
- public void ejbPassivate() {}
- public void setSessionContext(SessionContext sessionContext)
- { m_ctxSess = sessionContext; }
-/**
- * @ejb.create-method
- * @throws CreateException
- */
- public void ejbCreate() throws CreateException
- { try
- { m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- Context oCtxInit = new InitialContext();
- String sDSjndiName = BobjStore.getDataSourceJndi();
- DataSource oDS = (DataSource)oCtxInit.lookup(sDSjndiName);
- m_oUidConn = new JdbcCleanConn(oDS);
- m_oDataConn = new JdbcCleanConn(oDS);
-
- Class oCls = Class.forName("org.jboss.soa.esb.util.BobjStdDTO");
- ObjectStreamClass XX = ObjectStreamClass.lookup(oCls);
- System.out.println(XX.getSerialVersionUID());
- System.out.println(oCls.getProtectionDomain().getCodeSource().getLocation());
-
- m_oLogger.info(this.toString()+" Created");
- }
- catch (Exception e)
- { m_oLogger.error("EJB Create Failed <"+e.getMessage()+">");
- throw new CreateException(e.getMessage());
- }
- } //__________________________________
-
- public void ejbRemove()
- { m_oLogger.info(this.toString()+" Removed");
- } //__________________________________
-
-// Utility Methods
-
- private DaoUidTable getDaoUid() throws Exception
- { if (null==m_oDaoUid) m_oDaoUid
- = new DaoUidTable(m_oUidConn,BobjStore.getUidTableName());
- return m_oDaoUid;
- } //__________________________________
-
- private DaoSnapTable getDaoSnap(BobjStore p_oSt) throws Exception
- { if (null==m_oDaoSnap)
- m_oDaoSnap = new DaoSnapTable(m_oDataConn,p_oSt);
- return m_oDaoSnap;
- } //__________________________________
-
- private DaoIndexTable getDaoIndex(BobjStore p_oSt,int p_i) throws Exception
- { if (null==m_oaDaoIndex)
- m_oaDaoIndex = new DaoIndexTable[p_oSt.allLocatorTables().length];
- if (null==m_oaDaoIndex[p_i])
- m_oaDaoIndex[p_i] = new DaoIndexTable(m_oDataConn,p_oSt.getLocatorTable(p_i));
- return m_oaDaoIndex[p_i];
- } //__________________________________
-
- protected ObjLocator[] doAddLocators(BobjStore pStore,BobjStdDTO p_oDto) throws Exception
- { long lUid = p_oDto.getUid();
- if (lUid < 1)
- { lUid = doAssignUid();
- p_oDto.setUid(lUid);
- p_oDto.setSnap(lUid);
- }
- long lStamp = p_oDto.getStamp();
- if (lStamp < 1)
- p_oDto.setStamp(lStamp = System.currentTimeMillis());
-
- String[][] saa = p_oDto.getLocators();
- ObjLocator[]oaRet = new ObjLocator[saa.length];
- int iCurr = 0;
- for (int i1=0; i1<saa.length; i1++)
- { String[] saCurr = saa[i1];
- ObjLocator oLoc = new ObjLocator(lUid,saCurr);
- oaRet[iCurr] = oLoc;
- String sTbl = pStore.getLocatorTable(iCurr++);
- if (null == sTbl)
- continue;
-
- DaoIndexTable oDao = new DaoIndexTable(m_oDataConn,sTbl);
- PreparedStatement PS = oDao.getPS(DaoIndexTable.PS_INS_INDEX);
-
- PS.setLong (DaoIndexTable.OBJECT_UID,lUid);
- PS.setLong (DaoIndexTable.TIMESTAMP,lStamp);
- PS.setLong (DaoIndexTable.UID_SNAP,p_oDto.getSnap());
- PS.setString (DaoIndexTable.SNAP_DATE,s_oY4md.format(new Date(lStamp)));
-
- int iFld = DaoIndexTable.FIRST_FIELD;
- for (int i2=0; i2<saCurr.length; i2++)
- { String sFldVal = saCurr[i2];
- PS.setString(iFld++,(null == sFldVal)?"":sFldVal);
- }
- m_oDataConn.execUpdWait(PS,1);
- }
-
- return oaRet;
- } //__________________________________
-
- private void doDelLocators (BobjStore p_oSt, long p_lUid)
- { if (p_lUid < 1) return;
- int iQlocs = p_oSt.allLocatorTables().length;
- for (int i1=0; i1<iQlocs; i1++)
- try
- { PreparedStatement PS = getDaoIndex(p_oSt,i1).getPS(DaoIndexTable.PS_RMV_INDEX);
- PS.setLong(1,p_lUid);
- m_oDataConn.execQueryWait(PS,5);
- }
- catch (Exception e)
- { m_oLogger.warn("doDelLocator() FAILED <"+e.getMessage()+">");
- }
- } //__________________________________
-
- private void doDelOneSnap (BobjStore p_oSt,long p_lUid) throws Exception
- { if (p_lUid < 1) return;
- PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_RMV_SNAP);
- PS.setLong(1,p_lUid);
- m_oDataConn.execQueryWait(PS,5);
- } //__________________________________
-
- private void doRmvSnapshot (BobjStore p_oSt,long p_lUid) throws Exception
- {
- PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_SEL_4UPD);
- PS.setLong(1,p_lUid);
- ResultSet rs = m_oDataConn.execQueryWait(PS,30);
- if (! rs.next()) throw new Exception("Non existing Snapshot");
- long lObjUid = rs.getLong(DaoSnapTable.OBJECT_UID);
-
- doDelOneSnap(p_oSt,p_lUid);
- doDelLocators(p_oSt,lObjUid);
-
- } //__________________________________
-
- private void doRplSnapshot(BobjStdDTO p_oDto)
- throws Exception
- { long lSnapUid = p_oDto.getSnap();
- BobjStore oSt = BobjStore.getStore(p_oDto);
- doDelOneSnap(oSt,lSnapUid);
- doDelLocators(oSt,p_oDto.getUid());
- doAddSnapshot(p_oDto,false);
- } //__________________________________
-
- private long doAddSnapshot(BobjStdDTO p_oDto)
- throws Exception
- { return doAddSnapshot(p_oDto,true);
- } //__________________________________
-
- SimpleDateFormat s_oY4md = new SimpleDateFormat("yyyyMMdd");
- private long doAddSnapshot(BobjStdDTO p_oDto, boolean p_bNewVrs)
- throws Exception
- { long lObjUid = p_oDto.getUid();
- if (lObjUid < 1) p_oDto.setUid(lObjUid=doAssignUid());
- p_oDto.setSnap(lObjUid);
-
- // Set Timestamp
- long lNow = System.currentTimeMillis();
- p_oDto.setStamp(lNow);
- p_oDto.setSnapDate(s_oY4md.format(new Date(lNow)));
-
- BobjStore oSt = BobjStore.getStore(p_oDto);
- PreparedStatement PS = getDaoSnap(oSt).getPS(DaoSnapTable.PS_INS_SNAP);
- getDaoSnap(oSt).setInsValues(PS,p_oDto);
-
- m_oDataConn.execUpdWait(PS,1);
-
- int iQlocs = oSt.allLocatorTables().length;
- for (int i1=0; i1<iQlocs; i1++)
- { DaoIndexTable oDao = getDaoIndex(oSt,i1);
- PS = oDao.getPS(DaoIndexTable.PS_INS_INDEX);
- oDao.setInsValues(PS,p_oDto);
- try { m_oDataConn.execUpdWait(PS,1); }
- catch (Exception e)
- { PS = oDao.getPS(DaoIndexTable.PS_UPD_INDEX);
- oDao.setUpdValues(PS,p_oDto);
- m_oDataConn.execUpdWait(PS,10);
- }
- }
-
- return lObjUid;
- } //__________________________________
-
- protected void updateLocTbl(BobjStdDTO p_oDto, int p_iNum)
- throws Exception
- { BobjStore oSt = BobjStore.getStore(p_oDto);
- String sTbl = oSt.getLocatorTable(p_iNum);
- if (null==sTbl) return;
- DaoIndexTable oDao = getDaoIndex(oSt,p_iNum);
- PreparedStatement PSupd = oDao.getPS(DaoIndexTable.PS_UPD_INDEX);
- oDao.setUpdValues(PSupd, p_oDto);
-
- m_oDataConn.execUpdWait(PSupd,10);
- } //__________________________________
-
- private BobjStdDTO doGetSnapshot (BobjStore p_oSt,long p_lUid) throws Exception
- { PreparedStatement PS = getDaoSnap(p_oSt).getPS(DaoSnapTable.PS_SEL_SNAP);
- PS.setLong(1,p_lUid);
- ResultSet rs = m_oDataConn.execQueryWait(PS,30);
- if (! rs.next()) throw new Exception("Non existing Snapshot");
- BobjStdDTO oRet = (BobjStdDTO)getDaoSnap(p_oSt).getFromRS(rs);
- return oRet;
- } //__________________________________
-
- private void releaseResources()
- { if (null!=m_oaDaoIndex)
- for (int i1=0; i1<m_oaDaoIndex.length; i1++)
- m_oaDaoIndex[i1] = null;
- m_oaDaoIndex = null;
- m_oDaoSnap = null;
- m_oDaoUid = null;
- if (null != m_oDataConn) m_oDataConn.release();
- if (null != m_oUidConn) m_oUidConn.release();
- } //__________________________________
-
- public long doAssignUid() throws Exception
- { if (m_iChunkLeft < 1)
- { m_lUid = getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_OBJ, s_iChunkSize);
- m_iChunkLeft = s_iChunkSize;
- }
- m_iChunkLeft--;
- return ++m_lUid;
- } //__________________________________
-
-//______________________________________________________________________________
-// Public local and remote interface methods
- /**
- * @ejb.interface-method
- * view-type="both"
- */
- public long getUidChunk (int p_iQ) throws Exception
- { try { return getDaoUid().getUidChunk(DaoUidTable.SEQUENCE_OBJ,p_iQ); }
- catch (Exception e) { throw e;}
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type="both"
- * @param p_sClassName
- * @param p_lUid
- * @throws Exception
- */
- public void rmvObject(String p_sClassName, long p_lUid) throws Exception
- { try { doRmvSnapshot(BobjStore.getStore(p_sClassName), p_lUid); m_oDataConn.commit(); }
- catch (Exception e)
- { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
- catch (Exception eRoll) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-/**
- * @ejb.interface-method
- * view-type="both"
- */
- public long addDTO(BobjStdDTO p_oDto) throws Exception
- { try
- { long lRet = doAddSnapshot(p_oDto);
- m_oDataConn.commit();
- return lRet;
- }
- catch (Exception e)
- { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
- catch (Exception eRoll) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type="both"
- * @param p_sClassName - String Fully qualified name of class to be retrieved
- * @param p_lUid
- * @return
- * @throws Exception
- */
- public BobjStdDTO getDTO (String p_sClassName, long p_lUid) throws Exception
- { try { return doGetSnapshot(BobjStore.getStore(p_sClassName), p_lUid);}
- catch (Exception e) { throw e; }
- finally { releaseResources(); }
- } //__________________________________
-/**
- * @ejb.interface-method
- * view-type="both"
- *
- * @param p_oDto BobjStdDTO - Serialized BaseBusinessObject that has to be replaced
- * @throws Exception
- */
- public void rplDTO(BobjStdDTO p_oDto) throws Exception
- { try
- { doRplSnapshot(p_oDto);
- m_oDataConn.commit();
- }
- catch (Exception e)
- { try { if (null != m_oDataConn) m_oDataConn.rollback(); }
- catch (Exception eRoll) {}
- throw e;
- }
- finally { releaseResources(); }
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerBean.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Home interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbPersistHandlerHome
- extends javax.ejb.EJBHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbPersistHandler";
- public static final String JNDI_NAME="JbossEsbPersistHandler";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbPersistHandler create()
- throws javax.ejb.CreateException,java.rmi.RemoteException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,27 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbPersistHandlerLocal
- extends javax.ejb.EJBLocalObject
-{
-
- public long getUidChunk( int p_iQ ) throws java.lang.Exception;
-
- public void rmvObject( java.lang.String p_sClassName,long p_lUid ) throws java.lang.Exception;
-
- public long addDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
-
- public org.jboss.soa.esb.util.BobjStdDTO getDTO( java.lang.String p_sClassName,long p_lUid ) throws java.lang.Exception;
-
- public void rplDTO( org.jboss.soa.esb.util.BobjStdDTO p_oDto ) throws java.lang.Exception;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,22 +0,0 @@
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.jboss.soa.esb.services.EJB;
-
-/**
- * Local home interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
- * @copyright The XDoclet Team
- * @author XDoclet
- * @version ${version}
- */
-public interface JbossEsbPersistHandlerLocalHome
- extends javax.ejb.EJBLocalHome
-{
- public static final String COMP_NAME="java:comp/env/ejb/JbossEsbPersistHandlerLocal";
- public static final String JNDI_NAME="JbossEsbPersistHandlerLocal";
-
- public org.jboss.soa.esb.services.EJB.JbossEsbPersistHandlerLocal create()
- throws javax.ejb.CreateException;
-
-}
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,47 +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.services;
-
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.services.EJB.*;
-
-public class NotifHandlerBsDelegateLocal implements InotificationHandler
-{
- private JbossEsbNotificationHandlerLocal m_oNotifH;
- public NotifHandlerBsDelegateLocal(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbNotificationHandlerLocal");
-
- JbossEsbNotificationHandlerLocalHome oHu = (JbossEsbNotificationHandlerLocalHome) ref;
- m_oNotifH = oHu.create();
- } //__________________________________
-
- public void sendNotifications(DomElement p_oP, Object p_o) throws Exception
- { m_oNotifH.sendNotifications(p_oP.toString(),p_o.toString());
- }
- public void sendNotifications(Object p_o) throws Exception
- { m_oNotifH.sendNotifications(null,p_o.toString());
- }
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,49 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.soa.esb.services;
-
-import javax.naming.*;
-import javax.rmi.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.services.EJB.*;
-
-public class NotifHandlerBsDelegateRemote implements InotificationHandler
-{
- private JbossEsbNotificationHandler m_oNotifH;
-
- public NotifHandlerBsDelegateRemote(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbNotificationHandler");
- Object oNarr = PortableRemoteObject.narrow(ref, JbossEsbNotificationHandlerHome.class);
- JbossEsbNotificationHandlerHome oHu = (JbossEsbNotificationHandlerHome) oNarr;
- m_oNotifH = oHu.create();
- } //__________________________________
-
- public void sendNotifications(DomElement p_oP, Object p_o) throws Exception
- { m_oNotifH.sendNotifications(p_oP.toString(),p_o.toString());
- } //__________________________________
- public void sendNotifications(Object p_o) throws Exception
- { m_oNotifH.sendNotifications(null,p_o.toString());
- }
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotifHandlerBsDelegateRemote.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,56 +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.services;
-
-import java.util.*;
-
-import javax.naming.*;
-import org.jboss.soa.esb.helpers.*;
-
-
-public class NotificationHandlerFactory
-{
- private static final String [] s_saTypes = {"local","remote"};
- private final static int LCL=0;
- private final static int REM=1;
-
- public static InotificationHandler getNotifHandler
- (String p_sLocRem, String p_sJndiType, String p_sJndiServer) throws Exception
- {
- int iIndex = Arrays.binarySearch(s_saTypes,p_sLocRem.toLowerCase());
- if (iIndex < 0) return null;
- switch (iIndex)
- {
- case REM: return getNotifHandler
- (AppServerContext.getServerContext(p_sJndiType,p_sJndiServer));
- case LCL: return new NotifHandlerBsDelegateLocal(new InitialContext());
- }
- throw new Exception("Invalid Notification Handler Delegate <" + p_sLocRem + ">");
- } //__________________________________
-
- public static InotificationHandler getNotifHandler(Context p_oCtx) throws Exception
- { return new NotifHandlerBsDelegateRemote(p_oCtx);
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/NotificationHandlerFactory.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,76 +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.services;
-
-import javax.naming.*;
-import java.util.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.services.EJB.*;
-
-
-public class PersistHandlerBsDelegateLocal implements IpersistHandler
-{
- private JbossEsbPersistHandlerLocal m_oSnapH;
-
- public PersistHandlerBsDelegateLocal(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbPersistHandlerLocal");
-
- JbossEsbPersistHandlerLocalHome oHu = (JbossEsbPersistHandlerLocalHome) ref;
- m_oSnapH = oHu.create();
- } //__________________________________
-
- public void remove() throws Exception {m_oSnapH.remove(); }
- public long getUidChunk(int p_iQ) throws Exception
- { return m_oSnapH.getUidChunk(p_iQ);
- } //__________________________________
- public long addObject (BobjStdDTO p_oDto) throws Exception
- { return m_oSnapH.addDTO(p_oDto);
- } //__________________________________
- public long addObject (BaseBusinessObject p_oBo) throws Exception
- { p_oBo.setPackage();
- return m_oSnapH.addDTO(p_oBo.toDTO());
- } //__________________________________
- public BaseBusinessObject getObject (Class p_oCls, long p_lUid) throws Exception
- { BobjStdDTO oDto = m_oSnapH.getDTO(p_oCls.getName(), p_lUid);
- return (null==oDto)?null:BaseBusinessObject.getFromDTO(oDto);
- } //__________________________________
- public void rmvObject (Class p_oCls, long p_lUid) throws Exception
- { m_oSnapH.rmvObject(p_oCls.getName(), p_lUid);
- } //__________________________________
- public void rplObject (BaseBusinessObject p_o) throws Exception
- { p_o.setPackage();
- m_oSnapH.rplDTO(p_o.toDTO());
- } //__________________________________
- public ObjLocator[] getLocatorList(Class p_oCls, Properties p_oProp)
- {
- return null;
- } //__________________________________
-
- public ObjLocator[] getLocatorList(Class p_oCls, long[] p_laUids)
- {
- return null;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateLocal.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,82 +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.services;
-
-import javax.naming.*;
-import javax.rmi.*;
-
-import org.jboss.soa.esb.services.EJB.*;
-import org.jboss.soa.esb.util.*;
-import java.util.*;
-
-
-public class PersistHandlerBsDelegateRemote implements IpersistHandler
-{
- private JbossEsbPersistHandler m_oSnapH;
-
- public PersistHandlerBsDelegateRemote(Context p_ctx) throws Exception
- {
- Object ref = p_ctx.lookup("JbossEsbPersistHandler");
- Object oNarr = PortableRemoteObject.narrow(ref, JbossEsbPersistHandlerHome.class);
- JbossEsbPersistHandlerHome oHu = (JbossEsbPersistHandlerHome) oNarr;
- m_oSnapH = oHu.create();
- } //__________________________________
-
- public void remove() throws Exception {}
- public long getUidChunk(int p_iQ) throws Exception
- { return m_oSnapH.getUidChunk(p_iQ);
- } //__________________________________
- public long addObject (BaseBusinessObject p_oBo) throws Exception
- { if (null==p_oBo) return -1;
- p_oBo.setPackage();
- BobjStdDTO oDto = p_oBo.toDTO();
- oDto.setLocators(p_oBo.allLocators());
- return m_oSnapH.addDTO(oDto);
- } //__________________________________
- public BaseBusinessObject getObject (Class p_oCls, long p_lUid) throws Exception
- {
- BobjStdDTO oDto = m_oSnapH.getDTO(p_oCls.getName(), p_lUid);
- return (null==oDto)?null:BaseBusinessObject.getFromDTO(oDto);
- } //__________________________________
- public void rmvObject (Class p_oCls, long p_lUid) throws Exception
- { m_oSnapH.rmvObject(p_oCls.getName(), p_lUid);
- } //__________________________________
- public void rplObject (BaseBusinessObject p_oBo) throws Exception
- { if (null==p_oBo) return;
- p_oBo.setPackage();
- BobjStdDTO oDto = p_oBo.toDTO();
- oDto.setLocators(p_oBo.allLocators());
- m_oSnapH.rplDTO(oDto);
- } //__________________________________
-
- public ObjLocator[] getLocatorList(Class p_oCls, Properties p_oProp)
- {
- return null;
- } //__________________________________
-
- public ObjLocator[] getLocatorList(Class p_oCls, long[] p_laUids)
- {
- return null;
- } //__________________________________
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerBsDelegateRemote.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -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.services;
-
-import java.util.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class PersistHandlerFactory
-{
- private static final String [] s_saTypes = {"local","remote"};
- private final static int LCL=0;
- private final static int REM=1;
-
- public static IpersistHandler getPersistHandler
- (String p_sLocRem, String p_sJndiType, String p_sJndiServer) throws Exception
- {
- int iIndex = Arrays.binarySearch(s_saTypes,p_sLocRem.toLowerCase());
- if (iIndex < 0) return null;
- switch (iIndex)
- {
- case REM: return getPersistHandler
- (AppServerContext.getServerContext(p_sJndiType,p_sJndiServer));
- case LCL: return new PersistHandlerBsDelegateLocal(new InitialContext());
- }
- throw new Exception("Invalid Persist Handler Delegate <" + p_sLocRem + ">");
- } //__________________________________
-
- public static IpersistHandler getPersistHandler(Context p_oCtx) throws Exception
- { return new PersistHandlerBsDelegateRemote(p_oCtx);
- } //__________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/PersistHandlerFactory.java)
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/msglistener)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,252 +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.services.msglistener;
-
-import java.lang.reflect.*;
-import javax.ejb.*;
-import javax.jms.*;
-import org.apache.log4j.*;
-
-import org.jboss.soa.esb.util.*;
-import org.jboss.soa.esb.common.*;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.parameters.*;
-
-/**
- * <p>Title: Abstract Jboss ESB Message Driven Bean</p>
- *
- * <p>Description: Base abstract class to simplify coding of ad hoc JMS listeners
- * engineered as message driven beans
- * </p>
- *
- * Author : Heuristica - Buenos Aires - Argentina
- *
- *<p>
- * Jboss ESB Messages should have a service identifier in the message header
- * property : "jbossEsb_parametersUid"
- *</p>
- * The service identifier will be used as a left_to_right (separator="/")
- * Name to search the corresponding configuration in a ParamsRepository object
- * provided by the factory class name in the
- * EsbSysProps.PARAMS_REPOS_FACTORY_CLASS system property
- *<p>
- * Derived classes are typically empty, and are coded just to tie the
- * MDB that extends this class with a specific
- * MessageConsumer (Queue or Topic) with (or without) a message selector
- *</p>
- *<p>
- * It makes sense to use the
- * "jbossEsb_parametersUid" message property as part
- * (or all) of the message selector associated with the MDB
- *</p>
- *<p>
- * Derived classes could also override the setMessageDrivenContext()
- * ejbRemove(), and onMessage() methods if that were necessary, but
- * developers should fully understand the underlying concepts used in the
- * onMessage() method of this base class, before attempting to override it
- *</p>
- *<p>
- * The onMessage method of this class will obtain the list of child
- * DomElement elements of the one obtained from the parameter repository,
- * and attempt to execute the processMessage(Message) of the actionClass
- * for each of the child DomElement objects
- *</p>
- *<p>
- * Classes that extend this base class receive their own DomElement
- * configuration object at constructor time, as well as the corresponding
- * javax.jms.Message as a parameter of their processMessage method
- * </p>
-
- * @version 1.0
- */
-public abstract class AbstractEsbMsgDrivenBean
- implements MessageDrivenBean, MessageListener
-{
-
- /**
- * Message property that indicates the name to fetch in the parameter
- * repository in order to configure at runtime the behaviour of this EJB
- * Name is left_to_right separator="/"
- */
- protected static final String SERVICE_UID
- = "jbossEsb_parametersUid";
-
- public static final String PARM_ACTION_CLASS= "actionClass";
-
-
- protected MessageDrivenContext m_oMdrvCtx;
- protected Logger m_oLogger;
- protected String m_sSvcName;
- protected DomElement m_oParms;
- protected Message m_oCurrMsg;
-
- public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) throws
- EJBException
- { m_oMdrvCtx = messageDrivenContext;
- } //__________________________________
-
- public void ejbCreate() throws EJBException
- {
- } //__________________________________
-
- public void ejbRemove() throws EJBException
- {
- } //__________________________________
- /**
- * Standard message error
- * <p>
-
- * </p>
- * @param message Message - The JMS message that will be processed
- */
- public void onException(JMSException ex)
- {
- m_oLogger.warn("JMS provider failure detected(onException): ", ex);
- }
- /**
- * Standard message processing method
- * <p>
- * <li>Retrieves an LDAP entry from the default Rosetta LDAP server</li>
- * <li>Invokes the execOneChild(DomElement) method for each of it's first
- * level child elements, that will attempt to process the same incoming
- * message</li>
- * </p>
- * @param message Message - The JMS message that will be processed
- */
- public void onMessage(Message p_oMsg)
- { if (null==m_oLogger)
- m_oLogger = EsbUtil.getDefaultLogger(this.getClass());
- // If the service name is null/blank then use the class name as the service name
- try
- {
- m_sSvcName = null;
- m_oParms = null;
- m_sSvcName = p_oMsg.getStringProperty(SERVICE_UID);
- if (null==m_sSvcName || m_sSvcName.trim().length() < 1)
- m_sSvcName = this.getClass().getName();
-
- m_oParms = getParameters(m_sSvcName);
- if (null==m_oParms) throw
- new Exception("DomElement '"+m_sSvcName+"' NOT FOUND in specified"
- +" parameter repository");
-
- m_oCurrMsg = p_oMsg;
- DomElement[] oaCh = m_oParms.getAllElemChildren();
-
- DomElement oCurr = null;
-// boolean bAllOK = true;
- for (int i1=0; i1<oaCh.length;i1++)
- try
- { oCurr = oaCh[i1];
- execOneChild(oCurr);
- }
- catch (Exception e)
- {
-// bAllOK = false;
- m_oLogger.error("JbossEsb MsgDrivenBean : Element <"+oCurr.getName()+"> FAILED",e);
- m_oMdrvCtx.setRollbackOnly();
- }
- }
- catch (Exception e)
- {
- String sDest = "Destination : ";
- try { sDest += p_oMsg.getJMSDestination().toString(); }
- catch (Exception e1) {}
- String sService = "Service = ";
- try { sService += p_oMsg.getStringProperty(SERVICE_UID); }
- catch (Exception e1) {}
- String sMessage="Message = ";
- try { sMessage += ((TextMessage)p_oMsg).getText(); }
- catch (Exception e1) {}
-
- StringBuffer sb = new StringBuffer(this.getClass().getName())
- .append(" EXCEPTION ")
- .append(" Problems initializing LDAP configuration object")
- .append("<rosetta,params,jmslisteners."+m_sSvcName+"> - ")
- .append(sDest+" - "+sService+" - "+sMessage)
- ;
- m_oLogger.error(sb.toString());
- m_oLogger.error("listenjms onMessage -raw error:" + e.toString()) ;// the raw error
- m_oMdrvCtx.setRollbackOnly();
- }
- } //__________________________________
-
-
- /**
- * Will be called for each first level child element of the main DomElement
- * object that configures the behaviour of this service
- * <li>Attempts to instantiate an object of the class specified in
- * the 'actionClass' attribute</li>
- * <li>Invokes the class' "processMessage(Message)" method, using
- * the same Message object received in this onMessage() method as
- * the argument</li>
- * <li>Action classes referenced will have access to the full DomElement
- * object (at instantiation time) in order to allow multi-level parameter trees</li>
- * @param p_oP DomElement - Current step configuration parameters
- * @throws Exception
- */
- protected void execOneChild(DomElement p_oP)
- throws Exception
- {
- String sAtt = p_oP.getAttr(PARM_ACTION_CLASS);
- Class oCls = null;
- if (null == sAtt) throw new Exception("Missing 'actionClass' attribute");
-
- try { oCls = Class.forName(sAtt); }
- catch (ClassNotFoundException e)
- { throw new Exception ("Class <"+sAtt+"> not found in classpath"); }
- Constructor oCnst = null;
-
-
- try
- { Class[] oaParmTypes = new Class[] {Message.class,JbossEsbMessageProcessor.class};
- oCnst = oCls.getConstructor(oaParmTypes);
- oCnst.newInstance(new Object[]{});
- }
- catch (NoSuchMethodException eN)
- {
- throw new Exception ("No appropriate constructor(Message,JbossEsbMessageProcessor) found for class "
- +oCls.getName());
- }
-
- JbossEsbMessageProcessor oMsgP = new JbossEsbMessageProcessor(p_oP);
- oMsgP.processMessage(m_oCurrMsg);
-
-
- } //__________________________________
-
- protected DomElement getParameters(String p_sKey)
- throws Exception
- {
- String sFactoryClass
- = EsbSysProps.getParamsReposFactoryClass();
- ParamsRepository oRep
- = ParamsReposUtil.reposFromFactory(sFactoryClass,null);
- return oRep.getElement(oRep.nameFromString(p_sKey));
-
- } //__________________________________
-
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/msglistener/AbstractEsbMsgDrivenBean.java)
Deleted: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,41 +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.services.msglistener;
-
-import javax.jms.*;
-import org.jboss.soa.esb.helpers.*;
-
-public class JbossEsbMessageProcessor
-{
- public void processMessage(Message p_Msg) throws Exception
- {
-
- } //________________________________
-
- public JbossEsbMessageProcessor(DomElement p_oP)
- {
- } //________________________________
-
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/src/org/jboss/soa/esb/services/msglistener/JbossEsbMessageProcessor.java)
Copied: labs/jbossesb/trunk/product/core/services/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests)
Deleted: labs/jbossesb/trunk/product/core/services/tests/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/tests/build.xml 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/tests/build.xml 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,123 +0,0 @@
-<?xml version="1.0"?>
-<project name="build.services.tests" default="org.jboss.esb.services.tests.compile" basedir=".">
-
- <property name="org.jboss.esb.tests.bin.dir" value="${org.jboss.esb.internal.dest}/tests"/>
- <property name="org.jboss.esb.tests.report.dir" value="${org.jboss.esb.internal.dest}/tests/junit"/>
- <property name="org.jboss.esb.core.bin.dir" value="${org.jboss.esb.internal.dest}/classes"/>
- <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
- <property name="org.jboss.esb.root.dir" value="../.."/>
- <property environment="env"/>
-
- <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
- <condition property="org.jboss.esb.ext.lib.dir" value="{org.jboss.esb.jboss.home}/client">
- <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
- </condition>
-
-
-
-
- <path id="org.jboss.esb.tests.base.classpath">
- <fileset dir="../${org.jboss.esb.ext.lib.dir}"
- includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
-
- <pathelement location="${org.jboss.esb.core.bin.dir}/common"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}/services"/>
-
- </path>
-
- <target name="org.jboss.esb.tests.init">
- <tstamp>
- <format property="TODAY" pattern="d-MM-yy"/>
- </tstamp>
-
- <mkdir dir="${org.jboss.esb.tests.bin.dir}"/>
- <mkdir dir="${org.jboss.esb.tests.report.dir}"/>
- </target>
-
- <target name="clean"/>
-
- <target name="purge" depends="clean">
- <delete dir="${org.jboss.esb.tests.bin.dir}"/>
- </target>
-
- <target name="org.jboss.esb.services.tests.compile" if="org.jboss.esb.buildtests" depends="org.jboss.esb.tests.init">
-
- <javac
- destdir="${org.jboss.esb.tests.bin.dir}"
- classpathref="org.jboss.esb.tests.base.classpath"
- debug="${org.jboss.esb.debug}"
- optimize="${org.jboss.esb.optimize}"
- >
- <src path="${org.jboss.esb.tests.src.dir}"/>
- </javac>
-
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- T E S T -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.services.internal.test">
- <antcall target="org.jboss.esb.services.internal.test.unit"/>
- <antcall target="org.jboss.esb.services.internal.test.functional"/>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- U N I T T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.services.internal.test.unit">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/services/**/**UnitTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-
- <!-- ====================================================================== -->
- <!-- F U NC T I O N A L T E S T S -->
- <!-- ====================================================================== -->
- <target name="org.jboss.esb.services.internal.test.functional">
- <echo message="Running tests for module"/>
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
- <formatter type="plain" usefile="false"/>
- <formatter type="xml"/>
- <batchtest todir="${org.jboss.esb.tests.report.dir}">
- <fileset dir="${org.jboss.esb.tests.bin.dir}">
- <include name="**/**/services/**/**FuncTest.class"/>
- </fileset>
- </batchtest>
- <classpath>
- <path refid="org.jboss.esb.tests.base.classpath"/>
- <pathelement location="${org.jboss.esb.core.bin.dir}"/>
- <pathelement location="${org.jboss.esb.tests.bin.dir}"/>
- </classpath>
- </junit>
- <junitreport>
- <fileset dir="${org.jboss.esb.tests.report.dir}">
- <include name="*.xml"/>
- </fileset>
- <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
- <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
- </junitreport>
- </target>
-
-</project>
Copied: labs/jbossesb/trunk/product/core/services/tests/build.xml (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/build.xml)
Copied: labs/jbossesb/trunk/product/core/services/tests/src (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests)
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,45 +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.services.tests;
-
-import org.jboss.soa.esb.common.tests.BaseTest;
-
-/**
- * Dummy test file.
- *
- * @author <a href="mailto:arvinder.singh at indigo-logic.com">Arvinder Singh</a>
- * @version <tt>$Revision:$</tt>
- * $Id:$
- */
-public class DummyUnitTest extends BaseTest {
-
- /**
- * Remove me
- * @throws Exception
- */
- public void testDummyCompileAndInvoke() throws Exception {
- log.info("****************************************************************");
- log.info(" Dummy unit test called. Replace this with module level tests");
- log.info("****************************************************************");
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/DummyUnitTest.java)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification)
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,215 +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.services.tests.notification;
-
-import java.util.*;
-import java.text.SimpleDateFormat;
-
-import org.jboss.soa.esb.common.EsbSysProps;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.helpers.*;
-import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
-import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.services.*;
-
-// DON'T FORGET !!
-// The Rosetta Application server has to be up and running
-// (set JNDI_SERVER appropriately)
-// For e-mail notification: System properties for smtp
-// (server, user, password, port) must be set up in app server
-
-public class NotificationFuncTest extends BaseTest
-{
- private static InotificationHandler m_oH;
-
-
- public NotificationFuncTest() {
- }
-
- public void testNotImplementedFuncTest() {
- log.info("*******************************************");
- log.info("Requires Implementation");
- log.info("*******************************************");
- }
-
- /*
- public NotificationFuncTest () throws Exception
- { performTest(); }
-
- static void performTest() throws Exception
- {
- // get a handle to your business delegate
- m_oH = NotificationHandlerFactory.getNotifHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
-
- DomElement oEl = new DomElement("MyFileList");
- oEl.setAttr(NotificationList.TYPE,"OK");
-
- // oEl.addElemChild(fileListTarget());
- // oEl.addElemChild(emailTarget());
- // oEl.addElemChild(jmsQueueTarget());
- // oEl.addElemChild(jmsTopicTarget());
- oEl.addElemChild(sqlTableTarget());
-
- 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())
- System.out.println(oNL.toString());
-
- // a simple timestamped message
- Date oNow = new Date(System.currentTimeMillis());
- SimpleDateFormat oStamp = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss.SSS");
- StringBuilder sb = new StringBuilder(oStamp.format(oNow))
- .append(" This message from Notification test");
-
- m_oH.sendNotifications(oNL,sb.toString());
- } //________________________________
-
- static DomElement emailTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyEmail");
- oTgt.setAttr(EsbEmail.FROM,"sender at jboss.com");
- oTgt.setAttr(EsbEmail.SENDTO,"receiver1 at hotmail.com,receiver2 at jboss.com");;
- oTgt.setAttr(EsbEmail.SUBJECT,"TEST from Rosetta");
- oTgt.setAttr(EsbEmail.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
- // application server (filesystem / mounts)
- String[] sa = {"/tmp/tomcat.sh","/tmp/program.js"};
- for (String sCurr : sa)
- oTgt.addTextChild(EsbEmail.ATTACH,sCurr);
-
- return oTgt;
- } //________________________________
-
- static DomElement fileListTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(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));
- oTgt.addElemChild(oFile);
- }
- return oTgt;
- } //________________________________
-
- static DomElement jmsQueueTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(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())
- oQ.addElemChild(oProp);
- oTgt.addElemChild(oQ);
- }
- return oTgt;
- } //________________________________
-
- static DomElement jmsTopicTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(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())
- oQ.addElemChild(oProp);
- oTgt.addElemChild(oQ);
- }
- return oTgt;
- } //________________________________
-
- static DomElement[] 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];
- 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());
- oaRet[iCurr++] = oElem;
- }
- return oaRet;
- } //________________________________
-
- static DomElement sqlTableTarget() throws Exception
- {
- DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
- oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifySqlTable");
-
- oTgt.setAttr(SimpleDataSource.DRIVER,"org.postgresql.Driver");
- oTgt.setAttr(SimpleDataSource.URL,"jdbc:postgresql://lavasca:5432/rosetta");
- oTgt.setAttr(SimpleDataSource.USER,"postgres");
- oTgt.setAttr(SimpleDataSource.PASSWORD,"");
-
- // Table name for insert - must exist in database (URL)
- oTgt.setAttr(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");
-
- // constant data that can be also added in the insert
- // (perhaps needed for queries)
- // Key = column name (it must exist in the table, same as ATT_DATA column)
- KeyValuePair[] oaCols = new KeyValuePair[]
- {new KeyValuePair("src","TestNotification")
- ,new KeyValuePair("ref","any Ref")
- ,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);
- }
-
-
- return oTgt;
- } //________________________________
-
- */
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java)
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore)
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java 2006-07-23 12:43:58 UTC (rev 5257)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java 2006-07-23 12:55:37 UTC (rev 5258)
@@ -1,97 +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.services.tests.objectstore;
-
-import org.jboss.soa.esb.common.EsbSysProps;
-import org.jboss.soa.esb.common.tests.bizclasses.PersonUnitTest;
-import org.jboss.soa.esb.common.tests.BaseTest;
-import org.jboss.soa.esb.common.bizclasses.*;
-import org.jboss.soa.esb.services.*;
-
-// DON'T FORGET !!
-// The Rosetta Application server has to be up and running
-// (set JNDI_SERVER appropriately)
-
-public class ObjectStoreFuncTest extends BaseTest
-{
- private static IpersistHandler m_oH;
-
- public ObjectStoreFuncTest() {
- }
-
- public void testNotImplementedFuncTest() {
- log.info("*******************************************");
- log.info("Requires Implementation");
- log.info("*******************************************");
- }
-
- /*
- public ObjectStoreFuncTest () throws Exception
- { performTest(); }
-
- static void performTest() throws Exception
- {
- // get a handle to your business delegate
- m_oH = PersistHandlerFactory.getPersistHandler
- ("remote"
- ,EsbSysProps.getJndiServerType()
- ,EsbSysProps.getJndiServerURL()
- );
-
- // request UID chunks for your own use
- // int[] ia = {10,20,30};
- // for (int iCurr : ia)
- // System.out.println
- // ("Requesting "+iCurr+" uids "
- // +" - First UID returned = " +m_oH.getUidChunk(iCurr)
- // );
-
- storeAndRetrievePerson();
- } //________________________________
-
- static void storeAndRetrievePerson() throws Exception
- {
- // set up a Person (see TestPersonAddrPhone.class)
- Person oPrs = PersonUnitTest.getPerson();
- // timestamp, uid and snap Uid are added just to make it easier
- // to compare output text
- oPrs.setStamp(System.currentTimeMillis());
- long lUid = m_oH.addObject(oPrs);
- oPrs.setUid(lUid);
- oPrs.setSnap(lUid);
-
- // retrieve it from the Object Store
- Person oP2 = (Person)m_oH.getObject(Person.class,lUid);
-
- // output in XML format both objects, and compare
- // timestamps will differ slightly because first object
- // has a dummy timestamp (just before "store" request)
- System.out.println(oPrs.toDTO().toXml());
- System.out.println(oP2.toDTO().toXml());
-
- // if you used the "ObjStoreExample.xml" that comes with the
- // standard example, you'll be able to see your objects
- // in the "object_snap" and "people_index" tables
-
- } //________________________________
- */
-} //____________________________________________________________________________
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java (from rev 5257, labs/jbossesb/branches/refactor/product/core/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java)
More information about the jboss-svn-commits
mailing list