net.sf.mybatchfwk
Class BatchConfiguration

java.lang.Object
  extended by net.sf.mybatchfwk.BatchConfiguration

public class BatchConfiguration
extends java.lang.Object

Configuration of the batch.
It can be load from the configuration file 'my-batch-fwk.properties' by the method getConfigurationProperties or build by the user.

Author:
Jérôme Bertèche (cyberteche@users.sourceforge.net)

Field Summary
static java.lang.String CONFIGURATION_FILENAME
          The name of the configuration file
static java.lang.String DATE_FORMAT
          The date format use to parse dates stored into the configuration file
 
Constructor Summary
BatchConfiguration()
          Default constructor: the default behavior is applicated.
BatchConfiguration(java.util.Properties properties)
          Init the configuration from properties.
 
Method Summary
protected  void checkConsistency()
          Check the consistency of the configuration:
- the min size of the thread pool cannot be greater than the max size.
 java.lang.String getBatchClassName()
           
 int getBlockingQueueCapacity()
           
 java.lang.String getExecutionHistoryClassName()
           
 java.lang.String getExecutionReportClassName()
           
 PropertiesLoader getPropertiesLoader()
           
 java.util.Date getScheduleEndDate()
           
 long getScheduleNumberOfLoop()
           
 long getSchedulePeriodTime()
           
 java.util.Date getScheduleStartDate()
           
 int getThreadPoolMaxSize()
           
 int getThreadPoolMinSize()
           
 boolean isDeferredStart()
           
 boolean isExecuteCompletedTasks()
           
 boolean isExecuteFailedTasks()
           
 boolean isExecuteNewTasks()
           
 boolean isJmxEnable()
           
 boolean isJmxEnableNotifications()
           
 boolean isScheduleEnable()
           
 boolean isStayAliveAfterShutdown()
           
 boolean isTaskFilterEnable()
          Return true if the tasks mut be filtered before to be execute
 void setBatchClass(java.lang.Class batchClass)
           
 void setBatchClassName(java.lang.String batchClassName)
           
 void setBlockingQueueCapacity(int blockingQueueCapacity)
           
 void setDeferredStart(boolean batchDeferredStart)
           
 void setExecuteCompletedTasks(boolean executeCompletedTasks)
           
 void setExecuteFailedTasks(boolean executeFailedTasks)
           
 void setExecuteNewTasks(boolean executeNewTasks)
           
 void setExecutionHistoryClass(java.lang.Class executionHistoryClass)
           
 void setExecutionHistoryClassName(java.lang.String historyStorageClassName)
           
 void setExecutionReportClass(java.lang.Class executionReportClass)
           
 void setExecutionReportClassName(java.lang.String executionReportClassName)
           
 void setJmxEnable(boolean jmxEnable)
           
 void setJmxEnableNotifications(boolean jmxEnableNotifications)
           
 void setPropertiesLoader(PropertiesLoader propertiesManager)
           
 void setScheduleEnable(boolean scheduleEnabled)
           
 void setScheduleEndDate(java.util.Date scheduleEndDate)
           
 void setScheduleNumberOfLoop(long scheduleNumberOfLoop)
           
 void setSchedulePeriodTime(long schedulePeriodTime)
           
 void setScheduleStartDate(java.util.Date scheduleStartDate)
           
 void setStayAliveAfterShutdown(boolean stayAliveAfterShutdown)
           
 void setThreadPoolMaxSize(int threadPoolMaxSize)
           
 void setThreadPoolMinSize(int threadPoolMinSize)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIGURATION_FILENAME

public static final java.lang.String CONFIGURATION_FILENAME
The name of the configuration file

See Also:
Constant Field Values

DATE_FORMAT

public static final java.lang.String DATE_FORMAT
The date format use to parse dates stored into the configuration file

See Also:
Constant Field Values
Constructor Detail

BatchConfiguration

public BatchConfiguration()
Default constructor: the default behavior is applicated.
Default behavior:
- Default execution report
- No history
- Infinite capacity of the blocking queue
- Infinite thread pool size
- Scheduler disabled
- JMX management disabled


BatchConfiguration

public BatchConfiguration(java.util.Properties properties)
                   throws BatchException
Init the configuration from properties.
Init missing parameters by their default values.

Parameters:
properties - properties (most of the time build by the getConfigurationProperties method)
Throws:
BatchException - if a parameter is not of the waiting type
Method Detail

checkConsistency

protected void checkConsistency()
                         throws BatchException
Check the consistency of the configuration:
- the min size of the thread pool cannot be greater than the max size.
- if the schedule is enable at least one schedule parameter must be set.

Throws:
BatchException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setExecutionHistoryClass

public void setExecutionHistoryClass(java.lang.Class executionHistoryClass)
Parameters:
executionHistoryClass -

setExecutionReportClass

public void setExecutionReportClass(java.lang.Class executionReportClass)
Parameters:
executionReportClass -

setBatchClass

public void setBatchClass(java.lang.Class batchClass)
Parameters:
batchClass -

isTaskFilterEnable

public boolean isTaskFilterEnable()
Return true if the tasks mut be filtered before to be execute

Returns:

getBatchClassName

public java.lang.String getBatchClassName()
Returns:
the batchClassName

setBatchClassName

