/**
  * Instantiates a new job.
  *
  * @param cfg the {@link DomainConfiguration} being processed
  * @param harvest the {@link HarvestDefinition} being processed
  * @return an instance of {@link Job}
  */
 public static Job getNewJob(HarvestDefinition harvest, DomainConfiguration cfg) {
   HarvestChannelDAO harvestChannelDao = HarvestChannelDAO.getInstance();
   HarvestChannel channel = harvestChannelDao.getChannelForHarvestDefinition(harvest.getOid());
   if (channel == null) {
     log.info(
         "No channel mapping registered for harvest id "
             + harvest.getOid()
             + ", will use default.");
     channel = harvestChannelDao.getDefaultChannel(harvest.isSnapShot());
   }
   if (harvest.isSnapShot()) {
     return Job.createSnapShotJob(
         harvest.getOid(),
         channel,
         cfg,
         harvest.getMaxCountObjects(),
         harvest.getMaxBytes(),
         ((FullHarvest) harvest).getMaxJobRunningTime(),
         harvest.getNumEvents());
   }
   return Job.createJob(harvest.getOid(), channel, cfg, harvest.getNumEvents());
 }
  /**
   * Creates the components handling the harvest job management and hooks them up to the <code>
   * HarvestJobManager</code>s lifecycle.
   */
  public HarvestJobManager() {
    jmsConnection = JMSConnectionFactory.getInstance();
    JobDispatcher jobDispather =
        new JobDispatcher(jmsConnection, HarvestDefinitionDAO.getInstance(), JobDAO.getInstance());
    HarvestChannelRegistry harvestChannelRegistry = new HarvestChannelRegistry();

    addChild(
        new HarvesterStatusReceiver(
            jobDispather, jmsConnection, HarvestChannelDAO.getInstance(), harvestChannelRegistry));

    addChild(new HarvestJobGenerator(harvestChannelRegistry));

    addChild(new HarvestSchedulerMonitorServer());

    addChild(new JobSupervisor());
  }