Package org.quartz

Examples of org.quartz.JobDataMap


        timerData.setScheduler(scheduler);
       
        Trigger trigger = timerData.getTrigger();
        trigger.setJobName(OPENEJB_TIMEOUT_JOB_NAME);
        trigger.setJobGroup(OPENEJB_TIMEOUT_JOB_GROUP_NAME);
        JobDataMap triggerDataMap = trigger.getJobDataMap();
        triggerDataMap.put(EjbTimeoutJob.EJB_TIMERS_SERVICE, this);
        triggerDataMap.put(EjbTimeoutJob.TIMER_DATA,timerData);
        try {
            scheduler.scheduleJob(trigger);
        } catch (Exception e) {
            //TODO Any other actions we could do ?
            log.warning("Could not schedule timer " + timerData, e);
View Full Code Here


     * @return A job data map.
     * @throws SchedulerException when something went wrong.
     */
    public JobDataMap createJobData(HttpServletRequest request)
        throws SchedulerException {
        JobDataMap map = new JobDataMap();
        String key = NamespaceMap.getFullName(LoadQuartzServlet.PREFIX, PARAMETER_DOCUMENT_URL);
        String documentUrl = request.getParameter(key);
        if (documentUrl == null) {
            throw new SchedulerException("Document URL must not be null!");
        }
        map.put(key, documentUrl);
        return map;
    }
View Full Code Here

     * Returns the document URL of a certain job.
     * @param jobDetail The job detail.
     * @return A string.
     */
    public String getDocumentUrl(JobDetail jobDetail) {
        JobDataMap map = jobDetail.getJobDataMap();
        NamespaceMap wrapper = new NamespaceMap(map, LoadQuartzServlet.PREFIX);
        String documentUrl = (String) wrapper.get(PARAMETER_DOCUMENT_URL);
        return documentUrl;
    }
View Full Code Here

     * Sets the document URL of a job.
     * @param jobDetail The job detail.
     * @param url The URL.
     */
    public void setDocumentUrl(JobDetail jobDetail, String url) {
        JobDataMap map = jobDetail.getJobDataMap();
        NamespaceMap wrapper = new NamespaceMap(map, LoadQuartzServlet.PREFIX);
        wrapper.put(PARAMETER_DOCUMENT_URL, url);
        jobDetail.setJobDataMap(map);
    }
View Full Code Here

            // 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);
View Full Code Here

     * @throws SchedulerException when something went wrong.
     */
    public JobDataMap createJobData(HttpServletRequest request)
        throws SchedulerException {
        log.debug("Creating job data map:");
        JobDataMap map = super.createJobData(request);

        Enumeration parameters = request.getParameterNames();
        Map wrapperMap = new HashMap();
        while (parameters.hasMoreElements()) {
            String key = (String) parameters.nextElement();
            Object value;
            String[] values = request.getParameterValues(key);
            if (values.length == 1) {
                value = values[0];
            }
            else {
                value = values;
            }
            wrapperMap.put(key, value);
        }

        map.putAll(stripPrefixes(wrapperMap));
        return map;
    }
View Full Code Here

       
        NamespaceHelper helper = SchedulerStore.getNamespaceHelper();
        DefaultTaskWrapper wrapper = new DefaultTaskWrapper(helper, jobElement);
        wrapper.getTaskParameters().setServletContextPath(servletContextPath);
       
        JobDataMap map = new JobDataMap(wrapper.getParameters());
        jobDetail.setJobDataMap(map);
       
        return jobDetail;
    }
View Full Code Here

    public void populateNormalizedMessage(NormalizedMessage message, JobExecutionContext context) throws JobExecutionException, MessagingException {
        message.setProperty(CONTEXT_KEY, context);
        JobDetail detail = context.getJobDetail();
        message.setProperty(DETAIL_KEY, detail);

        JobDataMap dataMap = detail.getJobDataMap();
        for (Iterator iter = dataMap.entrySet().iterator(); iter.hasNext(); ) {
            Map.Entry entry = (Map.Entry) iter.next();
            String key = (String) entry.getKey();
            Object value = entry.getValue();
            message.setProperty(key, value);
        }
View Full Code Here

      MessagingException {
    message.setProperty(CONTEXT_KEY, context);
    JobDetail detail = context.getJobDetail();
    message.setProperty(DETAIL_KEY, detail);

    JobDataMap dataMap = detail.getJobDataMap();
    for (Iterator iter = dataMap.entrySet().iterator(); iter.hasNext();) {
      Map.Entry entry = (Map.Entry) iter.next();
      String key = (String) entry.getKey();
      Object value = entry.getValue();
      message.setProperty(key, value);
    }
View Full Code Here

            BundleDeploymentStatusCheckJob.class.getName(), BundleDeploymentStatusCheckJob.class);
        jobDetail.setVolatility(false);
        jobDetail.setDurability(false);
        jobDetail.setRequestsRecovery(false);

        JobDataMap map = new JobDataMap();
        map.putAsString(BUNDLE_DEPLOYMENT_ID_KEY, bundleDeploymentId);

        jobDetail.setJobDataMap(map);

        return jobDetail;
    }
View Full Code Here

TOP

Related Classes of org.quartz.JobDataMap

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.