import java.io.FileFilter;\r
import java.io.IOException;\r
import java.sql.SQLException;\r
+import java.text.ParseException;\r
import java.text.SimpleDateFormat;\r
import java.util.ArrayList;\r
import java.util.Date;\r
private List<String> parameters = new ArrayList<String>();\r
\r
@Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")\r
- Integer verbose = 1;\r
+ public Integer verbose = 1;\r
\r
@Parameter(names = "-start", description = "Start time")\r
- String starttime;\r
+ public String starttime;\r
\r
@Parameter(names = "-end", description = "Start time")\r
- String endtime;\r
+ public String endtime;\r
\r
@Parameter(names = "-db", description = "Path to database")\r
- String dbname;\r
+ public String dbname;\r
+\r
+ @Parameter(names = "-dir", description = "Path to job directory")\r
+ public String workingdir;\r
}\r
\r
public class ExecutionStatUpdater {\r
static SimpleDateFormat DF = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");\r
+ static SimpleDateFormat shortDF = new SimpleDateFormat("dd/MM/yyyy");\r
private static final Logger log = Logger.getLogger(ExecutionStatUpdater.class);\r
\r
final private File workingDirectory;\r
\r
/**\r
* main function\r
+ * @throws ParseException \r
*/\r
- public static void main(String[] args) throws IOException, SQLException {\r
+ public static void main(String[] args) throws IOException, SQLException, ParseException {\r
mainJCommander jct = new mainJCommander();\r
new JCommander(jct, args);\r
- String WorkingDir = "jobout";\r
- String StartTime = jct.starttime;\r
- String EndTime = jct.endtime;\r
+ String WorkingDir = jct.workingdir;\r
String dbname = jct.dbname;\r
- long StartTimeLong = 0;\r
- long EndTimeLong = 0;\r
+ Date ST = shortDF.parse(jct.starttime);\r
+ Date ET = shortDF.parse(jct.endtime);\r
+ long StartTime = 0;\r
+ if (null != ST) {\r
+ StartTime = ST.getTime();\r
+ }\r
+ Date currDate = new Date();\r
+ long EndTime = currDate.getTime();\r
+ if (null != ET) {\r
+ EndTime = ET.getTime();\r
+ }\r
+\r
+ System.out.println("Start time: " + jct.starttime + " = " + StartTime);\r
+ System.out.println("End time: " + jct.endtime + " = " + EndTime);\r
\r
ExecutionStatUpdater esu = new ExecutionStatUpdater(WorkingDir, 1);\r
- esu.collectStatistics(StartTimeLong, EndTimeLong);\r
+ esu.collectStatistics(StartTime, EndTime);\r
esu.writeStatToDB();\r
}\r
\r