[jboss-svn-commits] JBL Code SVN: r13805 - in labs/jbossesb/trunk/product: lib/ext and 18 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 27 08:34:28 EDT 2007


Author: tfennelly
Date: 2007-07-27 08:34:27 -0400 (Fri, 27 Jul 2007)
New Revision: 13805

Added:
   labs/jbossesb/trunk/product/lib/ext/quartz-1.6.0.jar
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduledEventMessageComposer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ScheduleProviderFactory.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/CronSchedule.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/Schedule.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduledEventListener.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulingException.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SimpleSchedule.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/MockScheduledEventMessageComposer.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-02.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-03.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-04.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-05.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml
Modified:
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsdconfig
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ActionContractPublisher.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/NotificationMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycle.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/mock/MockAction.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ConfigurationControlerUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/MockContractPublisher.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/listenerFtp.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
Log:
Some scheduling code.

Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2007-07-27 12:34:27 UTC (rev 13805)
@@ -48,24 +48,44 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:sequence>
-                <xsd:element ref="jesb:provider" maxOccurs="unbounded" minOccurs="1"/>
+                <xsd:element ref="jesb:provider" maxOccurs="unbounded" minOccurs="0"/>
             </xsd:sequence>
         </xsd:complexType>
     </xsd:element>
-    <xsd:complexType name="provider">
+    <xsd:complexType name="provider" abstract="true">
         <xsd:annotation>
-            <xsd:documentation xml:lang="en">A provider of a bus. So for instance you can have a jms-provider (JBossMQ)
-                or an ftp-provider.
-            </xsd:documentation>
+            <xsd:documentation xml:lang="en">Abstract provider.</xsd:documentation>
         </xsd:annotation>
         <xsd:sequence>
             <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
-            <xsd:element ref="jesb:bus" maxOccurs="unbounded" minOccurs="1"/>
         </xsd:sequence>
         <xsd:attribute name="name" use="required" type="xsd:string"/>
     </xsd:complexType>
-    <xsd:element name="provider" type="jesb:provider"/>
+    <xsd:element name="provider" type="jesb:provider" abstract="true"/>
 
+    <xsd:complexType name="bus-provider">
+        <xsd:complexContent>
+            <xsd:extension base="jesb:provider">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">A provider of a bus. So for instance you can have a jms-provider (JBossMQ) or an ftp-provider.</xsd:documentation>
+                </xsd:annotation>
+                <xsd:sequence>
+                    <xsd:element ref="jesb:bus" maxOccurs="unbounded" minOccurs="1"/>
+                </xsd:sequence>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+    <xsd:element name="bus-provider" substitutionGroup="jesb:provider">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">Generic Bus Provider.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:bus-provider" />
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
     <xsd:complexType name="bus">
         <xsd:annotation>
             <xsd:documentation xml:lang="en">A bus (also called "channel" by others) is a means by which Services
@@ -77,15 +97,82 @@
         </xsd:sequence>
         <xsd:attribute name="busid" use="required" type="xsd:string">
             <xsd:annotation>
-                <xsd:documentation xml:lang="en">An id such that this bus can be referenced by Service listn.
-                </xsd:documentation>
-                <xsd:appinfo>
-                </xsd:appinfo>
+                <xsd:documentation xml:lang="en">An id such that this bus can be referenced by Service listn.</xsd:documentation>
             </xsd:annotation>
         </xsd:attribute>
     </xsd:complexType>
     <xsd:element name="bus" type="jesb:bus"/>
 
+    <xsd:element name="schedule-provider" substitutionGroup="jesb:provider">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:provider">
+                    <xsd:sequence>
+                        <xsd:element ref="jesb:schedule" maxOccurs="unbounded" minOccurs="1"/>
+                    </xsd:sequence>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:complexType name="schedule" abstract="true">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">Schedule Configuration.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:sequence>
+            <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
+        </xsd:sequence>
+        <xsd:attribute name="scheduleid" use="required" type="xsd:string">
+            <xsd:annotation>
+                <xsd:documentation xml:lang="en">An id such that this schedule can be referenced by Service listner.</xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
+        <xsd:attribute name="startDate" use="optional" type="xsd:dateTime">
+            <xsd:annotation>
+                <xsd:documentation xml:lang="en">Schedule start time and date.</xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
+        <xsd:attribute name="endDate" use="optional" type="xsd:dateTime">
+            <xsd:annotation>
+                <xsd:documentation xml:lang="en">Schedule end time and date.</xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
+    </xsd:complexType>
+    <xsd:element name="schedule" type="jesb:schedule" abstract="true"/>
+
+    <xsd:element name="simple-schedule" substitutionGroup="jesb:schedule">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:schedule">
+                    <xsd:attribute name="frequency" use="optional" type="xsd:long" default="10">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">Schedule frequency, in seconds.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                    <xsd:attribute name="repeatCount" use="optional" type="xsd:int" default="-1">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">Schedule repeat count. -1 to repeat indefinitely.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:element name="cron-schedule" substitutionGroup="jesb:schedule">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:schedule">
+                    <xsd:attribute name="cronExpression" use="optional" type="xsd:string">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">Schedule CRON expression.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
     <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
        Service and Action types.
     88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
@@ -229,6 +316,49 @@
         </xsd:attribute>
     </xsd:complexType>
     <xsd:element name="listener" type="jesb:listener"/>
+
+    <xsd:complexType name="abstract-scheduled-listener" abstract="true">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">Abstract scheduled listener.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexContent>
+            <xsd:extension base="jesb:listener">
+                <xsd:attribute name="poll-frequency-seconds" use="optional"  type="xsd:int" default="-1"> <!-- Purposely defaults to -1 -->
+                    <xsd:annotation>
+                        <xsd:documentation xml:lang="en">DEPRECATED (use "schedule-frequency" or "scheduleidref"): The frequency with which this listener is scheduled (in seconds). Defaults to 10 seconds.</xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
+                <xsd:attribute name="schedule-frequency" use="optional" type="xsd:int" default="-1"> <!-- Purposely defaults to -1 -->
+                    <xsd:annotation>
+                        <xsd:documentation xml:lang="en">The frequency with which this listener is scheduled (in seconds). Defaults to 10 seconds.</xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
+                <xsd:attribute name="scheduleidref" use="optional" type="xsd:string">
+                    <xsd:annotation>
+                        <xsd:documentation xml:lang="en">The id reference for the schedule that's driving this scheduled listener.</xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:element name="scheduled-listener" substitutionGroup="jesb:listener">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">Scheduled listener.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:abstract-scheduled-listener">
+                    <xsd:attribute name="composer" use="required" type="xsd:string">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">Message Composer class name.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
     <!-- JCA Types -->
     <xsd:element name="activation-config">
         <xsd:annotation>
@@ -321,7 +451,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider">
+                <xsd:extension base="jesb:bus-provider">
                     <xsd:attribute name="connection-factory" use="required" type="xsd:string">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">The connection-factory used to lookup queues/topics in a
@@ -462,7 +592,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider"/>
+                <xsd:extension base="jesb:bus-provider"/>
             </xsd:complexContent>
         </xsd:complexType>
     </xsd:element>
@@ -472,22 +602,10 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:listener">
+                <xsd:extension base="jesb:abstract-scheduled-listener">
                     <xsd:sequence>
                         <xsd:element ref="jesb:fs-message-filter" maxOccurs="1" minOccurs="0"/>
                     </xsd:sequence>
-                    <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
-                        <xsd:annotation>
-                            <xsd:documentation xml:lang="en">The frequency with which this listener polls fs in seconds.
-                                Defaults to 10 seconds.
-                            </xsd:documentation>
-                        </xsd:annotation>
-                        <xsd:simpleType>
-                            <xsd:restriction base="xsd:integer">
-                                <xsd:minExclusive value="0"/>
-                            </xsd:restriction>
-                        </xsd:simpleType>
-                    </xsd:attribute>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
@@ -631,7 +749,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider">
+                <xsd:extension base="jesb:bus-provider">
                     <xsd:attribute name="hostname" use="required" type="xsd:string">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">The ftp hostname, as it can be resolved by DNS.
@@ -648,22 +766,10 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:listener">
+                <xsd:extension base="jesb:abstract-scheduled-listener">
                     <xsd:sequence>
                         <xsd:element ref="jesb:ftp-message-filter" maxOccurs="1" minOccurs="0"/>
                     </xsd:sequence>
-                    <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
-                        <xsd:annotation>
-                            <xsd:documentation xml:lang="en">The frequency with which this listener polls ftp server in
-                                seconds. Defaults to 10 seconds.
-                            </xsd:documentation>
-                        </xsd:annotation>
-                        <xsd:simpleType>
-                            <xsd:restriction base="xsd:integer">
-                                <xsd:minExclusive value="0"/>
-                            </xsd:restriction>
-                        </xsd:simpleType>
-                    </xsd:attribute>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
@@ -744,7 +850,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider">
+                <xsd:extension base="jesb:bus-provider">
                     <xsd:attribute name="url" use="required" type="xsd:string">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">The url needed to connect to the db.</xsd:documentation>
@@ -777,22 +883,10 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:listener">
+                <xsd:extension base="jesb:abstract-scheduled-listener">
                     <xsd:sequence>
                         <xsd:element ref="jesb:sql-message-filter" maxOccurs="1" minOccurs="0"/>
                     </xsd:sequence>
-                    <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
-                        <xsd:annotation>
-                            <xsd:documentation xml:lang="en">The frequency with which this listener polls the db in
-                                seconds. Defaults to 10 seconds.
-                            </xsd:documentation>
-                        </xsd:annotation>
-                        <xsd:simpleType>
-                            <xsd:restriction base="xsd:integer">
-                                <xsd:minExclusive value="0"/>
-                            </xsd:restriction>
-                        </xsd:simpleType>
-                    </xsd:attribute>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
@@ -840,7 +934,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider">
+                <xsd:extension base="jesb:bus-provider">
                     <xsd:attribute name="hibernate-cfg-file" use="required" type="xsd:string">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">The Hibernate configuration file to use.</xsd:documentation>
@@ -860,18 +954,6 @@
                     <xsd:sequence>
                         <xsd:element ref="jesb:hibernate-message-filter" maxOccurs="unbounded" minOccurs="0"/>
                     </xsd:sequence>
-					<xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
-                        <xsd:annotation>
-                            <xsd:documentation xml:lang="en">The frequency with which this listener polls the db in
-                                seconds. Defaults to 10 seconds.
-                            </xsd:documentation>
-                        </xsd:annotation>
-                        <xsd:simpleType>
-                            <xsd:restriction base="xsd:integer">
-                                <xsd:minExclusive value="0"/>
-                            </xsd:restriction>
-                        </xsd:simpleType>
-                    </xsd:attribute>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
@@ -904,7 +986,7 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:complexContent>
-                <xsd:extension base="jesb:provider">
+                <xsd:extension base="jesb:bus-provider">
                     <xsd:attribute name="protocol" use="required">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">Jboss Remoting Listener/Server protocol.
@@ -960,5 +1042,5 @@
             </xsd:complexContent>
         </xsd:complexType>
     </xsd:element>
-
+    
 </xsd:schema>

Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsdconfig
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsdconfig	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsdconfig	2007-07-27 12:34:27 UTC (rev 13805)
@@ -9,6 +9,6 @@
     <!-- Use the "namespace" element to map a namespace to the Java package
         name that should be generated. -->
     <xb:namespace uri="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
-        <xb:package>org.jboss.soa.esb.listeners.config</xb:package>
+        <xb:package>org.jboss.soa.esb.listeners.config.xbeanmodel</xb:package>
     </xb:namespace>
 </xb:config>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/lib/ext/quartz-1.6.0.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/lib/ext/quartz-1.6.0.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ActionContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ActionContractPublisher.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ActionContractPublisher.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -1,7 +1,7 @@
 package org.jboss.internal.soa.esb.publish;
 
 import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
 
 /**
  * Action contract Publisher.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -55,586 +55,676 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
+
 /**
- * Objects of this class are to be used for run time configuration of ESB components 
+ * Objects of this class are to be used for run time configuration of ESB components
  * <p/>  This should gradually replace the ConfigTree class
  * <br/> It is a subset of Tree that accepts a Map of attributes, and a List of children
  * <br/> children can only be String values, or objects of this class
  * <p/> fromXml() and toXml() methods allow 'visible' representations of objects of this class
  * and run time loading/dumping from/to standard XML documents
- * 
+ *
  * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- *
  */
