User: schaefera
  Date: 01/06/10 23:32:31

  Modified:    src/main/org/jboss/util Schedulable.java Scheduler.java
                        SchedulerMBean.java
  Log:
  Adjusted the Scheduler to run as a real MBean able to be started,
  managed and stopped at runtime (JMX HTML-Adaptor) etc.
  
  Revision  Changes    Path
  1.2       +1 -1      jboss/src/main/org/jboss/util/Schedulable.java
  
  Index: Schedulable.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Schedulable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Schedulable.java  2001/06/10 07:50:58     1.1
  +++ Schedulable.java  2001/06/11 06:32:31     1.2
  @@ -35,6 +35,6 @@
       **/
      public void perform(
         Date pTimeOfCall,
  -      int pRemainingRepetitions
  +      long pRemainingRepetitions
      );
   }
  
  
  
  1.4       +279 -81   jboss/src/main/org/jboss/util/Scheduler.java
  
  Index: Scheduler.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Scheduler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Scheduler.java    2001/06/11 00:52:23     1.3
  +++ Scheduler.java    2001/06/11 06:32:31     1.4
  @@ -14,6 +14,8 @@
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.Map;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
   
   import javax.management.MalformedObjectNameException;
   import javax.management.MBeanServer;
  @@ -54,24 +56,28 @@
      // Members
      // -------------------------------------------------------------------------  
   
  -   private MBeanServer mServer;
      private String mName;
      
  -   private long mSchedulePeriod;
  -   private int mRemainingRepetitions = 0;
  +   private long mActualSchedulePeriod;
  +   private long mRemainingRepetitions = 0;
      private int mActualSchedule = -1;
  -   private boolean mScheduleIsStarted = false;
  -   private boolean mWaitForNextCallToStop = false;
      private ObjectName mTimer;
      private Schedulable mSchedulable;
      
  +   private boolean mScheduleIsStarted = false;
  +   private boolean mWaitForNextCallToStop = false;
      private boolean mStartOnStart = false;
  -   private String mSchedulableClass;
  -   private Object[] mInitArguments;
  -   private String[] mInitTypes;
  +   private boolean mIsRestartPending = true;
  +
  +   // Pending values which can be different to the actual ones
  +   private Class mSchedulableClass;
  +   private String mSchedulableArguments;
  +   private String[] mSchedulableArgumentList = new String[ 0 ];
  +   private String mSchedulableArgumentTypes;
  +   private Class[] mSchedulableArgumentTypeList = new Class[ 0 ];
      private Date mStartDate;
  -   private long mPeriod;
  -   private int mRepetitions;
  +   private long mSchedulePeriod;
  +   private long mInitialRepetitions;
   
      // -------------------------------------------------------------------------
      // Constructors
  @@ -111,53 +117,86 @@
      ) {
         mName = pName;
         mStartOnStart = true;
  -      mSchedulableClass = pSchedulableClass;
  -//      if( pInitArguments == null || pInitArguments.equals( "" ) ) {
  -         mInitArguments = new Object[ 0 ];
  -//      }
  -//      if( pInitTypes == null || pInitTypes.equals( "" ) ) {
  -         mInitArguments = new String[ 0 ];
  -//      }
  +      setSchedulableClass( pSchedulableClass );
  +      setSchedulableArguments( pInitArguments );
  +      setSchedulableArgumentTypes( pInitTypes );
         mStartDate = new Date( pInitialStartDate );
  -      mPeriod = pSchedulePeriod;
  -      mRepetitions = (int) pNumberOfRepetitions;
  +      setSchedulePeriod( pSchedulePeriod );
  +      setInitialRepetitions( pNumberOfRepetitions );
      }
   
      // -------------------------------------------------------------------------
      // SchedulerMBean Methods
      // -------------------------------------------------------------------------  
      
  -   public void startSchedule(
  -      String pSchedulableClass,
  -      Object[] pInitArguments,
  -      String[] pInitTypes,
  -      Date pInitialStartDate,
  -      long pSchedulePeriod,
  -      int pNumberOfRepetitions
  -   ) {
  +   public void startSchedule() {
         // Check if not already started
         if( !isStarted() ) {
            try {
  -            // Try to load the Schedulable Class
  -            Class lSchedulableClass = 
Thread.currentThread().getContextClassLoader().loadClass( pSchedulableClass );
  -            // Create an instance of it
  -            if( pInitArguments == null ) {
  -               pInitArguments = new Object[ 0 ];
  -            }
  -            if( pInitTypes == null ) {
  -               pInitTypes = new String[ 0 ];
  -            }
  -            if( pInitArguments.length != pInitTypes.length ) {
  -               throw new InvalidParameterException( "Constructor Arguments and Data 
Types does not match" );
  -            }
  -            Class[]  lInitTypes = new Class[ pInitTypes.length ];
  -            for( int i = 0; i < pInitTypes.length; i++ ) {
  -               lInitTypes[ i ] = 
Thread.currentThread().getContextClassLoader().loadClass( pInitTypes[ i ] );
  +            // Check the given attributes if correct
  +            if( mSchedulableClass == null ) {
  +               throw new InvalidParameterException(
  +                  "Schedulable Class must be set"
  +               );
  +            }
  +            if( mSchedulableArgumentList.length != 
mSchedulableArgumentTypeList.length ) {
  +               throw new InvalidParameterException(
  +                  "Schedulable Class Arguments and Types do not match in length"
  +               );
  +            }
  +            if( mSchedulePeriod <= 0 ) {
  +               throw new InvalidParameterException(
  +                  "Schedule Period must be set and greater than 0 (ms)"
  +               );
  +            }
  +            // Create all the Objects for the Constructor to be called
  +            Object[] lArgumentList = new Object[ 
mSchedulableArgumentTypeList.length ];
  +            try {
  +               for( int i = 0; i < mSchedulableArgumentTypeList.length; i++ ) {
  +                  Class lClass = mSchedulableArgumentTypeList[ i ];
  +                  if( lClass == Boolean.TYPE ) {
  +                     lArgumentList[ i ] = new Boolean( mSchedulableArgumentList[ i 
] );
  +                  } else
  +                  if( lClass == Integer.TYPE ) {
  +                     lArgumentList[ i ] = new Integer( mSchedulableArgumentList[ i 
] );
  +                  } else
  +                  if( lClass == Long.TYPE ) {
  +                     lArgumentList[ i ] = new Long( mSchedulableArgumentList[ i ] );
  +                  } else
  +                  if( lClass == Short.TYPE ) {
  +                     lArgumentList[ i ] = new Short( mSchedulableArgumentList[ i ] 
);
  +                  } else
  +                  if( lClass == Float.TYPE ) {
  +                     lArgumentList[ i ] = new Float( mSchedulableArgumentList[ i ] 
);
  +                  } else
  +                  if( lClass == Double.TYPE ) {
  +                     lArgumentList[ i ] = new Double( mSchedulableArgumentList[ i ] 
);
  +                  } else
  +                  if( lClass == Byte.TYPE ) {
  +                     lArgumentList[ i ] = new Byte( mSchedulableArgumentList[ i ] );
  +                  } else
  +                  if( lClass == Character.TYPE ) {
  +                     lArgumentList[ i ] = new Character( mSchedulableArgumentList[ 
i ].charAt( 0 ) );
  +                  } else {
  +                     Constructor lConstructor = lClass.getConstructor( new Class[] 
{ String.class } );
  +                     lArgumentList[ i ] = lConstructor.newInstance( new Object[] { 
mSchedulableArgumentList[ i ] } );
  +                  }
  +               }
  +            }
  +            catch( Exception e ) {
  +               throw new InvalidParameterException( "Could not load or create a 
constructor argument" );
  +            }
  +            try {
  +               // Check if constructor is found
  +               Constructor lSchedulableConstructor = 
mSchedulableClass.getConstructor( mSchedulableArgumentTypeList );
  +               // Create an instance of it
  +               mSchedulable = (Schedulable) lSchedulableConstructor.newInstance( 
lArgumentList );
               }
  -            Constructor lSchedulableConstructor = lSchedulableClass.getConstructor( 
lInitTypes );
  -            mSchedulable = (Schedulable) lSchedulableConstructor.newInstance( 
pInitArguments );
  +            catch( Exception e ) {
  +               throw new InvalidParameterException( "Could not find the constructor 
or create the Schedulable Instance" );
  +            }
               // Register the notificaiton listener at the MBeanServer
  -            mServer.addNotificationListener(
  +            getServer().addNotificationListener(
                  mTimer, 
                  new Listener( mSchedulable ),
                  // No filter
  @@ -165,16 +204,16 @@
                  // No object handback necessary
                  null
               );
  -            mRemainingRepetitions = pNumberOfRepetitions;
  -            mSchedulePeriod = pSchedulePeriod;
  +            mRemainingRepetitions = mInitialRepetitions;
  +            mActualSchedulePeriod = mSchedulePeriod;
               // Register the Schedule at the Timer
  -            if( pInitialStartDate == null || pInitialStartDate.getTime() < new 
Date().getTime() ) {
  -               pInitialStartDate = new Date( new Date().getTime() + 1000 );
  +            if( mStartDate == null || mStartDate.getTime() < new Date().getTime() ) 
{
  +               mStartDate = new Date( new Date().getTime() + 1000 );
                  // Start Schedule now
  -               System.out.println( "Start regular Schedule with period: " + 
getSchedulePeriod() );
  -               if( getRemainingRepetitions() > 0 ) {
  -                  System.out.println( "Start Schedule wtih " + 
getRemainingRepetitions() + " reps." );
  -                  mActualSchedule = ( (Integer) mServer.invoke(
  +               System.out.println( "Start regular Schedule with period: " + 
mActualSchedulePeriod );
  +               if( mRemainingRepetitions > 0 ) {
  +                  System.out.println( "Start Schedule wtih " + 
mRemainingRepetitions + " reps." );
  +                  mActualSchedule = ( (Integer) getServer().invoke(
                        mTimer,
                        "addNotification",
                        new Object[] {
  @@ -182,13 +221,13 @@
                           "Scheduler Notification",
                           null,
                           new Date( new Date().getTime() + 1000 ),
  -                        new Long( getSchedulePeriod() ),
  -                        new Long( (long) getRemainingRepetitions() )
  +                        new Long( mActualSchedulePeriod ),
  +                        new Long( mRemainingRepetitions )
                        },
                        new String[] {
                           "".getClass().getName(),
                           "".getClass().getName(),
  -                        "java.lang.Object",
  +                        Object.class.getName(),
                           Date.class.getName(),
                           Long.TYPE.getName(),
                           Long.TYPE.getName()
  @@ -197,7 +236,7 @@
                  }
                  else {
                     System.out.println( "Start Schedule with unlimited reps." );
  -                  mActualSchedule = ( (Integer) mServer.invoke(
  +                  mActualSchedule = ( (Integer) getServer().invoke(
                        mTimer,
                        "addNotification",
                        new Object[] {
  @@ -205,7 +244,7 @@
                           "Scheduler Notification",
                           null,
                           new Date( new Date().getTime() + 1000 ),
  -                        new Long( getSchedulePeriod() )
  +                        new Long( mActualSchedulePeriod )
                        },
                        new String[] {
                           String.class.getName(),
  @@ -219,22 +258,23 @@
               }
               else {
                  // Add an initial call
  -               mActualSchedule = ( (Integer) mServer.invoke(
  +               mActualSchedule = ( (Integer) getServer().invoke(
                     mTimer,
                     "addNotification",
                     new Object[] {
                        "Schedule",
                        "Scheduler Notification",
  -                     pInitialStartDate
  +                     mStartDate
                     },
                     new String[] {
  -                     "".getClass().getName(),
  -                     "".getClass().getName(),
  +                     String.class.getName(),
  +                     String.class.getName(),
                        Date.class.getName(),
                     }
                  ) ).intValue();
               }
               mScheduleIsStarted = true;
  +            mIsRestartPending = false;
            }
            catch( Exception e ) {
               e.printStackTrace();
  @@ -249,7 +289,7 @@
            if( pDoItNow ) {
               // Remove notification listener now
               mWaitForNextCallToStop = false;
  -            mServer.invoke(
  +            getServer().invoke(
                  mTimer,
                  "removeNotification",
                  new Object[] {
  @@ -271,11 +311,161 @@
         }
      }
      
  +   public void restartSchedule() {
  +      stopSchedule( true );
  +      startSchedule();
  +   }
  +   
  +   public String getSchedulableClass() {
  +      if( mSchedulableClass == null ) {
  +         return null;
  +      }
  +      return mSchedulableClass.getName();
  +   }
  +   
  +   public void setSchedulableClass( String pSchedulableClass )
  +      throws InvalidParameterException
  +   {
  +      if( pSchedulableClass == null || pSchedulableClass.equals( "" ) ) {
  +         throw new InvalidParameterException( "Schedulable Class cannot be empty or 
undefined" );
  +      }
  +      try {
  +         // Try to load the Schedulable Class
  +         mSchedulableClass = 
Thread.currentThread().getContextClassLoader().loadClass( pSchedulableClass );
  +         // Check if instance of Schedulable
  +         Class[] lInterfaces = mSchedulableClass.getInterfaces();
  +         boolean lFound = false;
  +         for( int i = 0; i < lInterfaces.length; i++ ) {
  +            if( lInterfaces[ i ] == Schedulable.class ) {
  +               lFound = true;
  +               break;
  +            }
  +         }
  +         if( !lFound ) {
  +            throw new InvalidParameterException(
  +               "Given class " + pSchedulableClass + " is not instance of 
Schedulable"
  +            );
  +         }
  +      }
  +      catch( ClassNotFoundException cnfe ) {
  +         throw new InvalidParameterException(
  +            "Given class " + pSchedulableClass + " is not valid or not found"
  +         );
  +      }
  +      mIsRestartPending = true;
  +   }
  +   
  +   public String getSchedulableArguments() {
  +      return mSchedulableArguments;
  +   }
  +   
  +   public void setSchedulableArguments( String pArgumentList ) {
  +      if( pArgumentList == null || pArgumentList.equals( "" ) ) {
  +         mSchedulableArgumentList = new String[ 0 ];
  +      }
  +      else {
  +         StringTokenizer lTokenizer = new StringTokenizer( pArgumentList, "," );
  +         Vector lList = new Vector();
  +         while( lTokenizer.hasMoreTokens() ) {
  +            String lToken = lTokenizer.nextToken().trim();
  +            if( lToken.equals( "" ) ) {
  +               lList.add( "null" );
  +            }
  +            else {
  +               lList.add( lToken );
  +            }
  +         }
  +         mSchedulableArgumentList = (String[]) lList.toArray( new String[ 0 ] );
  +      }
  +      mSchedulableArguments = pArgumentList;
  +      mIsRestartPending = true;
  +   }
  +   
  +   public String getSchedulableArgumentTypes() {
  +      return mSchedulableArgumentTypes;
  +   }
  +   
  +   public void setSchedulableArgumentTypes( String pTypeList )
  +      throws InvalidParameterException
  +   {
  +      if( pTypeList == null || pTypeList.equals( "" ) ) {
  +         mSchedulableArgumentTypeList = new Class[ 0 ];
  +      }
  +      else {
  +         StringTokenizer lTokenizer = new StringTokenizer( pTypeList, "," );
  +         Vector lList = new Vector();
  +         while( lTokenizer.hasMoreTokens() ) {
  +            String lToken = lTokenizer.nextToken().trim();
  +            // Get the class
  +            Class lClass = null;
  +            if( lToken.equals( "short" ) ) {
  +              lClass = Short.TYPE;
  +            } else
  +            if( lToken.equals( "int" ) ) {
  +              lClass = Integer.TYPE;
  +            } else
  +            if( lToken.equals( "long" ) ) {
  +              lClass = Long.TYPE;
  +            } else
  +            if( lToken.equals( "byte" ) ) {
  +              lClass = Byte.TYPE;
  +            } else
  +            if( lToken.equals( "char" ) ) {
  +              lClass = Character.TYPE;
  +            } else
  +            if( lToken.equals( "float" ) ) {
  +              lClass = Float.TYPE;
  +            } else
  +            if( lToken.equals( "double" ) ) {
  +              lClass = Double.TYPE;
  +            } else
  +            if( lToken.equals( "boolean" ) ) {
  +              lClass = Boolean.TYPE;
  +            }
  +            if( lClass == null ) {
  +               try {
  +                  // Load class to check if available
  +                  lClass = 
Thread.currentThread().getContextClassLoader().loadClass( lToken );
  +               }
  +               catch( ClassNotFoundException cnfe ) {
  +                  throw new InvalidParameterException(
  +                     "The argument type: " + lToken + " is not a valid class or 
could not be found"
  +                  );
  +               }
  +            }
  +            lList.add( lClass );
  +         }
  +         mSchedulableArgumentTypeList = (Class[]) lList.toArray( new Class[ 0 ] );
  +      }
  +      mSchedulableArgumentTypes = pTypeList;
  +      mIsRestartPending = true;
  +   }
  +   
      public long getSchedulePeriod() {
         return mSchedulePeriod;
      }
  +   
  +   public void setSchedulePeriod( long pPeriod ) {
  +      if( pPeriod <= 0 ) {
  +         throw new InvalidParameterException( "Schedulable Period may be not less 
or equals than 0" );
  +      }
  +      mSchedulePeriod = pPeriod;
  +      mIsRestartPending = true;
  +   }
      
  -   public int getRemainingRepetitions() {
  +   public long getInitialRepetitions() {
  +      return mInitialRepetitions;
  +   }
  +   
  +   public void setInitialRepetitions( long pNumberOfCalls ) {
  +      if( pNumberOfCalls <= 0 ) {
  +         pNumberOfCalls = -1;
  +      }
  +      mInitialRepetitions = pNumberOfCalls;
  +      mIsRestartPending = true;
  +   }
  +
  +   public long getRemainingRepetitions() {
         return mRemainingRepetitions;
      }
      
  @@ -283,6 +473,10 @@
         return mScheduleIsStarted;
      }
   
  +   public boolean isRestartPending() {
  +      return mIsRestartPending;
  +   }
  +
      // -------------------------------------------------------------------------
      // Methods
      // -------------------------------------------------------------------------  
  @@ -293,7 +487,6 @@
      )
         throws MalformedObjectNameException
      {
  -      mServer = pServer;
         return pName;
      }
      
  @@ -326,9 +519,9 @@
         try {
            // Create Timer MBean
            mTimer = new ObjectName( "DefaultDomain", "service", "Timer" );
  -         mServer.createMBean( "javax.management.timer.Timer", mTimer );
  +         getServer().createMBean( "javax.management.timer.Timer", mTimer );
            // Now start the Timer
  -         mServer.invoke(
  +         getServer().invoke(
               mTimer,
               "start",
               new Object[] {},
  @@ -339,14 +532,7 @@
            e.printStackTrace();
         }
         if( mStartOnStart ) {
  -         startSchedule(
  -            mSchedulableClass,
  -            mInitArguments,
  -            mInitTypes,
  -            mStartDate,
  -            mPeriod,
  -            mRepetitions
  -         );
  +         startSchedule();
         }
      }
      
  @@ -446,7 +632,7 @@
                           // When Initial Call then setup the regular schedule
                           // By first removing the initial one and then adding the
                           // regular one.
  -                        mServer.invoke(
  +                        getServer().invoke(
                              mTimer,
                              "removeNotification",
                              new Object[] {
  @@ -457,14 +643,14 @@
                              }
                           );
                           // Add regular schedule
  -                        mActualSchedule = ( (Integer) mServer.invoke(
  +                        mActualSchedule = ( (Integer) getServer().invoke(
                              mTimer,
                              "addNotification",
                              new Object[] {
                                 "Schedule",
                                 "Scheduler Notification",
                                 new Date( new Date().getTime() + 1000 ),
  -                              new Long( getSchedulePeriod() ),
  +                              new Long( mActualSchedulePeriod ),
                                 new Long( getRemainingRepetitions() )
                              },
                              new String[] {
  @@ -481,7 +667,7 @@
               }
               else {
                  // Schedule is stopped therefore remove the Schedule
  -               mServer.invoke(
  +               getServer().invoke(
                     mTimer,
                     "removeNotification",
                     new Object[] {
  @@ -507,15 +693,27 @@
         implements Schedulable
      {
         
  +      private String mName;
  +      private int mValue;
  +      
  +      public SchedulableExample(
  +         String pName,
  +         int pValue
  +      ) {
  +         mName = pName;
  +         mValue = pValue;
  +      }
  +      
         /**
          * Just log the call
          **/
         public void perform(
            Date pTimeOfCall,
  -         int pRemainingRepetitions
  +         long pRemainingRepetitions
         ) {
            System.out.println( "Schedulable Examples is called at: " + pTimeOfCall +
  -            ", remaining repetitions: " + pRemainingRepetitions );
  +            ", remaining repetitions: " + pRemainingRepetitions +
  +            ", test, name: " + mName + ", value: " + mValue );
         }
      }
   }
  
  
  
  1.2       +102 -26   jboss/src/main/org/jboss/util/SchedulerMBean.java
  
  Index: SchedulerMBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/SchedulerMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SchedulerMBean.java       2001/06/10 07:50:58     1.1
  +++ SchedulerMBean.java       2001/06/11 06:32:31     1.2
  @@ -6,6 +6,7 @@
    */
   package org.jboss.util;
   
  +import java.security.InvalidParameterException;
   import java.util.Date;
   
   import org.jboss.util.ServiceMBean;
  @@ -32,33 +33,14 @@
   
      /**
       * Starts the schedule if the schedule is stopped otherwise nothing will happen.
  -    * The scheduled is immediately set to started even the first call is in the
  +    * The Schedule is immediately set to started even the first call is in the
       * future.
       *
  -    * @param pSchedulableClass Full qaulified Class Name of the class implementing
  -    *                          the {@link org.jboss.util.Schedulable} interface.
  -    * @param pInitArguments Arrays of arguments for the constructor. It must have as
  -    *                       many elements as the Initial Types array. If null then
  -    *                       an empty array is assumed.
  -    * @param pInitTypes Arrays of data types to look up the constructor. It must 
have
  -    *                   as many elements as the Init Arguments array. If null then 
an
  -    *                   empty array is assumed.
  -    * @param pInitialStartDate Date when the schedule will be started initially. If
  -    *                          null of older than now it will started NOW.
  -    * @param pSchedulePeriod Time in Milliseconds between two scheduled calls after
  -    *                        the initial call.
  -    * @param pNumberOfRepetitions Number of repetitions this schedule is suppossed 
to
  -    *                             call. If less or equal than 0 it will repeat
  -    *                             unlimited.
  -    **/
  -   public void startSchedule(
  -      String pSchedulableClass,
  -      Object[] pInitArguments,
  -      String[] pInitTypes,
  -      Date pInitialStartDate,
  -      long pSchedulePeriod,
  -      int pNumberOfRepetitions
  -   );
  +    * @throws InvalidParameterException If any of the necessary values are not set
  +    *                                   or invalid (especially for the Schedulable
  +    *                                   class attributes).
  +    **/
  +   public void startSchedule();
      
      /**
       * Stops the schedule because it is either not used anymore or to restart it with
  @@ -73,15 +55,104 @@
      );
      
      /**
  +    * Stops the server right now and starts it right now.
  +    **/
  +   public void restartSchedule();
  +   
  +   /**
  +    * @return Full qualified Class name of the schedulable class called by the 
schedule or
  +    *         null if not set.
  +    **/
  +   public String getSchedulableClass();
  +   
  +   /**
  +    * Sets the fully qualified Class name of the Schedulable Class being called by 
the
  +    * Scheduler. Must be set before the Schedule is started. Please also set the
  +    * {@link #setSchedulableArguments} and {@link #setSchedulableArgumentTypes}.
  +    *
  +    * @param pSchedulableClass Fully Qualified Schedulable Class.
  +    *
  +    * @throws InvalidParameterException If the given value is not a valid class or 
cannot
  +    *                                   be loaded by the Scheduler or is not of 
instance
  +    *                                   Schedulable.
  +    **/
  +   public void setSchedulableClass( String pSchedulableClass )
  +      throws InvalidParameterException;
  +   
  +   /**
  +    * @return Comma seperated list of Constructor Arguments used to instantiate the
  +    *         Schedulable class instance. Right now only basic data types, String 
and
  +    *         Classes with a Constructor with a String as only argument are 
supported.
  +    **/
  +   public String getSchedulableArguments();
  +   
  +   /**
  +    * Sets the comma seperated list of arguments for the Schedulable class. Note 
that
  +    * this list must have as many elements as the Schedulable Argument Type list 
otherwise
  +    * the start of the Scheduler will fail. Right now only basic data types, String 
and
  +    * Classes with a Constructor with a String as only argument are supported.
  +    *
  +    * @param pArgumentList List of arguments used to create the Schedulable 
intance. If
  +    *                      the list is null or empty then the no-args constructor 
is used.
  +    **/
  +   public void setSchedulableArguments( String pArgumentList );
  +   
  +   /**
  +    * @return A comma seperated list of Argument Types which should match the list 
of
  +    *         arguments.
  +    **/
  +   public String getSchedulableArgumentTypes();
  +   
  +   /**
  +    * Sets the comma seperated list of argument types for the Schedulable class. 
This will
  +    * be used to find the right constructor and to created the right instances to 
call the
  +    * constructor with. This list must have as many elements as the Schedulable 
Arguments
  +    * list otherwise the start of the Scheduler will fail. Right now only basic 
data types,
  +    * String and Classes with a Constructor with a String as only argument are 
supported.
  +    *
  +    * @param pTypeList List of arguments used to create the Schedulable intance. If
  +    *                  the list is null or empty then the no-args constructor is 
used.
  +    *
  +    * @throws InvalidParameterException If the given list contains a unknow datat 
type.
  +    **/
  +   public void setSchedulableArgumentTypes( String pTypeList )
  +      throws InvalidParameterException;
  +   
  +   /**
       * @return Schedule Period between two scheduled calls in Milliseconds. It will 
always
       *         be bigger than 0 except it returns -1 then the schedule is stopped.
       **/
      public long getSchedulePeriod();
      
      /**
  +    * Sets the Schedule Period between two scheduled call.
  +    *
  +    * @param pPeriod Time between to scheduled calls (after the initial call) in 
Milliseconds.
  +    *                This value must be bigger than 0.
  +    *
  +    * @throws InvalidParameterException If the given value is less or equal than 0
  +    **/
  +   public void setSchedulePeriod( long pPeriod );
  +   
  +   /**
  +    * @return Number of scheduled calls initially. If -1 then there is not limit.
  +    **/
  +   public long getInitialRepetitions();
  +   
  +   /**
  +    * Sets the initial number of scheduled calls.
  +    *
  +    * @param pNumberOfCalls Initial Number of scheduled calls. If -1 then the number
  +    *                       is unlimted.
  +    *
  +    * @throws InvalidParameterException If the given value is less or equal than 0
  +    **/
  +   public void setInitialRepetitions( long pNumberOfCalls );
  +
  +   /**
       * @return Number of remaining repetitions. If -1 then there is no limit.
       **/
  -   public int getRemainingRepetitions();
  +   public long getRemainingRepetitions();
      
      /**
       * @return True if the schedule is up and running. If you want to start the 
schedule
  @@ -89,5 +160,10 @@
       *         first with {@ #stopSchedule} and wait until this method returns false.
       **/
      public boolean isStarted();
  +   
  +   /**
  +    * @return True if any attributes are changed but the Schedule is not restarted 
yet.
  +    **/
  +   public boolean isRestartPending();
   
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to