public static Long loadLastModifiedTime(MappingTool tool) throws DAOException { Long last; try { logger.debug("Tool properties loaded"); Properties prop = loadToolProperties(tool.getDirectory()); last = Long.parseLong(prop.getProperty(tool.getName() + ".last_modified")); } catch (Exception ex) { logger.error("loadLastModifiedTime error: " + ex.getLocalizedMessage()); return new Long(0); } return last; }
public static void saveLastModifiedTime(long lastModified, MappingTool tool) throws DAOException { FileOutputStream out = null; try { Properties prop = loadToolProperties(tool.getDirectory()); logger.info(tool.getName() + ".last_modified " + lastModified + ""); prop.setProperty(tool.getName() + ".last_modified", lastModified + ""); out = new FileOutputStream(tool.getDirectory() + "/tool.properties"); prop.store(out, null); out.close(); } catch (Exception ex) { logger.error("saveLastModifiedTime error: " + ex.getLocalizedMessage()); throw new DAOException(ex); } finally { try { if (out != null) { out.close(); } } catch (IOException ex) { } } }