1 |
pjm2 |
1.1 |
import java.sql.*; |
2 |
|
|
import java.io.*; |
3 |
|
|
|
4 |
pjm2 |
1.2 |
// Main method to run the reports. |
5 |
pjm2 |
1.1 |
public class DBReporterMain { |
6 |
|
|
|
7 |
pjm2 |
1.3 |
public static final String webDir = "/home/cut/pjm2/webpages/reports/"; |
8 |
|
|
|
9 |
pjm2 |
1.1 |
public static void main(String[] args) { |
10 |
|
|
|
11 |
|
|
long endTime = DateUtils.startOfToday(); |
12 |
pjm2 |
1.2 |
|
13 |
|
|
// Uncomment next line to go back in time... |
14 |
|
|
//endTime = DateUtils.subtractDays(endTime, 2); |
15 |
|
|
|
16 |
pjm2 |
1.1 |
long startTime = DateUtils.subtractDays(endTime, 1); |
17 |
|
|
|
18 |
|
|
DBReporter reporter = new DBReporter(startTime, endTime); |
19 |
|
|
|
20 |
|
|
ReportList reportList = null; |
21 |
|
|
try { |
22 |
|
|
reportList = new ReportList("report_list.txt"); |
23 |
|
|
} |
24 |
|
|
catch (IOException e) { |
25 |
|
|
System.out.println(e); |
26 |
|
|
return; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
try { |
30 |
pjm2 |
1.3 |
reporter.runReports(reportList, webDir); |
31 |
pjm2 |
1.1 |
} |
32 |
|
|
catch (SQLException e) { |
33 |
|
|
System.out.println("Fatal SQL errors - Cannot complete reports: " + e); |
34 |
|
|
} |
35 |
|
|
catch (Exception e) { |
36 |
|
|
System.out.println("Fatal errors - Cannot complete reports: " + e); |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
System.out.println("DBReporterMain finished."); |
40 |
|
|
|
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
} |