com.taleo.integration.client.customstep.count
Class CountManager

java.lang.Object
  extended by com.taleo.integration.client.customstep.count.CountManager

public class CountManager
extends java.lang.Object

Manage the record count.

Count will be reset, overwriting the daily count file, each day at 00:00:00 in the "America/New_York" time zone. This time zone adapts to daylight savings and is the one all Taleo servers are set and should not need to change. However, if needed, the time zone can be set differently using the System property called "com.taleo.client.customstep.CountManager.ResetTimeZone".

Author:
Romain Guay - Taleo Corporation

Field Summary
static java.lang.String DEFAULT_RESET_TIME_ZONE
          Default value for com.taleo.client.customstep.CountManager.ResetTimeZone system property.
static java.lang.Object PIPELINE_KEY
          Key for the CountManager in the pipeline.
 
Constructor Summary
CountManager()
          Constructor without arguments.
CountManager(java.io.File file)
          Constructor with the file to store the count.
 
Method Summary
 java.util.Date getCurrentDate()
          Get the current execution date.
 java.lang.String getCurrentEntity()
          Get the current entity.
 java.lang.String getCurrentExtractId()
          Get the current extract Id.
 int getCurrentRecordCount()
          Get the current record count.
 int getDailyRecordCount()
          Get the daily count.
 int getDailyRunCount()
          Get the daily completed run count (excluding the current run).
 java.io.File getFile()
          Get the file where the count state is stored.
 java.util.Date getNextResetTime()
          Get the next reset time in the local time zone.
protected  java.util.Date getNextResetTime(java.util.Date now)
          Get the next reset time in the local time zone.
protected  boolean mustReset(java.util.Date now, java.util.Date lastModifiedDate)
          Determine if a count file with the given last modified date must be reset.
 void save()
          Save the count state on disk.
 void setCurrentDate(java.util.Date date)
          Set the current execution date.
 void setCurrentEntity(java.lang.String entity)
          Set the current entity.
 void setCurrentExtractId(java.lang.String extractId)
          Set the current extract Id.
 void setCurrentRecordCount(int recordCount)
          Set the current record count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIPELINE_KEY

public static final java.lang.Object PIPELINE_KEY
Key for the CountManager in the pipeline.


DEFAULT_RESET_TIME_ZONE

public static final java.lang.String DEFAULT_RESET_TIME_ZONE
Default value for com.taleo.client.customstep.CountManager.ResetTimeZone system property.

See Also:
Constant Field Values
Constructor Detail

CountManager

public CountManager()
Constructor without arguments.


CountManager

public CountManager(java.io.File file)
             throws java.io.IOException
Constructor with the file to store the count.

Parameters:
file - The file to store the count state.
Throws:
java.io.IOException
Method Detail

mustReset

protected boolean mustReset(java.util.Date now,
                            java.util.Date lastModifiedDate)
Determine if a count file with the given last modified date must be reset. It will be if it is in a previous day in the specified reset time zone.

Parameters:
now -
lastModifiedDate -
Returns:

getNextResetTime

public java.util.Date getNextResetTime()
Get the next reset time in the local time zone.

Returns:

getNextResetTime

protected java.util.Date getNextResetTime(java.util.Date now)
Get the next reset time in the local time zone.

Parameters:
now -
Returns:

setCurrentExtractId

public void setCurrentExtractId(java.lang.String extractId)
Set the current extract Id.


getCurrentExtractId

public java.lang.String getCurrentExtractId()
Get the current extract Id.

Returns:

setCurrentEntity

public void setCurrentEntity(java.lang.String entity)
Set the current entity.


getCurrentEntity

public java.lang.String getCurrentEntity()
Get the current entity.

Returns:

setCurrentDate

public void setCurrentDate(java.util.Date date)
Set the current execution date.


getCurrentDate

public java.util.Date getCurrentDate()
Get the current execution date.

Returns:

setCurrentRecordCount

public void setCurrentRecordCount(int recordCount)
Set the current record count.


getCurrentRecordCount

public int getCurrentRecordCount()
Get the current record count.

Returns:
The current record count or -1 if there is no current record count.

getDailyRunCount

public int getDailyRunCount()
Get the daily completed run count (excluding the current run).

Returns:

getDailyRecordCount

public int getDailyRecordCount()
Get the daily count.

Returns:

getFile

public java.io.File getFile()
Get the file where the count state is stored.

Returns:

save

public void save()
          throws java.io.IOException
Save the count state on disk.

Throws:
java.io.IOException