KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > utils > TriggerStatus


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
22 package org.quartz.utils;
23
24 import java.util.Date JavaDoc;
25
26 /**
27  * <p>
28  * Object representing a job or trigger key.
29  * </p>
30  *
31  * @author James House
32  */

33 public class TriggerStatus extends Pair {
34
35     // TODO: Repackage under spi or root pkg ?, put status constants here.
36
/*
37      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38      *
39      * Data members.
40      *
41      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42      */

43
44     private Key key;
45
46     private Key jobKey;
47
48     /*
49      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50      *
51      * Constructors.
52      *
53      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54      */

55
56     /**
57      * Construct a new TriggerStatus with the status name and nextFireTime.
58      *
59      * @param status
60      * the trigger's status
61      * @param nextFireTime
62      * the next time the trigger will fire
63      */

64     public TriggerStatus(String JavaDoc status, Date JavaDoc nextFireTime) {
65         super();
66         super.setFirst(status);
67         super.setSecond(nextFireTime);
68     }
69
70     /*
71      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72      *
73      * Interface.
74      *
75      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76      */

77
78     public Key getJobKey() {
79         return jobKey;
80     }
81
82     public void setJobKey(Key jobKey) {
83         this.jobKey = jobKey;
84     }
85
86     public Key getKey() {
87         return key;
88     }
89
90     public void setKey(Key key) {
91         this.key = key;
92     }
93
94     /**
95      * <p>
96      * Get the name portion of the key.
97      * </p>
98      *
99      * @return the name
100      */

101     public String JavaDoc getStatus() {
102         return (String JavaDoc) getFirst();
103     }
104
105     /**
106      * <p>
107      * Get the group portion of the key.
108      * </p>
109      *
110      * @return the group
111      */

112     public Date JavaDoc getNextFireTime() {
113         return (Date JavaDoc) getSecond();
114     }
115
116     /**
117      * <p>
118      * Return the string representation of the TriggerStatus.
119      * </p>
120      *
121      */

122     public String JavaDoc toString() {
123         return "status: " + getStatus() + ", next Fire = " + getNextFireTime();
124     }
125 }
126
127 // EOF
128
Popular Tags