Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/controller/pool AbstractPoolJobLo
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-03 04:19:59
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30411/controller/pool Added Files: AbstractPoolJobLoader.java AbstractPoolJobProcessor.java CollectionJobPool.java DefaultCollectionJobPool.java JobPool.java OrderedCollectionJobPool.java PoolJobController.java PoolJobLoader.java PoolJobProcessor.java Log Message: Submitting the class skeltons --- NEW FILE: PoolJobLoader.java --- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.config.*; /** * Loader is the one which loads the job data into the pool. This inteface defines the responsibilites of the loader and some of these responsibilities will be implemented by AbstractPoolJobLoader. * * @author : Suresh Pragada * @version 1.0 */ public interface PoolJobLoader { public void initialize(org.jmonks.batchserver.framework.controller.pool.JobPool pool, org.jmonks.batchserver.framework.config.PoolJobLoaderConfig config); public void cleanup(); public int loadPool(); public boolean suspend(); public boolean resume(); public boolean stop(); public int getTotalRecords(); public Object getLoaderState(); public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool); } --- NEW FILE: JobPool.java --- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.config.*; /** * <p> * Pool provides the interface to load the job information into it and retrieves the job information from the pool. * </p> * * @author : Suresh Pragada * @version 1.0 */ public interface JobPool { public boolean loadJobData(Object jobData); public Object getNextJobData(); public void initialize(org.jmonks.batchserver.framework.config.JobPoolConfig config); public void cleanup(); public int getLoadedCount(); public void getProcessedCount(); } --- NEW FILE: AbstractPoolJobProcessor.java --- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.*; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.controller.pool; /** * <p> * Abstract job processor implements some of responsiblites defined by the job processor and leaves the application specific functionality implementation to the final processor. * </p> * @author : Suresh Pragada * @version 1.0 */ public abstract class AbstractPoolJobProcessor implements PoolJobProcessor { private JobPool mJobPool; public AbstractPoolJobProcessor() { } public abstract void initialize(org.jmonks.batchserver.framework.config.PoolJobProcessorConfig config); public boolean suspend() { return true; } public boolean resume() { return true; } public boolean stop() { return true; } public void initialize(org.jmonks.batchserver.framework.controller.pool.JobPool pool, org.jmonks.batchserver.framework.config.PoolJobProcessorConfig config) { } public abstract void cleanup(); public int processPool() { return 0; } public Object getProcessorState() { return null; } public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool) { } } --- NEW FILE: PoolJobProcessor.java --- package org.jmonks.batchserver.framework.controller.pool; /** * Processor is the one which processes the job data. This interface defines the responsiblities of the job processor. * * @author : Suresh pragada * @version 1.0 */ public interface PoolJobProcessor { public boolean suspend(); public boolean resume(); public boolean stop(); public void initialize(org.jmonks.batchserver.framework.controller.pool.JobPool pool, org.jmonks.batchserver.framework.config.PoolJobProcessorConfig config); public void cleanup(); public int processPool(); public Object getProcessorState(); public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool); } --- NEW FILE: DefaultCollectionJobPool.java --- package org.jmonks.batchserver.framework.controller.pool; /** * <p> * This is the default pool implementation for the PoolJobController. This provides the basic pool functionality using java utility collection. This uses the ArrayList for its implementation. * </p> * @author : Suresh Pragada * @version 1.0 */ public class DefaultCollectionJobPool extends CollectionJobPool { public DefaultCollectionJobPool() { } public List getCollection() { return null; } } --- NEW FILE: AbstractPoolJobLoader.java --- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.controller.pool; /** * AbstractPoolJobLoader does the basic implementation of the job loader responsibilities by leaving the job specific functionality implementation to the final loader. * * @author : Suresh Pragada * @version 1.0 */ public abstract class AbstractPoolJobLoader implements PoolJobLoader { private JobPool mJobPool; public AbstractPoolJobLoader() { } public abstract int loadJobData(); public abstract void initialize(org.jmonks.batchserver.framework.config.PoolJobLoaderConfig config); public abstract Object getNextLoadableJobData(); public void initialize(org.jmonks.batchserver.framework.controller.pool.JobPool pool, org.jmonks.batchserver.framework.config.PoolJobLoaderConfig config) { } public abstract void cleanup(); public int loadPool() { return 0; } public boolean suspend() { return true; } public boolean resume() { return true; } public boolean stop() { return true; } public abstract int getTotalRecords(); public Object getLoaderState() { return null; } public void initialize(Map configProps, org.jmonks.batchserver.framework.controller.pool.JobPool pool) { } } --- NEW FILE: OrderedCollectionJobPool.java --- package org.jmonks.batchserver.framework.controller.pool; /** * <p> * This provides the information to and from the pool based on the order. This uses the LinkedList as its collection. * </p> * * @author : Suresh Pragada * @version 1.0 */ public class OrderedCollectionJobPool extends CollectionJobPool { public OrderedCollectionJobPool() { } public List getCollection() { return null; } } --- NEW FILE: PoolJobController.java --- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.*; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.controller.*; import org.jmonks.batchserver.framework.mgmtmntr.*; import org.jmonks.batchserver.framework.common.*; /** * <p> * PoolJobController provides the job architecture based on the pool concept, where a loader is load all the information to be processed into the pool and processors(>=1) retrieves this information from pool and process them. As this subclasses the abstract JobController, it implements all the management and monitoring methods. It provides the abstract loader and processor classes to be overriden by job implementation and comes with different implementation of pools. * <br><br> * To write any job using this controller, developer needs to write a loader class extends AbstractPoolJobLoader, which loads the data needs to be processed into the pool and write a processor class extending the AbstractPoolJobProcessor, which process the data from the pool. * Once implementation is done, this job should be configured either using the XML configuration or DB configuration. * * <br><br> * XML Configuration is as follows <br><br> * <pre> * <job-config job-name="process_file_abc"> * <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" * controller-config-class-name="org.jmonks.batchserver.framework.config.PoolControllerConfig"> * <job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> * <property key="loader-info1">loader-value1</property> * </job-loader> * <job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> * <thread-count>1</thread-count> * <property key="processor-info1">processor-value1</property> * </job-processor> * <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.DefaultJobPool"> * <property key="pool-size">50000</property> * </job-pool> * <property key="controller-info1">controller-value1</property> * </job-controller> * <job-logging-config> * <logging-property-file>com.mycompany.batch.processfileabc.Logging</logging-property-file> * </job-logging-config> * </job-config> * </pre> * </p> * @author : Suresh Pragada * @version 1.0 */ public class PoolJobController extends JobController { private PoolJobProcessor mJobProcessor; private JobPool mJobPool; private PoolJobLoader mPoolJobLoader; public PoolJobController(JobControllerConfig config) { } public org.jmonks.batchserver.framework.common.StatusCode process() { return null; } /** * Returns the total number of records this job gonna process. This information will be obtained from the pool loader. * * @return Returns the number of records this job gonna process. */ public int getExpectedRecordsCount() { return 0; } /** * Number of records this job processed so far. This information will be obtained from the pool. * * @return Returns the number of records processed so far. */ public int getProcessedRecordsCount() { return 0; } /** * Returns the number of threads creates to process this job. This includes each thread for loader and pool and the specified number of threads for the processor. * * @return Returns the number of threads controller created to process this job. */ public String getThreadIDList() { return null; } /** * Returns the current state of the thread. * * @param threadNo Thread number. * @return Retuns the current state of the thread. */ public org.jmonks.batchserver.framework.mgmtmntr.ThreadState getThreadState(String threadID) { return null; } /** * Returns the status of the job. * * @return Returns the status of the job. */ public org.jmonks.batchserver.framework.mgmtmntr.JobStatus getJobStatus() { return null; } /** * This calls the stop method on the loader processor and persists the loader, pool and processor, if restart flag is true and return with appropriate return code. */ public boolean stop(boolean restart) { return true; } /** * This calls the suspend on the loader and processor threads. * * @return Returns true, if it could suspend the processes, false, otherwise. */ public boolean suspend() { return true; } /** * This would resume the job. * * @return Returns true, if it could resume the job, false otherwise. */ public boolean resume() { return true; } /** * @see org.jmonks.batchserver.framework.controller.JobController#readObject(ObjectInputStream) */ public void readObject(java.io.ObjectInputStream inputStream) { } /** * @see org.jmonks.batchserver.framework.controller.JobController#writeObject(ObjectOutputStream) */ public void writeObject(java.io.ObjectOutputStream outputStream) { } } --- NEW FILE: CollectionJobPool.java --- package org.jmonks.batchserver.framework.controller.pool; /** * <p> * This provides the pool implementaiton using java utility collections. This is the default implementatio of pool, unless developer configured an another one. * </p> * * @author : Suresh Pragada * @version 1.0 */ public abstract class CollectionJobPool implements JobPool { public CollectionJobPool() { } public abstract List getCollection(); public boolean loadJobData(Object jobData) { return true; } public Object getNextJobData() { return null; } public void initialize(org.jmonks.batchserver.framework.config.JobPoolConfig config) { } public void cleanup() { } public int getLoadedCount() { return 0; } public void getProcessedCount() { } } |