-public class ConfigTree implements Serializable, Cloneable
-{
-	private static final long serialVersionUID = 1L;
-/**
- * Constructor of a root node (an uppermost ConfigTree)
- * @param name String - the element name of 'this'
- */
-	public ConfigTree(String name) { this(name,null); }
-/**
- * Constructor of a ConfigTree as a child of another (second arg)
- * @param name String - element name of 'this'
- * @param dad ConfigTree - whom 'this' will be hanging from
- */
-	public ConfigTree(String name, ConfigTree dad)
-	{
-		setName(name);
-		setParent(dad);
-	} // _______________________________
-/**
- * protected constructor
- * @param other - Where to get values for deep copy
- */
-	protected ConfigTree(ConfigTree other)
-	{
-		copyFrom(other);
-	} // _______________________________
+public class ConfigTree implements Serializable, Cloneable {
 
-	/**
-	 * 
-	 * @return String - the name of this tree (element name for XML representation)
-	 */
-	public String getName() 			{ return _name; }
-	/**
-	 * assign a name to 'this'
-	 * @param name String - The name for this object
-	 */
-	public void   setName(String name) 	
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		_name = name; 
-	} // _______________________________
+    private static Logger logger = Logger.getLogger(ConfigTree.class);
 
-	/**
-	 * whose child is 'this' (null if root)
-	 * @return ConfigTree - the parent tree of 'this' 
-	 */
-	public ConfigTree getParent() 			{ return _dad; }
-	
-	private  void   setParent(ConfigTree dad)	
-	{ 
-		if (null!=_dad && null!=_dad._childs)
-				_dad._childs.remove(this);
-		if (null!=dad)
-			dad.addChild(this); 
-	} 	
-	/**
-	 * assign a value to a named attribute 
-	 * @param name String - the name (key) for the new attribute 
-	 * @param value String - the value assigned to the key (if null - old value will be deleted)
-	 * @return String - old value assigned to the name (null if there was none)
-	 */
-	public String setAttribute(String name,String value)
-	{
-		if (null==name)
-			throw new IllegalArgumentException("Attribute name must be non null");
-		if (null==_attributes)
-			_attributes = new HashMap<String,String>();
-		String oldVal = _attributes.remove(name);
-		if(null!=value)
-			_attributes.put(name,value);
-		return oldVal;
-	} // _______________________________
-	/**
-	 * 
-	 * @return int - the number of non null attributes that this node has been assigned
-	 */
-	public int attributeCount()
-	{
-		return (null==_attributes) ? 0 : _attributes.size();
-	} // _______________________________
-	/**
-	 * Retrieve the value assigned to an attribute key.
-	 * @param name String - the search key.
-	 * @return String - the value assigned to the specified key, or null if the
-	 * attribute is not defined.
-	 */
-	public String getAttribute(String name)
-	{
-		return (null==_attributes) ? null : _attributes.get(name);
-	} // _______________________________
-	/**
-	 * Retrieve the value assigned to an attribute key, returning the supplied default
-	 * if the attribute is not defined.
-	 * @param name String - the search key.
-	 * @param defaultValue String - the default value to return if attribute is not set.
-	 * @return String - the value assigned to the specified key, or the default if
-	 * the value is not defined.
-	 */
-	public String getAttribute(String name, String defaultValue)
-	{
-		String ret = (null==_attributes) ? null : _attributes.get(name);
-		return (ret !=null?ret:defaultValue);
-	} // _______________________________
-	
-	/**
-	 * Get the value of a requred property, throwing a {@link ConfigurationException}
-	 * if the property is not defined. 
-	 * @param name String - the search key.
-	 * @return The value assigned to the specified property.
-	 * @throws ConfigurationException The propery is not defined.
-	 */
-	public String getRequiredAttribute(String name) throws ConfigurationException {
-		String ret = getAttribute(name);
-		
-		if(ret == null) {
-			throw new ConfigurationException("Required configuration property '" + name + "' not defined on configuration '" + _name + "'.");
-		}
-		
-		return ret;
-	}
-	
-	/**
-	 * obtain the list of all attribute names
-	 * @return Set<String>  - the set of keys that have been assigned a non null value
-	 */
-	public Set<String>getAttributeNames() 
-	{ return (null==_attributes) 
-		? new HashSet<String>() 
-		: _attributes.keySet();
-	} // _______________________________
-	/**
-	 * obtain the list of all attribute as a List<KeyValuePair>
-	 * @return List<KeyValuePair> - containing all attributes
-	 */
-	public List<KeyValuePair> attributesAsList() 
-	{
-		List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
-		if (null!=_attributes) 
-			for (Map.Entry<String,String> oCurr : _attributes.entrySet())
-				oRet.add(new KeyValuePair(oCurr.getKey(),oCurr.getValue()));
-		return oRet;
-	} // _______________________________
-	/**
-	 * obtain the list of all child "property" elements as a List<KeyValuePair>
-	 * @return List<KeyValuePair> - containing all child elements with tag name "property"
-	 */
-	public List<KeyValuePair> childPropertyList() 
-	{
-		List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
-		for (ConfigTree current : getChildren("property"))
-		{
-			String name = current.getAttribute("name");
-			if (null!=name)
-				oRet.add(new KeyValuePair(name,current.getAttribute("value")));
-		}
-		return oRet;
-	} // _______________________________
-	/**
-	 * concatenated values of all child String values that have been added to 'this'
-	 * <br/>"" (zero length String) if no String child nodes
-	 * @return String - concatenation of all String segments (equivalent to xml text nodes)
-	 */
-	public String getWholeText() 
-	{
-		if (null==_childs)
-			return "";
-		StringBuilder sb = null;
-		for (Child child : _childs)
-		{	if (! (child._obj instanceof String))
-				continue;
-			if (null==sb)
-				sb = new StringBuilder((String)child._obj);
-			else
-				sb.append((String)child._obj);
-		}
-		return sb.toString();
-				
-	} // _______________________________
-/**
- * <b>first</b> child containing only text, with name=arg0
- * @param name String - the name to filter
- * @return full text content of first 'pure text' child element under that name - &lt;null&gt; if none
- */
-	public String getFirstTextChild(String name) 
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		if (null!=_childs)
-			for (Child oCurr : _childs)
-			{
-				ConfigTree tree = oCurr.getTree();
-				if (null != tree && tree.isPureText() && name.equals(tree.getName()))
-					 return tree.getWholeText();
-			}
-		return null;
-	} // _______________________________
+    private static final long serialVersionUID = 1L;
 
-	/**
- * Obtain all String values with the same name
- * @param name String - filter for child String nodes
- * @return String[]
- */
-	public String[] getTextChildren(String name) 
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		if (null==_childs)
-			return new String[0];
-		List<String>oRet = new ArrayList<String>();
-		for (Child oCurr : _childs)
-		{
-			ConfigTree tree = oCurr.getTree();
-			if (null != tree && tree.isPureText() && name.equals(tree.getName()))
-				oRet.add(tree.getWholeText());
-		}
-		return oRet.toArray(new String[oRet.size()]);
-	} // _______________________________
-/**
- * add a child element that consists only of the text in arg0
- * @param value String - the text to assign to the added child node
- */
-	public void addTextChild (String value) { new Child(value); }
-	
-	private void addChild(ConfigTree child)	
-		{ child._dad = this; new Child(child); }
-/**
- * retrieve list of child elements of 'this' that are instances of ConfigTree
- * @return ConfigTree[] - Array containing all child elements of class ConfigTree
- */
-	public ConfigTree[] getAllChildren() 
-	{
-		if (null==_childs) 
-			return new ConfigTree[]{};
-		List<ConfigTree>oRet = new ArrayList<ConfigTree>();
-		for (Child oCurr : _childs)
-			if (null != oCurr.getTree())
-				oRet.add(oCurr.getTree());
-		return oRet.toArray(new ConfigTree[oRet.size()]);
-	} // _______________________________
+    /**
+     * Constructor of a root node (an uppermost ConfigTree)
+     *
+     * @param name String - the element name of 'this'
+     */
+    public ConfigTree(String name) {
+        this(name, null);
+    }
 
-	/**
-	 * list of child elements of 'this' that are instances of ConfigTree, with name = arg0
-	 * @param name String - the name of child nodes to filter
-	 * @return ConfigTree[] - child elements of class ConfigTree with name provided
-	 */
-	public ConfigTree[] getChildren(String name) 
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		if (null==_childs)
-			return new ConfigTree[0];
-		List<ConfigTree>oRet = new ArrayList<ConfigTree>();
-		for (Child oCurr : _childs)
-			if (name.equals(oCurr.getName()))
-					oRet.add(oCurr.getTree());
-		return oRet.toArray(new ConfigTree[oRet.size()]);
-	} // _______________________________
-/**
- * <b>first</b> child of class ConfigTree with name=arg0
- * @param name String - the name to filter
- * @return first child element under that name - &lt;null&gt; if none
- */
-	public ConfigTree getFirstChild(String name) 
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		if (null!=_childs)
-			for (Child oCurr : _childs)
-				if (name.equals(oCurr.getName()))
-					return oCurr.getTree();
-		return null;
-	} // _______________________________
-/**
- * purge the list of children
- */
-	public void removeAllChildren() 
-	{
-		_childs = null;
-	} // _______________________________
+    /**
+     * Constructor of a ConfigTree as a child of another (second arg)
+     *
+     * @param name String - element name of 'this'
+     * @param dad  ConfigTree - whom 'this' will be hanging from
+     */
+    public ConfigTree(String name, ConfigTree dad) {
+        setName(name);
+        setParent(dad);
+    } // _______________________________
 
-	/**
-	 * remove children by name
-	 * @param name String - only children by that name will be removed
-	 */
-	public void removeChildrenByName(String name) 
-	{
-		if (null==name)
-			throw new IllegalArgumentException();
-		if (null!=_childs)
-			for (ListIterator<Child> II=_childs.listIterator(); II.hasNext();)
-				if (name.equals(II.next().getName()))
-					II.remove();
-	} // __________________________________
+    /**
+     * protected constructor
+     *
+     * @param other - Where to get values for deep copy
+     */
+    protected ConfigTree(ConfigTree other) {
+        copyFrom(other);
+    } // _______________________________
 
-	/**
-	 * 
-	 * @return the number of child nodes (of any type)
-	 */
-	public int childCount()
-	{
-		return (null==_childs) ? 0 : _childs.size();
-	} // __________________________________
+    /**
+     * @return String - the name of this tree (element name for XML representation)
+     */
+    public String getName() {
+        return _name;
+    }
 
-	@Override
-	public Object clone() { return cloneObj(); }
+    /**
+     * assign a name to 'this'
+     *
+     * @param name String - The name for this object
+     */
+    public void setName(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        _name = name;
+    } // _______________________________
 
-	/**
-	 * instantiate a new ConfigTree with the same topology and contents of 'this'
-	 * <br/>Contained ConfigTree child elements will also be cloned
-	 * <br/>Transient objects are NOT copied nor cloned
-	 * @return ConfigTree - Deep copy of 'this'
-	 */
-	public ConfigTree cloneObj() {return cloneSubtree(null); } 
+    /**
+     * whose child is 'this' (null if root)
+     *
+     * @return ConfigTree - the parent tree of 'this'
+     */
+    public ConfigTree getParent() {
+        return _dad;
+    }
 
-	/**
-	 * @return ConfigTree - Deep copy of 'this'
-	 */
-	private ConfigTree cloneSubtree(ConfigTree dad)
-	{
-		ConfigTree oRet = new ConfigTree(_name, dad);
-		if (null!=_attributes)
-			for (Map.Entry<String,String> oAtt: _attributes.entrySet())
-				oRet.setAttribute(oAtt.getKey(),oAtt.getValue());
-		if (null!= _childs)
-			for (Child oChild : _childs)
-			{	
-				ConfigTree tree = oChild.getTree();
-				if (null!=tree)
-					tree.cloneSubtree(oRet);
-				else
-					oRet.addTextChild(oChild._obj.toString());
-			}
-		return oRet;
-	} // __________________________________
-	/**
-	 * Deep copy of other tree
-	 * @param other - from where to copy values
-	 */
-	protected void copyFrom(ConfigTree other)
-	{
-		this.setName(other.getName());
-		this._pureText	= other._pureText;
+    private void setParent(ConfigTree dad) {
+        if (null != _dad && null != _dad._childs)
+            _dad._childs.remove(this);
+        if (null != dad)
+            dad.addChild(this);
+    }
 
-		if (null != other._attributes)
-			for (Map.Entry<String,String> oneAtt : other._attributes.entrySet())
-				setAttribute(oneAtt.getKey(),oneAtt.getValue());
-		if (null != other._childs)
-			for (Child child : other._childs)
-				new Child(child);
-			
-	} // __________________________________
-/**
- * obtain an instance of this class, from a 'normalized' xml format, with the default encoding
- * <p/> the 'normalized' xml format is the output of the toXml() instance method
- * @param xml String - what to parse
- * @return ConfigTree - an object of this class
- * @throws SAXException - if xml format is invalid
- */
-	public static ConfigTree fromXml(String xml) throws SAXException
-	{
-		try { return fromXml(xml,java.nio.charset.Charset.defaultCharset().toString()); }
-		catch (UnsupportedEncodingException e)
-		{
-			//  This can't happen
-			_logger.fatal("Received unexpected exception: ",e);
-			return null;
-		}
-	} // __________________________________
-	
-	/**
-	 * obtain an instance of this class, from a 'normalized' xml format, with the encoding defined in arg1
-	 * <p/> the 'normalized' xml format is the output of the toXml() instance method
-	 * @param xml String - what to parse
-	 * @param encoding String - The encoding of arg 0
-	 * @return ConfigTree - an object of this class
-	 * @throws SAXException - if xml format is invalid
-	 */
-	public static ConfigTree fromXml(String xml, String encoding)
-		throws UnsupportedEncodingException, SAXException
-	{
-		if (null==xml)
-			throw new IllegalArgumentException("Xml source String is null");
-		try { return fromInputStream(new ByteArrayInputStream(xml.getBytes(encoding))); }
-		catch (IOException e)
-		{
-			_logger.fatal("Received unexpected IOException: ",e);
-			return null;
-		}
-	} // __________________________________
+    /**
+     * assign a value to a named attribute
+     *
+     * @param name  String - the name (key) for the new attribute
+     * @param value String - the value assigned to the key (if null - old value will be deleted)
+     * @return String - old value assigned to the name (null if there was none)
+     */
+    public String setAttribute(String name, String value) {
+        if (null == name)
+            throw new IllegalArgumentException("Attribute name must be non null");
+        if (null == _attributes)
+            _attributes = new HashMap<String, String>();
+        String oldVal = _attributes.remove(name);
+        if (null != value)
+            _attributes.put(name, value);
+        return oldVal;
+    } // _______________________________
 
-	/**
-	 * obtain an instance of this class, from a 'normalized' xml format contained in an input stream
-	 * <p/> the 'normalized' xml format is the output of the toXml() instance method
-	 * @param input InputStream - where to parse from
-	 * @return ConfigTree - an object of this class
-	 * @throws SAXException - if xml format is invalid
-	 * @throws IOException - if an input/output error occurs
-	 */
-	public static ConfigTree fromInputStream(InputStream input) 
-		throws SAXException, IOException
-	{
-		if (null==input)
-			throw new IllegalArgumentException();
-		DocumentBuilder builder = null;
-		try { builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); }
-		catch (ParserConfigurationException e2)
-		{	_logger.error("Problems with default Parser Configuration",e2);
-			return null;
-		}
-		Document oDoc = builder.parse(input);
-		oDoc.normalize();
-		
-		return fromElement(oDoc.getDocumentElement());
-		
-	} // __________________________________
+    /**
+     * @return int - the number of non null attributes that this node has been assigned
+     */
+    public int attributeCount() {
+        return (null == _attributes) ? 0 : _attributes.size();
+    } // _______________________________
 
-	public static ConfigTree fromElement(Element elem)
-	{
-		ConfigTree tree = new ConfigTree(elem.getNodeName());
-		NamedNodeMap NM = elem.getAttributes();
-		if (null!=NM)
-			for (int i1=0; i1<NM.getLength(); i1++)
-			{
-				Node node = NM.item(i1);
-				tree.setAttribute(node.getNodeName(),node.getNodeValue());
-			}
-		NodeList NL = elem.getChildNodes();
-		if (null!=NL)
-			for (int i1=0; i1<NL.getLength(); i1++)
-			{
-				Node node = NL.item(i1);
-				switch (node.getNodeType())
-				{	
-					case Node.ELEMENT_NODE:
-						tree.addChild(ConfigTree.fromElement((Element)node));
-						break;
-					case Node.TEXT_NODE:
-						tree.addTextChild(node.getNodeValue());
-						break;
-				}
-			}
-		
-		return tree;
-	} // __________________________________
+    /**
+     * Retrieve the value assigned to an attribute key.
+     *
+     * @param name String - the search key.
+     * @return String - the value assigned to the specified key, or null if the
+     *         attribute is not defined.
+     */
+    public String getAttribute(String name) {
+        return (null == _attributes) ? null : _attributes.get(name);
+    } // _______________________________
 
-	private Element toElement(Document doc)
-	{
-		Element elem = doc.createElement(_name);
-		if (null!=_attributes)
-			for (Map.Entry<String,String> oAtt : _attributes.entrySet())
-				elem.setAttribute(oAtt.getKey(),oAtt.getValue());
-		if (null!=_childs)
-			for (Child child : _childs)
-			{
-				ConfigTree tree = child.getTree();
-				if (null!=tree)
-					elem.appendChild(tree.toElement(doc));
-				else
-					elem.appendChild(doc.createTextNode(child._obj.toString()));
-			}
-		return elem;
-	} // __________________________________
-	/**
-	 * Equivalent to a call to toXml()
-	 * @return String - a String with the 'standard' xml representation of 'this',
-	 * using the default encoding
-	 */
-	public String toString() { return toXml(); }
-	/**
-	 * Equivalent to a call to toXml(encoding)
-	 * @param encoding String - 
-	 * @return String - a String with the 'standard' xml representation of 'this',
-	 * using the encoding specified in arg 0
-	 */
+    /**
+     * Retrieve the value assigned to an attribute key, returning the supplied default
+     * if the attribute is not defined.
+     *
+     * @param name         String - the search key.
+     * @param defaultValue String - the default value to return if attribute is not set.
+     * @return String - the value assigned to the specified key, or the default if
+     *         the value is not defined.
+     */
+    public String getAttribute(String name, String defaultValue) {
+        String ret = (null == _attributes) ? null : _attributes.get(name);
+        return (ret != null ? ret : defaultValue);
+    } // _______________________________
 
