import java.io.*; import java.util.*; import java.util.Date; import java.sql.ResultSet; //TO DO: Find a way to have checks done on files that are received past // the late tolerance class FileChecker { public static final int LATETOLERANCE = 24*60*60*1000; //hours*minutes*seconds*milliseconds...in milliseconds public static final int NAMECHECKTOLERANCE = 5 * 60 * 1000; //minutes * second * milliseconds in milliseconds public static final double MISSINGTOLERANCE = 5 / 100.0; //missing frames acceptable fraction, percentage/100 // public static String LOGSTREAMNAME = "/home/pcruce/logfiles/filechecker.txt"; public static String emailList; public static String opsMailList; public static String returnUser; public LogStream logStream; static String configName = "/home/pcruce/opstools/src/scratch-/filetracker/trackerconfig/filetracker.cfg"; public static String logFile; public static String hostName; public static String userName; public static String password; public static String dbName; MysqlConnection myCon; static int counter = 1; public static void main(String[] args) { if(args.length > 0) { configName = args[0]; } Config c; c = new Config(configName); logFile = c.getString("checkerlogfilepath"); hostName = c.getString("mysqlhostname"); userName = c.getString("mysqlusername"); password = c.getString("mysqlpassword"); dbName = c.getString("mysqldbname"); emailList = c.getString("emaillist"); opsMailList = c.getString("opsmaillist"); returnUser = c.getString("user"); java.util.Date d = new java.util.Date(); FileChecker fc = null; LogStream mainLogStream; //PrintStream o; int mainCounter = 0; try { mainLogStream = new LogStream(logFile,4); } catch (Exception e) { mainLogStream = new LogStream(System.out,3); mainLogStream.print("LogStream allocation error:\n" + e + "\nDefaulting to System.out\nTerminating program",2); System.exit(1); } mainLogStream.print("Emaillist: " + emailList,1); try { fc = new FileChecker(logFile,4); } catch(Exception e) { try { SendMail.sendEmailNotification("FileChecker was unable to start due to an internal error\nReceived internal error: " + e.toString(),"FileChecker Internal Startup Error",emailList,returnUser,e); } catch(Exception ex) { mainLogStream.print("Caught exception while sending email notification: " + ex.toString(),1); mainLogStream.printStackTrace(ex,1); } mainLogStream.print("Error in main loop while allocating fileChecker class:\nTerminating fileChecker" + e,3); System.exit(1); } try { fc.checkerLoop(); } catch(java.lang.OutOfMemoryError o) { try { SendMail.sendEmailNotification("FileChecker ran out of memory and failed unexpectedly\nReceived error: " + o.toString(),"FileChecker Programmatic Runtime Error",emailList,returnUser,o); } catch(Exception ex) { mainLogStream.print("Caught exception while sending email notification: " + o.toString(),1); mainLogStream.printStackTrace(o,1); } fc.logStream.print("OutOfMemory Error: " + o,3); fc.logStream.printStackTrace(o,3); System.exit(1); } catch(Throwable e) { try { SendMail.sendEmailNotification("A FileChecker internal runtime error caused the filecheck to fail unexpectedly\nReceived error: " + e.toString(),"FileChecker Programmatic Runtime Error",emailList,returnUser,e); } catch(Exception ex) { mainLogStream.print("Caught exception while sending email notification: " + ex.toString(),1); mainLogStream.printStackTrace(ex,1); } fc.logStream.print("Runtime Error: " + e,3); fc.logStream.printStackTrace(e,3); } finally { try { fc.close(); } catch(Throwable ex) { mainLogStream.print("logStream Shutdown Error: " + ex,2); } System.exit(0); } System.exit(0); } public FileChecker(String log,int verbosity) throws Exception { logStream = new LogStream(log,verbosity); logStream.print("Starting Iteration: " + counter,4); counter++; try { myCon = new MysqlConnection(logStream,hostName,userName,password,dbName); } catch(Exception e) { if(myCon != null) { myCon.close(); myCon = null; } } logStream.print("Started",5); } public void close() throws Exception { myCon.close(); logStream.close(); } public void checkerLoop() throws Exception { Vector checks; Enumeration e; SatCheck sc; SatContact so; SatFile sf; int counter = 0; try { //obtain db lock, this method will block until lock is available //myCon.getLock(); logStream.print("Entering checkerloop",5); //rather than looping repeatedly it just runs through all the checks once...the cron will restart...saves it from having to deal with memory leaks and such.........java isn't supposed to have memory leaks.....arg /* while(true) { */ doScheduleDataCheck(); logStream.print("Inside checkerloop",5); checks = getChecks(); logStream.print("Checks acquired",5); e = checks.elements(); logStream.print("Acquired " + checks.size() + " check entries",5); while(e.hasMoreElements()) { //needs to add logic so it only does checks if file that has been received has also been processed...perhaps the getChecks, fx should do additional checks to exclude those files that have been received but have not yet been processed... sc = (SatCheck) e.nextElement(); logStream.print("Processing check: " + sc.checkKey,5); so = getSatContact(sc); if(sc.lateCheck == null) { doLateCheck(sc,so); } //checks are added by scheduling program, as files are received and matched with schedule entries fileKey's are filled. if(sc.fileKey == null ) { logStream.print("Null fileKey...File unreceived",5); } else if(isProblemFile(sc.fileKey.intValue())) { logStream.print("Check file is problem file, checks deferred",5); } else { logStream.print("Doing static checks",5); sf = getSatFile(sc); if(sc.nameScidCheck == null) { doScidCheck(sc,sf); } if(sc.nameVcidCheck == null) { doVcidCheck(sc,sf); } if(sc.nameTimeCheck == null) { doTimeCheck(sc,sf); } if(sc.missingFrameCheck == null) { doMissingCheck(sc,sf); } if(sc.gapChecks == null) { doGapChecks(sc,sf); } } } //myCon.releaseLock(); /* checks.clear(); checks = null; e = null; Thread.sleep(60000); if((counter % 30) == 0) { logStream.print("finished checker iteration: " + counter,3); } counter++; } */ } catch(Exception ex) { throw ex; } } public Vector getChecks() throws Exception { logStream.print("inside getCheck fx",5); String q = "SELECT * FROM check_list WHERE late_check IS NULL OR name_scid_check IS NULL OR name_vcid_check IS NULL OR name_time_check IS NULL OR missing_frame_check IS NULL OR gap_checks IS NULL"; ResultSet rs; SatCheck sc; Vector out; int sz = 0; out = new Vector(); rs = myCon.mysqlDbExecuteQuery(q,false); sz = MysqlConnection.resultSetSize(rs); logStream.print("getting ready to process check results:" + sz,5); rs.beforeFirst(); for(int i = 0;i < sz;i++) { rs.next(); //logStream.print("processing check results:" + i,4); sc = new SatCheck(); sc.checkKey = new Integer(rs.getInt("check_key")); if(rs.wasNull()) { throw new Exception("Mysql Data Acquisition Error:checkKey = null"); } sc.contactKey = new Integer(rs.getInt("contact_key")); if(rs.wasNull()) { throw new Exception("Mysql Data Acquisition Error:contactKey = null"); } sc.vcid = new Integer(rs.getInt("vcid")); if(rs.wasNull()) { throw new Exception("Mysql Data Acquisition Error:vcid = null"); } sc.fileKey = new Integer(rs.getInt("file_key")); if(rs.wasNull()) { sc.fileKey = null; } sc.lateCheck = new Boolean(rs.getBoolean("late_check")); if(rs.wasNull()) { sc.lateCheck = null; } sc.nameScidCheck = new Boolean(rs.getBoolean("name_scid_check")); if(rs.wasNull()) { sc.nameScidCheck = null; } sc.nameVcidCheck = new Boolean(rs.getBoolean("name_vcid_check")); if(rs.wasNull()) { sc.nameVcidCheck = null; } sc.nameTimeCheck = new Boolean(rs.getBoolean("name_time_check")); if(rs.wasNull()) { sc.nameTimeCheck = null; } sc.missingFrameCheck = new Boolean(rs.getBoolean("missing_frame_check")); if(rs.wasNull()) { sc.missingFrameCheck = null; } sc.gapChecks = new Boolean(rs.getBoolean("gap_checks")); if(rs.wasNull()) { sc.gapChecks = null; } out.add(sc); } rs.close(); rs = null; return out; } SatContact getSatContact(SatCheck sch) throws Exception { SatContact sco; String q; ResultSet rs; if(sch.contactKey == null) { throw new Exception("ERROR: FileChecker.getSatContact passed SatCheck with null contactKey"); } sco = new SatContact(); sco.contactKey = sch.contactKey.intValue(); q = "SELECT facility_name,object_name,AOS_datetime FROM contact_schedule WHERE contact_key = " + sch.contactKey.intValue(); rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { sco.facility = rs.getString("facility_name"); sco.objectName = rs.getString("object_name"); sco.aosDatetime = MysqlConnection.getMysqlDate(rs,"AOS_datetime"); } else { throw new Exception("ERROR: FileChecker.getSatContact unable to retrieve satContact from mysql" + sch.contactKey.intValue()); } rs.close(); return sco; } SatFile getSatFile(SatCheck sc) throws Exception { SatFile sf; String q; ResultSet rs; if(sc.fileKey == null) { throw new Exception("ERROR:FileChecker.getSatFile passed SatCheck with null fileKey"); } q = "SELECT * FROM file_list WHERE file_key = " + sc.fileKey.intValue(); rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { sf = new SatFile(rs.getString("archive_file_name"),MysqlConnection.getMysqlDate(rs,"file_name_datetime"),sc.fileKey.intValue()); sf.originalFileName = rs.getString("original_file_name"); sf.scid = rs.getInt("scid"); sf.vcid = rs.getInt("vcid"); sf.facility = rs.getString("facility"); sf.contactKey = rs.getInt("schedule_key"); sf.startDateTime = MysqlConnection.getMysqlDate(rs,"frame_start"); sf.stopDateTime = MysqlConnection.getMysqlDate(rs,"frame_stop"); sf.fileSize = rs.getInt("file_size"); sf.frameNumber = rs.getInt("frame_number"); sf.packetNumber = rs.getInt("packet_number"); sf.ccsdsErrors = rs.getInt("ccsds_errors"); sf.scidErrors = rs.getInt("scid_errors"); sf.syncErrors = rs.getInt("sync_errors"); sf.vcidErrors = rs.getInt("vcid_errors"); sf.sequenceErrors = rs.getInt("sequence_errors"); sf.missingFrameNumber = rs.getInt("missing_frame_number"); sf.rsErrors = rs.getInt("rs_errors"); sf.crcErrors = rs.getInt("crc_errors"); } else { throw new Exception("ERROR:FileChecker.getSatFile unable to retrieve satFile from mysql: " + sc.fileKey.intValue()); } rs.close(); return sf; } void doScheduleDataCheck() throws Exception { String q = "SELECT contact_key FROM contact_schedule WHERE AOS_datetime >= get_mission_time() AND AOS_datetime <= DATE_ADD(get_mission_time(),INTERVAL 2 DAY)"; ResultSet rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { return; } else { SendMail.sendEmailNotification("FileChecker found no contacts scheduled in the next two days","No Scheduled Contacts",opsMailList,returnUser); logStream.print("Schedule data check failed.",2); } } //checks to see if a file has not been received after LATETOLERANCE milliseconds past the AOS_datetime void doLateCheck(SatCheck sc,SatContact so) throws Exception { String msg; java.util.Date missionTime; missionTime = new java.util.Date(); logStream.print("missionTime Class: " + missionTime.getClass() + " aosDatetime class: " + so.aosDatetime.getClass(),5); missionTime = getMissionTime(); logStream.print("Doing late check",3); logStream.print("missionTime Class: " + missionTime.getClass() + " aosDatetime class: " + so.aosDatetime.getClass(),5); logStream.print("missionTime: " + missionTime.getTime() + " aosDateTime: " + so.aosDatetime.getTime(),5); logStream.print("missionTime: " + missionTime.toString() + " aosDateTime: " + so.aosDatetime.toString(),5); if(sc.fileKey != null) { logStream.print("Check with fileKey: " + sc.fileKey + " passes",5); setLateFlag(true,sc); } else if(missionTime.getTime() - so.aosDatetime.getTime() > LATETOLERANCE) { setLateFlag(false,sc); msg = "A file is over " + LATETOLERANCE/(1000.0 * 60.0 * 60.0) + " hours late\nFacility: " + so.facility + "\nSpacecraft: " + so.objectName + "\nAOS_datetime: " + so.aosDatetime.toString() + "\nVcid: " + sc.vcid.toString() + "\n"; logStream.print("Late notification: " + msg,5); SendMail.sendEmailNotification(msg,"Late themis file",opsMailList,returnUser); } else { logStream.print("File neither late nor received",5); } } //should probably check for congruence with satContact as well... //maybe I should just check for congruence with satContact... void doScidCheck(SatCheck sc,SatFile sf) throws Exception { String msg; //it uses the special purpose constructor to parse file name information for checks String nameSpaceCraft = SatFile.extractProcessedFileObjectName(sf.archiveFileName); //scid information is that garnered from framecheck, because the satfile table has information from both file name and from framecheck this may not be immediately apparent String sn = getSpacecraftName(sf.scid); //if its a WLM support with a dummy value if(sn.equalsIgnoreCase(nameSpaceCraft)) { setScidFlag(true,sc); } else { setScidFlag(false,sc); msg = "The file " + sf.archiveFileName + " has a mismatch between the name spacecraft and its internal scid\nName spacecraft: " + nameSpaceCraft + "\nscid: " + sf.scid + "\ncorresponding spacecraft name: " + sn; SendMail.sendEmailNotification(msg,"Themis file name spacecraft incongruency",opsMailList,returnUser); } } void doVcidCheck(SatCheck sc,SatFile sf) throws Exception { String msg; //it uses the special purpose constructor to parse file name information for checks SatFile tempSf = new SatFile(sf.originalFileName,sf.facility); if(tempSf.vcid == sf.vcid) { setVcidFlag(true,sc); } else { setVcidFlag(false,sc); msg = "The file " + sf.archiveFileName + " has a mismatch between the name vcid and its internal vcid\nName vcid: " + tempSf.vcid + "\nInternal vcid: " + sf.vcid; SendMail.sendEmailNotification(msg,"Themis file name vcid incongruency",opsMailList,returnUser); } } void doTimeCheck(SatCheck sc,SatFile sf) throws Exception { String msg; long nameTime,startTime; nameTime = sf.fileDateTime.getTime(); startTime = sf.startDateTime.getTime(); if(Math.abs(nameTime - startTime) > NAMECHECKTOLERANCE) { setTimeFlag(false,sc); msg = "The file " + sf.archiveFileName + " has a time in its name that differs from its start frame time by more than " + (NAMECHECKTOLERANCE / (60.0 * 1000.0)) + " minutes, nameTime: " + sf.fileDateTime.toString() + " startTime: " + sf.startDateTime.toString(); //removed at teq's request,10/10/07 //SendMail.sendEmailNotification(msg,"Themis file name time incongruency",opsMailList,returnUser); } else { setTimeFlag(true,sc); } } void doMissingCheck(SatCheck sc,SatFile sf) throws Exception { String msg; double missingFraction = ((double) sf.missingFrameNumber / (double) (sf.frameNumber + sf.missingFrameNumber)); if( missingFraction > MISSINGTOLERANCE) { setMissingFlag(false,sc); msg = "The file " + sf.archiveFileName + " had " + missingFraction*100 + " percent missing frames, greater than the acceptable tolerance of " + MISSINGTOLERANCE*100 + "%"; SendMail.sendEmailNotification(msg,"Themis file has too many missing frames",opsMailList,returnUser); } else { setMissingFlag(true,sc); } } void doGapChecks(SatCheck sc,SatFile sf) throws Exception { if(sf.vcid == 3) { //this could probably be done in a slightly more general way with a loop and an array, but I feel like writing it out is a little //clearer, especially since apids to be checked are not parameterized if(doGapCheck(sf,0x440) && doGapCheck(sf,0x441) && doGapCheck(sf,0x442) && doGapCheck(sf,0x443) && doGapCheck(sf,0x444) && doGapCheck(sf,0x453) && doGapCheck(sf,0x454) && doGapCheck(sf,0x455) && doGapCheck(sf,0x457) && doGapCheck(sf,0x458) && doGapCheck(sf,0x45a) && doGapCheck(sf,0x45b) && doGapCheck(sf,0x45d) && doGapCheck(sf,0x45e)) { setGapFlag(true,sc); } else { setGapFlag(false,sc); } } } //apids to check(decimal): 1088,1089,1090,1091,1092,1107,1108,1109,1111,1112,1114,1115,1117,1118 //apids to check(hex): 0x 440, 441, 442, 443, 444, 453, 454, 455, 457, 458, 45a, 45b, 45d, 45e boolean doGapCheck(SatFile sf,int apid) throws Exception { return doIntraGapCheck(sf,apid) && doInterGapCheck(sf,apid); } boolean doIntraGapCheck(SatFile sf,int apid) throws Exception { int first; int last; int total; int calc; int mod = (int) Math.pow(2,14); int missing; float percent; logStream.print("Doing intragap check on: " + sf.archiveFileName + " for apid: " + apid,3); String q = "SELECT first_packet,last_packet,total_packets FROM packet_list WHERE file_key=" + sf.fileKey + " AND apid=" + apid + " LIMIT 1"; ResultSet rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { first = rs.getInt("first_packet"); last = rs.getInt("last_packet"); total = rs.getInt("total_packets"); if(last < first) { last+=mod; } //not sure this 1 should be here calc=last-first+1; //calc = last-first; logStream.print("Intragapcheck info:\nFirst: " + first + "\nLast: " + last + "\nTotal: " + total + "\nOriginal Calculated: " + calc,4); //this calculation rarely comes into play because the //number of packets in a file is normally small //but it ensures we are working with the greatest possible //value of calc less than the total //also this example is deprecated mod is not 65536 //example:total is 65538 //first is 0 //last is 1 //calc is 2 //this calculation makes calc = 2 + (1*mod) = 65538 //and it passes if(calc<=total-mod) { //this is integral not floating point division calc += (total/mod) * mod; } if(calc==total) { return true; } else { missing = calc-total; percent = (((float)missing)/((float)total)*100); if(percent > 5.0) { SendMail.sendEmailNotification("The file " + sf.archiveFileName + " had an intra file gap in apid " + apid + "(decimal) 0x" + Integer.toString(apid,16) + "(hex)\nIt was missing at least " + missing + " packets or " + percent + "% of that apid","Themis Packet Gap Detected",emailList,returnUser); } return false; } } else { return true;//if packet isn't found passes check } } boolean doInterGapCheck(SatFile sf,int apid) throws Exception { int first; int last; logStream.print("Doing Intergap check on: " + sf.archiveFileName + " for apid: " + apid,3); String q = "SELECT first_packet FROM packet_list WHERE file_key=" + sf.fileKey + " AND apid=" + apid + " LIMIT 1"; ResultSet rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { first = rs.getInt("first_packet"); } else { return true; //if the packet doesn't exist return true } logStream.print("Inter Check First: " + first,4); q = "SELECT get_last_packet(" + sf.fileKey + "," + apid + ") AS last"; rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(!rs.next() || (last=rs.getInt("last"))==-1) { //SendMail.sendEmailNotification("Intergapcheck no previous\nData:\nName: " + sf.archiveFileName + "\napid: " + apid + "\nfileKey: " + sf.fileKey,"Intercheck no prev","pcruce@ssl.berkeley.edu","thmsoc"); logStream.print("Intercheck no previous",4); return true; //if there is no previous packet return true } if(first != last + 1) { logStream.print("InterCheck Failure: Last: " + last,4); //removed at teq's request 10/10/07 //SendMail.sendEmailNotification("The file: " + sf.archiveFileName + " had an inter file gap in apid: " + apid + "(decimal) 0x" + Integer.toString(apid,16) + "(hex)\nThis gap occured between this file and the prior file with data from the given apid.","Themis Packet Gap Detected",emailList,returnUser); return false; } else { logStream.print("Intercheck Success",4); //SendMail.sendEmailNotification("Intergapcheck Success\nData:\nName: " + sf.archiveFileName + "\napid: " + apid + "\nfileKey: " + sf.fileKey + "\nFirst: " + first + "\nLast: " + last,"Intercheck Success","pcruce@ssl.berkeley.edu","thmsoc"); return true; } } //returns the stack trace as a single string for output static String stackTraceString(Throwable t) { String o = ""; StackTraceElement[] e; e = t.getStackTrace(); for(int i = 0;i < e.length;i++) { o += e[i].toString() + "\n"; } return o; } void setLateFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_late_check(" + sc.contactKey.intValue() + "," + sc.vcid.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } void setScidFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_scid_check(" + sc.fileKey.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } void setVcidFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_vcid_check(" + sc.fileKey.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } void setTimeFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_time_check(" + sc.fileKey.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } void setMissingFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_missing_check(" + sc.fileKey.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } void setGapFlag(boolean val,SatCheck sc) throws Exception { String q; q = "CALL set_gap_checks(" + sc.fileKey.intValue(); if(val == true) { q += ",true)"; } else { q+= ",false)"; } myCon.mysqlDbExecuteQuery(q); } java.util.Date getMissionTime() throws Exception { ResultSet rs; String q = "SELECT get_mission_time() AS m_time"; rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { return MysqlConnection.getMysqlDate(rs,"m_time"); } else { throw new Exception("ERROR: FileChecker.getMissionTime() unable to get mission time from mysql"); } } //attempts to match an scid to a spacecraft name //returns null if match fails String getSpacecraftName(int scid) throws Exception { String q; String sc; ResultSet rs; q = "SELECT get_object_name(" + scid + ") AS sc_name"; rs = myCon.mysqlDbExecuteQuery(q,false); rs.beforeFirst(); if(rs.next()) { return rs.getString("sc_name"); } else { return null; } } /* java.util.Date getMysqlDate(ResultSet rs,String cName) throws Exception { java.sql.Time t = rs.getTime(cName); java.sql.Date d = rs.getDate(cName); java.util.Date dt; logStream.print("Time: " + t.getTime() + ":" + t.toString(),5); logStream.print("Date: " + d.getTime() + ":" + d.toString(),5); dt = new java.util.Date(d.getTime()); logStream.print("Dtd: " + dt.getTime() + ":" + dt.toString(),5); dt = new java.util.Date(t.getTime()); logStream.print("Dtt: " + dt.getTime() + ":" + dt.toString(),5); dt = new java.util.Date(d.getTime() + t.getTime()); logStream.print("Dtdt: " + dt.getTime() + ":" + dt.toString(),5); //strange correction factor added,not sure why it showed up, 8 hrs //8hrs * 60min/hr * 60sec/min * 1000ms/sec dt = new java.util.Date(d.getTime() + t.getTime() - (8 * 60 * 60 * 1000)); logStream.print("Dtdt: " + dt.getTime() + ":" + dt.toString(),5); t = null; d = null; return dt; }*/ public boolean isProblemFile(int fk) throws Exception { ResultSet rs; String q = "SELECT is_problem_file(" + fk + ")"; rs = myCon.mysqlDbExecuteQuery(q,false); if(!rs.first()) { throw new Exception("Call to sql function is_new_file returned no results"); } if(rs.getInt(1) == 1) { return true; } else { return false; } } }