[opencms-dev] Can´t schedule customized Job (solved)

Celio Faria Jr celiofariajr at gmail.com
Sun Jan 13 05:24:53 CET 2008


Hi all,

problem solved. The cron expression was wrong, and the code was changed to
use the OpenCms "default" schedule manager:

        CmsScheduledJobInfo csji = new CmsScheduledJobInfo();

        // Changed to use the OpenCms "default" schedule manager
        CmsScheduleManager csm =OpenCms.getScheduleManager();

        csm.initialize(cmsObject);

        CmsContextInfo cci = new CmsContextInfo(cmsJspBean.getRequestContext());

        csji.setCronExpression(getCronExpression());
        csji.setClassName("br.portalconhecimento.scheduling.PJob");

        csji.setActive(true);
        csji.setContextInfo(cci);
        csji
                .setJobName(new StringBuilder("PAnalysis[").append(
                        cmsUser.getId()).append("][").append(cmsVfsFileURL)
                        .append("][").append(
                                new SimpleDateFormat(DATE_FORMAT_BR)
                                        .format(new Date())).toString());

        SortedMap parametros = new TreeMap();
        parametros.put (PJob.PARAM_USER, cmsUser);
        parametros.put(PJob.PARAM_FILE, cmsVfsFileURL);
        parametros.put(PJob.PARAM_NOTIFY_END_OF_JOB, notifyEndOfJob);

        csji.setParameters(parametros);

Thanks again,

Celio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080113/dd5601cb/attachment.htm>


More information about the opencms-dev mailing list