/**
   * @see org.opencms.module.I_CmsModuleAction#initialize(CmsObject cmsObject,
   *     CmsConfigurationManager cmsConfigurationManager, CmsModule cmsModule)
   */
  public void initialize(
      CmsObject cmsObject, CmsConfigurationManager cmsConfigurationManager, CmsModule cmsModule) {
    boolean isTransmitMaiJobThere = false;
    boolean isDeletionJobThere = false;
    TreeMap map = new TreeMap();
    CmsContextInfo context = new CmsContextInfo(cmsObject.getRequestContext());

    CmsScheduleManager scheduleManager = OpenCms.getScheduleManager();
    List jobs = scheduleManager.getJobs();
    Iterator jobsIter = jobs.iterator();
    while (jobsIter.hasNext()) {
      CmsScheduledJobInfo jobInfo = ((CmsScheduledJobInfo) jobsIter.next());
      log.debug("The name of the ScheduledClass is : " + jobInfo.getClassName());
      log.debug("The name of the ScheduledJob is : " + jobInfo.getJobName());
      if (jobInfo.getClassName().equals(CLASSNAME_TRANSMIT_MAIL)) {
        isTransmitMaiJobThere = true;
      }
      if (jobInfo.getClassName().equals(CLASSNAME_DELETION_JOB)) {
        isDeletionJobThere = true;
      }
    }
    // check if the necessary jobs are there or not
    if (!isDeletionJobThere) {
      try {
        // create a new schedule job at the opencms system to delete greeting cards from archive
        // after a specified time
        CmsScheduledJobInfo scheduleDeletionJob =
            new CmsScheduledJobInfo(
                null,
                JOBNAME_DELETION_JOB,
                CLASSNAME_DELETION_JOB,
                context,
                CRONEXPRESSION_DELETION_JOB,
                false,
                true,
                map);
        // add the new job to the schedule manager
        scheduleManager.scheduleJob(cmsObject, scheduleDeletionJob);
      } catch (CmsRoleViolationException ex) {
        log.error("Exception scheduling job", ex);
      } catch (CmsSchedulerException ex) {
        log.error("Exception scheduling job", ex);
      }
    }
    if (!isTransmitMaiJobThere) {
      try {
        // create a new schedule job at the opencms system to transmit mails at the specified
        // timestamp
        CmsScheduledJobInfo newScheduleJob =
            new CmsScheduledJobInfo(
                null,
                JOBNAME_TRANSMIT_MAIL,
                CLASSNAME_TRANSMIT_MAIL,
                context,
                CRONEXPRESSION_TRANSMIT_MAIL,
                false,
                true,
                map);
        // add the new job to the schedule manager
        scheduleManager.scheduleJob(cmsObject, newScheduleJob);
      } catch (CmsRoleViolationException ex) {
        log.error("Exception scheduling job", ex);
      } catch (CmsSchedulerException ex) {
        log.error("Exception scheduling job", ex);
      }
    }
  }