Scheduler.java
3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package com.sitech.schedule;
import java.util.Date;
import java.util.HashMap;
import com.sitech.ismp.messageObject.AgentSyncObject;
public class Scheduler {
private String agentId;
private String mbeanId;
private String objectName;
private String className;
private String scheduleId;
private String function;
private Date beginTime;
private Date endTime;
private int repeatCount;
private long interval;
private String crontab;
private HashMap<String, String> params;
public Scheduler(AgentSyncObject obj) {
this.agentId = obj.getAgentId();
this.mbeanId = obj.getMbeanId();
this.objectName = obj.getObjectName();
this.className = obj.getClassName();
this.scheduleId = obj.getScheduleId();
this.function = obj.getFunction();
this.beginTime = obj.getBeginTime();
this.endTime = obj.getEndTime();
this.repeatCount = obj.getRepeatCount();
this.interval = obj.getInterval();
this.crontab = obj.getCrontab();
this.params = obj.getParams();
}
public String toString() {
return "OBJECT_NAME={" + objectName + "},CLASS_NAME={" + className
+ "},SCHEDULE_ID={" + scheduleId + "},FUNCTION={" + function
+ "},INTERVAL{" + interval + "},CRONTAB={" + crontab
+ "},PARAMS=" + params.toString();
}
public Scheduler() {
}
public boolean equals(Scheduler scheduler) {
if (scheduler == null) {
return false;
}
try {
if (!scheduler.getObjectName().equals(this.objectName)) {
return false;
}
if (!scheduler.getClassName().equals(this.className)) {
return false;
}
if (!scheduler.getFunction().equals(this.function)) {
return false;
}
if (scheduler.getInterval() != this.interval) {
return false;
}
for (String key : scheduler.getParams().keySet()) {
if (this.params.get(key) == null
|| !this.params.get(key).equals(
scheduler.getParams().get(key))) {
return false;
}
}
return true;
} catch (Exception e) {
return false;
}
}
public String getAgentId() {
return agentId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getMbeanId() {
return mbeanId;
}
public void setMbeanId(String mbeanId) {
this.mbeanId = mbeanId;
}
public String getObjectName() {
return objectName;
}
public void setObjectName(String objectName) {
this.objectName = objectName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getScheduleId() {
return scheduleId;
}
public void setScheduleId(String scheduleId) {
this.scheduleId = scheduleId;
}
public String getFunction() {
return function;
}
public void setFunction(String function) {
this.function = function;
}
public Date getBeginTime() {
return beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public int getRepeatCount() {
return repeatCount;
}
public void setRepeatCount(int repeatCount) {
this.repeatCount = repeatCount;
}
public long getInterval() {
return interval;
}
public void setInterval(long interval) {
this.interval = interval;
}
public String getCrontab() {
return crontab == null ? "" : crontab;
}
public void setCrontab(String crontab) {
this.crontab = crontab;
}
public HashMap<String, String> getParams() {
return params;
}
public void setParams(HashMap<String, String> params) {
this.params = params;
}
}