submarine.connectors
Class TimerFunction

java.lang.Object
  |
  +--submarine.connectors.TimerFunction
All Implemented Interfaces:
PoolingFunction, SubmiterAware, XMLConfigurable

public class TimerFunction
extends java.lang.Object
implements PoolingFunction, SubmiterAware

This TimerFunction class is a PoolingFunction that is connected directly to a WritingFunction but never submit any document to Submarine. The aim of this class is to have a way to execute task at a regular frequency or at a special date and time. The task must be implemented by a WritingFunction.


Inner Class Summary
protected static class TimerFunction.CrontabDefinition
          
 
Field Summary
private  TimerFunction.CrontabDefinition at
           
private  ConnectorsControler controler
           
private static java.text.SimpleDateFormat dateFormatCompare
           
private  long frequency
           
private  java.lang.String lastExecution
           
private  Submiter submiter
           
private  WritingFunction writer
           
 
Constructor Summary
TimerFunction()
           
 
Method Summary
 long getFrequency()
          returns the frequency at which the batch should be tested to be executed.
 java.lang.Object getNextDocument()
          Always returns null, because no document should be submited to submarine.
 RouteInfos getRouteInfos()
          Always returns null because no route is required for this PoolingFunction.
 boolean hasNewDocument()
          Returns always false but try to execute the associated WritingFunction.
 void init(org.w3c.dom.Element xml)
          Initialisation of the TimerFunction.
 void notifyResponse(java.lang.Object doc, java.lang.Object response, boolean ok)
          Never used and implementation do nothing.
 void setSubmiter(Submiter s)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

submiter

private Submiter submiter

controler

private ConnectorsControler controler

writer

private WritingFunction writer

frequency

private long frequency

at

private TimerFunction.CrontabDefinition at

dateFormatCompare

private static java.text.SimpleDateFormat dateFormatCompare

lastExecution

private java.lang.String lastExecution
Constructor Detail

TimerFunction

public TimerFunction()
Method Detail

hasNewDocument

public boolean hasNewDocument()
Returns always false but try to execute the associated WritingFunction.
Specified by:
hasNewDocument in interface PoolingFunction
See Also:
PoolingFunction.hasNewDocument()

getNextDocument

public java.lang.Object getNextDocument()
                                 throws java.lang.Exception
Always returns null, because no document should be submited to submarine.
Specified by:
getNextDocument in interface PoolingFunction
See Also:
PoolingFunction.getNextDocument()

getFrequency

public long getFrequency()
returns the frequency at which the batch should be tested to be executed.
Specified by:
getFrequency in interface PoolingFunction
See Also:
PoolingFunction.getFrequency()

getRouteInfos

public RouteInfos getRouteInfos()
Always returns null because no route is required for this PoolingFunction.
Specified by:
getRouteInfos in interface PoolingFunction
See Also:
PoolingFunction.getRouteInfos()

notifyResponse

public void notifyResponse(java.lang.Object doc,
                           java.lang.Object response,
                           boolean ok)
Never used and implementation do nothing.
Specified by:
notifyResponse in interface PoolingFunction
See Also:
PoolingFunction.notifyResponse(Object, Object, boolean)

init

public void init(org.w3c.dom.Element xml)
          throws java.lang.Exception
Initialisation of the TimerFunction. 1000 TheWriterIdToExecute
Specified by:
init in interface XMLConfigurable
See Also:
XMLConfigurable#init(Element)

setSubmiter

public void setSubmiter(Submiter s)
Specified by:
setSubmiter in interface SubmiterAware
Following copied from interface: submarine.core.SubmiterAware
Parameters:
s -  

Submarine project. free distribution of this software must include the opensource licence.
Guénolé de Cadoudal.