diff --git a/src/main/java/altk/comm/engine/Broadcast.java b/src/main/java/altk/comm/engine/Broadcast.java
index 28c3fdc..ed97912 100644
--- a/src/main/java/altk/comm/engine/Broadcast.java
+++ b/src/main/java/altk/comm/engine/Broadcast.java
@@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
+import org.json.simple.JSONObject;
import altk.comm.engine.Job.JobStatus;
import altk.comm.engine.exception.BroadcastError;
@@ -38,6 +39,7 @@ public abstract class Broadcast
private static final int SCHEDULER_THREAD_POOL_SIZE = 5;
private static final String ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT = "activity_record_id";
private static final long SLEEP_BETWEEN_JOBS_DEFAULT = 0;
+
public final String broadcastType;
private String broadcastId;
@@ -63,8 +65,8 @@ public abstract class Broadcast
protected String postbackURL;
private Postback postback;
public long expireTime;
- protected String clock_24hr_resume;
- protected String clock_24hr_pause;
+ protected String daily_resume = "";
+ protected String daily_pause = "";
/**
* Sleep time in milliseconds between consecutive job processing (actualliy batch)
@@ -238,7 +240,7 @@ public abstract class Broadcast
BroadcastState.RUNNING, // User action
BroadcastState.COMPLETED,
BroadcastState.ABORTING,
- BroadcastState.CANCELED, // User action
+ BroadcastState.CANCELING, // User action
BroadcastState.PAUSED,
BroadcastState.PURGED // User action
));
@@ -888,6 +890,8 @@ public abstract class Broadcast
"' ready='" + getPendingJobCount() + "'");
statusBf.append(" active='" + getActiveJobCount() + "'");
statusBf.append(">");
+ statusBf.append("" + daily_pause + "\n");
+ statusBf.append("" + daily_resume + "\n");
statusBf.append(additionalStatusXML());
statusBf.append("" + topLevelTag + ">");
String statusReport = statusBf.toString();
@@ -1405,4 +1409,42 @@ public abstract class Broadcast
}
}
+ /**
+ * @return null or configuration in XML
+ */
+ public String getConfigXML()
+ {
+ StringBuffer configBuf = new StringBuffer();
+ configBuf.append("");
+ configBuf.append("<" + CommEngine.DAILY_PAUSE_KEY + ">" + daily_pause + "" + CommEngine.DAILY_PAUSE_KEY + ">");
+ configBuf.append("<" + CommEngine.DAILY_RESUME_KEY + ">" + daily_resume + "" + CommEngine.DAILY_RESUME_KEY + ">");
+ configBuf.append("");
+ return configBuf.toString();
+ }
+
+ public void configure(JSONObject configuration) throws Exception {
+ String value, timeOfDay, key;
+ key = CommEngine.DAILY_PAUSE_KEY;
+ value = (String)configuration.get(key);
+ if (value != null) {
+ timeOfDay = CommEngine.checkTimeOfDay(value);
+ if (timeOfDay == null) throw new Exception(String.format("Invalid value for %s: %s", key, value));
+ daily_pause = timeOfDay;
+ }
+ key = CommEngine.DAILY_RESUME_KEY;
+ value = (String)configuration.get(key);
+ if (value != null) {
+ timeOfDay = CommEngine.checkTimeOfDay(value);
+ if (timeOfDay == null) throw new Exception(String.format("Invalid value for %s: %s", key, value));
+ daily_resume = timeOfDay;
+ }
+ }
+
+ public JSONObject getConfigJSON() {
+ Map