Class CollectJob

java.lang.Object
  extended by CollectJob
All Implemented Interfaces:
org.quartz.Job
Direct Known Subclasses:
NewsJob, StockJob

public abstract class CollectJob
extends Object
implements org.quartz.Job

Basic data collection job, implementing basic configuration handling and collection routines.

Author:
fhogenboom

Field Summary
private static org.slf4j.Logger _log
           
protected  String date
           
protected  String form_date
           
protected  String form_hday
           
protected  String form_time
           
protected  ArrayList<Object> hday
           
protected  Integer hour_stop
           
protected  Integer hour_strt
           
protected  Integer mnte_stop
           
protected  Integer mnte_strt
           
protected  Integer scnd_stop
           
protected  Integer scnd_strt
           
protected  String time
           
protected  String time_zone
           
 
Constructor Summary
CollectJob()
          Constructor.
 
Method Summary
protected abstract  void collect()
          Collects data from a specific source.
private  boolean configure(org.quartz.JobExecutionContext context)
          Configures the CollectJob component by parsing a configuration file.
protected abstract  boolean configureLocal(String jobKey)
          Configures the CollectJob component by parsing a configuration file for local component elements.
private  boolean configureShared()
          Configures the CollectJob component by parsing a configuration file for shared market elements.
 void execute(org.quartz.JobExecutionContext context)
          Executes the tasks of the CollectJob component.
protected abstract  org.slf4j.Logger getLogger()
          Retrieves the Logger of the component.
private  boolean isHoliday(Calendar date_now)
          Checks whether it is a holiday.
private  boolean isMarket(Calendar date_now)
          Checks whether the market is open.
private  boolean isTime(Calendar date_now)
          Checks whether it is a trading time.
private  boolean isWeekend(Calendar date_now)
          Checks whether it is a weekend.
private  boolean load(org.quartz.JobExecutionContext context)
          Configures the CollectJob component by loading configurations stored in a JobDataMap, which is available during runtime of the component.
protected abstract  boolean loadLocal(org.quartz.JobExecutionContext context)
          Configures the CollectJob component by loading configurations for local component elements stored in a JobDataMap, which is available during runtime of the component.
private  boolean loadShared(org.quartz.JobExecutionContext context)
          Configures the CollectJob component by loading configurations for shared market elements stored in a JobDataMap, which is available during runtime of the component.
private  void store(org.quartz.JobExecutionContext context)
          Stores the configuration of the CollectJob component in a JobDataMap, which is available during runtime of the component.
protected abstract  void storeLocal(org.quartz.JobExecutionContext context)
          Stores the configuration for local component elements of the CollectJob component in a JobDataMap, which is available during runtime of the component.
private  void storeShared(org.quartz.JobExecutionContext context)
          Stores the configuration for shared market elements of the CollectJob component in a JobDataMap, which is available during runtime of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hday

protected ArrayList<Object> hday

hour_stop

protected Integer hour_stop

hour_strt

protected Integer hour_strt

mnte_stop

protected Integer mnte_stop

mnte_strt

protected Integer mnte_strt

scnd_stop

protected Integer scnd_stop

scnd_strt

protected Integer scnd_strt

date

protected String date

form_date

protected String form_date

form_hday

protected String form_hday

form_time

protected String form_time

time

protected String time

time_zone

protected String time_zone

_log

private static org.slf4j.Logger _log
Constructor Detail

CollectJob

public CollectJob()
Constructor.

Method Detail

configure

private boolean configure(org.quartz.JobExecutionContext context)
Configures the CollectJob component by parsing a configuration file. Configurations are stored in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.
Returns:
Boolean value indicating whether parsed configuration is valid.

configureShared

private boolean configureShared()
Configures the CollectJob component by parsing a configuration file for shared market elements.

Returns:
Boolean value indicating whether parsed configuration is valid.

load

private boolean load(org.quartz.JobExecutionContext context)
Configures the CollectJob component by loading configurations stored in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.
Returns:
Boolean value indicating whether loaded configuration is valid.

loadShared

private boolean loadShared(org.quartz.JobExecutionContext context)
Configures the CollectJob component by loading configurations for shared market elements stored in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.
Returns:
Boolean value indicating whether loaded configuration is valid.

store

private void store(org.quartz.JobExecutionContext context)
Stores the configuration of the CollectJob component in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.

storeShared

private void storeShared(org.quartz.JobExecutionContext context)
Stores the configuration for shared market elements of the CollectJob component in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
Executes the tasks of the CollectJob component.

Specified by:
execute in interface org.quartz.Job
Parameters:
context - Execution context of the component.
Throws:
org.quartz.JobExecutionException - An exception that indicates to the scheduler that an error occurred while executing, and whether or not the component requests to be re-fired immediately, or whether it wants to be unscheduled.

isMarket

private boolean isMarket(Calendar date_now)
Checks whether the market is open.

Parameters:
date_now - The date to be checked.
Returns:
Boolean value indicating whether the market is open.

isWeekend

private boolean isWeekend(Calendar date_now)
Checks whether it is a weekend.

Parameters:
date_now - The date to be checked.
Returns:
Boolean value indicating whether it is a weekend.

isHoliday

private boolean isHoliday(Calendar date_now)
Checks whether it is a holiday.

Parameters:
date_now - The date to be checked.
Returns:
Boolean value indicating whether it is a holiday.

isTime

private boolean isTime(Calendar date_now)
Checks whether it is a trading time.

Parameters:
date_now - The date to be checked.
Returns:
Boolean value indicating whether it is a trading time.

collect

protected abstract void collect()
Collects data from a specific source.


configureLocal

protected abstract boolean configureLocal(String jobKey)
Configures the CollectJob component by parsing a configuration file for local component elements.

Parameters:
jobKey - ID of the component.
Returns:
Boolean value indicating whether parsed configuration is valid.

loadLocal

protected abstract boolean loadLocal(org.quartz.JobExecutionContext context)
Configures the CollectJob component by loading configurations for local component elements stored in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.
Returns:
Boolean value indicating whether loaded configuration is valid.

getLogger

protected abstract org.slf4j.Logger getLogger()
Retrieves the Logger of the component.

Returns:
Logger used for logging system output.

storeLocal

protected abstract void storeLocal(org.quartz.JobExecutionContext context)
Stores the configuration for local component elements of the CollectJob component in a JobDataMap, which is available during runtime of the component.

Parameters:
context - Execution context of the component.