KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > xml > JobSchedulingBundle


1 /*
2  * Copyright 2004-2005 OpenSymphony
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy
6  * of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations
14  * under the License.
15  *
16  */

17
18 /*
19  * Previously Copyright (c) 2001-2004 James House
20  */

21 package org.quartz.xml;
22
23 import java.util.ArrayList JavaDoc;
24 import java.util.Date JavaDoc;
25 import java.util.List JavaDoc;
26
27 import org.quartz.JobDetail;
28 import org.quartz.Trigger;
29
30 /**
31  * Wraps a <code>JobDetail</code> and <code>Trigger</code>.
32  *
33  * @author <a HREF="mailto:bonhamcm@thirdeyeconsulting.com">Chris Bonham</a>
34  * @author James House
35  */

36 public class JobSchedulingBundle {
37     /*
38      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39      *
40      * Data members.
41      *
42      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43      */

44
45     protected JobDetail jobDetail;
46
47     protected List JavaDoc triggers = new ArrayList JavaDoc();
48
49     /*
50      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51      *
52      * Constructors.
53      *
54      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55      */

56
57     public JobSchedulingBundle() {
58     }
59
60     /*
61      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62      *
63      * Interface.
64      *
65      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66      */

67
68     public JobDetail getJobDetail() {
69         return jobDetail;
70     }
71
72     public void setJobDetail(JobDetail jobDetail) {
73         this.jobDetail = jobDetail;
74     }
75
76     public List JavaDoc getTriggers() {
77         return triggers;
78     }
79     
80     public void setTriggers(List JavaDoc triggers) {
81         this.triggers = triggers;
82     }
83
84     public void addTrigger(Trigger trigger) {
85         if (trigger.getStartTime() == null) {
86             trigger.setStartTime(new Date JavaDoc());
87         }
88         
89         triggers.add(trigger);
90     }
91     
92     public void removeTrigger(Trigger trigger) {
93         triggers.remove(trigger);
94     }
95
96     public String JavaDoc getName() {
97         if (getJobDetail() != null) {
98             return getJobDetail().getName();
99         } else {
100             return null;
101         }
102     }
103     public String JavaDoc getFullName() {
104         if (getJobDetail() != null) {
105             return getJobDetail().getFullName();
106         } else {
107             return null;
108         }
109     }
110
111
112     public boolean isValid() {
113         return ((getJobDetail() != null) && (getTriggers() != null));
114     }
115 }
116
Popular Tags