01: /**
02: * EasyBeans
03: * Copyright (C) 2007 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: EasyBeansJobDetail.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.component.quartz;
25:
26: import org.quartz.JobDataMap;
27: import org.quartz.JobDetail;
28:
29: /**
30: * This class is used to give more parameters to the Invoker Job. It extends the
31: * basic class and then add some info in the JobDataMap.
32: * @author Florent Benoit
33: */
34: public class EasyBeansJobDetail extends JobDetail {
35:
36: /**
37: * Serial version UID for serializable classes.
38: */
39: private static final long serialVersionUID = 5194296209118376082L;
40:
41: /**
42: * Key for the data that are stored in the Job Data Map.
43: */
44: public static final String DATA_KEY = "data";
45:
46: /**
47: * Create an EasyBeans Job Detail by specifying a given name, group and data.
48: * The EasyBeansJob class will be used as Job.
49: * @param name the name of this job detail
50: * @param group the group of this job detail
51: * @param jobDetailData The data that are stored in the job detail. It allows to get the
52: * serializable info object that can be given by the user and to retrieve
53: * the right bean.
54: */
55: public EasyBeansJobDetail(final String name, final String group,
56: final EasyBeansJobDetailData jobDetailData) {
57: super (name, group, EasyBeansJob.class);
58:
59: // Get the data map (that is built if null)
60: JobDataMap jobDataMap = getJobDataMap();
61:
62: // Add the data for this job
63: jobDataMap.put(DATA_KEY, jobDetailData);
64:
65: }
66:
67: /**
68: * Gets the data for this Job Detail.
69: * @return the data for this job detail.
70: */
71: public EasyBeansJobDetailData getJobDetailData() {
72: return (EasyBeansJobDetailData) getJobDataMap().get(DATA_KEY);
73: }
74:
75: }
|