public void destroy() { watcher.destroy(); }
public long getLastModified() { return watcher.getLastModified(); }
private void scan(final Path file) throws IOException { if (isMatchesFile(file)) { fireListeners(file, ENTRY_MODIFY); process(file); processedMap.put(file, Boolean.TRUE); } }
public Maven2MetadataProvider(String path, String dirMatcher, String fileMatcher) throws IOException { metadatas = new ConcurrentHashMap<String, Map<String, String>>(); root = Paths.get(path); watcher = new FileWatcher(); watcher.setRoot(root); if (dirMatcher != null && !dirMatcher.isEmpty()) { watcher.setDirMatchPattern(dirMatcher); } if (fileMatcher != null && !fileMatcher.isEmpty()) { watcher.setFileMatchPattern(fileMatcher); } watcher.setProcessor(new Processor() { @Override public void process(Path path) { scan(path); } @Override public void onRemove(Path path) { unscan(path); } }); watcher.init(); }
public void init() throws IOException { super.init(); LOG.info("Watching directory " + getRoot() + " for Spring XML files to load"); }
public void setRootDirectory(File directory) { setRoot(directory.toPath()); }
/** * Sets the file matching pattern using the * <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)">java 7 pattern matching syntax</a> * such as <code>glob:*.xml</code> */ public void setFileMatchPattern(String pattern) { setFileMatcher(Matchers.parse(pattern, getFileSystem())); }
/** * Sets the directory matching pattern using the * <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)">java 7 pattern matching syntax</a> * such as <code>glob:/foo/*</code> */ public void setDirMatchPattern(String pattern) { setDirMatcher(Matchers.parse(pattern, getFileSystem())); }
private void process(final Path path) throws IOException { final Processor processor = getProcessor(); if (processor != null) { processing.incrementAndGet(); try { executor.execute(new Runnable() { @Override public void run() { try { processor.process(path); lastModified = System.currentTimeMillis(); } finally { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } } } }); } catch (RejectedExecutionException e) { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } throw e; } } }
public void init() throws IOException { super.init(); LOG.info("Watching directory " + getRoot() + " for XML Schema files to dynamically compile"); }
@Override public void destroy() { if (mapper != null) { mapper.destroy(); } super.destroy(); }
private void scan(final Path file) throws IOException { if (isMatchesFile(file)) { fireListeners(file, ENTRY_MODIFY); process(file); processedMap.put(file, Boolean.TRUE); } }
public void setRootDirectory(File directory) { setRoot(directory.toPath()); }
/** * Sets the file matching pattern using the * <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)">java 7 pattern matching syntax</a> * such as <code>glob:*.xml</code> */ public void setFileMatchPattern(String pattern) { setFileMatcher(Matchers.parse(pattern, getFileSystem())); }
/** * Sets the directory matching pattern using the * <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)">java 7 pattern matching syntax</a> * such as <code>glob:/foo/*</code> */ public void setDirMatchPattern(String pattern) { setDirMatcher(Matchers.parse(pattern, getFileSystem())); }
private void process(final Path path) throws IOException { final Processor processor = getProcessor(); if (processor != null) { processing.incrementAndGet(); try { executor.execute(new Runnable() { @Override public void run() { try { processor.process(path); lastModified = System.currentTimeMillis(); } finally { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } } } }); } catch (RejectedExecutionException e) { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } throw e; } } }
public void init() throws IOException { if (camelContext == null) { throw new IllegalArgumentException("CamelContext must be configured on " + this); } mapper = new DozerBeanMapper(); setFileMatchPattern("glob:META-INF/services/dozer/*.xml"); setProcessor(new Processor() { public void process(Path path) { addOrUpdateMapping(path); } public void onRemove(Path path) { removeMapping(path); } }); super.init(); LOG.info("Watching directory " + getRoot() + " for Dozer XML Mapping file changes"); }
public void destroy() { if (closing.compareAndSet(false, true)) { Set<Map.Entry<String, FileSystemXmlApplicationContext>> entries = contextMap.entrySet(); for (Map.Entry<String, FileSystemXmlApplicationContext> entry : entries) { String url = entry.getKey(); FileSystemXmlApplicationContext context = entry.getValue(); closeContext(url, context); } } super.destroy(); }
public void setRootPath(String rootPath) { Path path = new File(rootPath).getAbsoluteFile().toPath(); setRoot(path); }
public void setRootPath(String rootPath) { Path path = new File(rootPath).getAbsoluteFile().toPath(); setRoot(path); }