/** * Returns true iff all the files listed in this tracker's dependency list exist and are at the * same version as when they were recorded. * * @return a boolean */ boolean isUpToDate(Properties properties) { Iterator e; // fixes bug 962 { if (mProperties.size() != properties.size()) { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="my size " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-181", new Object[] {new Integer(mProperties.size())})); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="new size " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-189", new Object[] {new Integer(properties.size())})); return false; } for (e = mProperties.keySet().iterator(); e.hasNext(); ) { String key = (String) e.next(); String val0 = mProperties.getProperty(key); String val1 = properties.getProperty(key); // val0 can't be null; properties don't allow that if (val1 == null || !val0.equals(val1)) { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="Missing or changed property: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-207", new Object[] {val0})); return false; } } } for (e = mDependencies.iterator(); e.hasNext(); ) { FileInfo saved = (FileInfo) e.next(); FileInfo current = new FileInfo(saved.mPathname); if (!saved.isUpToDate(current)) { mLogger.debug(saved.mPathname + " has changed"); mLogger.debug("was " + saved.mLastMod); mLogger.debug(" is " + current.mLastMod); return false; } } return true; }
/** * Add the specified file to the list of file dependencies. * * @param file a file */ void addFile(File file) { mLogger.debug("addFile Path is " + file.getPath()); FileInfo fi = new FileInfo(file.getPath()); try { fi.mPathname = file.getCanonicalPath(); } catch (java.io.IOException e) { throw new ChainedException(e); } mDependencies.add(fi); }
/** * This will update the FileInfo object chain to use the (possibly new) webappPath once the * DependencyTracker object has been reconstitutded from ondisk cache. */ void updateWebappPath() { String webappPath = LPS.HOME(); // get it from global if (webappPath.equals(mWebappPath)) return; mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="updating webappPath from: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-128", new Object[] {mWebappPath})); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="updating webappPath to: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-136", new Object[] {webappPath})); for (Iterator e = mDependencies.iterator(); e.hasNext(); ) { FileInfo saved = (FileInfo) e.next(); if (saved.mPathname.startsWith(mWebappPath)) { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="updating dependencies from: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-147", new Object[] {saved.mPathname})); saved.mPathname = webappPath + saved.mPathname.substring(mWebappPath.length()); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="updating dependencies to : " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( DependencyTracker.class.getName(), "051018-157", new Object[] {saved.mPathname})); } } mWebappPath = webappPath; }