public void setBatchClassName(java.lang.String batchClassName)
Parameters:
batchClassName - the batchClassName to set

isScheduleEnable

public boolean isScheduleEnable()
Returns:
the scheduleEnable

setScheduleEnable

public void setScheduleEnable(boolean scheduleEnabled)
Parameters:
scheduleEnable - the scheduleEnable to set

getScheduleEndDate

public java.util.Date getScheduleEndDate()
Returns:
the scheduleEndDate

setScheduleEndDate

public void setScheduleEndDate(java.util.Date scheduleEndDate)
Parameters:
scheduleEndDate - the scheduleEndDate to set

getScheduleNumberOfLoop

public long getScheduleNumberOfLoop()
Returns:
the scheduleNumberOfLoop

setScheduleNumberOfLoop

public void setScheduleNumberOfLoop(long scheduleNumberOfLoop)
Parameters:
scheduleNumberOfLoop - the scheduleNumberOfLoop to set

getSchedulePeriodTime

public long getSchedulePeriodTime()
Returns:
the schedulePeriodTime

setSchedulePeriodTime

public void setSchedulePeriodTime(long schedulePeriodTime)
Parameters:
schedulePeriodTime - the schedulePeriodTime to set

getScheduleStartDate

public java.util.Date getScheduleStartDate()
Returns:
the scheduleStartDate

setScheduleStartDate

public void setScheduleStartDate(java.util.Date scheduleStartDate)
Parameters:
scheduleStartDate - the scheduleStartDate to set

getThreadPoolMaxSize

public int getThreadPoolMaxSize()
Returns:
the threadPoolMaxSize

setThreadPoolMaxSize

public void setThreadPoolMaxSize(int threadPoolMaxSize)
Parameters:
threadPoolMaxSize - the threadPoolMaxSize to set

getThreadPoolMinSize

public int getThreadPoolMinSize()
Returns:
the threadPoolMinSize

setThreadPoolMinSize

public void setThreadPoolMinSize(int threadPoolMinSize)
Parameters:
threadPoolMinSize - the threadPoolMinSize to set

isDeferredStart

public boolean isDeferredStart()
Returns:
the deferredStart

setDeferredStart

public void setDeferredStart(boolean batchDeferredStart)
Parameters:
deferredStart - the deferredStart to set

isStayAliveAfterShutdown

public boolean isStayAliveAfterShutdown()
Returns:
the stayAliveAfterShutdown

setStayAliveAfterShutdown

public void setStayAliveAfterShutdown(boolean stayAliveAfterShutdown)
Parameters:
stayAliveAfterShutdown - the stayAliveAfterShutdown to set

isJmxEnable

public boolean isJmxEnable()
Returns:
Returns the jmxEnable.

setJmxEnable

public void setJmxEnable(boolean jmxEnable)
Parameters:
jmxEnable - The jmxEnable to set.

isJmxEnableNotifications

public boolean isJmxEnableNotifications()
Returns:
Returns the jmxEnableNotifications.

setJmxEnableNotifications

public void setJmxEnableNotifications(boolean jmxEnableNotifications)
Parameters:
jmxEnableNotifications - The jmxEnableNotifications to set.

getExecutionReportClassName

public java.lang.String getExecutionReportClassName()
Returns:
Returns the executionReportClassName.

setExecutionReportClassName

public void setExecutionReportClassName(java.lang.String executionReportClassName)
Parameters:
executionReportClassName - The executionReportClassName to set.

getBlockingQueueCapacity

public int getBlockingQueueCapacity()
Returns:
Returns the blockingQueueCapacity.

setBlockingQueueCapacity

public void setBlockingQueueCapacity(int blockingQueueCapacity)
Parameters:
blockingQueueCapacity - The blockingQueueCapacity to set.

getExecutionHistoryClassName

public java.lang.String getExecutionHistoryClassName()
Returns:
Returns the executionHistoryClassName.

setExecutionHistoryClassName

public void setExecutionHistoryClassName(java.lang.String historyStorageClassName)
Parameters:
executionHistoryClassName - The executionHistoryClassName to set.

isExecuteCompletedTasks

public boolean isExecuteCompletedTasks()
Returns:
Returns the executeCompletedTasks.

setExecuteCompletedTasks

public void setExecuteCompletedTasks(boolean executeCompletedTasks)
Parameters:
executeCompletedTasks - The executeCompletedTasks to set.

isExecuteFailedTasks

public boolean isExecuteFailedTasks()
Returns:
Returns the executeFailedTasks.

setExecuteFailedTasks

public void setExecuteFailedTasks(boolean executeFailedTasks)
Parameters:
executeFailedTasks - The executeFailedTasks to set.

isExecuteNewTasks

public boolean isExecuteNewTasks()
Returns:
Returns the executeNewTasks.

setExecuteNewTasks

public void setExecuteNewTasks(boolean executeNewTasks)
Parameters:
executeNewTasks - The executeNewTasks to set.

getPropertiesLoader

public PropertiesLoader getPropertiesLoader()
Returns:
the propertiesLoader

setPropertiesLoader

public void setPropertiesLoader(PropertiesLoader propertiesManager)
Parameters:
propertiesLoader - the propertiesLoader to set


Copyright © 2006 null. All Rights Reserved.