jason.core
Class SchedulableService

java.lang.Object
  |
  +--jason.core.AbstractService
        |
        +--jason.core.SchedulableService
All Implemented Interfaces:
java.io.Serializable, Service, ServiceDataListener
Direct Known Subclasses:
NopSchedulableService, UpdatableService

public class SchedulableService
extends AbstractService

Created Wed May 8 15:50:51 2002

This service type has a part of a task scheduler. This kind of service uses a clock system that awakes the service when needed. This is very like the crontab unix/linux system.

Note that the start and stop methods will be call several time during the life cycle of this objet. When the clock awake this service, the start is called. This is of the service responsability to call the stop method.

By default, if you don't reset a starting period, this service is awakened every minute.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jason.core.AbstractService
INITIALIZED, name, NOSTATE, serviceContext, STARTED, STOPPED
 
Fields inherited from interface jason.core.Service
ERROR_MESSAGE, INFORMATION_MESSAGE, VERBOSE_MESSAGE, WARNING_MESSAGE
 
Constructor Summary
SchedulableService()
          This service is not by default starting as a thread.
 
Method Summary
 int getStartingDay()
           
 int getStartingHour()
           
 int getStartingMinute()
           
 int getStartingMonth()
           
 double getStartingPeriod()
           
 void init(ServiceContext sc)
          Overrided for avoiding an override of the notifyInitReady method
protected  void notifyInitSchedulableReady()
          This method is called at the end of the notifyInitReady method
 void run()
          Overrided method for avoiding any thread support or management
 void setStartingDay(int day)
          Set the starting day number.
 void setStartingHour(int hour)
          Set the starting hour.
 void setStartingMinute(int minute)
          Set the starting minute.
 void setStartingMonth(int month)
          Set the starting month number.
 void setStartingPeriod(double period)
          This method will awake the service every period in minute.
 
Methods inherited from class jason.core.AbstractService
actionForStart, checkForContext, fireCriticalErrorDetected, getBooleanProperty, getInfo, getIntProperty, getName, getPropertiesName, getProperty, getServiceContext, getServiceState, getState, getStringProperty, getType, getVersion, hasServiceContext, isAutoStop, isEnabled, isInitialized, isOverride, isPersistent, isPrivate, isProcessable, isStarted, isStopped, isTest, isThreadable, isVerbose, manageRequest, manageRequestForType, notifyData, notifyInitReady, notifyStartReady, notifyStopReady, postStop, restart, sendCustomMessage, sendErrorMessage, sendInformationMessage, sendInnerError, sendWarningMessage, setAutoStop, setEnabled, setName, setPersistent, setPrivate, setProperty, setServiceContext, setTest, setType, setVerbose, setVersion, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulableService

public SchedulableService()
This service is not by default starting as a thread. This is not a good idea to change this behavior as this service is managed by the container

Method Detail

init

public void init(ServiceContext sc)
Overrided for avoiding an override of the notifyInitReady method

Specified by:
init in interface Service
Overrides:
init in class AbstractService

notifyInitSchedulableReady

protected void notifyInitSchedulableReady()
This method is called at the end of the notifyInitReady method


setStartingPeriod

public void setStartingPeriod(double period)
This method will awake the service every period in minute. By default a 0 value is set, this is a value for cancelling thie period too. This value can be used with a starting value too

Parameters:
period - a period value in minutes

setStartingMinute

public void setStartingMinute(int minute)
Set the starting minute. If you don't specify a hour, it will work every hour

Parameters:
minute - starting minute starting from 0

setStartingHour

public void setStartingHour(int hour)
Set the starting hour. If you don't specify a day, it will work every day

Parameters:
hour - starting hour starting from 0

setStartingDay

public void setStartingDay(int day)
Set the starting day number. If you don't specify a month it will work every month


setStartingMonth

public void setStartingMonth(int month)
Set the starting month number.

Parameters:
month - a month numerb starting from 0

getStartingMinute

public int getStartingMinute()
Returns:
a starting minute time

getStartingHour

public int getStartingHour()
Returns:
a starting hour time

getStartingDay

public int getStartingDay()
Returns:
a starting day time

getStartingMonth

public int getStartingMonth()
Returns:
a starting month time

getStartingPeriod

public double getStartingPeriod()
Returns:
a starting period in minute

run

public void run()
Overrided method for avoiding any thread support or management

Overrides:
run in class AbstractService