org.jmonks.batch.framework.repository.db4o
Class Db4oRepository

java.lang.Object
  extended byorg.jmonks.batch.framework.Repository
      extended byorg.jmonks.batch.framework.repository.db4o.Db4oRepository
Direct Known Subclasses:
ClientServerDb4oRepository

public class Db4oRepository
extends Repository

This implementation of repository uses the DB4O database as the repository. It expects the property repository-location present in the repository configuration in framework-cofig.xml file. The value of this property should be a valid directory name. If directory doesnt exist, it will try to create directory with that path.

    <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository">
          <property key="db4o-directory">/batchserver/repository</property>
    </repository-config>
 

Here repository-location defines where the DB4O database needs to create the repository file. By default framework will be configured with the values shown in the above XML configuration snippet.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static java.lang.String DB4O_REPOSITORY_FILENAME
          Name of the DB4O repository file name which is batchserver_repository.db.
static java.lang.String PROPERTY_DB4O_DIRECTORY
          Property identifies the db4o directory name which is db4o-directory.
protected  java.util.Map repositoryConfigProperties
          Map holds the configuration properties of repository.
 
Fields inherited from class org.jmonks.batch.framework.Repository
jobName
 
Constructor Summary
Db4oRepository()
           Do not use this constructor to instantiate Db4oRepository directly.
 
Method Summary
 boolean clearDataTransferredFromThisJob()
           This method will clear all the data that has been sent by this job to all the next jobs.
protected  com.db4o.ObjectContainer createContainer(java.util.Map configProps)
          Creates the container by looking at the configuration from given Map.
 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  void init(java.util.Map configProps)
           Initializes the Db4oRepository by accepting the map consist of properties needed to setup the repository.
 boolean logStatistics(JobStatistics statistics)
           Logs the job statistics given in the form of JobStatistics object in the repository for further use/references.
 boolean registerJobMgmtMntrInfo(java.lang.Object registrationInfo)
           Registers the given job management and monitoring information to this job.
 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.
 boolean unregisterJobMgmtMntrInfo()
          Unregisters the job management and monitoring information assosciated with this job.
 
Methods inherited from class org.jmonks.batch.framework.Repository
createRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_DB4O_DIRECTORY

public static final java.lang.String PROPERTY_DB4O_DIRECTORY
Property identifies the db4o directory name which is db4o-directory.

See Also:
Constant Field Values

DB4O_REPOSITORY_FILENAME

public static final java.lang.String DB4O_REPOSITORY_FILENAME
Name of the DB4O repository file name which is batchserver_repository.db.

See Also:
Constant Field Values

repositoryConfigProperties

protected java.util.Map repositoryConfigProperties
Map holds the configuration properties of repository.

Constructor Detail

Db4oRepository

public Db4oRepository()

Do not use this constructor to instantiate Db4oRepository directly. Access the repository only through the JobContext reference. This constructor has been provided to make sure this should be instantiable and accessible to the Repository class.

Method Detail

init

protected void init(java.util.Map configProps)

Initializes the Db4oRepository by accepting the map consist of properties needed to setup the repository. This validates for db4o-directory property has been defined and the value defined for this property is valid. If the configured directory name is not exists, it tries to create that directory.

Specified by:
init in class Repository
Parameters:
configProps - Map contains the configuration properties.
Throws:
ConfigurationException - If db4o-directory property is not defined and the value specified is a file and not existing directory could not be created.
java.lang.IllegalArgumentException - If given configProps is null.

createContainer

protected com.db4o.ObjectContainer createContainer(java.util.Map configProps)
Creates the container by looking at the configuration from given Map.

Returns:
Returns the Db4o object container reference.

sendDataToNextJob

public boolean sendDataToNextJob(java.lang.String dataIdentifier,
                                 java.lang.String nextJobName,
                                 java.lang.Object data)
Description copied from class: Repository

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.

Specified by:
sendDataToNextJob in class Repository
Parameters:
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.
Returns:
Returns true, if it could save the data to be send to the next job.
See Also:
Repository#sendDataToNextJob(String,String,Object)

getDataFromPreviousJob

public java.lang.Object getDataFromPreviousJob(java.lang.String dataIdentifier,
                                               java.lang.String previousJobName)
Description copied from class: Repository
Gets the data that has been sent by the previous job with the given data identifier.

Specified by:
getDataFromPreviousJob in class Repository
Parameters:
dataIdentifier - Identifier tied to the data that has been sent.
previousJobName - Name of the previous job sent the data to this job.
Returns:
Returns the data, null, if it couldnt find any data from the previous job with that identifier.
See Also:
org.jmonks.batch.framework.repository.Repository#getDataFromPreviousJob(String,String)

clearDataTransferredFromThisJob

public boolean clearDataTransferredFromThisJob()
Description copied from class: Repository

This method will clear all the data that has been sent by this job to all the next jobs.

Specified by:
clearDataTransferredFromThisJob in class Repository
Returns:
Returns true if it could clear all the data, false, otherwise.
See Also:
org.jmonks.batch.framework.repository.Repository#clearDataTransferredToNextJob()

registerJobMgmtMntrInfo

public boolean registerJobMgmtMntrInfo(java.lang.Object registrationInfo)
Description copied from class: Repository

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.

Specified by:
registerJobMgmtMntrInfo in class Repository
Parameters:
registrationInfo - Information to be associated with the job.
Returns:
Return true, if it could assosciate this information, false, otherwise.
See Also:
org.jmonks.batch.framework.repository.Repository#registerJobMgmtMntrInfo(Object)

unregisterJobMgmtMntrInfo

public boolean unregisterJobMgmtMntrInfo()
Description copied from class: Repository
Unregisters the job management and monitoring information assosciated with this job.

Specified by:
unregisterJobMgmtMntrInfo in class Repository
Returns:
Return true, it it could unregister the information, false, otherwise.
See Also:
org.jmonks.batch.framework.repository.Repository#unregisterJobMgmtMntrInfo()

logStatistics

public boolean logStatistics(JobStatistics statistics)
Description copied from class: Repository

Logs the job statistics given in the form of JobStatistics object in the repository for further use/references.

Specified by:
logStatistics in class Repository
Parameters:
statistics - Job Statistics object which holds all the statistics related to that job.
Returns:
Returns true if statistics can be logged into repository, false, otherwise.
See Also:
org.jmonks.batch.framework.repository.Repository#logStatistics(org.jmonks.batch.framework.JobStatistics)