[Batchserver-cvs] batchserver/src/org/jmonks/batch/framework/repository/db4o ClientServerDb4oRepos
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-15 20:07:28
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batch/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20326 Added Files: ClientServerDb4oRepository.java Db4oJobControllerHolder.java Db4oJobControllerHolderPredicate.java Db4oJobDataTransferHolder.java Db4oJobMgmtMntrInfoHolder.java Db4oJobMgmtMntrInfoHolderPredicate.java Db4oJobStatisticsPredicate.java Db4oRepository.java Log Message: no message --- NEW FILE: Db4oJobControllerHolder.java --- /* * Db4oJobControllerHolder.java * * Created on March 15, 2006, 10:52 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; import org.jmonks.batch.framework.controller.JobController; /** * Db4oJobControllerHolder holds the job controller object and job name. * This class will be accessed by only Db4oRepository. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobControllerHolder { /** * Holds the job name */ private String jobName=null; /** * Holds the job controller object */ private JobController jobController=null; /** * Constructor takes job name and job controller to constructs the object. */ Db4oJobControllerHolder(String jobName,JobController jobController) { this.jobName=jobName; this.jobController=jobController; } /** * Returns the jobName. */ public String getJobName() { return this.jobName; } /** * Returns the mgmt & mntr object. */ public JobController getJobController() { return this.jobController; } /** * <p> * Returns the string representation of Db4oJobControllerHolder class in the format * <br> {Db4oJobControllerHolder [jobName = value] [mgmtMntrInfo = value]} * </p> * * @return Returns the string representation of Db4oJobControllerHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobControllerHolder "); stringValue.append("[jobName = " + this.jobName + "]"); stringValue.append("[jobController = " + this.jobController + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oJobControllerHolderPredicate.java --- /* * Db4oJobControllerHolderPredicate.java * * Created on March 16, 2006, 7:32 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; import com.db4o.query.Predicate; /** * Db4oJobControllerHolderPredicate used to find the Db4oJobControllerHolder * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobControllerHolderPredicate extends Predicate { /** * job name to find the controller holder objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobControllerHolderPredicate with the job name. */ Db4oJobControllerHolderPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null for Db4oJobControllerHolder Predicate."); this.jobName=jobName; } /** * Method to run the the native query. This receives the Db4oJobControllerHolder * objects and look for the job name this predicate initialized with. */ public boolean match(Db4oJobControllerHolder holder) { if(jobName.equals(holder.getJobName())) return true; else return false; } } --- NEW FILE: Db4oRepository.java --- package org.jmonks.batch.framework.repository.db4o; import com.db4o.Db4o; import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import com.db4o.query.Predicate; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batch.framework.config.ConfigurationException; import org.jmonks.batch.framework.Repository; import org.jmonks.batch.framework.JobStatistics; /** * <p> * 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. * <br><br> * <pre> * <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.Db4oRepository"> * <property key="db4o-filename">/batchserver/repository/batchserver_repository.db</property> * </repository-config> * </pre> * <br> * 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. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oRepository extends Repository { private static Logger logger=Logger.getLogger(Db4oRepository.class); /** * Property identifies the db4o file name which <code>db4o-filename</code>. */ public static final String PROPERTY_DB4O_FILENAME = "db4o-filename"; /** * Map holds the configuration properties of repository. */ protected Map repositoryConfigProperties=null; /** *<p> * <i> * 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. * </i> * </p> */ public Db4oRepository() { } /** * <p> * Initializes the Db4oRepository by accepting the map consist of properties * needed to setup the repository. This make sure repository-location property * has been defined and the value defined for this property is valid. * </p> * @param configProps Map contains the configuration properties. * * @throws ConfigurationException If repository-location property is not defined and * the value specified is invalid. * @throws IllegalArgumentException If given configProps is null. */ protected void init(Map configProps) { logger.trace("Entering init"); if(configProps==null) throw new IllegalArgumentException("Map to call the init cannot be null."); this.repositoryConfigProperties=new HashMap(configProps); String db4oFileName=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_DB4O_FILENAME); if(db4oFileName==null || "".equals(db4oFileName)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "db4o-filename is required for Db4oReposiotry implementation."); else { File repositoryFile=new File(db4oFileName); if(!repositoryFile.exists()) { try { boolean created=repositoryFile.createNewFile(); if(!created) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Attempt to create Db4o filename " + db4oFileName + " is failed."); } catch(IOException exception) { exception.printStackTrace(); logger.fatal("Exception while trying to create not nonexistent file = " + db4oFileName, exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Exception while trying to create non existing Db4o filename " + db4oFileName + ". Message = " + exception.getMessage()); } } else if(repositoryFile.isDirectory()) { throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Db4o file name " + db4oFileName + " defined is a directory. File name is expected."); } /** * Just to make sure, would be able to setup the repository. */ ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + repositoryFile.getAbsoluteFile() + " to setup repository."); container.close(); } logger.trace("Exiting init"); } /** * Creates the container by looking at the configuration from given Map. * * @configProps Configuration properties defined in repository configuration. * * @return Returns the Db4o object container reference. */ protected ObjectContainer createContainer(Map configProps) { String db4oFileName=(String)configProps.get(Db4oRepository.PROPERTY_DB4O_FILENAME); ObjectContainer container=Db4o.openFile(db4oFileName); return container; } /** * @see org.jmonks.batch.framework.repository Repository#sendDataToNextJob(String,String,Object) */ public boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final Object data) { logger.trace("Entering sendDataToNextJob);"); logger.debug("data identifier = " + dataIdentifier + " next job name = " + nextJobName + " data = " + data); if(dataIdentifier==null || nextJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); final String finalDataIdentifier=dataIdentifier; final String finalSourceJobName=this.jobName; final String finalNextJobName=nextJobName; boolean dataSaved=false; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) dataSaved=false; else { /** * Delete the entries exist with the identifier, source and target job names. */ ObjectSet dataTransferredSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && finalNextJobName.equals(jobDataTransfer.getTargetJobName())) return true; else return false; } }); while(dataTransferredSet.hasNext()) { container.delete(dataTransferredSet.next()); } container.commit(); logger.trace("deleted the data identified by " + dataIdentifier + " from the job name " + this.jobName + " to " + nextJobName); /** * Add the new entry. */ Db4oJobDataTransferHolder dataTransfer=new Db4oJobDataTransferHolder(dataIdentifier, this.jobName, nextJobName, data); container.set(dataTransfer); container.commit(); container.close(); logger.trace("data has been added with the identifier " + dataIdentifier + " from job name " + this.jobName); dataSaved=true; } logger.trace("Exiting sendDataToNextJob"); return dataSaved; } /** * @see org.jmonks.batch.framework.repository.Repository#getDataFromPreviousJob(String,String) */ public Object getDataFromPreviousJob(String dataIdentifier, String previousJobName) { logger.trace("Entering getDataFromPreviousJob"); logger.debug("data identifier = " + dataIdentifier + " target job name = " + previousJobName); if(dataIdentifier==null || previousJobName==null) throw new IllegalArgumentException("Data identifer and previous job name cannot be null " + "to get the data from previous job."); final String finalDataIdentifier=dataIdentifier; final String finalPreviousJobName=previousJobName; final String finalTargetJobName=this.jobName; Object data=null; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) data=null; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && finalPreviousJobName.equals(jobDataTransfer.getSourceJobName()) && finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) return true; else return false; } }); if(dataTransferResultSet.hasNext()) { data=((Db4oJobDataTransferHolder)dataTransferResultSet.next()).getData(); logger.debug("data identified by " + dataIdentifier + " has been found from the source job name " + previousJobName); } else data=null; container.close(); } logger.trace("Exiting getDataFromPreviousJob"); return data; } /** * @see org.jmonks.batch.framework.repository.Repository#clearDataTransferredToNextJob() */ public boolean clearDataTransferredFromThisJob() { logger.trace("Entering clearDataTransferredToNextJob"); final String finalJobName=this.jobName; boolean dataCleared=false; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) dataCleared=false; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { if(finalJobName.equals(jobDataTransfer.getSourceJobName())) { return true; } else return false; } }); while(dataTransferResultSet.hasNext()) container.delete(dataTransferResultSet.next()); logger.debug(jobName + " data has been cleared from the repository."); container.commit(); container.close(); dataCleared=true; } logger.trace("Exiting clearDataTransferredToNextJob"); return dataCleared; } /** * @see org.jmonks.batch.framework.repository.Repository#registerJobMgmtMntrInfo(Object) */ public boolean registerJobMgmtMntrInfo(final Object registrationInfo) { logger.trace("Entering registerJobMgmtMntrInfo"); logger.debug("registratinfo = " + registrationInfo); if(registrationInfo==null) throw new IllegalArgumentException("Job registration information cannot be null to register the job in repository."); boolean registered=true; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) registered=false; else { ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(this.jobName)); while(mgmtMntrInfoHolderResultSet.hasNext()) container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); logger.trace(this.jobName + " previous mgmt and mntr information has been deleted"); container.set(new Db4oJobMgmtMntrInfoHolder(this.jobName, registrationInfo)); container.commit(); container.close(); logger.trace(this.jobName + " mgmt and mntr information has been added to the repository"); registered=true; } logger.trace("Exiting registerJobMgmtMntrInfo"); return registered; } /** * @see org.jmonks.batch.framework.repository.Repository#unregisterJobMgmtMntrInfo() */ public boolean unregisterJobMgmtMntrInfo() { logger.trace("Entering unregisterJobMgmtMntrInfo"); boolean unregistered=false; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) unregistered=false; else { ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(this.jobName)); if(mgmtMntrInfoHolderResultSet.hasNext()) { container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); logger.debug(this.jobName + " mgmt and mntr information has been deleted."); unregistered=true; } else unregistered=false; container.close(); } logger.trace("Exiting unregisterJobMgmtMntrInfo"); return unregistered; } /** * * @see org.jmonks.batch.framework.repository.Repository#logStatistics(org.jmonks.batch.framework.JobStatistics) */ public boolean logStatistics(final JobStatistics statistics) { logger.trace("Entering logStatistics"); if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); if(!statistics.getJobname().equals(this.jobName)) throw new IllegalArgumentException("Statistics object is not related to the job configured for this repository."); boolean logged=false; ObjectContainer container=this.createContainer(this.repositoryConfigProperties); if(container==null) logged=false; else { container.set(statistics); container.commit(); logger.debug(statistics.getJobname() + " has been logged."); logged=true; container.close(); } logger.trace("Exiting logStatistics"); return logged; } } --- NEW FILE: Db4oJobMgmtMntrInfoHolder.java --- /* * Db4oJobMgmtMntrInfoHolder.java * * Created on March 15, 2006, 10:54 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; /** * Db4oJobMgmtMntrInfoHolder holds the job mgmt&mntr information and job name. * This will be used only by Db4oRepository. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobMgmtMntrInfoHolder { /** * Holds the job name */ private String jobName=null; /** * Holds the mgmtMntrInfo object */ private Object mgmtMntrInfo=null; /** * Constructor takes job name and mgmt & mntr info and constructs the object. */ Db4oJobMgmtMntrInfoHolder(String jobName,Object mgmtMntrInfo) { this.jobName=jobName; this.mgmtMntrInfo=mgmtMntrInfo; } /** * Returns the jobName. */ public String getJobName() { return this.jobName; } /** * Returns the mgmt & mntr object. */ public Object getMgmtMntrInfo() { return this.mgmtMntrInfo; } /** * <p> * Returns the string representation of Db4oJobMgmtMntrInfoHolder class in the format * <br> {Db4oJobMgmtMntrInfoHolder [jobName = value] [mgmtMntrInfo = value]} * </p> * * @return Returns the string representation of Db4oJobMgmtMntrInfoHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobMgmtMntrInfoHolder "); stringValue.append("[jobName = " + this.jobName + "]"); stringValue.append("[mgmtMntrInfo = " + this.mgmtMntrInfo + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oJobMgmtMntrInfoHolderPredicate.java --- /* * Db4oJobMgmtMntrInfoHolderPredicate.java * * Created on March 16, 2006, 7:23 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; import com.db4o.query.Predicate; /** * Db4oJobMgmtMntrInfoHolderPredicate used to find the Db4oJobMgmtMntrInfoHolder * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobMgmtMntrInfoHolderPredicate extends Predicate { /** * job name to find the job mgmt and mntr info objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobMgmtMntrInfoHolderPredicate with the job name. */ Db4oJobMgmtMntrInfoHolderPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null"); this.jobName=jobName; } /** * Method to run the the native query. This receives the Db4oJobMgmtMntrInfoHolder * objects and look for the job name this predicate initialized with. */ public boolean match(Db4oJobMgmtMntrInfoHolder holder) { if(jobName.equals(holder.getJobName())) return true; else return false; } } --- NEW FILE: Db4oJobStatisticsPredicate.java --- /* * Db4oJobStatisticsPredicate.java * * Created on March 16, 2006, 7:41 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; import com.db4o.query.Predicate; import org.jmonks.batch.framework.JobStatistics; /** * Db4oJobStatisticsPredicate used to find the JobStatistics * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobStatisticsPredicate extends Predicate { /** * job name to find the job statistics objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobStatisticsPredicate with the given job name. */ Db4oJobStatisticsPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null"); this.jobName=jobName; } /** * Method to run the the native query. This receives the JobStatistics * objects and look for the job name this predicate initialized with. */ public boolean match(JobStatistics statistics) { if(jobName.equals(statistics.getJobname())) return true; else return false; } } --- NEW FILE: ClientServerDb4oRepository.java --- /* * ClientServerDb4oRepository.java * * Created on September 14, 2006, 11:13 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; import com.db4o.Db4o; import com.db4o.ObjectContainer; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batch.framework.config.ConfigurationException; /** * <p> * ClientServerDb4oRepository access the Db4o Server and use it as a repository. * This requires the db4o server configuration in the repository configuration. * Framework provides a utility shell script to start the server. Following is an * example repository configuration to use Db4o in client and server mode. * <br><br> * <pre> * <repository-config repository-class-name="org.jmonks.batch.framework.repository.db4o.ClientServerDb4oRepository"> * <property key="db4o-server-name">server name or IP Address</property> * <property key="db4o-server-port">4545</property> * <property key="db4o-server-username">scott</property> * <property key="db4o-server-password">tiger</property> * </repository-config> * </pre> * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class ClientServerDb4oRepository extends Db4oRepository { private static Logger logger=Logger.getLogger(ClientServerDb4oRepository.class); /** * Property identifies the Db4o Server name which is <code>db4o-server-name</code>. */ public static final String PROPERTY_DB4O_SERVER_NAME = "db4o-server-name"; /** * Property identifies the Db4o Server port which is <code>db4o-server-port</code>. */ public static final String PROPERTY_DB4O_SERVER_PORT = "db4o-server-port"; /** * Property identifies the Db4o Server user name which is <code>db4o-server-username</code>. */ public static final String PROPERTY_DB4O_SERVER_USERNAME = "db4o-server-username"; /** * Property identifies the Db4o Server password which is <code>db4o-server-password</code>. */ public static final String PROPERTY_DB4O_SERVER_PASSWORD = "db4o-server-password"; /** * Enables the creation of the ClientServerDb4oRepository instance from the factory method. */ public ClientServerDb4oRepository() { } /** * <p> * Initializes the ClientServerDb4oRepository by accepting the map consist of properties * needed to access Db4o server. This make sure required properties like * <code>db4o-server-name</code>, <code>db4o-server-port</code>, * <code>db4o-server-username</code> and <code>db4o-server-password</code> have been defined * and the value defined for this property is valid. * </p> * * @param configProps Map contains the configuration properties. * * @throws ConfigurationException If any one of the required properties are not defined and * the value specified is invalid. * @throws IllegalArgumentException If given configProps is null. */ protected void init(Map configProps) { logger.trace("Entering init"); if(configProps==null) throw new IllegalArgumentException("Map to call the init cannot be null."); super.repositoryConfigProperties=new HashMap(configProps); String db4oServerName=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_NAME); String db4oServerPort=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_PORT); String db4oServerUserName=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_USERNAME); String db4oServerPassword=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_PASSWORD); if(db4oServerName==null || "".equals(db4oServerName) || db4oServerPort==null || "".equals(db4oServerPort) || db4oServerUserName==null || "".equals(db4oServerUserName) || db4oServerPassword==null || "".equals(db4oServerPassword)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Required properties to access Db4o server are missing."); else { /** * Just to make sure, would be able to setup the repository. */ ObjectContainer container=createContainer(super.repositoryConfigProperties); if(container==null) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to access the db4o server using given properites = " + super.repositoryConfigProperties); container.close(); } logger.trace("Exiting init"); } /** * @see org.jmonks.batch.framework.repository.db4o.Db4oRepository#createContainer(Map) */ protected ObjectContainer createContainer(Map configProps) { ObjectContainer container=null; try { String db4oServerName=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_NAME); int db4oServerPort=Integer.parseInt((String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_PORT)); String db4oServerUserName=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_USERNAME); String db4oServerPassword=(String)this.repositoryConfigProperties.get(ClientServerDb4oRepository.PROPERTY_DB4O_SERVER_PASSWORD); container=Db4o.openClient(db4oServerName, db4oServerPort, db4oServerUserName, db4oServerPassword); } catch(IOException exception) { exception.printStackTrace(); logger.fatal("IOException while opening the client with the configuration = " + configProps.toString(), exception); } return container; } } --- NEW FILE: Db4oJobDataTransferHolder.java --- /* * Db4oJobDataTransferHolder.java * * Created on March 15, 2006, 10:39 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.framework.repository.db4o; /** * <p> * Db4oJobDataTransferHolder holds the data being transferred between the jobs. * This will not have any functionality except holding the data and * this will be used to store in DB4O database. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oJobDataTransferHolder { /** * Holds the identifier by which jobs will communicated. */ private String dataIdentifier; /** * Source job name. */ private String sourceJobName; /** * Target job name, where data to be sent. */ private String targetJobName; /** * Data object. */ private Object data; /** * Constructor with all the argument to make this class immutable, * once it got created. */ Db4oJobDataTransferHolder(String dataIdentifer,String sourceJobName,String targetJobName,Object data) { this.dataIdentifier=dataIdentifer; this.sourceJobName=sourceJobName; this.targetJobName=targetJobName; this.data=data; } /** * Returns the data identifier. */ public String getDataIdentifier() { return this.dataIdentifier; } /** * Returns the source job name. */ public String getSourceJobName() { return this.sourceJobName; } /** * Returns the target job name. */ public String getTargetJobName() { return this.targetJobName; } /** * Returns the job data. */ public Object getData() { return this.data; } /** * <p> * Returns the string representation of Db4oJobDataTransferHolder class in the format * <br> {Db4oJobDataTransferHolder [dataIdentifier = value] [sourceJN = value] * [targetJN = value] [data = value]} * </p> * * @return Returns the string representation of Db4oJobDataTransferHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobDataTransferHolder "); stringValue.append("[dataIdentifier = " + this.dataIdentifier + "]"); stringValue.append("[sourceJobName = " + this.sourceJobName + "]"); stringValue.append("[targetJobName = " + this.targetJobName + "]"); stringValue.append("[Data = " + this.data + "]"); stringValue.append("}"); return stringValue.toString(); } } |