-	public String toString(String encoding) { return toXml(encoding); }
-	/**
-	 * @return String - a String with the 'standard' xml representation of 'this',
-	 * using the default encoding
-	 */
-	public String toXml()
-	{
-		return toXml(java.nio.charset.Charset.defaultCharset().toString());
-	} // __________________________________
-	
-	/**
-	 * Serialize this object - Transient objects are
-	 * @param encoding String - String 
-	 * @return String - a String with the 'standard' xml representation of 'this',
-	 * using encoding specified in arg0
-	 */
-	public String toXml(String encoding)
-	{
-		Transformer transf = null;
-		try { transf = TransformerFactory.newInstance().newTransformer(); }
-		catch (TransformerConfigurationException e1)
-		{	_logger.error("Cannot obtain transformer to render XML output",e1);
-			return null;
-		}
-		transf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
-		transf.setOutputProperty(OutputKeys.INDENT, "no");
-		transf.setOutputProperty(OutputKeys.ENCODING, encoding);
+    public long getLongAttribute(String name, long defaultValue) {
+        String value = getAttribute(name);
 
-		DocumentBuilder builder = null;
-		try { builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); }
-		catch (ParserConfigurationException e2)
-		{	_logger.error("Problems with default Parser Configuration",e2);
-			return null;
-		}
-		Document oDoc = builder.newDocument();
-		oDoc.appendChild(toElement(oDoc));
-		oDoc.normalize();
-		DOMSource src = new DOMSource(oDoc);
+        if(value != null) {
+            try {
+                return Long.parseLong(value.trim());
+            } catch(NumberFormatException e) {
+                logger.error("Invalid value '" + value + "' for property '" + name + "'.  Must be an long/integer value.  Returning default value '" + defaultValue + "'.");
+            }
+        }
 
-		ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
-		StreamResult res = new StreamResult(oStrm);
+        return defaultValue;
+    }
 
-		try { transf.transform(src, res); }
-		catch (TransformerException e3)
-		{	_logger.error("Problems with XML transformation",e3);
-			return null;
-		}
+    public float getFloatAttribute(String name, float defaultValue) {
+        String value = getAttribute(name);
 
-		return oStrm.toString();
-	} // __________________________________
-	
-	/**
-	 * 
-	 * @return boolean - indicating if 'this' element has ONLY text children (and consequently no ConfigTree children)
-	 */
-	public boolean isPureText() { return _pureText; }
+        if(value != null) {
+            try {
+                return Float.parseFloat(value.trim());
+            } catch(NumberFormatException e) {
+                logger.error("Invalid value '" + value + "' for property '" + name + "'.  Must be an float value.  Returning default value '" + defaultValue + "'.");
+            }
+        }
 
