--- /dev/null
+package compbio.cassandra;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class DataBase {
+ private String date;
+ private int total; // total number of jobs
+ private int totalOK; // number of jobs with execution status OK
+ private int totalStopped; // number of jobs with execution status STOPPED
+ private int totalError; // number of jobs with execution status Jpred ERROR
+ private int totalTimeOut; // number of jobs with execution status TIMEOUT
+ private int totalJobs;
+ private int totalId; // total jobs for current protein sequence
+ private String id;
+ private String ip;
+ private String prot; // protein sequence
+ private String jpred;
+ private List<Integer> timeRez;
+ private List<Integer> timeTotalExec;
+ private JobBean logInfo;
+ private ProteinBean predictions;
+
+ public DataBase() {
+ }
+
+ public DataBase(String dat, int total) {
+ this.date = dat;
+ this.total = total;
+ }
+
+ public void setDate(String dat) {
+ this.date = dat;
+ }
+
+ public String getDate() {
+ if (null == date)
+ return "1/1/1970";
+ return date;
+ }
+
+ public void setTotal(int tot) {
+ this.total = tot;
+ }
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotalOK(int tot) {
+ this.totalOK = tot;
+ }
+
+ public int getTotalOK() {
+ return totalOK;
+ }
+
+ public void setTotalStopped(int tot) {
+ this.totalStopped = tot;
+ }
+
+ public int getTotalStopped() {
+ return totalStopped;
+ }
+
+ public void setTotalError(int tot) {
+ this.totalError = tot;
+ }
+
+ public int getTotalError() {
+ return totalError;
+ }
+
+ public void setTotalTimeOut(int tot) {
+ this.totalTimeOut = tot;
+ }
+
+ public int getTotalTimeOut() {
+ return totalTimeOut;
+ }
+
+ public void setTotalJobs(int totalJobs) {
+ this.totalJobs = totalJobs;
+ }
+
+ public int getTotalJobs() {
+ return totalJobs;
+ }
+
+ public void setTotalId(int totId) {
+ this.totalId = totId;
+ }
+
+ public int getTotalId() {
+ return totalId;
+ }
+
+ public void setProt(String prot) {
+ this.prot = prot;
+ }
+
+ public String getProt() {
+ return prot;
+ }
+
+ public void setJpred(String jpred) {
+ this.jpred = jpred;
+ }
+
+ public String getJpred() {
+ return jpred;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setTimeRez(List<Integer> timeRez) {
+ this.timeRez = timeRez;
+ }
+
+ public List<Integer> getTimeRez() {
+ return timeRez;
+ }
+
+ public void setTimeTotalExec(List<Integer> timeTotalExec) {
+ this.timeTotalExec = timeTotalExec;
+ }
+
+ public List<Integer> getTimeTotalExec() {
+ return timeTotalExec;
+ }
+
+ public void setLogInfo(JobBean logInfo){
+ this.logInfo = logInfo;
+ }
+
+ public JobBean getLogInfo() {
+ return logInfo;
+ }
+
+ public void setPredictions(ProteinBean predictions){
+ this.predictions = predictions;
+ }
+
+ public ProteinBean getPredictions() {
+ return predictions;
+ }
+
+}
import compbio.cassandra.DateBean;
import compbio.cassandra.TotalJobsStatisticBean;
import compbio.statistic.CassandraRequester;
-import compbio.statistic.StatisticsProt;
/**
* @author Alexander Sherstnev
CassandraRequester cr = new CassandraRequester();
if (option.equals("AllDates,off")) {
Calendar cal = Calendar.getInstance();
- date1 = StatisticsProt.DateFormatYYMMDD(cr.earliestDate());
+ date1 = DateFormatYYMMDD(cr.earliestDate());
date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
}
model.put("date1", date1);
model.put("timeExecution", (endTime - startTime));
return "/reportJobStatisticsOneDay";
}
+
+ /*
+ * convert ???
+ */
+ private String DateFormatYYMMDD(long indate) {
+ SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
+ String dateString = datformat.format(new Date(indate));
+ return dateString;
+ }
+
}
package compbio.listeners;
import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import compbio.cassandra.DataBase;
import compbio.statistic.CassandraRequester;
-import compbio.statistic.StatisticsProt;
@WebServlet("/ServletJobsByDate")
public class ServletJobsByDate extends HttpServlet {
CassandraRequester cr = new CassandraRequester();
if (null != request.getParameter("option")) {
Calendar cal = Calendar.getInstance();
- date1 = StatisticsProt.DateFormatYYMMDD(cr.earliestDate());
+ date1 = DateFormatYYMMDD(cr.earliestDate());
date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
}
request.setAttribute("data1", date1);
request.setAttribute("data2", date2);
-// List<DataBase> res = cr.countJobs(date1, date2);
-// request.setAttribute("result", res);
+ // List<DataBase> res = cr.countJobs(date1, date2);
+ // request.setAttribute("result", res);
final long endTime = System.currentTimeMillis();
request.setAttribute("timeExecution", (endTime - startTime));
-// System.out.println ("QueryServlet.doGet: total number of dates = " + res.size());
+ // System.out.println ("QueryServlet.doGet: total number of dates = " +
+ // res.size());
request.setAttribute("flag", request.getParameter("option"));
RequestDispatcher rd = request.getRequestDispatcher("/ReportJobsByDate.jsp");
rd.forward(request, response);
doGet(request, response);
}
+ /*
+ * convert ???
+ */
+ private String DateFormatYYMMDD(long indate) {
+ SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
+ String dateString = datformat.format(new Date(indate));
+ return dateString;
+ }
}
package compbio.listeners;
import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Date;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import compbio.statistic.StatisticsProt;
import compbio.statistic.CassandraRequester;
/**
CassandraRequester sp = new CassandraRequester();
if (null != request.getParameter("option")) {
Calendar cal = Calendar.getInstance();
- date1 = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
+ date1 = DateFormatYYMMDD(sp.earliestDate());
date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
}
request.setAttribute("data1", date1);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
+ /*
+ * convert ???
+ */
+ private String DateFormatYYMMDD(long indate) {
+ SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
+ String dateString = datformat.format(new Date(indate));
+ return dateString;
+ }
}
import compbio.cassandra.DateBean;
import compbio.cassandra.ProteinBean;
import compbio.cassandra.CassandraNativeConnector;
-import compbio.cassandra.CassandraReader;
+import compbio.cassandra.CassandraReaderOld;
import compbio.cassandra.DataBase;
import compbio.cassandra.Pair;
import compbio.cassandra.JobBean;
import compbio.engine.JobStatus;
public class CassandraRequester {
- private CassandraReader db = new CassandraReader();
+ private CassandraReaderOld db = new CassandraReaderOld();
private ArrayList<DataBase> query;
private static long currentDate = 0;
private static long earlestDate = 0;
* query: total number of jobs for the period from date1 till date2
*/
public TotalJobsStatisticBean countJobs(String date1, String date2) {
- if (null == date1) {
+ /* if (null == date1) {
date1 = "1970/1/1";
}
if (null == date2) {
if (!isThisDateValid(date1, formatYYMMDD) || !isThisDateValid(date2, formatYYMMDD)) {
System.out.println("CassandraRequester.countJobs: wrong format for date1 " + date1 + "or date2 " + date2);
return null;
- }
+ }*/
SetDateRange();
long dateStart = DateParsing(date1, formatYYMMDD);
long dateEnd = DateParsing(date2, formatYYMMDD);
- if (dateEnd < earlestDate || dateStart > currentDate || dateStart > dateEnd)
+/* if (dateEnd < earlestDate || dateStart > currentDate || dateStart > dateEnd)
return null;
if (dateStart < earlestDate)
dateStart = earlestDate;
if (dateEnd > currentDate)
- dateStart = currentDate;
-
+ dateStart = currentDate;*/
Calendar start = Calendar.getInstance();
start.setTime(new Date(dateStart));
Calendar end = Calendar.getInstance();