/** * Set the properties by file. Setting the properties this way will also set * the base for this analyzer. After reading the properties, this will call * setProperties(Properties) which will handle the includes. * * @param propertiesFile * @throws FileNotFoundException * @throws IOException */ public void setProperties(File propertiesFile) throws IOException { propertiesFile = propertiesFile.getAbsoluteFile(); setProperties(propertiesFile, propertiesFile.getParentFile()); }
/** * Set the properties by file. Setting the properties this way will also set * the base for this analyzer. After reading the properties, this will call * setProperties(Properties) which will handle the includes. * * @param propertiesFile * @throws FileNotFoundException * @throws IOException */ public void setProperties(File propertiesFile) throws IOException { propertiesFile = propertiesFile.getAbsoluteFile(); setProperties(propertiesFile, propertiesFile.getParentFile()); }
/** * */ public void forceRefresh() { included = null; properties.clear(); setProperties(propertiesFile, base); propertiesChanged(); }
public boolean refresh() { plugins = null; // We always refresh our plugins if (propertiesFile == null) return false; boolean changed = false; if (included != null) { for (File file : included) { if (file.lastModified() > modified) { changed = true; break; } } } // System.out.println("Modified " + modified + " file: " // + propertiesFile.lastModified() + " diff " // + (modified - propertiesFile.lastModified())); // Date last = new Date(propertiesFile.lastModified()); // Date current = new Date(modified); changed |= modified < propertiesFile.lastModified(); if (changed) { included = null; properties.clear(); setProperties(propertiesFile, base); propertiesChanged(); return true; } return false; }
public void addProperties(File file) throws Exception { addIncluded(file); Properties p = loadProperties(file); setProperties(p); }
public void addProperties(File file) throws Exception { addIncluded(file); Properties p = loadProperties(file); setProperties(p); }
public void setProperties(File propertiesFile, File base) { this.propertiesFile = propertiesFile.getAbsoluteFile(); setBase(base); try { if (propertiesFile.isFile()) { // System.out.println("Loading properties " + propertiesFile); long modified = propertiesFile.lastModified(); if (modified > System.currentTimeMillis() + 100) { System.out.println("Huh? This is in the future " + propertiesFile); this.modified = System.currentTimeMillis(); } else this.modified = modified; included = null; Properties p = loadProperties(propertiesFile); setProperties(p); } else { if (fileMustExist) { error("No such properties file: " + propertiesFile); } } } catch (IOException e) { error("Could not load properties " + propertiesFile); } }
public void setProperties(File propertiesFile, File base) { this.propertiesFile = propertiesFile.getAbsoluteFile(); setBase(base); try { if (propertiesFile.isFile()) { // System.out.println("Loading properties " + propertiesFile); long modified = propertiesFile.lastModified(); if (modified > System.currentTimeMillis() + 100) { System.out.println("Huh? This is in the future " + propertiesFile); this.modified = System.currentTimeMillis(); } else this.modified = modified; included = null; Properties p = loadProperties(propertiesFile); setProperties(p); } else { if (fileMustExist) { error("No such properties file: " + propertiesFile); } } } catch (IOException e) { error("Could not load properties " + propertiesFile); } }
public void execute() throws BuildException { try { if (propertyFile.exists()) { Properties properties = new Properties(); properties.putAll((Map<?,?>)getProject().getProperties()); Processor processor = new Processor(properties); processor.setProperties(propertyFile); Project project = getProject(); Properties flattened = processor.getFlattenedProperties(); for (Iterator<Object> i = flattened.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); if (project.getProperty(key) == null) { project.setProperty(key, flattened.getProperty(key)); } } } report(); } catch (IOException e) { e.printStackTrace(); throw new BuildException(e); } }
public void execute() throws BuildException { try { if (propertyFile.exists()) { Properties properties = new Properties(); properties.putAll((Map<?,?>)getProject().getProperties()); Processor processor = new Processor(properties); processor.setProperties(propertyFile); Project project = getProject(); Properties flattened = processor.getFlattenedProperties(); for (Iterator<Object> i = flattened.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); if (project.getProperty(key) == null) { project.setProperty(key, flattened.getProperty(key)); } } } report(); } catch (IOException e) { e.printStackTrace(); throw new BuildException(e); } }