com.taleo.integration.client.customstep.lrd
Class FileDateProvider

java.lang.Object
  extended by com.taleo.integration.client.customstep.lrd.FileDateProvider
All Implemented Interfaces:
DateProvider

public class FileDateProvider
extends java.lang.Object

Date provider that uses a date stored on file. The file must contain the date in ISO-8601 format.

Author:
Romain Guay - Taleo

Field Summary
 
Fields inherited from interface com.taleo.integration.client.customstep.lrd.DateProvider
DEFAULT_LRD_MINUTE_ADJUSTMENT, PROP_MINUTE_ADJUSTEMENT
 
Constructor Summary
FileDateProvider(java.io.File file)
          Constructor with the file.
FileDateProvider(java.io.File file, DateProvider baseProvider)
          Constructor with the file and base provider.
FileDateProvider(java.io.File file, DateProvider baseProvider, boolean reset)
          Constructor with the file, base provider and reset flag.
 
Method Summary
protected  java.util.Date adjustTime(java.util.Date date)
          Adjust the specified time using the default minute adjustment or the system property value.
 java.util.Date getDate()
          Return the date.
 void saveDate()
          Save the date in the file or clear the file if date is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDateProvider

public FileDateProvider(java.io.File file)
Constructor with the file. Date will be null if the file does not exist or is empty.

Parameters:
file - The file to get the date from.

FileDateProvider

public FileDateProvider(java.io.File file,
                        DateProvider baseProvider)
Constructor with the file and base provider.

Parameters:
file - The file to get the date from.
baseProvider - The DateProvider to use if the file is empty or absent.

FileDateProvider

public FileDateProvider(java.io.File file,
                        DateProvider baseProvider,
                        boolean reset)
Constructor with the file, base provider and reset flag.

Parameters:
file - The file to get the date from.
baseProvider - The DateProvider to use if the file is empty or absent.
reset - Reset the date, forcing to read date from the baseProvider.
Method Detail

getDate

public java.util.Date getDate()
Description copied from interface: DateProvider
Return the date.

Returns:

saveDate

public void saveDate()
              throws java.io.IOException
Save the date in the file or clear the file if date is null.

Throws:
java.io.IOException

adjustTime

protected java.util.Date adjustTime(java.util.Date date)
Adjust the specified time using the default minute adjustment or the system property value.

Parameters:
date - The date to be adjusted