}
sb.append(t);
}
topics = sb.toString();
}
Statistics s = this.jobManager.getStatistics();
pw.printf("<tr><td>Start Time</td><td>%s</td></tr>", formatDate(s.getStartTime()));
pw.printf("<tr><td>Local topic consumers: </td><td>%s</td></tr>", topics);
pw.printf("<tr><td>Last Activated</td><td>%s</td></tr>", formatDate(s.getLastActivatedJobTime()));
pw.printf("<tr><td>Last Finished</td><td>%s</td></tr>", formatDate(s.getLastFinishedJobTime()));
pw.printf("<tr><td>Queued Jobs</td><td>%s</td></tr>", s.getNumberOfQueuedJobs());
pw.printf("<tr><td>Active Jobs</td><td>%s</td></tr>", s.getNumberOfActiveJobs());
pw.printf("<tr><td>Jobs</td><td>%s</td></tr>", s.getNumberOfJobs());
pw.printf("<tr><td>Finished Jobs</td><td>%s</td></tr>", s.getNumberOfFinishedJobs());
pw.printf("<tr><td>Failed Jobs</td><td>%s</td></tr>", s.getNumberOfFailedJobs());
pw.printf("<tr><td>Cancelled Jobs</td><td>%s</td></tr>", s.getNumberOfCancelledJobs());
pw.printf("<tr><td>Processed Jobs</td><td>%s</td></tr>", s.getNumberOfProcessedJobs());
pw.printf("<tr><td>Average Processing Time</td><td>%s</td></tr>", formatTime(s.getAverageProcessingTime()));
pw.printf("<tr><td>Average Waiting Time</td><td>%s</td></tr>", formatTime(s.getAverageWaitingTime()));
pw.println("</tbody></table>");
pw.println("<br/>");
pw.println("<table class='nicetable'><tbody>");
pw.println("<tr><th colspan='2'>Topology Capabilities</th></tr>");
final TopologyCapabilities cap = this.configuration.getTopologyCapabilities();
if ( cap == null ) {
pw.print("<tr><td colspan='2'>No topology information available !</td></tr>");
} else {
final Map<String, List<InstanceDescription>> instanceCaps = cap.getInstanceCapabilities();
for(final Map.Entry<String, List<InstanceDescription>> entry : instanceCaps.entrySet()) {
final StringBuilder sb = new StringBuilder();
for(final InstanceDescription id : entry.getValue()) {
if ( sb.length() > 0 ) {
sb.append("<br/>");
}
if ( id.isLocal() ) {
sb.append("<b>local</b>");
} else {
sb.append(id.getSlingId());
}
}
pw.printf("<tr><td>%s</td><td>%s</td></tr>", entry.getKey(), sb.toString());
}
}
pw.println("</tbody></table>");
pw.println("<br/>");
pw.println("<p class='statline'>Scheduled Jobs</p>");
pw.println("<table class='nicetable'><tbody>");
final Collection<ScheduledJobInfo> infos = this.jobManager.getScheduledJobs();
if ( infos.size() == 0 ) {
pw.print("<tr><td colspan='5'>No jobs currently scheduled.</td></tr>");
} else {
pw.println("<tr><th>Schedule</th><th>Job Topic</th><th>Schedules</th></tr>");
int index = 1;
for(final ScheduledJobInfo info : infos) {
pw.printf("<tr><td><b>%s</b></td><td>%s</td><td>",
String.valueOf(index), info.getJobTopic());
boolean first = true;
for(final ScheduleInfo si : info.getSchedules() ) {
if ( !first ) {
pw.print("<br/>");
}
first = false;
switch ( si.getType() ) {
case YEARLY : pw.printf("YEARLY %s %s : %s:%s", si.getMonthOfYear(), si.getDayOfMonth(), si.getHourOfDay(), si.getMinuteOfHour());
break;
case MONTHLY : pw.printf("MONTHLY %s : %s:%s", si.getDayOfMonth(), si.getHourOfDay(), si.getMinuteOfHour());
break;
case WEEKLY : pw.printf("WEEKLY %s : %s:%s", si.getDayOfWeek(), si.getHourOfDay(), si.getMinuteOfHour());
break;
case DAILY : pw.printf("DAILY %s:%s", si.getHourOfDay(), si.getMinuteOfHour());
break;
case HOURLY : pw.printf("HOURLY %s", si.getMinuteOfHour());
break;
case CRON : pw.printf("CRON %s", si.getExpression());
break;
default : pw.printf("AT %s", si.getAt());
}
}
pw.print("</td></tr>");
index++;
}
}
pw.println("</tbody></table>");
pw.println("<br/>");
boolean isEmpty = true;
for(final Queue q : this.jobManager.getQueues()) {
isEmpty = false;
String queueName = q.getName();
pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>");
pw.printf("<span style='float: left; margin-left: 1em'>Active JobQueue: %s %s</span>", escape(q.getName()),
q.isSuspended() ? "(SUSPENDED)" : "");
this.printForm(pw, queueName, "Reset Stats", "reset");
if ( q.isSuspended() ) {
this.printForm(pw, queueName, "Resume", "resume");
} else {
this.printForm(pw, queueName, "Suspend", "suspend");
}
this.printForm(pw, queueName, "Test", "test");
this.printForm(pw, queueName, "Clear Queue", "clear");
this.printForm(pw, queueName, "Drop All", "dropall");
pw.println("</div>");
pw.println("<table class='nicetable'><tbody>");
s = q.getStatistics();
final QueueConfiguration c = q.getConfiguration();
pw.println("<tr><th colspan='2'>Statistics</th><th colspan='2'>Configuration</th></tr>");
pw.printf("<tr><td>Start Time</td><td>%s</td><td>Type</td><td>%s</td></tr>", formatDate(s.getStartTime()), formatType(c.getType()));
pw.printf("<tr><td>Last Activated</td><td>%s</td><td>Topics</td><td>%s</td></tr>", formatDate(s.getLastActivatedJobTime()), formatArray(c.getTopics()));
pw.printf("<tr><td>Last Finished</td><td>%s</td><td>Max Parallel</td><td>%s</td></tr>", formatDate(s.getLastFinishedJobTime()), c.getMaxParallel());
pw.printf("<tr><td>Queued Jobs</td><td>%s</td><td>Max Retries</td><td>%s</td></tr>", s.getNumberOfQueuedJobs(), c.getMaxRetries());
pw.printf("<tr><td>Active Jobs</td><td>%s</td><td>Retry Delay</td><td>%s ms</td></tr>", s.getNumberOfActiveJobs(), c.getRetryDelayInMs());
pw.printf("<tr><td>Jobs</td><td>%s</td><td>Priority</td><td>%s</td></tr>", s.getNumberOfJobs(), c.getThreadPriority());
pw.printf("<tr><td>Finished Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfFinishedJobs());
pw.printf("<tr><td>Failed Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfFailedJobs());
pw.printf("<tr><td>Cancelled Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfCancelledJobs());
pw.printf("<tr><td>Processed Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfProcessedJobs());
pw.printf("<tr><td>Average Processing Time</td><td>%s</td><td colspan='2'> </td></tr>", formatTime(s.getAverageProcessingTime()));
pw.printf("<tr><td>Average Waiting Time</td><td>%s</td><td colspan='2'> </td></tr>", formatTime(s.getAverageWaitingTime()));
pw.printf("<tr><td>Status Info</td><td colspan='3'>%s</td></tr>", escape(q.getStateInfo()));
pw.println("</tbody></table>");
pw.println("<br/>");
}
if ( isEmpty ) {