-	private class Child
-	{
-		Object _obj;
-		ConfigTree getTree() 
-		{	return (_obj instanceof ConfigTree)? (ConfigTree) _obj : null;
-		}
-		String getName() 
-		{	return (_obj instanceof ConfigTree)? ((ConfigTree) _obj)._name : null;
-		}
-		private Child(ConfigTree obj)	{addToDad(obj); _pureText = false;}
-		private Child(String obj)		{addToDad(obj); }
-		private Child(Child other)		
-		{	
-			if (other._obj instanceof ConfigTree)
-			{
-				addToDad(((ConfigTree)other._obj).cloneObj());
-				_pureText	= false;
-				return;
-			}
-			if (other._obj instanceof String)
-			{
-				addToDad((String)other._obj);
-				return;
-			}
+        return defaultValue;
+    }
 
-		}
-		private void addToDad(Object obj)
-		{	if (null==_childs)
-				_childs = new ArrayList<Child>();
-			_obj	= obj;
-			_childs.add(this);
-		}
-		
-	}
+    public boolean getBooleanAttribute(String name, boolean defaultValue) {
+        String value = getAttribute(name);
 
-	private boolean				_pureText=true;
+        if(value != null) {
+            try {
+                return Boolean.parseBoolean(value.trim());
+            } catch(NumberFormatException e) {
+                logger.error("Invalid value '" + value + "' for property '" + name + "'.  Must be an boolean value.  Returning default value '" + defaultValue + "'.");
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Get the value of a requred property, throwing a {@link ConfigurationException}
+     * if the property is not defined.
+     *
+     * @param name String - the search key.
+     * @return The value assigned to the specified property.
+     * @throws ConfigurationException The propery is not defined.
+     */
+    public String getRequiredAttribute(String name) throws ConfigurationException {
+        String ret = getAttribute(name);
+
+        if (ret == null) {
+            throw new ConfigurationException("Required configuration property '" + name + "' not defined on configuration '" + _name + "'.");
+        }
+
+        return ret;
+    }
+
+    /**
+     * obtain the list of all attribute names
+     *
+     * @return Set<String>  - the set of keys that have been assigned a non null value
+     */
+    public Set<String> getAttributeNames() {
+        return (null == _attributes)
+                ? new HashSet<String>()
+                : _attributes.keySet();
+    } // _______________________________
+
+    /**
+     * obtain the list of all attribute as a List<KeyValuePair>
+     *
+     * @return List<KeyValuePair> - containing all attributes
+     */
+    public List<KeyValuePair> attributesAsList() {
+        List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
+        if (null != _attributes)
+            for (Map.Entry<String, String> oCurr : _attributes.entrySet())
+                oRet.add(new KeyValuePair(oCurr.getKey(), oCurr.getValue()));
+        return oRet;
+    } // _______________________________
+
+    /**
+     * obtain the list of all child "property" elements as a List<KeyValuePair>
+     *
+     * @return List<KeyValuePair> - containing all child elements with tag name "property"
+     */
+    public List<KeyValuePair> childPropertyList() {
+        List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
+        for (ConfigTree current : getChildren("property")) {
+            String name = current.getAttribute("name");
+            if (null != name)
+                oRet.add(new KeyValuePair(name, current.getAttribute("value")));
+        }
+        return oRet;
+    } // _______________________________
+
+    /**
+     * concatenated values of all child String values that have been added to 'this'
+     * <br/>"" (zero length String) if no String child nodes
+     *
+     * @return String - concatenation of all String segments (equivalent to xml text nodes)
+     */
+    public String getWholeText() {
+        if (null == _childs)
+            return "";
+        StringBuilder sb = null;
+        for (Child child : _childs) {
+            if (!(child._obj instanceof String))
+                continue;
+            if (null == sb)
+                sb = new StringBuilder((String) child._obj);
+            else
+                sb.append((String) child._obj);
+        }
+        return sb.toString();
+
+    } // _______________________________
+
+    /**
+     * <b>first</b> child containing only text, with name=arg0
+     *
+     * @param name String - the name to filter
+     * @return full text content of first 'pure text' child element under that name - &lt;null&gt; if none
+     */
+    public String getFirstTextChild(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        if (null != _childs)
+            for (Child oCurr : _childs) {
+                ConfigTree tree = oCurr.getTree();
+                if (null != tree && tree.isPureText() && name.equals(tree.getName()))
+                    return tree.getWholeText();
+            }
+        return null;
+    } // _______________________________
+
+    /**
+     * Obtain all String values with the same name
+     *
+     * @param name String - filter for child String nodes
+     * @return String[]
+     */
+    public String[] getTextChildren(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        if (null == _childs)
+            return new String[0];
+        List<String> oRet = new ArrayList<String>();
+        for (Child oCurr : _childs) {
+            ConfigTree tree = oCurr.getTree();
+            if (null != tree && tree.isPureText() && name.equals(tree.getName()))
+                oRet.add(tree.getWholeText());
+        }
+        return oRet.toArray(new String[oRet.size()]);
+    } // _______________________________
+
+    /**
+     * add a child element that consists only of the text in arg0
+     *
+     * @param value String - the text to assign to the added child node
+     */
+    public void addTextChild(String value) {
+        new Child(value);
+    }
+
+    private void addChild(ConfigTree child) {
+        child._dad = this;
+        new Child(child);
+    }
+
+    /**
+     * retrieve list of child elements of 'this' that are instances of ConfigTree
+     *
+     * @return ConfigTree[] - Array containing all child elements of class ConfigTree
+     */
+    public ConfigTree[] getAllChildren() {
+        if (null == _childs)
+            return new ConfigTree[]{};
+        List<ConfigTree> oRet = new ArrayList<ConfigTree>();
+        for (Child oCurr : _childs)
+            if (null != oCurr.getTree())
+                oRet.add(oCurr.getTree());
+        return oRet.toArray(new ConfigTree[oRet.size()]);
+    } // _______________________________
+
+    /**
+     * list of child elements of 'this' that are instances of ConfigTree, with name = arg0
+     *
+     * @param name String - the name of child nodes to filter
+     * @return ConfigTree[] - child elements of class ConfigTree with name provided
+     */
+    public ConfigTree[] getChildren(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        if (null == _childs)
+            return new ConfigTree[0];
+        List<ConfigTree> oRet = new ArrayList<ConfigTree>();
+        for (Child oCurr : _childs)
+            if (name.equals(oCurr.getName()))
+                oRet.add(oCurr.getTree());
+        return oRet.toArray(new ConfigTree[oRet.size()]);
+    } // _______________________________
+
+    /**
+     * <b>first</b> child of class ConfigTree with name=arg0
+     *
+     * @param name String - the name to filter
+     * @return first child element under that name - &lt;null&gt; if none
+     */
+    public ConfigTree getFirstChild(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        if (null != _childs)
+            for (Child oCurr : _childs)
+                if (name.equals(oCurr.getName()))
+                    return oCurr.getTree();
+        return null;
+    } // _______________________________
+
+    /**
+     * purge the list of children
+     */
+    public void removeAllChildren() {
+        _childs = null;
+    } // _______________________________
+
+    /**
+     * remove children by name
+     *
+     * @param name String - only children by that name will be removed
+     */
+    public void removeChildrenByName(String name) {
+        if (null == name)
+            throw new IllegalArgumentException();
+        if (null != _childs)
+            for (ListIterator<Child> II = _childs.listIterator(); II.hasNext();)
+                if (name.equals(II.next().getName()))
+                    II.remove();
+    } // __________________________________
+
+    /**
+     * @return the number of child nodes (of any type)
+     */
+    public int childCount() {
+        return (null == _childs) ? 0 : _childs.size();
+    } // __________________________________
+
+    @Override
+    public Object clone() {
+        return cloneObj();
+    }
+
+    /**
+     * instantiate a new ConfigTree with the same topology and contents of 'this'
+     * <br/>Contained ConfigTree child elements will also be cloned
+     * <br/>Transient objects are NOT copied nor cloned
+     *
+     * @return ConfigTree - Deep copy of 'this'
+     */
+    public ConfigTree cloneObj() {
+        return cloneSubtree(null);
+    }
+
+    /**
+     * @return ConfigTree - Deep copy of 'this'
+     */
+    private ConfigTree cloneSubtree(ConfigTree dad) {
+        ConfigTree oRet = new ConfigTree(_name, dad);
+        if (null != _attributes)
+            for (Map.Entry<String, String> oAtt : _attributes.entrySet())
+                oRet.setAttribute(oAtt.getKey(), oAtt.getValue());
+        if (null != _childs)
+            for (Child oChild : _childs) {
+                ConfigTree tree = oChild.getTree();
+                if (null != tree)
+                    tree.cloneSubtree(oRet);
+                else
+                    oRet.addTextChild(oChild._obj.toString());
+            }
+        return oRet;
+    } // __________________________________
+
+    /**
+     * Deep copy of other tree
+     *
+     * @param other - from where to copy values
+     */
+    protected void copyFrom(ConfigTree other) {
+        this.setName(other.getName());
+        this._pureText = other._pureText;
+
+        if (null != other._attributes)
+            for (Map.Entry<String, String> oneAtt : other._attributes.entrySet())
+                setAttribute(oneAtt.getKey(), oneAtt.getValue());
+        if (null != other._childs)
+            for (Child child : other._childs)
+                new Child(child);
+
+    } // __________________________________
+
+    /**
+     * obtain an instance of this class, from a 'normalized' xml format, with the default encoding
+     * <p/> the 'normalized' xml format is the output of the toXml() instance method
+     *
+     * @param xml String - what to parse
+     * @return ConfigTree - an object of this class
+     * @throws SAXException - if xml format is invalid
+     */
+    public static ConfigTree fromXml(String xml) throws SAXException {
+        try {
+            return fromXml(xml, java.nio.charset.Charset.defaultCharset().toString());
+        }
+        catch (UnsupportedEncodingException e) {
+            //  This can't happen
+            _logger.fatal("Received unexpected exception: ", e);
+            return null;
+        }
+    } // __________________________________
+
+    /**
+     * obtain an instance of this class, from a 'normalized' xml format, with the encoding defined in arg1
+     * <p/> the 'normalized' xml format is the output of the toXml() instance method
+     *
+     * @param xml      String - what to parse
+     * @param encoding String - The encoding of arg 0
+     * @return ConfigTree - an object of this class
+     * @throws SAXException - if xml format is invalid
+     */
+    public static ConfigTree fromXml(String xml, String encoding)
+            throws UnsupportedEncodingException, SAXException {
+        if (null == xml)
+            throw new IllegalArgumentException("Xml source String is null");
+        try {
+            return fromInputStream(new ByteArrayInputStream(xml.getBytes(encoding)));
+        }
+        catch (IOException e) {
+            _logger.fatal("Received unexpected IOException: ", e);
+            return null;
+        }
+    } // __________________________________
+
+    /**
+     * obtain an instance of this class, from a 'normalized' xml format contained in an input stream
+     * <p/> the 'normalized' xml format is the output of the toXml() instance method
+     *
+     * @param input InputStream - where to parse from
+     * @return ConfigTree - an object of this class
+     * @throws SAXException - if xml format is invalid
+     * @throws IOException  - if an input/output error occurs
+     */
+    public static ConfigTree fromInputStream(InputStream input)
+            throws SAXException, IOException {
+        if (null == input)
+            throw new IllegalArgumentException();
+        DocumentBuilder builder = null;
+        try {
+            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        }
+        catch (ParserConfigurationException e2) {
+            _logger.error("Problems with default Parser Configuration", e2);
+            return null;
+        }
+        Document oDoc = builder.parse(input);
+        oDoc.normalize();
+
+        return fromElement(oDoc.getDocumentElement());
+
+    } // __________________________________
+
+    public static ConfigTree fromElement(Element elem) {
+        ConfigTree tree = new ConfigTree(elem.getNodeName());
+        NamedNodeMap NM = elem.getAttributes();
+        if (null != NM)
+            for (int i1 = 0; i1 < NM.getLength(); i1++) {
+                Node node = NM.item(i1);
+                tree.setAttribute(node.getNodeName(), node.getNodeValue());
+            }
+        NodeList NL = elem.getChildNodes();
+        if (null != NL)
+            for (int i1 = 0; i1 < NL.getLength(); i1++) {
+                Node node = NL.item(i1);
+                switch (node.getNodeType()) {
+                    case Node.ELEMENT_NODE:
+                        tree.addChild(ConfigTree.fromElement((Element) node));
+                        break;
+                    case Node.TEXT_NODE:
+                        tree.addTextChild(node.getNodeValue());
+                        break;
+                }
+            }
+
+        return tree;
+    } // __________________________________
+
+    private Element toElement(Document doc) {
+        Element elem = doc.createElement(_name);
+        if (null != _attributes)
+            for (Map.Entry<String, String> oAtt : _attributes.entrySet())
+                elem.setAttribute(oAtt.getKey(), oAtt.getValue());
+        if (null != _childs)
+            for (Child child : _childs) {
+                ConfigTree tree = child.getTree();
+                if (null != tree)
+                    elem.appendChild(tree.toElement(doc));
+                else
+                    elem.appendChild(doc.createTextNode(child._obj.toString()));
+            }
+        return elem;
+    } // __________________________________
+
+    /**
+     * Equivalent to a call to toXml()
+     *
+     * @return String - a String with the 'standard' xml representation of 'this',
+     *         using the default encoding
+     */
+    public String toString() {
+        return toXml();
+    }
+
+    /**
+     * Equivalent to a call to toXml(encoding)
+     *
+     * @param encoding String -
+     * @return String - a String with the 'standard' xml representation of 'this',
+     *         using the encoding specified in arg 0
+     */
+
+    public String toString(String encoding) {
+        return toXml(encoding);
+    }
+
+    /**
+     * @return String - a String with the 'standard' xml representation of 'this',
+     *         using the default encoding
+     */
+    public String toXml() {
+        return toXml(java.nio.charset.Charset.defaultCharset().toString());
+    } // __________________________________
+
+    /**
+     * Serialize this object - Transient objects are
+     *
+     * @param encoding String - String
+     * @return String - a String with the 'standard' xml representation of 'this',
+     *         using encoding specified in arg0
+     */
+    public String toXml(String encoding) {
+        Transformer transf = null;
+        try {
+            transf = TransformerFactory.newInstance().newTransformer();
+        }
+        catch (TransformerConfigurationException e1) {
+            _logger.error("Cannot obtain transformer to render XML output", e1);
+            return null;
+        }
+        transf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+        transf.setOutputProperty(OutputKeys.INDENT, "no");
+        transf.setOutputProperty(OutputKeys.ENCODING, encoding);
+
+        DocumentBuilder builder = null;
+        try {
+            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        }
+        catch (ParserConfigurationException e2) {
+            _logger.error("Problems with default Parser Configuration", e2);
+            return null;
+        }
+        Document oDoc = builder.newDocument();
+        oDoc.appendChild(toElement(oDoc));
+        oDoc.normalize();
+        DOMSource src = new DOMSource(oDoc);
+
+        ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
+        StreamResult res = new StreamResult(oStrm);
+
+        try {
+            transf.transform(src, res);
+        }
+        catch (TransformerException e3) {
+            _logger.error("Problems with XML transformation", e3);
+            return null;
+        }
+
+        return oStrm.toString();
+    } // __________________________________
+
+    /**
+     * @return boolean - indicating if 'this' element has ONLY text children (and consequently no ConfigTree children)
+     */
+    public boolean isPureText() {
+        return _pureText;
+    }
+
+    private class Child {
+        Object _obj;
+
+        ConfigTree getTree() {
+            return (_obj instanceof ConfigTree) ? (ConfigTree) _obj : null;
+        }
+
+        String getName() {
+            return (_obj instanceof ConfigTree) ? ((ConfigTree) _obj)._name : null;
+        }
+
+        private Child(ConfigTree obj) {
+            addToDad(obj);
+            _pureText = false;
+        }
+
+        private Child(String obj) {
+            addToDad(obj);
+        }
+
+        private Child(Child other) {
+            if (other._obj instanceof ConfigTree) {
+                addToDad(((ConfigTree) other._obj).cloneObj());
+                _pureText = false;
+                return;
+            }
+            if (other._obj instanceof String) {
+                addToDad((String) other._obj);
+                return;
+            }
+
+        }
+
+        private void addToDad(Object obj) {
+            if (null == _childs)
+                _childs = new ArrayList<Child>();
+            _obj = obj;
+            _childs.add(this);
+        }
+
+    }
+
+    private boolean				_pureText=true;
 	private ConfigTree 			_dad;
 	private String 				_name;
 	private Map<String,String> 	_attributes;

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners;
+
+import org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
+import org.jboss.soa.esb.schedule.ScheduledEventListener;
+import org.jboss.soa.esb.schedule.SchedulingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * ESB Schedule listener.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ScheduleListener extends AbstractManagedLifecycle implements ScheduledEventListener {
+
+    /**
+     * The action pipeline.
+     */
+    private ActionProcessingPipeline pipeline;
+    /**
+     * Event message composer. 
+     */
+    private ScheduledEventMessageComposer composer;
+
+    /**
+     * Construct the managed lifecycle.
+     *
+     * @param config The configuration associated with this instance.
+     * @throws org.jboss.soa.esb.ConfigurationException
+     *          for configuration errors during initialisation.
+     */
+    public ScheduleListener(ConfigTree config) throws ConfigurationException {
+        super(config);
+
+        // Construct the Message processing pipeline instance...
+        pipeline = new ActionProcessingPipeline(getConfig());
+        pipeline.initialise();
+
+        // Construct the message composer instance...
+        String composerClassName = config.getRequiredAttribute("composer");
+        composer = ScheduledEventMessageComposer.Factory.createInstance(composerClassName);
+        composer.initialize(config);
+    }
+
+    /**
+     * On schedule event processor implementation.
+     * @throws SchedulingException Error processing scheduled event.
+     */
+    public void onSchedule() throws SchedulingException {
+        Message message;
+
+        message = composer.composeMessage();
+        pipeline.process(message);
+        composer.onProcessingComplete(message);
+    }
+
+    protected void doInitialise() throws ManagedLifecycleException {
+    }
+
+    protected void doStart() throws ManagedLifecycleException {
+    }
+
+    protected void doStop() throws ManagedLifecycleException {
+    }
+
+    protected void doDestroy() throws ManagedLifecycleException {
+        composer.uninitialize();
+        pipeline.destroy() ;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduleListener.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduledEventMessageComposer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduledEventMessageComposer.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduledEventMessageComposer.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.schedule.SchedulingException;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+
+/**
+ * Scheduled Event Composer.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface ScheduledEventMessageComposer {
+
+    /**
+     * Initialize the composer.
+     * @param config Composer configuration.
+     */
+    public void initialize(ConfigTree config) throws ConfigurationException;
+
+    /**
+     * Uninitialize the composer.
+     */
+    public void uninitialize();
+
+    /**
+     * Compose an ESB "aware" message.
+     * <p/>
+     * Called by the {@link org.jboss.soa.esb.schedule.ScheduledEventListener#onSchedule()} method.
+     *
+     * @return ESB aware message instance.
+     * @throws SchedulingException Failed to compose message on scheduled event.
+     */
+    public Message composeMessage() throws SchedulingException;
+
+    /**
+     * Called by the {@link org.jboss.soa.esb.schedule.ScheduledEventListener} after processing of the
+     * {@link org.jboss.soa.esb.message.Message} has completed.
+     * <p/>
+     * This event can be used to perform any necessary cleanup processing for the {@link Message} instance etc.
+     *
+     * @param message ESB aware message instance to be decomposed.
+     * @return ESB unaware message instance - a message payload.
+     * @throws SchedulingException Error while processing the onProcessingComplete event.
+     */
+    public Message onProcessingComplete(Message message) throws SchedulingException;
+
+    /**
+     * Uitility factory class for reflective {@link ScheduledEventMessageComposer} construction.
+     */
+    public static class Factory {
+
+        /**
+         * Factory method.
+         *
+         * @param className Class name.
+         * @return Composer instance.
+         * @throws ConfigurationException Unable to construct composer.
+         */
+        public static ScheduledEventMessageComposer createInstance(String className) throws ConfigurationException {
+            AssertArgument.isNotNullAndNotEmpty(className, "className");
+
+            try {
+                return (ScheduledEventMessageComposer) ClassUtil.forName(className, Factory.class).newInstance();
+            } catch (ClassNotFoundException e) {
+                throw new ConfigurationException("Composer class [" + className + "] not found in classpath.", e);
+            } catch (InstantiationException e) {
+                throw new ConfigurationException("Failed to instantiate composer class [" + className + "].", e);
+            } catch (IllegalAccessException e) {
+                throw new ConfigurationException("Failed to instantiate composer class [" + className + "].", e);
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ScheduledEventMessageComposer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -36,6 +36,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.schedule.ScheduleProvider;
 import org.xml.sax.InputSource;
 
 /**
@@ -102,6 +103,8 @@
             instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
 
              ManagedLifecycleController controller = new ManagedLifecycleController(instances);
+             ScheduleProvider scheduleProvider = ScheduleProviderFactory.createInstance(instances, generator.getModel().getScheduleProvider());
+             controller.setScheduleProvider(scheduleProvider);
 
              // In parallel, create a map of the contract publication info...
              ServicePublisher.addServicePublishers(controller, generator.getModel());

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -43,8 +43,13 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
 import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
+import org.jboss.soa.esb.parameters.ParamRepositoryException;
 import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.schedule.ScheduleProvider;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
 import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
 /**
  * The controller monitors changes in the jbossesb configuration file call jbossesb.xml. When
@@ -59,7 +64,7 @@
 	private static final int SLEEP_MILLIS       = 1000; // default interval between parameter reloads
         private static final int ENDED_MILLIS       = 20000; // default interval between parameter reloads
 	private static final String JBOSSESB_XSD = "/jbossesb-1.0.1.xsd";
-	private final Logger mLogger = Logger.getLogger(this.getClass());
+	private static final Logger mLogger = Logger.getLogger(ConfigurationController.class);
         private final Lock endedLock = new ReentrantLock() ;
         private final Condition endedChanged = endedLock.newCondition() ;
         private final Condition endRequested = endedLock.newCondition() ;
@@ -121,6 +126,15 @@
 
 		processConfiguration() ;
 	}
+
+    protected String getListenerConfigFile() {
+        return mListenerConfigFile;
+    }
+
+    protected String getGatewayConfigFile() {
+        return mGatewayConfigFile;
+    }
+
     /**
      * Thread that observes the configuration (file). If the configuration is updated it is
      * validated and new set jbossesb-listener.xml and jbossesb-gateway.xml is created for the
@@ -308,22 +322,8 @@
                     mLogger.info("Parameter reload completed.");
                     stopController() ;
 
-                    final List<ManagedLifecycle> instances = LifecycleUtil.getListeners(mListenerConfigFile) ;
-                    instances.addAll(LifecycleUtil.getGateways(mGatewayConfigFile)) ;
-
-                    controller = new ManagedLifecycleController(instances) ;
-                    try
-                    {
-                        controller.start() ;
-
-                        // In parallel, create a map of the contract publication info...
-                        ServicePublisher.addServicePublishers(controller, generator.getModel());
-                    }
-                    catch (final ManagedLifecycleException mle)
-                    {
-                        controller = null ;
-                        mLogger.error("Unexpected exception starting controller", mle) ;
-                    }
+                    // TODO: Get rid of generating config files to disk.  It's nuts.  Use in memory stream buffers!!
+                    controller = startController(generator.getModel(), LifecycleUtil.getConfigTree(mListenerConfigFile), LifecycleUtil.getConfigTree(mGatewayConfigFile));
 				} else {
 					StringBuffer buffer = new StringBuffer("The configuration file "
 							+ mConfigFileName + "\n did not pass validation for the following reasons: \n");
@@ -345,6 +345,27 @@
 		}
 	}
 
+    public static ManagedLifecycleController startController(Generator.XMLBeansModel configModel, ConfigTree listenerConfig, ConfigTree gatewayConfig) throws ParamRepositoryException, SAXException, ManagedLifecycleException, ConfigurationException {
+        final List<ManagedLifecycle> instances = LifecycleUtil.getListeners(listenerConfig);
+        instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
+
+        ManagedLifecycleController lifecycleController = new ManagedLifecycleController(instances);
+        ScheduleProvider scheduleProvider = ScheduleProviderFactory.createInstance(instances, configModel.getScheduleProvider());
+        lifecycleController.setScheduleProvider(scheduleProvider);
+
+        try {
+            lifecycleController.start();
+
+            // In parallel, create a map of the contract publication info...
+            ServicePublisher.addServicePublishers(lifecycleController, configModel);
+        } catch (final ManagedLifecycleException mle) {
+            lifecycleController = null;
+            mLogger.error("Unexpected exception starting controller", mle);
+        }
+
+        return lifecycleController;
+    }
+
     /**
 	 * Check the file timestamp and return true when it changes. In other
 	 * words this only works for files for now.
@@ -375,18 +396,25 @@
          */
         private void stopController()
         {
-            if (controller != null)
+            stopController(controller);
+            controller = null ;
+        }
+
+    /**
+     * Stop the controller if it is active.
+     */
+    public static void stopController(ManagedLifecycleController lifecycleController) {
+        if (lifecycleController != null)
+        {
+            try
             {
-                try
-                {
-                    ServicePublisher.removeServicePublishers(controller);
-                    controller.stop();
-                }
-                catch (final ManagedLifecycleException mle)
-                {
-                    mLogger.error("Unexpected exception stopping controller", mle) ;
-                }
-                controller = null ;
+                ServicePublisher.removeServicePublishers(lifecycleController);
+                lifecycleController.stop();
             }
+            catch (final ManagedLifecycleException mle)
+            {
+                mLogger.error("Unexpected exception stopping controller", mle) ;
+            }
         }
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -26,19 +26,18 @@
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.soa.esb.listeners.config.FsListenerDocument.FsListener;
-import org.jboss.soa.esb.listeners.config.FtpListenerDocument.FtpListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsListenerDocument.FsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpListenerDocument.FtpListener;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.JmsListenerDocument.JmsListener;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
-import org.jboss.soa.esb.listeners.config.SqlListenerDocument.SqlListener;
-import org.jboss.soa.esb.listeners.config.mappers.ActionMapper;
-import org.jboss.soa.esb.listeners.config.mappers.FsListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.FtpListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.JmsListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.NotificationMapper;
-import org.jboss.soa.esb.listeners.config.mappers.SqlListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.UntypedListenerMapper;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlListenerDocument.SqlListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduledListenerDocument.ScheduledListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbrListenerDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.GroovyListenerDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.AbstractScheduledListener;
+import org.jboss.soa.esb.listeners.config.mappers.*;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -102,13 +101,16 @@
 		// Of course we could do the following reflectively if we really want to - TODO perhaps!!
 		if(listener instanceof JmsListener) {
 			listenerConfigTree = JmsListenerMapper.map(root, (JmsListener)listener, model);
-      } else if(listener instanceof FsListener) {
+        } else if (listener instanceof ScheduledListener) {
+            listenerConfigTree = ScheduledListenerMapper.map(root, (ScheduledListener) listener);
+        } else if(listener instanceof FsListener) {
          listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
 		} else if (listener instanceof FtpListener) {
 			listenerConfigTree = FtpListenerMapper.map(root, (FtpListener)listener, model);
 		} else if (listener instanceof SqlListener) {
 			listenerConfigTree = SqlListenerMapper.map(root, (SqlListener)listener, model);
-        } else if (listener instanceof JbrListenerDocument.JbrListener) {
+        } else if (listener instanceof
+                JbrListenerDocument.JbrListener) {
             logger.error("JbossRemoting listener only supported in Gateway mode.");
             return;
         } else if (listener instanceof GroovyListenerDocument.GroovyListener) {
@@ -117,8 +119,12 @@
 		} else {
 			listenerConfigTree = UntypedListenerMapper.map(root, listener, model);
 		}
-		
-		// Locate the Service to which the listener is bound...
+
+        if (listener instanceof AbstractScheduledListener) {
+            ScheduleMapper.map(listenerConfigTree, (AbstractScheduledListener) listener);
+        }
+
+        // Locate the Service to which the listener is bound...
 		listenerService = model.getService(listener);
 		
 		// Map the actions and notiications...

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -25,97 +25,101 @@
 
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.soa.esb.listeners.config.FsListenerDocument.FsListener;
-import org.jboss.soa.esb.listeners.config.FtpListenerDocument.FtpListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsListenerDocument.FsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpListenerDocument.FtpListener;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.GroovyListenerDocument.GroovyListener;
-import org.jboss.soa.esb.listeners.config.HibernateListenerDocument.HibernateListener;
-import org.jboss.soa.esb.listeners.config.JbrListenerDocument.JbrListener;
-import org.jboss.soa.esb.listeners.config.JmsListenerDocument.JmsListener;
-import org.jboss.soa.esb.listeners.config.SqlListenerDocument.SqlListener;
-import org.jboss.soa.esb.listeners.config.mappers.FsListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.FtpListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.GroovyListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.HibernateListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.JbrListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.JcaGatewayMapper;
-import org.jboss.soa.esb.listeners.config.mappers.JmsListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.SqlListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.UntypedListenerMapper;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.GroovyListenerDocument.GroovyListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.HibernateListenerDocument.HibernateListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbrListenerDocument.JbrListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlListenerDocument.SqlListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JcaGatewayDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.AbstractScheduledListener;
+import org.jboss.soa.esb.listeners.config.mappers.*;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /**
  * Gateway Listeners Configuration Generator.
  * <p/>
- * Generates a "ConfigTree" style configuration for the Gateways Listeners. 
- * 
+ * Generates a "ConfigTree" style configuration for the Gateways Listeners.
+ *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public class GatewayGenerator {
 
-	/**
-	 * XMLBeans based configuration model instance.
-	 */
-	@SuppressWarnings("unused")
-	private XMLBeansModel model;
-	
-	/**
-	 * Public constructor.
-	 * @param model XMLBeans based configuration model instance.
-	 */
-	public GatewayGenerator(XMLBeansModel model) {
-		this.model = model;
-	}
+    /**
+     * XMLBeans based configuration model instance.
+     */
+    @SuppressWarnings("unused")
+    private XMLBeansModel model;
 
-	/**
-	 * Generate the configuration DOM for the target Server.
-	 * @return The configuration DOM.
-	 * @throws ConfigurationException Error creating configuration. 
-	 */
-	public Document generate() throws ConfigurationException {
-		Document doc = YADOMUtil.createDocument();
-		Element root;
-		
-		doc.appendChild(doc.createComment("\n\tNOTE: DO NOT MODIFY\n\tThis file was auto-generated.\n"));
-		root = YADOMUtil.addElement(doc, "jbossesb-gateways");
-		root.setAttribute("parameterReloadSecs", model.getParameterReloadSecs());
-		
-		// Iterate over all the gateway configs and map them to the gateway configuration...
-		List<Listener> gateways = model.getGatewayListeners();
-		for(Listener gateway : gateways) {
-			addGatewayConfig(root, gateway);
-		}
-		
-		return doc;
-	}
+    /**
+     * Public constructor.
+     *
+     * @param model XMLBeans based configuration model instance.
+     */
+    public GatewayGenerator(XMLBeansModel model) {
+        this.model = model;
+    }
 
-	/**
-	 * Add a single gateway configuration node to configuration root. 
-	 * @param root Configuration root node.
-	 * @param gateway The Gateway Listener configuration to be added.
-	 * @throws ConfigurationException Invalid listener configuration.
-	 */
-	private void addGatewayConfig(Element root, Listener gateway) throws ConfigurationException {
-		// Of course we could do the following reflectively if we really want to - TODO perhaps!!
-		if(gateway instanceof JmsListener) {
-			JmsListenerMapper.map(root, (JmsListener)gateway, model);
-		} else if (gateway instanceof FsListener){
-			FsListenerMapper.map(root, (FsListener)gateway, model);
-		} else if(gateway instanceof JcaGatewayDocument.JcaGateway) {
-			JcaGatewayMapper.map(root, (JcaGatewayDocument.JcaGateway)gateway, model);
-		} else if (gateway instanceof FtpListener) {
-			FtpListenerMapper.map(root, (FtpListener)gateway, model);
-		} else if (gateway instanceof SqlListener) {
-			SqlListenerMapper.map(root, (SqlListener)gateway, model);
+    /**
+     * Generate the configuration DOM for the target Server.
+     *
+     * @return The configuration DOM.
+     * @throws ConfigurationException Error creating configuration.
+     */
+    public Document generate() throws ConfigurationException {
+        Document doc = YADOMUtil.createDocument();
+        Element root;
+
+        doc.appendChild(doc.createComment("\n\tNOTE: DO NOT MODIFY\n\tThis file was auto-generated.\n"));
+        root = YADOMUtil.addElement(doc, "jbossesb-gateways");
+        root.setAttribute("parameterReloadSecs", model.getParameterReloadSecs());
+
+        // Iterate over all the gateway configs and map them to the gateway configuration...
+        List<Listener> gateways = model.getGatewayListeners();
+        for (Listener gateway : gateways) {
+            addGatewayConfig(root, gateway);
+        }
+
+        return doc;
+    }
+
+    /**
+     * Add a single gateway configuration node to configuration root.
+     *
+     * @param root    Configuration root node.
+     * @param gateway The Gateway Listener configuration to be added.
+     * @throws ConfigurationException Invalid listener configuration.
+     */
+    private void addGatewayConfig(Element root, Listener gateway) throws ConfigurationException {
+        Element listenerConfig;
+
+        // Of course we could do the following reflectively if we really want to - TODO perhaps!!
+        if (gateway instanceof JmsListener) {
+            listenerConfig = JmsListenerMapper.map(root, (JmsListener) gateway, model);
+        } else if (gateway instanceof FsListener) {
+            listenerConfig = FsListenerMapper.map(root, (FsListener) gateway, model);
+        } else if (gateway instanceof JcaGatewayDocument.JcaGateway) {
+            listenerConfig = JcaGatewayMapper.map(root, (JcaGatewayDocument.JcaGateway) gateway, model);
+        } else if (gateway instanceof FtpListener) {
+            listenerConfig = FtpListenerMapper.map(root, (FtpListener) gateway, model);
+        } else if (gateway instanceof SqlListener) {
+            listenerConfig = SqlListenerMapper.map(root, (SqlListener) gateway, model);
         } else if (gateway instanceof JbrListener) {
-            JbrListenerMapper.map(root, (JbrListener)gateway, model);
+            listenerConfig = JbrListenerMapper.map(root, (JbrListener) gateway, model);
         } else if (gateway instanceof GroovyListener) {
-            GroovyListenerMapper.map(root, (GroovyListener)gateway, model);
+            listenerConfig = GroovyListenerMapper.map(root, (GroovyListener) gateway, model);
         } else if (gateway instanceof HibernateListener) {
-        	HibernateListenerMapper.map(root, (HibernateListener)gateway, model);
+            listenerConfig = HibernateListenerMapper.map(root, (HibernateListener) gateway, model);
         } else {
-			UntypedListenerMapper.map(root, gateway, model);
-		}
-	}
+            listenerConfig = UntypedListenerMapper.map(root, gateway, model);
+        }
+
+        if (gateway instanceof AbstractScheduledListener) {
+            ScheduleMapper.map(listenerConfig, (AbstractScheduledListener) gateway);
+        }
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -28,14 +28,17 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.log4j.Logger;
 import org.apache.xmlbeans.XmlException;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.soa.esb.listeners.config.JbossesbDocument.Jbossesb;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
-import org.jboss.soa.esb.listeners.config.ServicesDocument.Services;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbossesbDocument.Jbossesb;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServicesDocument.Services;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduleProviderDocument.ScheduleProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.*;
 import org.w3c.dom.Document;
 
 /**
@@ -90,9 +93,31 @@
 		
 		// Parse the config into our internal model instance...
        model = parseConfig(config);
+       assertOneScheduleProviderConfig(model);
    }
 
-   /**
+    private void assertOneScheduleProviderConfig(XMLBeansModel model) throws ConfigurationException {
+        ProvidersDocument.Providers providersConfig = model.jbossesb.getProviders();
+
+        if(providersConfig == null) {
+            return;
+        }
+
+        List<Provider> providers = providersConfig.getProviderList();
+        int numScheduleProviders = 0;
+
+        for(Provider provider : providers) {
+            if(provider instanceof ScheduleProvider) {
+                numScheduleProviders++;
+            }
+        }
+
+        if(numScheduleProviders > 1) {
+            throw new ConfigurationException("Configuration contains " + numScheduleProviders + " <schedule-provider> configurations.  Only one of this provider type can exist per configuration.");
+        }
+    }
+
+    /**
     * Parse the supplied config into a config model.
     * @param config The input configuration stream.
     * @return Config model.
@@ -169,11 +194,21 @@
 		YADOMUtil.serialize(gatewayConfig, outdir, ESB_CONFIG_GATEWAY_XML_FILE);
 	}
 
+    public static Properties toProperties(List<PropertyDocument.Property> configProperties) {
+        Properties properties = new Properties();
+
+        for(PropertyDocument.Property property : configProperties) {
+            properties.setProperty(property.getName(), property.getValue());
+        }
+
+        return properties;
+    }
+
 	/**
 	 * Get the model instance associate with the configuration used to create this Generator instance. 
 	 * @return Returns the model.
 	 */
-	protected XMLBeansModel getModel() {
+	public XMLBeansModel getModel() {
 		return model;
 	}
 	
@@ -257,14 +292,16 @@
 			List<Provider> providers = jbossesb.getProviders().getProviderList();
 			
 			for(Provider provider : providers) {
-				List<Bus> buses = provider.getBusList();
-				
-				for(Bus bus : buses) {
-					if(bus.getBusid().equals(busid)) {
-						return bus;
-					}
-				}
-			}
+                if(provider instanceof BusProvider) {
+                    List<Bus> buses = ((BusProvider)provider).getBusList();
+
+                    for(Bus bus : buses) {
+                        if(bus.getBusid().equals(busid)) {
+                            return bus;
+                        }
+                    }
+                }
+            }
 			
 			throw new ConfigurationException("Invalid ESB Configuration: No <bus> configuration matching busid reference value [" + busid + "].");
 		}
@@ -278,18 +315,37 @@
 			List<Provider> providers = jbossesb.getProviders().getProviderList();
 			
 			for(Provider provider : providers) {
-				List<Bus> buses = provider.getBusList();
-				
-				for(Bus installedBus : buses) {
-					if(installedBus == bus) {
-						return provider;
-					}
-				}
-			}
+                if(provider instanceof BusProvider) {
+                    List<Bus> buses = ((BusProvider)provider).getBusList();
+
+                    for(Bus installedBus : buses) {
+                        if(installedBus == bus) {
+                            return provider;
+                        }
+                    }
+                }
+            }
 			
 			throw new IllegalStateException("No Provider instance found for the supplied Bus config instance.  This should not be possible if the Bus instance was provided by this configuration.  Where has this Bus instance come from?");
 		}
-      private boolean isGateway(Listener listener)
+
+        public ScheduleProvider getScheduleProvider() {
+            if(jbossesb.getProviders() == null) {
+                return null;
+            }
+
+            List<Provider> providers = jbossesb.getProviders().getProviderList();
+
+            for(Provider provider : providers) {
+                if(provider instanceof ScheduleProvider) {
+                    return (ScheduleProvider) provider;
+                }
+            }
+
+            return null;
+        }
+
+        private boolean isGateway(Listener listener)
       {
          return listener.getIsGateway() || (listener instanceof JcaGatewayDocument.JcaGateway);
       }

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ScheduleProviderFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ScheduleProviderFactory.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ScheduleProviderFactory.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config;
+
+import org.jboss.soa.esb.schedule.*;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduleProviderDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SimpleScheduleDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.CronScheduleDocument;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.ArrayList;
+
+/**
+ * Factory class for creating and configuring a {@link ScheduleProvider}
+ * instance.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class ScheduleProviderFactory {
+
+    public static final String ATTR_SCHEDULE_ID_REF = "scheduleidref";
+    public static final String ATTR_FREQUENCY = "schedule-frequency";
+
+    public static ScheduleProvider createInstance(List<ManagedLifecycle> listeners, ScheduleProviderDocument.ScheduleProvider scheduleProviderConfig) throws ConfigurationException {
+        Properties schedulerConfig = null;
+        List<org.jboss.soa.esb.schedule.Schedule> schedules = null;
+        ScheduleProvider instance;
+
+        if(scheduleProviderConfig != null) {
+            schedulerConfig = Generator.toProperties(scheduleProviderConfig.getPropertyList());
+            schedules = getSchedules(scheduleProviderConfig);
+        }
+        instance = new ScheduleProvider(schedulerConfig, schedules);
+
+        try {
+            for(ManagedLifecycle listener : listeners) {
+                if(listener instanceof ScheduledEventListener) {
+                    ConfigTree config = listener.getConfig();
+                    String scheduleIdRef = config.getAttribute(ATTR_SCHEDULE_ID_REF);
+
+                    if(scheduleIdRef != null) {
+                        instance.addListener((ScheduledEventListener) listener, scheduleIdRef);
+                    } else {
+                        long frequency = config.getLongAttribute(ATTR_FREQUENCY, 10);
+                        instance.addListener((ScheduledEventListener) listener, frequency);
+                    }
+                }
+            }
+        } catch (SchedulingException e) {
+            throw new ConfigurationException(e);
+        }
+
+        return instance;
+    }
+
+    private static List<org.jboss.soa.esb.schedule.Schedule> getSchedules(ScheduleProviderDocument.ScheduleProvider scheduleProviderConfig) throws ConfigurationException {
+        List<Schedule> schedules = new ArrayList<Schedule>();
+        List<org.jboss.soa.esb.listeners.config.xbeanmodel.Schedule> scheduleConfigs = scheduleProviderConfig.getScheduleList();
+        List<String> schedulIds = new ArrayList<String>();
+
+        // We wouldn't have to do this if we were using JAXB!!!
+        // TODO: Get XMLBeans to fudge the class names for the generated binds - existing names are potentialy dangerous because they're the same as the non XMLBeans types
+        for(org.jboss.soa.esb.listeners.config.xbeanmodel.Schedule scheduleConfig : scheduleConfigs) {
+            String scheduleId = scheduleConfig.getScheduleid();
+            Schedule schedule;
+
+            if(schedulIds.contains(scheduleId)) {
+                throw new ConfigurationException("Duplicate 'scheduleid' value of '" + scheduleId + "'.  Must be unique on a per <schedule-provider> basis.");
+            }
+            schedulIds.add(scheduleId);
+
+            if(scheduleConfig instanceof SimpleScheduleDocument.SimpleSchedule) {
+                SimpleSchedule simpleSchedule;
+
+                schedule = simpleSchedule = new SimpleSchedule(scheduleId);
+                simpleSchedule.setFrequency(((SimpleScheduleDocument.SimpleSchedule)scheduleConfig).getFrequency());
+                simpleSchedule.setRepeatCount(((SimpleScheduleDocument.SimpleSchedule)scheduleConfig).getRepeatCount());
+            } else {
+                CronSchedule cronSchedule;
+                
+                schedule = cronSchedule = new CronSchedule(scheduleId);
+                cronSchedule.setCronExpression(((CronScheduleDocument.CronSchedule)scheduleConfig).getCronExpression());
+            }
+            schedule.setStartDate(scheduleConfig.getStartDate());
+            schedule.setEndDate(scheduleConfig.getEndDate());
+            schedules.add(schedule);
+        }
+
+        return schedules;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ScheduleProviderFactory.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -10,9 +10,9 @@
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
 import org.jboss.internal.soa.esb.publish.ContractPublisher;
 import org.jboss.internal.soa.esb.publish.Publish;
-import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.util.ClassUtil;
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -25,10 +25,10 @@
 
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.PropertyDocument.Property;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.w3c.dom.Element;
 
 /**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FsListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -26,10 +26,10 @@
 import org.jboss.soa.esb.addressing.eprs.FileEpr;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.FsBusDocument.FsBus;
-import org.jboss.soa.esb.listeners.config.FsListenerDocument.FsListener;
-import org.jboss.soa.esb.listeners.config.FsMessageFilterDocument.FsMessageFilter;
-import org.jboss.soa.esb.listeners.config.FsProviderDocument.FsProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsBusDocument.FsBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsListenerDocument.FsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsMessageFilterDocument.FsMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FsProviderDocument.FsProvider;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
 import org.jboss.soa.esb.listeners.gateway.FileGatewayListener;
 import org.w3c.dom.Element;
@@ -73,7 +73,6 @@
 				throw new ConfigurationException("No <fs-detination> defined on either <fs-listener> [" + listener.getName() + "] or <fs-bus> [" + bus.getBusid() + "].");
 			}
 		}
-		listenerNode.setAttribute("pollLatencySeconds", String.valueOf(listener.getPollFrequencySeconds()));
 		// Map the standard listener attributes - common across all listener types...
 		MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
 		// Map the <property> elements targeted at the listener - from the listener itself.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -25,10 +25,10 @@
 import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.FtpBusDocument.FtpBus;
-import org.jboss.soa.esb.listeners.config.FtpListenerDocument.FtpListener;
-import org.jboss.soa.esb.listeners.config.FtpMessageFilterDocument.FtpMessageFilter;
-import org.jboss.soa.esb.listeners.config.FtpProviderDocument.FtpProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpBusDocument.FtpBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpListenerDocument.FtpListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpMessageFilterDocument.FtpMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpProviderDocument.FtpProvider;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
 import org.jboss.soa.esb.listeners.gateway.ReadOnlyRemoteGatewayListener;
 import org.jboss.soa.esb.listeners.gateway.RemoteGatewayListener;
@@ -73,7 +73,6 @@
 				throw new ConfigurationException("No <ftp-detination> defined on either <ftp-listener> [" + listener.getName() + "] or <ftp-bus> [" + bus.getBusid() + "].");
 			}
 		}
-		listenerNode.setAttribute("pollLatencySeconds", String.valueOf(listener.getPollFrequencySeconds()));
 		// Map the standard listener attributes - common across all listener types...
 		MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
 		// Map the <property> elements targeted at the listener - from the listener itself.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/GroovyListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -22,7 +22,7 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.config.Generator;
-import org.jboss.soa.esb.listeners.config.GroovyListenerDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.GroovyListenerDocument;
 import org.jboss.soa.esb.listeners.gateway.GroovyGateway;
 import org.w3c.dom.Element;
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/HibernateListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -28,10 +28,10 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.HibernateBusDocument.HibernateBus;
-import org.jboss.soa.esb.listeners.config.HibernateListenerDocument.HibernateListener;
-import org.jboss.soa.esb.listeners.config.HibernateMessageFilterDocument.HibernateMessageFilter;
-import org.jboss.soa.esb.listeners.config.HibernateProviderDocument.HibernateProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.HibernateBusDocument.HibernateBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.HibernateListenerDocument.HibernateListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.HibernateMessageFilterDocument.HibernateMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.HibernateProviderDocument.HibernateProvider;
 import org.jboss.soa.esb.listeners.gateway.HibernateGatewayListener;
 import org.w3c.dom.Element;
 
@@ -76,7 +76,6 @@
 				throw new ConfigurationException("No <hibernate-message-filter> defined on either <hibernate-listener> [" + listener.getName() + "] or <hibernate-bus> [" + bus.getBusid() + "].");
 			}
 		}
-		listenerNode.setAttribute("pollLatencySeconds", String.valueOf(listener.getPollFrequencySeconds()));
 		// Map the standard listener attributes - common across all listener types...
 		MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
 		// Map the <property> elements targeted at the listener - from the listener itself.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -23,9 +23,9 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.JbrBusDocument.JbrBus;
-import org.jboss.soa.esb.listeners.config.JbrListenerDocument.JbrListener;
-import org.jboss.soa.esb.listeners.config.JbrProviderDocument.JbrProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbrBusDocument.JbrBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbrListenerDocument.JbrListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbrProviderDocument.JbrProvider;
 import org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener;
 import org.w3c.dom.Element;
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -25,8 +25,8 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator;
-import org.jboss.soa.esb.listeners.config.ServiceDocument;
-import org.jboss.soa.esb.listeners.config.JcaGatewayDocument.JcaGateway;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JcaGatewayDocument.JcaGateway;
 import org.jboss.soa.esb.listeners.jca.JcaInflowGateway;
 import org.w3c.dom.Element;
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/JmsListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -26,10 +26,10 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.JmsBusDocument.JmsBus;
-import org.jboss.soa.esb.listeners.config.JmsListenerDocument.JmsListener;
-import org.jboss.soa.esb.listeners.config.JmsMessageFilterDocument.JmsMessageFilter;
-import org.jboss.soa.esb.listeners.config.JmsProviderDocument.JmsProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsBusDocument.JmsBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsMessageFilterDocument.JmsMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsProviderDocument.JmsProvider;
 import org.jboss.soa.esb.listeners.gateway.JmsGatewayListener;
 import org.w3c.dom.Element;
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/MapperUtil.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -29,12 +29,12 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.Bus;
-import org.jboss.soa.esb.listeners.config.Listener;
-import org.jboss.soa.esb.listeners.config.Provider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Bus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Provider;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.PropertyDocument.Property;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.jboss.soa.esb.listeners.message.MessageAwareListener;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -62,9 +62,11 @@
 			target.setAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG, service.getName());			
 		} else {
             target.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG, service.getCategory());         
-            target.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, service.getName());          
-			target.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());	
-		}
+            target.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, service.getName());
+            if(!target.hasAttribute(ListenerTagNames.LISTENER_CLASS_TAG)) {
+                target.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, MessageAwareListener.class.getName());
+            }
+        }
 	}
 	
 	/**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/NotificationMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/NotificationMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/NotificationMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -22,7 +22,7 @@
 package org.jboss.soa.esb.listeners.config.mappers;
 
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.w3c.dom.Element;
 
 /**

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config.mappers;
+
+import org.w3c.dom.Element;
+import org.jboss.soa.esb.listeners.config.ScheduleProviderFactory;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.AbstractScheduledListener;
+import org.jboss.soa.esb.ConfigurationException;
+import org.apache.log4j.Logger;
+
+/**
+ * Schedule Mapper.
+ * <p/>
+ * Maps the scheduling info from the Schedule based listener config, to the
+ * ConfigTree config model.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ScheduleMapper {
+
+    private static Logger logger = Logger.getLogger(ScheduleMapper.class);
+
+    public static void map(Element listenerConfig, AbstractScheduledListener scheduledListener) throws ConfigurationException {
+        String scheduleIdRef = scheduledListener.getScheduleidref();
+        Element domElement = (Element) scheduledListener.getDomNode();
+        int frequency = scheduledListener.getScheduleFrequency();
+        int pollFrequency = scheduledListener.getPollFrequencySeconds();
+
+        if(scheduleIdRef != null) {
+            listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_SCHEDULE_ID_REF, scheduleIdRef);
+            if(domElement.hasAttribute("poll-frequency-seconds") || domElement.hasAttribute("schedule-frequency") ) {
+                logger.warn("Schedule Listener '" + listenerConfig.getTagName() + "' defines both 'scheduleidref' and frequency attributes.  Using the 'scheduleidref'.");
+            }
+        } else if(frequency > -1) {
+            listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, Integer.toString(frequency));
+        } else if(pollFrequency > -1) {
+            listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, Integer.toString(pollFrequency));
+        } else {
+            listenerConfig.setAttribute(ScheduleProviderFactory.ATTR_FREQUENCY, "10");
+        }
+
+        if(domElement.hasAttribute("poll-frequency-seconds")) {
+            logger.warn("Attrubute 'poll-frequency-seconds' is DEPRECATED.  Please change your configuation to use 'schedule-frequency'.");
+        }
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduleMapper.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config.mappers;
+
+import org.w3c.dom.Element;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduledListenerDocument;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.ScheduleListener;
+import org.jboss.soa.esb.dom.YADOMUtil;
+
+/**
+ * Mapper for the {@link ScheduleListener}.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ScheduledListenerMapper {
+    public static Element map(Element root, ScheduledListenerDocument.ScheduledListener scheduledListener) {
+        Element listenerNode = YADOMUtil.addElement(root, scheduledListener.getName());
+
+        listenerNode.setAttribute("composer", scheduledListener.getComposer());
+        listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, ScheduleListener.class.getName());
+
+        return listenerNode;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ScheduledListenerMapper.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/SqlListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -25,10 +25,10 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.SqlBusDocument.SqlBus;
-import org.jboss.soa.esb.listeners.config.SqlListenerDocument.SqlListener;
-import org.jboss.soa.esb.listeners.config.SqlMessageFilterDocument.SqlMessageFilter;
-import org.jboss.soa.esb.listeners.config.SqlProviderDocument.SqlProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlBusDocument.SqlBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlListenerDocument.SqlListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlMessageFilterDocument.SqlMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlProviderDocument.SqlProvider;
 import org.jboss.soa.esb.listeners.gateway.SqlTableGatewayListener;
 import org.w3c.dom.Element;
 
@@ -71,7 +71,6 @@
 				throw new ConfigurationException("No <sql-detination> defined on either <sql-listener> [" + listener.getName() + "] or <sql-bus> [" + bus.getBusid() + "].");
 			}
 		}
-		listenerNode.setAttribute("pollLatencySeconds", String.valueOf(listener.getPollFrequencySeconds()));
 		// Map the standard listener attributes - common across all listener types...
 		MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
 		// Map the <property> elements targeted at the listener - from the listener itself.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/UntypedListenerMapper.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -24,13 +24,13 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.Bus;
-import org.jboss.soa.esb.listeners.config.Listener;
-import org.jboss.soa.esb.listeners.config.Provider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Bus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Provider;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.impl.BusImpl;
-import org.jboss.soa.esb.listeners.config.impl.ListenerImpl;
-import org.jboss.soa.esb.listeners.config.impl.ProviderImpl;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.impl.BusImpl;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.impl.ListenerImpl;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.impl.BusProviderImpl;
 import org.w3c.dom.Element;
 
 /**
@@ -104,8 +104,8 @@
 			throw new ConfigurationException("The base Listener config [" + listener.getName() + "] must reference a base Bus config type (<bus>).");
 		}
 		Provider provider = model.getProvider(bus);
-		if(provider.getClass() != ProviderImpl.class) {
-			throw new ConfigurationException("A base Bus config type (<bus>) must be contained within a base Provider type (<provider>).");
+		if(provider.getClass().isAssignableFrom(BusProviderImpl.class)) {
+			throw new ConfigurationException("A base Bus config type (<bus>) must be contained within a base Provider type (<bus-provider>).");
 		}
 	}
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -480,7 +480,7 @@
      * Get the configuration associated with this lifecycle.
      * @return The instance configuration.
      */
-    protected ConfigTree getConfig()
+    public ConfigTree getConfig()
     {
         return config;
     }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycle.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycle.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycle.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -21,6 +21,8 @@
  */
 package org.jboss.soa.esb.listeners.lifecycle;
 
+import org.jboss.soa.esb.helpers.ConfigTree;
+
 public interface ManagedLifecycle
 {
 
@@ -96,4 +98,10 @@
      * @param listener The listener.
      */
     public void removeManagedLifecycleEventListener(final ManagedLifecycleEventListener listener) ;
+
+    /**
+     * Get the configuration assoicated with the ManagedLifecycle.
+     * @return Configuration.
+     */
+    public ConfigTree getConfig();
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -29,6 +29,9 @@
 import org.jboss.soa.esb.couriers.CourierFactory;
 import org.jboss.soa.esb.helpers.NamingContext;
 import org.jboss.soa.esb.lifecycle.LifecycleIdentity;
+import org.jboss.soa.esb.schedule.ScheduleProvider;
+import org.jboss.soa.esb.schedule.SchedulingException;
+import org.apache.log4j.Logger;
 
 /**
  * Controller class to manage the lifecycles of a set of managed instances.
@@ -37,6 +40,7 @@
  */
 public class ManagedLifecycleController
 {
+    private static Logger logger = Logger.getLogger(ManagedLifecycleController.class);   
 
    /**
     * The managed lifecycle instances.
@@ -46,6 +50,7 @@
     * The lifecycle identity.
     */
    private final String lifecycleIdentity ;
+    private ScheduleProvider scheduleProvider;
 
     /**
     * Construct the controller to manage the specified managed lifecycle instances.
@@ -81,8 +86,13 @@
          lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
          initialiseInstances();
          startInstances();
-      }
-      finally
+         if(scheduleProvider != null) {
+             scheduleProvider.start();
+         }
+      } catch (SchedulingException e) {
+          stopInstances();
+          throw new ManagedLifecycleException("Failed to start schedule provider.", e);
+      } finally
       {
          lifecycleIdentitySingleton.setThreadLifecycleIdentity(currentIdentity) ;
       }
@@ -95,19 +105,25 @@
     *
     * @throws ManagedLifecycleException For errors during the lifecycle restart.
     */
-   public void restart()
-           throws ManagedLifecycleException
+   public void restart() throws ManagedLifecycleException
    {
       final LifecycleIdentity lifecycleIdentitySingleton = LifecycleIdentity.getSingleton() ;
       final String currentIdentity = lifecycleIdentitySingleton.getThreadLifecycleIdentity() ;
       try
       {
+          if(scheduleProvider != null) {
+              scheduleProvider.standby();
+          }
          lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
          stopInstances();
          startInstances();
-      }
-      finally
-      {
+          if(scheduleProvider != null) {
+              scheduleProvider.start();
+          }
+      } catch (SchedulingException e) {
+          stopInstances();
+          throw new ManagedLifecycleException("Failed to restart schedule provider.", e);
+      } finally {
          lifecycleIdentitySingleton.setThreadLifecycleIdentity(currentIdentity) ;
       }
    }
@@ -119,13 +135,19 @@
     *
     * @throws ManagedLifecycleException For errors during the lifecycle stop.
     */
-   public void stop()
-           throws ManagedLifecycleException
+   public void stop() throws ManagedLifecycleException
    {
       final LifecycleIdentity lifecycleIdentitySingleton = LifecycleIdentity.getSingleton() ;
       final String currentIdentity = lifecycleIdentitySingleton.getThreadLifecycleIdentity() ;
       try
       {
+          if(scheduleProvider != null) {
+              try {
+                  scheduleProvider.stop();
+              } catch (SchedulingException e) {
+                  logger.error("Failed to stop scheduling.", e);
+              }
+          }
          lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
          stopInstances();
          destroyInstances();
@@ -300,4 +322,8 @@
          } // Ignore exception
       }
    }
+
+    public void setScheduleProvider(ScheduleProvider scheduleProvider) {
+        this.scheduleProvider = scheduleProvider;
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/mock/MockAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/mock/MockAction.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/mock/MockAction.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -31,10 +31,13 @@
  */
 public class MockAction extends AbstractActionPipelineProcessor {
 
-    public MockAction(ConfigTree config) {        
+    public static Message message;
+
+    public MockAction(ConfigTree config) {
     }
 
     public Message process(final Message message) throws ActionProcessingException {
+        MockAction.message = message;
         return message;
     }
 }

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/CronSchedule.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/CronSchedule.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/CronSchedule.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+/**
+ * Cron Schedule value object.
+ * <p/>
+ * Example of cron expression configuration:
+ * <pre>
+ *   &lt;property name="cronExpression" value="0/20 * * * * ?"/&gt;
+ *   &lt;property name="startDate" value="yy-MM-dd HH:mm:ss"/&gt;
+ *   &lt;property name="endDate" value="yy-MM-dd HH:mm:ss"/&gt;
+ * </pre>
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class CronSchedule extends Schedule {
+
+    /* cron expression for job */
+    private String cronExpression;
+
+    public CronSchedule(String scheduleid) {
+        super(scheduleid);
+    }
+
+    public String getCronExpression() {
+        return cronExpression;
+    }
+
+    public void setCronExpression(String cronExpression) {
+        this.cronExpression = cronExpression;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/CronSchedule.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/Schedule.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/Schedule.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/Schedule.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import java.util.Calendar;
+
+/**
+ * Schedule value object.
+ * </p>
+ * The scheduling can be configured by:
+ * <ol>
+ *      <li> {@link SimpleSchedule}.
+ *      <li> {@link CronSchedule}
+ * </ol>
+ * 
+ * Note tha startDate and endDate are optional.<br>
+ * If a startDate is not specified thenthe time will start immedietly. <br>
+ * If endDate is not specified the it will run
+ * indefinetly.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class Schedule {
+
+    /* schedule ID */
+    private String scheduleid;
+    /* start date for job */
+    private Calendar startDate;
+    /* end date for job */
+    private Calendar endDate;
+
+    public Schedule(String scheduleid) {
+        this.scheduleid = scheduleid;
+    }
+
+    public String getScheduleid() {
+        return scheduleid;
+    }
+
+    public Calendar getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Calendar startDate) {
+        this.startDate = startDate;
+    }
+
+    public Calendar getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Calendar endDate) {
+        this.endDate = endDate;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/Schedule.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.quartz.*;
+import org.quartz.impl.StdSchedulerFactory;
+
+import java.util.Properties;
+import java.util.List;
+import java.text.ParseException;
+
+/**
+ * Schedule Provider.
+ * <p/>
+ * Manages all of the configured scheduled jobs and their listeners.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ScheduleProvider {
+    
+    /* Quartz scheduler instance */
+    private Scheduler scheduler;
+    private List<Schedule> schedules;
+
+    public ScheduleProvider(Properties properties, List<Schedule> schedules) throws ConfigurationException {
+        try {
+            if(properties != null && !properties.isEmpty()) {
+                scheduler = new StdSchedulerFactory(properties).getScheduler();
+            } else {
+                scheduler = new StdSchedulerFactory().getScheduler();
+            }
+        } catch (SchedulerException e) {
+            throw new ConfigurationException("Unable to create Scheduler instance.", e);
+        }
+        this.schedules = schedules;
+    }
+
+    public void addListener(ScheduledEventListener listener, String scheduleId) throws SchedulingException, ConfigurationException {
+        Schedule schedule = getSchedule(scheduleId);
+        Trigger trigger;
+
+        if(schedule == null) {
+            throw new ConfigurationException("Unknown schedule '" + scheduleId + "' referenced in listener configuration.");
+        }
+
+        if(schedule instanceof SimpleSchedule) {
+            SimpleSchedule simpleSchedule = (SimpleSchedule) schedule;
+            if(simpleSchedule.getRepeatCount() == -1) {
+                trigger = TriggerUtils.makeSecondlyTrigger((int) simpleSchedule.getFrequency());
+            } else {
+                trigger = TriggerUtils.makeSecondlyTrigger((int) simpleSchedule.getFrequency(), simpleSchedule.getRepeatCount());
+            }
+            trigger.setName(simpleSchedule.getScheduleid());
+        } else {
+            String cronExpression = ((CronSchedule)schedule).getCronExpression();
+            try {
+                trigger = new CronTrigger(scheduleId, "JBossESB", cronExpression);
+            } catch (ParseException e) {
+                throw new ConfigurationException("Invalid CRON expression '" + cronExpression + "' on schedule '" + scheduleId + "'.", e);
+            }
+        }
+
+        // Set the start and end times, if configured....
+        if(schedule.getStartDate() != null) {
+            trigger.setStartTime(schedule.getStartDate().getTime());
+        }
+        if(schedule.getEndDate() != null) {
+            trigger.setEndTime(schedule.getEndDate().getTime());
+        }
+
+        addListener(listener, trigger, (listener.toString() + scheduleId));
+    }
+
+    public void addListener(ScheduledEventListener listener, long scheduleFrequency) throws SchedulingException {
+        Trigger trigger = TriggerUtils.makeSecondlyTrigger((int) scheduleFrequency);
+        String name = (listener.toString() + scheduleFrequency);
+
+        trigger.setName(name);
+        addListener(listener, trigger, name);
+    }
+
+    private void addListener(ScheduledEventListener listener, Trigger trigger, String name) throws SchedulingException {
+        JobDetail jobDetail = new JobDetail("JBossESB", name, ESBScheduledJob.class);
+        JobDataMap jobDataMap = new JobDataMap();
+
+        jobDataMap.put(ScheduledEventListener.class.getName(), listener);
+        jobDetail.setJobDataMap(jobDataMap);
+        try {
+            scheduler.scheduleJob(jobDetail, trigger);
+        } catch (SchedulerException e) {
+            throw new SchedulingException("Failed to schedule job.", e);
+        }
+    }
+
+    private Schedule getSchedule(String scheduleId) {
+        for(Schedule schedule : schedules) {
+            if(schedule.getScheduleid().equals(scheduleId.trim())) {
+                return schedule;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Start the scheduler.
+     * @throws SchedulingException Start failed.
+     */
+    public void start() throws SchedulingException {
+        try {
+            scheduler.start();
+        } catch (SchedulerException e) {
+            throw new SchedulingException("Failed to start scheduling.", e);
+        }
+    }
+
+    /**
+     * Standby the scheduler.
+     * <p/>
+     * Restart the scheduler through the {@link #start()} method.
+     *
+     * @throws SchedulingException Standby failed.
+     */
+    public void standby() throws SchedulingException {
+        try {
+            scheduler.standby();
+        } catch (SchedulerException e) {
+            throw new SchedulingException("Failed to standby scheduling.", e);
+        }
+    }
+
+    /**
+     * Stop the scheduler.
+     * @throws SchedulingException Stop failed.
+     */
+    public void stop() throws SchedulingException {
+        try {
+            scheduler.shutdown();
+        } catch (SchedulerException e) {
+            throw new SchedulingException("Failed to shutdown scheduling.", e);
+        }
+    }
+
+    public static class ESBScheduledJob implements Job {
+        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+            ScheduledEventListener listener = (ScheduledEventListener) jobExecutionContext.getJobDetail().getJobDataMap().get(ScheduledEventListener.class.getName());
+            try {
+                listener.onSchedule();
+            } catch (SchedulingException e) {
+                throw new JobExecutionException("Scheduling exception on " + jobExecutionContext.getJobDetail().getName(), e);
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduleProvider.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduledEventListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduledEventListener.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduledEventListener.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+/**
+ * Schedule Listener.
+ * <p/>
+ * A schedule listener listens for scheduling events.  Not to be confused with an
+ * ESB Channel Listener e.g. a JMS Listener.  The likes of the
+ * {@link org.jboss.soa.esb.listeners.gateway.FileGatewayListener} are actually both
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface ScheduledEventListener {
+
+    /**
+     * On schedule event processor.
+     * 
+     * @throws SchedulingException Exception processing schedule event.
+     */
+    public void onSchedule() throws SchedulingException ;
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/ScheduledEventListener.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulingException.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulingException.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulingException.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import org.jboss.soa.esb.BaseException;
+
+/**
+ * Scheduling Exception.
+ * 
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SchedulingException extends BaseException {
+
+    public SchedulingException(String message) {
+        super(message);
+    }
+
+    public SchedulingException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulingException.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SimpleSchedule.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SimpleSchedule.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SimpleSchedule.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+/**
+ * Simple Schedule value object.
+ * <p/>
+ * Example of simple configuration:
+ * <pre>
+ *   &lt;property name="frequency" value="10"/&gt;
+ *   &lt;property name="repeatCount" value="10"/&gt;
+ *   &lt;property name="startDate" value="yy-MM-dd HH:mm:ss"/&gt;
+ *   &lt;property name="endDate" value="yy-MM-dd HH:mm:ss"/&gt;
+ * </pre>
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SimpleSchedule extends Schedule {
+
+    /* polling frequency in seconds */
+    private long frequency;
+    /* nr of times to execute */
+    private int repeatCount;
+    
+    public SimpleSchedule(String scheduleid) {
+        super(scheduleid);
+    }
+
+    public long getFrequency() {
+        return frequency;
+    }
+
+    public void setFrequency(long frequency) {
+        this.frequency = frequency;
+    }
+
+    public int getRepeatCount() {
+        return repeatCount;
+    }
+
+    public void setRepeatCount(int repeatCount) {
+        this.repeatCount = repeatCount;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/schedule/SimpleSchedule.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/helpers/ConfigTreeUnitTest.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -260,4 +260,16 @@
 		assertTrue("Clone should produce a completely different object", (ConfigTree1 != clone));
 		assertEquals("Clone should produce the same XML", ConfigTree1.toString(), clone.toString());
 	}
+
+    public void test_non_strings() throws SAXException {
+        ConfigTree configTree = ConfigTree.fromXml("<config v1='11' v2='22.22' v3='true' v4='12x' />");
+
+        assertEquals(11, configTree.getLongAttribute("v1", 123123));
+        assertEquals(22.22f, configTree.getFloatAttribute("v2", 123123.123123f));
+        assertEquals(true, configTree.getBooleanAttribute("v3", false));
+
+        assertEquals(123123, configTree.getLongAttribute("v4", 123123));
+        assertEquals(123123.123123f, configTree.getFloatAttribute("v4", 123123.123123f));
+        assertEquals(false, configTree.getBooleanAttribute("v4", false));
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ConfigurationControlerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ConfigurationControlerUnitTest.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ConfigurationControlerUnitTest.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -41,9 +41,6 @@
 {
 	private static Logger logger = Logger.getLogger(ConfigurationControlerUnitTest.class);
 	
-	/**
-	 * Testing the Content Based Router.
-	 */
 	@Test
 	public void readAndGenerateConfig() throws Exception
 	{
@@ -51,9 +48,7 @@
 			+ "rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml";
 		//Make sure this file exists
 		File configFile = new File(configFileName);
-		if (!configFile.exists()){
-			assertTrue(false);
-		}
+        assertTrue("File '" + configFile + "' doesn't exist.", configFile.exists());
 		//Remove the listener and gateway configuration files if the exist
 		File currentDir = configFile.getParentFile();
 		if (null==currentDir)
@@ -70,27 +65,18 @@
 			+ "etc/schemas/xml/jbossesb-1.0.1.xsd";
 //		Make sure this file exists
 		File validationFile = new File(validationFileName);
-		if (!validationFile.exists()){
-			assertTrue(false);
-		}
-		new ConfigurationController(configFileName, validationFileName);
+        assertTrue("File '" + validationFile + "' doesn't exist.", validationFile.exists());
+
+		ConfigurationController controller = new ConfigurationController(configFileName, validationFileName);
 		for (int i=0; i<currentDir.listFiles().length;i++){
 			logger.info(currentDir.listFiles()[i].getName());
 		}
-		if (listenerFile.exists()) {
-			listenerFile.delete();
-		} else {
-			//Listener file should exist if all was successful
-			System.out.println("file=" + listenerFile.getAbsolutePath() + " does not exist, while it should have.");
-			assertTrue(false);
-		}
-		if (gatewayFile.exists()) {
-			gatewayFile.delete();
-		} else {
-			//Gateway file should exist if all was successful
-			System.out.println("file=" + gatewayFile.getAbsolutePath() + " does not exist, while it should have.");
-			assertTrue(false);
-		}
+
+        assertTrue("file=" + listenerFile.getAbsolutePath() + " does not exist, while it should have.  Actually exists in " + controller.getListenerConfigFile(), listenerFile.exists());
+        listenerFile.delete();
+
+        assertTrue("file=" + gatewayFile.getAbsolutePath() + " does not exist, while it should have.  Actually exists in " + controller.getGatewayConfigFile(), gatewayFile.exists());
+        gatewayFile.delete();
 	}
 	
 	public static junit.framework.Test suite() {

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/GeneratorUnitTest.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -31,11 +31,12 @@
 import org.jboss.internal.soa.esb.util.StreamUtils;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.JmsBusDocument.JmsBus;
-import org.jboss.soa.esb.listeners.config.JmsListenerDocument.JmsListener;
-import org.jboss.soa.esb.listeners.config.JmsMessageFilterDocument.JmsMessageFilter;
-import org.jboss.soa.esb.listeners.config.JmsProviderDocument.JmsProvider;
-import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsBusDocument.JmsBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsMessageFilterDocument.JmsMessageFilter;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsProviderDocument.JmsProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
 import org.jboss.soa.esb.testutils.FileUtil;
 
 /**

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/MockContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/MockContractPublisher.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/MockContractPublisher.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -3,6 +3,7 @@
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
 import org.jboss.internal.soa.esb.publish.ContractInfo;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument;
 import org.jboss.soa.esb.addressing.EPR;
 
 /**

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -32,15 +32,17 @@
             <jbr-bus busid="HTTP-2" port="8766" />
         </jbr-provider>
 
-        <provider name="JBossAS">
+        <bus-provider name="JBossAS">
 			<property name="my-generic-provider" value="my-generic-provider#someattribvalue" />
 			
 			<bus busid="my-generic-bus">
 				<property name="my-generic-bus" value="my-generic-bus#someattribvalue" />
 			</bus>
-		</provider>
+		</bus-provider>
 
-	</providers>
+       
+
+    </providers>
 	<services>    
 		<service category="Bank" name="Reconciliation" description="Bank Reconciliation Service">
 		

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!--	NOTE: DO NOT MODIFY	This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><Bank-Listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" protocol="jms"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">						This is some complex..						<!-- property -->						value.						<xxxx>							boooo							<yyyy/>						</xxxx>						 Some CDATA data...					</action></Bank-Listener><Bank-Listener-Generic listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" !
 service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">						This is some complex..						<!-- property -->						value.						<xxxx>							boooo							<yyyy/>						</xxxx>						 Some CDATA data...					</action></Bank-Listener-Generic><test-ftp-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" pollLatencySeconds="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-ftp-listener><test-sq!
 l-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageA
wareListener" maxThreads="1" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-sql-listener></jbossesb-listeners>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!--	NOTE: DO NOT MODIFY	This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><Bank-Listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" protocol="jms"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">						This is some complex..						<!-- property -->						value.						<xxxx>							boooo							<yyyy/>						</xxxx>						 Some CDATA data...					</action></Bank-Listener><Bank-Listener-Generic listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" !
 service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue">						This is some complex..						<!-- property -->						value.						<xxxx>							boooo							<yyyy/>						</xxxx>						 Some CDATA data...					</action></Bank-Listener-Generic><test-ftp-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" schedule-frequency="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-ftp-listener><test-sq!
 l-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageA
wareListener" maxThreads="1" schedule-frequency="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-sql-listener></jbossesb-listeners>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -2,7 +2,7 @@
 <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
 
 	<providers>
-		<provider name="JBossMQ">
+		<bus-provider name="JBossMQ">
 			<property name="connection-factory" value="ConnectionFactory" />
 			<property name="jndi-URL" value="jnp://localhost:1099" />
 			<property name="protocol" value="jms" />
@@ -12,9 +12,9 @@
 				<property name="destination-name" value="queue/B" />
 				<property name="message-selector" value="service='Reconciliation'" />
 			</bus>
-		</provider>
+		</bus-provider>
 		
-		<provider name="JBossMessaging">
+		<bus-provider name="JBossMessaging">
 			<property name="connection-factory" value="com.xyz.provider.XYZConnectionFactory" />
 			<property name="jndi-context-factory" value="com.xyz.provider.NamingContextFactory" />
 			<property name="jndi-URL" value="xyz://server1:9876" />
@@ -25,9 +25,9 @@
 				<property name="destination-name" value="queue/A" />
 				<property name="message-selector" value="service='Reconciliation'" />
 			</bus>
-		</provider>
+		</bus-provider>
 		
-		<provider name="FTP">
+		<bus-provider name="FTP">
 			<property name="URL" value="ftp://joe:secret@localhost:21/Temp" />
 
 			<bus busid="Ftp-ServerTest">
@@ -37,9 +37,9 @@
 				<property name="passive" value="false" />
 				<property name="workSuffix" value=".esbInProcess" />
 			</bus>
-		</provider>
+		</bus-provider>
 		
-		<provider name="HSQLDB">
+		<bus-provider name="HSQLDB">
 			<property name="URL" value="jdbc:postgresql://myhost:5432/testDB" />
 			<property name="driver" value="org.postgresql.Driver" />
 			<property name="username" value="joe" />
@@ -56,9 +56,9 @@
 				<property name="insert_timestamp_column" value="insert_timestamp" />
 				<property name="postDelete" value="true" />
 			</bus>
-		</provider>
+		</bus-provider>
 
-        <provider name="JBR">
+        <bus-provider name="JBR">
             <property name="jbr-serverBindAddress" value="192.168.1.111" />
             <property name="jbr-serverProtocol" value="http" />
 
@@ -68,15 +68,15 @@
             <bus busid="HTTP-2">
                 <property name="jbr-serverBindPort" value="8766" />
             </bus>
-        </provider>
+        </bus-provider>
 
-        <provider name="JBossAS">
+        <bus-provider name="JBossAS">
 			<property name="my-generic-provider" value="my-generic-provider#someattribvalue" />
 			
 			<bus busid="my-generic-bus">
 				<property name="my-generic-bus" value="my-generic-bus#someattribvalue" />
 			</bus>
-		</provider>
+		</bus-provider>
 
 	</providers>
 	<services>    
@@ -129,7 +129,7 @@
 				<listener name="test-ftp-listener"
 							busidref="Ftp-ServerTest"
 							maxThreads="1">
-							<property name="pollLatencySeconds" value="10" />
+							<property name="schedule-frequency" value="10" />
 				</listener>
 			</listeners>
 			<actions>    	    
@@ -137,13 +137,13 @@
 			</actions> 	
 			
 		</service>
-		<service category="Test3" name="SQLTest" description="SQL server Test" is-gateway="false">
+		<service category="Test3" name="SQLTest" description="SQL server Test">
 		
 			<listeners>    	    
 				<listener name="test-sql-listener"
 							busidref="SQL-Test"
 							maxThreads="1">
-							<property name="pollLatencySeconds" value="10" />
+							<property name="schedule-frequency" value="10" />
 				</listener>
 			</listeners>
 			<actions>    	    

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -32,9 +32,9 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.config.Generator;
-import org.jboss.soa.esb.listeners.config.Listener;
-import org.jboss.soa.esb.listeners.config.FtpBusDocument.FtpBus;
-import org.jboss.soa.esb.listeners.config.FtpListenerDocument.FtpListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpListenerDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.FtpBusDocument;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
 import org.jboss.soa.esb.listeners.gateway.ReadOnlyRemoteGatewayListener;
 import org.junit.Test;
@@ -65,10 +65,10 @@
 		XMLBeansModel model = getXmlBeanModel( ESB_CONFIG_READ_ONLY );
 		
 		List<Listener> gateways = model.getGatewayListeners();
-		FtpListener ftpListener = (FtpListener) gateways.get(0);
+		FtpListenerDocument.FtpListener ftpListener = (FtpListenerDocument.FtpListener) gateways.get(0);
 		assertEquals ( true, ftpListener.getIsGateway() );
 		
-		FtpBus ftpBus = (FtpBus) model.getBus( ftpListener.getBusidref() );
+		FtpBusDocument.FtpBus ftpBus = (FtpBusDocument.FtpBus) model.getBus( ftpListener.getBusidref() );
 		assertNotNull( "FtpBus element should exist", ftpBus );
 		assertEquals ( "read-only attribute should be true", true, ftpBus.getFtpMessageFilter().getReadOnly() );
 		
@@ -114,7 +114,7 @@
 		}
 
 		@Override
-		protected XMLBeansModel getModel()
+		public XMLBeansModel getModel()
 		{
 			return super.getModel();
 		}

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -2,13 +2,13 @@
 <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
 
     <providers>
-        <provider name="provider">
+        <bus-provider name="provider">
             <property name="protocol" value="jms" />
             <bus busid="bus">
                 <property name="destination-type" value="topic" />
                 <property name="destination-name" value="queue/B" />
             </bus>
-        </provider>
+        </bus-provider>
     </providers>
 
     <services>

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/listenerFtp.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/listenerFtp.xml	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/listenerFtp.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -5,7 +5,7 @@
 	service-description="My Dummy Service Name FILE"
   	listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener"
 	maxThreads="10"
-	pollLatencySeconds="1"
+	schedule-frequency="1"
 	>
 		<EPR
 			URL="ftp://ftpuser:ftppassword@localhost:/"

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/MockScheduledEventMessageComposer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/MockScheduledEventMessageComposer.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/MockScheduledEventMessageComposer.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import org.jboss.soa.esb.listeners.ScheduledEventMessageComposer;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockScheduledEventMessageComposer implements ScheduledEventMessageComposer {
+
+    public static ConfigTree config;
+    public static boolean uninitialised;
+    public static List<Message> composedMessages = new ArrayList<Message>();
+    public static List<Message> completedMessage = new ArrayList<Message>();
+
+    public static void reset() {
+        config = null;
+        uninitialised = false;
+        composedMessages.clear();
+        completedMessage.clear();
+    }
+
+    public void initialize(ConfigTree config) {
+        MockScheduledEventMessageComposer.config = config;
+    }
+
+    public void uninitialize() {
+        MockScheduledEventMessageComposer.uninitialised = true;
+    }
+
+    public Message composeMessage() throws SchedulingException {
+        Message message = org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage();
+        MockScheduledEventMessageComposer.composedMessages.add(message);
+
+        return message;
+    }
+
+    public Message onProcessingComplete(Message message) throws SchedulingException {
+        completedMessage.add(message);
+        return message;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/MockScheduledEventMessageComposer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.jboss.soa.esb.parameters.ParamRepositoryException;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.mock.MockAction;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.xml.sax.SAXException;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Scheduling unit tests.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SchedulingUnitTest extends TestCase {
+
+
+    protected void setUp() throws Exception {
+        MockScheduledEventMessageComposer.reset();
+        MockAction.message = null;
+    }
+
+    public void test_listener_config() throws UnsupportedEncodingException {
+        ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
+        String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("expected-config-01-listener.xml"), "UTF-8");
+
+        assertEquals(expected, configUtil.getListenerConfig("simple-schedule-listener").toString());
+    }
+
+    public void test_simple_schedule_01() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        runTestConfig("config-01.xml", 5000);
+
+        // Check that the scheduling happened as defined in the config...
+        assertNotNull(MockScheduledEventMessageComposer.config);
+        assertEquals(2, MockScheduledEventMessageComposer.composedMessages.size());
+        assertTrue(MockScheduledEventMessageComposer.uninitialised);
+        assertEquals(2, MockScheduledEventMessageComposer.completedMessage.size());
+
+        // Check that the action pipeline was executed as expeected...
+        assertNotNull(MockAction.message);
+    }
+
+    public void test_simple_schedule_02() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        runTestConfig("config-02.xml", 5000);
+
+        // Just check that the schedule was triggered more than once...
+        assertTrue(MockScheduledEventMessageComposer.composedMessages.size() > 1);
+    }
+
+    public void test_simple_schedule_03() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        runTestConfig("config-03.xml", 5000);
+
+        // Just check that the schedule was triggered more than once...
+        assertTrue(MockScheduledEventMessageComposer.composedMessages.size() > 1);
+    }
+
+    public void test_simple_schedule_04() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        runTestConfig("config-04.xml", 5000);
+
+        // Just check that the schedule was triggered more than once...
+        assertTrue(MockScheduledEventMessageComposer.composedMessages.size() > 1);
+    }
+
+    public void test_simple_schedule_05() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        runTestConfig("config-05.xml", 5000);
+
+        // Just check that the schedule was triggered more than once...
+        assertTrue(MockScheduledEventMessageComposer.composedMessages.size() > 1);
+    }
+
+    private void runTestConfig(String configName, long upTime) throws ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
+        ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
+
+        configUtil.startController();
+        Thread.sleep(upTime);
+        configUtil.stopController();
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-01.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-01.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,23 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <providers>
+        <schedule-provider name="schedule">
+            <simple-schedule scheduleid="1-sec-trigger" frequency="1" repeatCount="1" />
+        </schedule-provider>
+    </providers>
+
+    <services>
+        <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+            <listeners>
+                <scheduled-listener name="simple-schedule-listener" scheduleidref="1-sec-trigger" composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" />
+            </listeners>
+
+            <actions>
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-01.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-02.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-02.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-02.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,24 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <providers>
+        <schedule-provider name="schedule">
+            <!-- Run indefinitely... -->
+            <simple-schedule scheduleid="1-sec-trigger" frequency="1" />
+        </schedule-provider>
+    </providers>
+
+    <services>
+        <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+            <listeners>
+                <scheduled-listener name="simple-schedule-listener" scheduleidref="1-sec-trigger" composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" />
+            </listeners>
+
+            <actions>
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-02.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-03.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-03.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-03.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,17 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <services>
+        <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+            <listeners>
+                <scheduled-listener name="simple-schedule-listener" schedule-frequency="1" composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" />
+            </listeners>
+
+            <actions>
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-03.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-04.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-04.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-04.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,17 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <services>
+        <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+            <listeners>
+                <scheduled-listener name="simple-schedule-listener" poll-frequency-seconds="1" composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" />
+            </listeners>
+
+            <actions>
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-04.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-05.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-05.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-05.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,23 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <providers>
+        <schedule-provider name="schedule">
+            <cron-schedule scheduleid="cron-trigger" cronExpression="0/1 * * * * ?" />
+        </schedule-provider>
+    </providers>
+
+    <services>
+        <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+            <listeners>
+                <scheduled-listener name="cron-schedule-listener" scheduleidref="cron-trigger" composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" />
+            </listeners>
+
+            <actions>
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/config-05.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml	2007-07-27 12:34:27 UTC (rev 13805)
@@ -0,0 +1,3 @@
+<simple-schedule-listener composer="org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer" listenerClass="org.jboss.soa.esb.listeners.ScheduleListener" scheduleidref="1-sec-trigger">
+<action action="action" class="org.jboss.soa.esb.mock.MockAction"/>
+</simple-schedule-listener>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/expected-config-01-listener.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/ESBConfigUtil.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -29,9 +29,15 @@
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.config.Generator;
+import org.jboss.soa.esb.listeners.config.ConfigurationController;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.parameters.ParamRepositoryException;
+import org.jboss.soa.esb.ConfigurationException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
 
 /**
  * Utility class for working with the ESB configuration.
@@ -40,14 +46,16 @@
  */
 public class ESBConfigUtil {
 
+    private Generator generator;
     private Document listenerConfig;
     private Document gatewayConfig;
+    private ManagedLifecycleController controller;
 
     public ESBConfigUtil(InputStream esbXsdConfig) {
         AssertArgument.isNotNull(esbXsdConfig, "esbXsdConfig");
         ByteArrayOutputStream listenerConfigStream = new ByteArrayOutputStream();
         ByteArrayOutputStream gatewayConfigStream = new ByteArrayOutputStream();
-        Generator generator = null;
+        generator = null;
 
         try {
             generator = new Generator(esbXsdConfig, listenerConfigStream, gatewayConfigStream);
@@ -102,7 +110,6 @@
         return null;
     }
 
-
     public Document getListenerConfig() {
         return listenerConfig;
     }
@@ -110,4 +117,14 @@
     public Document getGatewayConfig() {
         return gatewayConfig;
     }
+
+    public void startController() throws ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException {
+        ConfigTree listenerConfigTree = ConfigTree.fromElement(listenerConfig.getDocumentElement());
+        ConfigTree gatewayConfigTree = ConfigTree.fromElement(gatewayConfig.getDocumentElement());
+        controller = ConfigurationController.startController(generator.getModel(), listenerConfigTree, gatewayConfigTree);
+    }
+
+    public void stopController() {
+        ConfigurationController.stopController(controller);
+    }
 }

Modified: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -202,6 +202,18 @@
  * To return the raw SOAP message as a String (Option 3), simply omit both the "responseXStreamConfig"
  * and "responseAsOgnlMap" properties.
  *
+ * <h2>Transforming the SOAP Request Message</h2>
+ * It's often necessary to be able to transform the SOAP request before sending it. This may be to simply
+ * add some SOAP headers.
+ * <p/>
+ * Transformation of the SOAP request (before sending) is supported by configuring the SOAPClient action
+ * with a Smooks transformation configuration property as follows:
+ * <pre>
+ *     &lt;property name="smooksTransform" value="/transforms/order-transform.xml" /&gt;</pre>
+ * 
+ * The value of the "smooksTransform" property is resolved by first checking it as a filesystem based resource.
+ * Failing that, it's checked as a classpath resource and failing that, as a URI based resource. 
+ *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public class SOAPClient extends AbstractActionPipelineProcessor {

Modified: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java	2007-07-27 03:32:46 UTC (rev 13804)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java	2007-07-27 12:34:27 UTC (rev 13805)
@@ -30,10 +30,10 @@
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
 import org.jboss.internal.soa.esb.publish.ContractInfo;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.PropertyDocument;
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
-import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.invocation.BasicInvocationContext;
 import org.jboss.wsf.spi.invocation.InvocationContext;
@@ -55,10 +55,10 @@
      * @param actionConfig action config.
      * @throws ConfigurationException Bad config.
      */
-    public void setActionConfig(Action actionConfig) throws ConfigurationException {
-        List<Property> properties = actionConfig.getPropertyList();
+    public void setActionConfig(ActionDocument.Action actionConfig) throws ConfigurationException {
+        List<PropertyDocument.Property> properties = actionConfig.getPropertyList();
 
-        for(Property property : properties) {
+        for(PropertyDocument.Property property : properties) {
             if(property.getName().equals(SOAPProcessor.JBOSSWS_ENDPOINT)) {
                 endpointName = property.getValue();
                 break;




More information about the jboss-svn-commits mailing list