Package org.quartz

Examples of org.quartz.SchedulerException


            jobElement.setAttribute(ATTRIBUTE_DOCUMENT_URL, documentUrl);
           
            return jobElement;
        } catch (final DOMException e) {
            log.error("" +e.toString());
            throw new SchedulerException(e);
        }
    }
View Full Code Here


     */
    public void addJob(String jobGroup, Date startTime, HttpServletRequest request)
        throws SchedulerException {

        if (jobGroup == null) {
            throw new SchedulerException("Job group must not be null!");
        }

        try {
            log.debug("----------------------------------------------");
            log.debug("Adding Job for group [" + jobGroup + "]");

            // FIXME: more flexible
            Class jobClass = TaskJob.class;

            ServletJob job = ServletJobFactory.createJob(jobClass);
            JobDataMap map = job.createJobData(request);

            addJob(jobGroup, startTime, jobClass, map);
        } catch (final SchedulerException e) {
            log.error("Adding job failed: ", e);
            throw new SchedulerException(e);
        } catch (final PublicationException e) {
            log.error("Adding job failed: ", e);
            throw new SchedulerException(e);
        }
    }
View Full Code Here

        try {
            element = getStore().createSnapshot(helper, getPublication(group), jobs);
        } catch (SchedulerException e) {
            throw e;
        } catch (PublicationException e) {
            throw new SchedulerException(e);
        }
        return element;
    }
View Full Code Here

                    addJob(jobs[i].getJobDetail());
                }
            }
        } catch (final SchedulerException e) {
            log.error("" +e.toString());
            throw new SchedulerException(e);
        } catch (final PublicationException e) {
            log.error("" +e.toString());
            throw new SchedulerException(e);
        }

    }
View Full Code Here

        throws SchedulerException {
        log.debug("Modifying job [" + _jobId + "][" + jobGroup + "]");

        JobDetail jobDetail = getScheduler().getJobDetail(_jobId, jobGroup);
        if (jobDetail == null) {
            throw new SchedulerException("Job not found!");
        }

        Trigger trigger = getTrigger(jobDetail.getName(), jobGroup);
        if (trigger == null) {
            log.debug("    No trigger found.");
        } else {
            log.debug("    Trigger found. Setting new start time.");
            jobDetail.setDurability(true);
            if (startTime.after(new GregorianCalendar().getTime())) {
                log.debug("    Start time is in future - re-scheduling job.");
                getScheduler().unscheduleJob(trigger.getName(), trigger.getGroup());
                trigger = TriggerHelper.createSimpleTrigger(_jobId, jobGroup, startTime);
                getScheduler().scheduleJob(trigger);
            } else {
                log.debug("    Start time has already expired - deleting job.");
                getScheduler().deleteJob(_jobId, jobGroup);
            }
            try {
                getStore().writeSnapshot(getPublication(jobGroup), getJobWrappers(jobGroup));
            } catch (SchedulerException e) {
                throw e;
            } catch (PublicationException e) {
                throw new SchedulerException(e);
            }
        }
    }
View Full Code Here

            if (jobsFile.createNewFile()) log.debug("new jobs file created.");
            DocumentHelper.writeDocument(getSnapshot(publication, jobs), jobsFile);
        } catch (final TransformerConfigurationException e) {
            log.error("Writing job snapshot failed: ", e);
            throw new SchedulerException(e);
        } catch (final IOException e) {
            log.error("Writing job snapshot failed: ", e);
            throw new SchedulerException(e);
        } catch (final TransformerException e) {
            log.error("Writing job snapshot failed: ", e);
            throw new SchedulerException(e);
        } catch (final SchedulerException e) {
            log.error("Writing job snapshot failed: ", e);
            throw new SchedulerException(e);
        }

    }
View Full Code Here

            Element[] jobElements = getJobElements(publication);
            Document document;
            try {
                document = DocumentHelper.readDocument(jobsFile);
            } catch (Exception e) {
                throw new SchedulerException(e);
            }
            NamespaceHelper helper = SchedulerStore.getNamespaceHelper(document);

            for (int i = 0; i < jobElements.length; i++) {
                wrappers.add(restoreJob(helper, jobElements[i], publication));
View Full Code Here

                }
            }
            wrapper = new JobWrapper(jobDetail, trigger);

        } catch (Exception e) {
            throw new SchedulerException(e);
        }
        return wrapper;
    }
View Full Code Here

                NamespaceHelper helper = SchedulerStore.getNamespaceHelper(document);

                Element jobGroupElement =
                    helper.getFirstChild(schedulerElement, SchedulerStore.ELEMENT_JOB_GROUP);
                if (jobGroupElement == null) {
                    throw new SchedulerException("No <job-group> element found!");
                }

                String jobGroupAttribute = jobGroupElement.getAttribute("name");

                if (!jobGroupAttribute.equals(publication.getId())) {
                    throw new SchedulerException(
                        "The jobs.xml file contains a wrong job group: ["
                            + jobGroupAttribute
                            + "]");
                }
                jobElements = helper.getChildren(jobGroupElement, SchedulerStore.ELEMENT_JOB);

            } else {
                throw new SchedulerException(
                    "The jobs file [" + jobsFile.getAbsolutePath() + "] does not exist!");
            }
        } catch (SchedulerException e) {
            throw e;
        } catch (Exception e) {
            throw new SchedulerException(e);
        }
        return jobElements;
    }
View Full Code Here

    private SchedulerServiceMBean getSchedulerService() throws SchedulerException {
        try {
            return MBeanServerInvocationHandler.newProxyInstance(
                ManagementFactory.getPlatformMBeanServer(), SCHEDULER_MBEAN_NAME, SchedulerServiceMBean.class, false);
        } catch (Exception e) {
            throw new SchedulerException("Failed to get a proxy to the scheduler service MBean", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.quartz.SchedulerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.