<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: schedule-manager-service.xml 59789 2007-01-18 17:30:15Z dimitris@jboss.org $ -->

<server>

   <!-- ==================================================================== -->
   <!-- Scheduler Service                                                    -->
   <!-- ==================================================================== -->
   
   <!--
    | JDK5 javax.management.timer.Timer appears to be using a single
    | threaded implementation for executing scheduled tasks.
    | If you want to revert to the JBossMX timer implementation that
    | uses a dynamically extensible thread pool to execute scheduled
    | tasks, uncomment the JBossTimer service below. The Scheduler
    | service will use this, instead of creating a new Timer.
    - -> 
   <mbean code="org.jboss.mx.timer.JBossTimer"
          name="jboss:service=Timer">
   </mbean>
   <!- - -->
   
   <!--
    | This MBean is an example of a Schedule Target
    - ->
   <mbean code="org.jboss.varia.scheduler.example.SchedulableMBeanExample" 
          name="jboss:service=SchedulableMBeanExample">
   </mbean>
   <!- - -->
   
   <!--
    | The Schedule Manager has to be started whenever
    | schedules are needed.
    |
    | The default JMX Timer scheduling behaviour of FixedDelay execution
    | (as of JDK5 or JBoss v4.0.5) is overriden below using FixedRate true
    - ->
   <mbean code="org.jboss.varia.scheduler.ScheduleManager"
          name="jboss:service=ScheduleManager">
      <attribute name="StartAtStartup">true</attribute>
      <attribute name="FixedRate">true</attribute>
   </mbean>
   <!- - -->
   
   <!--
    | This is a single schedule Provider which works like the
    | old Scheduler (when a MBean target is used)
    |
    | For clustered singleton schedules add the following dependency:
    | <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>
    - ->
   <mbean code="org.jboss.varia.scheduler.SingleScheduleProvider" 
          name="jboss:service=SingleScheduleProvider">
      <depends optional-attribute-name="ScheduleManagerName">jboss:service=ScheduleManager</depends>
      <depends optional-attribute-name="TargetName">jboss:service=SchedulableMBeanExample</depends>
      <attribute name="TargetMethod">hit( NOTIFICATION, DATE, REPETITIONS, SCHEDULER_NAME, java.lang.String )</attribute>
      <attribute name="DateFormat"></attribute>
      <attribute name="StartDate">NOW</attribute>
      <attribute name="Period">10000</attribute>
      <attribute name="Repetitions">10</attribute>
   </mbean>
   <!- - -->
   
   <!--
    | This is a Database based schedule Provider. For more
    | information have a look at the class JavaDoc
    | For hypersonic
    | CREATE TABLE Schedule
    | (
    |    target VARCHAR(100),
    |    method_name VARCHAR(100),
    |    method_signature VARCHAR(100),
    |    start_date VARCHAR(20),
    |    period BIGINT,
    |    repetitions INTEGER,
    |    date_format VARCHAR(20)
    | )
    |
    | For clustered singleton schedules add the following dependency:
    | <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>    
    - ->
   <mbean code="org.jboss.varia.scheduler.DBScheduleProvider" 
          name="jboss:service=DBScheduleProvider">
      <depends optional-attribute-name="ScheduleManagerName">jboss:service=ScheduleManager</depends>
      <depends>jboss:service=SchedulableMBeanExample</depends>
      <depends>jboss:service=Hypersonic</depends>
      <attribute name="DataSourceName">java:DefaultDS</attribute>
      <attribute name="SQLStatement">SELECT target, method_name, method_signature, start_date, period, repetitions, date_format FROM Schedule</attribute>
   </mbean>
   <!- - -->
   
   <!--
    | This is a XML based schedule Provider. For more
    | information have a look at the class JavaDoc
    |
    | For clustered singleton schedules add the following dependency:
    | <depends>jboss.ha:service=HASingletonDeployer,type=Barrier</depends>       
    - ->
   <mbean code="org.jboss.varia.scheduler.XMLScheduleProvider" 
          name="jboss:service=XMLScheduleProvider">
      <depends optional-attribute-name="ScheduleManagerName">jboss:service=ScheduleManager</depends>
      <depends>jboss:service=SchedulableMBeanExample</depends>
      <attribute name="Schedules">
         <schedules>
            <schedule>
               <target-mbean-name>jboss:service=SchedulableMBeanExample</target-mbean-name>
               <target-method-name>hit</target-method-name>
               <target-method-signature>NOTIFICATION, DATE, REPETITIONS, SCHEDULER_NAME, java.lang.String</target-method-signature>
               <date-format></date-format>
               <start-date>NOW</start-date>
               <period>15555</period>
               <repetitions>55</repetitions>
            </schedule>
         </schedules>
      </attribute>
   </mbean>
   <!- - -->
   
</server>
