|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmonks.batch.framework.Repository
Repository class provides utility methods to access and use the repository maintained by the framework. The repository could be any data store from files to databases, useful to save and retrieve the data. So, there could be different implementations available of this Repository class. Framework configuration defines which implementation should be used for the framework.
This povides utility methods to log the job statistics and transfer data between the jobs and register & unregister management and monitoring information. Framework creates the repository at the startup and provides this reference through the JobContext to all the jobs. When the repository get created, it will be associated with the job beign run and all the operations will be performed with respect to that job only. The job being run will be taken as source job in all the operations.
Default framework configuration uses Db4o database as repository for its simplicity. There is a JdbcRepository implementation by using which we can use any database that can be used JDBC can be configured to use as repository. If anyone wish to use tools provided to manage and monitor the applications, consider of using the JdbcRepository implementation.
Field Summary | |
protected java.lang.String |
jobName
Name of the job associated with the repository. |
Constructor Summary | |
Repository()
|
Method Summary | |
abstract boolean |
clearDataTransferredFromThisJob()
This method will clear all the data that has been sent by this job to all the next jobs. |
static Repository |
createRepository(java.lang.String jobName,
FrameworkConfig.RepositoryConfig repositoryConfig,
Main repositoryCreator)
Factory method creates the repository instance based on the given repository configuration and associate this repository instance with the given job. |
abstract java.lang.Object |
getDataFromPreviousJob(java.lang.String dataIdentifier,
java.lang.String previousJobName)
Gets the data that has been sent by the previous job with the given data identifier. |
protected abstract void |
init(java.util.Map configProps)
Method to initialize the repository implementation by using the properties defined in the framework configuration. |
abstract boolean |
logStatistics(JobStatistics statistics)
Logs the job statistics given in the form of JobStatistics object in the repository for further use/references. |
abstract boolean |
registerJobMgmtMntrInfo(java.lang.Object registrationInfo)
Registers the given job management and monitoring information to this job. |
abstract boolean |
sendDataToNextJob(java.lang.String dataIdentifier,
java.lang.String nextJobName,
java.lang.Object data)
Data will be send to the specified next job and will be identified with the given identifier. |
abstract boolean |
unregisterJobMgmtMntrInfo()
Unregisters the job management and monitoring information assosciated with this job. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String jobName
Constructor Detail |
public Repository()
Method Detail |
protected abstract void init(java.util.Map configProps)
Method to initialize the repository implementation by using the properties defined in the framework configuration. This method will be called immediately after instantiating the implementation class.
configProps
- Configuration properties defined in <repository-config> element
in framework configuration file.
ConfigurationException
- If required configuration properties are missing or the values
are invalid.public static Repository createRepository(java.lang.String jobName, FrameworkConfig.RepositoryConfig repositoryConfig, Main repositoryCreator)
Factory method creates the repository instance based on the given repository configuration and associate this repository instance with the given job. So, all the repository operations performed using this repository instance will be associated with that job and taken that job as source job in all operations. This method will be called by the framework to create the repository and places the reference in JobContext object.
jobName
- Name of the job this repository will be associated with.repositoryConfig
- Repository configuration defined in framework configuration.repositoryCreator
- Creator of the repository. This is is restrict only framework can instantiate the repository.
java.lang.SecurityException
- If an attempt is made to create the repository by other than the Main class(framework).
java.lang.IllegalArgumentException
- If jobName is null to create the repository instance.
ConfigurationException
- If required properties are missing in the repository configuration or the values are invalid.public abstract boolean sendDataToNextJob(java.lang.String dataIdentifier, java.lang.String nextJobName, java.lang.Object data)
Data will be send to the specified next job and will be identified with the given identifier. By using different identifiers, multiple data objects can be send to the same next job. Next job should use the data identifier and this (source) job name to read the data. If there is any data with this identifier from this job to the next job, it will be overriden.
dataIdentifier
- Identifier to be used to exchange the data between two jobs.nextJobName
- Name of the next job this data to be send.data
- Data that needs to be send as the object.
java.lang.IllegalArgumentException
- If any one of the incoming values are null.public abstract java.lang.Object getDataFromPreviousJob(java.lang.String dataIdentifier, java.lang.String previousJobName)
dataIdentifier
- Identifier tied to the data that has been sent.previousJobName
- Name of the previous job sent the data to this job.
java.lang.IllegalArgumentException
- If any one of the input values are null.public abstract boolean clearDataTransferredFromThisJob()
This method will clear all the data that has been sent by this job to all the next jobs.
public abstract boolean registerJobMgmtMntrInfo(java.lang.Object registrationInfo)
Registers the given job management and monitoring information to this job. If there is any information already associated with this job, it will be overriden.
registrationInfo
- Information to be associated with the job.
java.lang.IllegalArgumentException
- If input argument registration information
value is null.public abstract boolean unregisterJobMgmtMntrInfo()
public abstract boolean logStatistics(JobStatistics statistics)
Logs the job statistics given in the form of JobStatistics object in the repository for further use/references.
statistics
- Job Statistics object which holds all the statistics related to that job.
java.lang.IllegalArgumentException
- If input argument job statistics is null.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |