001: /*
002: * Copyright 2004-2005 OpenSymphony
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy
006: * of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations
014: * under the License.
015: *
016: */
017:
018: /*
019: * Previously Copyright (c) 2001-2004 James House
020: */
021:
022: package org.quartz.utils;
023:
024: import java.util.Date;
025:
026: /**
027: * <p>
028: * Object representing a job or trigger key.
029: * </p>
030: *
031: * @author James House
032: */
033: public class TriggerStatus extends Pair {
034:
035: // TODO: Repackage under spi or root pkg ?, put status constants here.
036: /*
037: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
038: *
039: * Data members.
040: *
041: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
042: */
043:
044: private Key key;
045:
046: private Key jobKey;
047:
048: /*
049: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
050: *
051: * Constructors.
052: *
053: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
054: */
055:
056: /**
057: * Construct a new TriggerStatus with the status name and nextFireTime.
058: *
059: * @param status
060: * the trigger's status
061: * @param nextFireTime
062: * the next time the trigger will fire
063: */
064: public TriggerStatus(String status, Date nextFireTime) {
065: super ();
066: super .setFirst(status);
067: super .setSecond(nextFireTime);
068: }
069:
070: /*
071: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
072: *
073: * Interface.
074: *
075: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
076: */
077:
078: public Key getJobKey() {
079: return jobKey;
080: }
081:
082: public void setJobKey(Key jobKey) {
083: this .jobKey = jobKey;
084: }
085:
086: public Key getKey() {
087: return key;
088: }
089:
090: public void setKey(Key key) {
091: this .key = key;
092: }
093:
094: /**
095: * <p>
096: * Get the name portion of the key.
097: * </p>
098: *
099: * @return the name
100: */
101: public String getStatus() {
102: return (String) 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 getNextFireTime() {
113: return (Date) getSecond();
114: }
115:
116: /**
117: * <p>
118: * Return the string representation of the TriggerStatus.
119: * </p>
120: *
121: */
122: public String toString() {
123: return "status: " + getStatus() + ", next Fire = "
124: + getNextFireTime();
125: }
126: }
127:
128: // EOF
|