本文整理汇总了Java中org.apache.commons.vfs2.impl.DefaultFileMonitor.setRecursive方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultFileMonitor.setRecursive方法的具体用法?Java DefaultFileMonitor.setRecursive怎么用?Java DefaultFileMonitor.setRecursive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.vfs2.impl.DefaultFileMonitor
的用法示例。
在下文中一共展示了DefaultFileMonitor.setRecursive方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
/**
* Starts watching the file system for changes to trigger a bake.
*
* @param res Commandline options
* @param config Configuration settings
*/
public void start(final LaunchOptions res, CompositeConfiguration config) {
try {
FileSystemManager fsMan = VFS.getManager();
FileObject listenPath = fsMan.resolveFile(res.getSource(), config.getString( ConfigUtil.Keys.CONTENT_FOLDER));
FileObject templateListenPath = fsMan.resolveFile(res.getSource(), config.getString( ConfigUtil.Keys.TEMPLATE_FOLDER));
FileObject assetPath = fsMan.resolveFile(res.getSource(), config.getString( ConfigUtil.Keys.ASSET_FOLDER));
System.out.println("Watching for (content, template, asset) changes in [" + res.getSource() + "]");
DefaultFileMonitor monitor = new DefaultFileMonitor(new CustomFSChangeListener(res, config));
monitor.setRecursive(true);
monitor.addFile(listenPath);
monitor.addFile(templateListenPath);
monitor.addFile(assetPath);
monitor.start();
} catch (FileSystemException e) {
e.printStackTrace();
}
}
示例2: watchDir
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
@Override
public void watchDir(File file) throws IOException {
FileSystemManager fileSystemManager = VFS.getManager();
FileObject dirToWatchFO = null;
dirToWatchFO = fileSystemManager.resolveFile(file.getAbsolutePath());
//IFileListenerService fileListener = this.beanService.getBean(ApacheDefaultFileListener.class);
DefaultFileMonitor fileMonitor = this.beanService.getBean(DefaultFileMonitor.class);
fileMonitor.setRecursive(true);
fileMonitor.addFile(dirToWatchFO);
fileMonitor.start();
this.fileMonitors.add(fileMonitor);
}
示例3: start
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
/**
* Starts watching the file system for changes to trigger a bake.
*
* @param res Commandline options
* @param config Configuration settings
*/
public void start(final LaunchOptions res, CompositeConfiguration config) {
try {
FileSystemManager fsMan = VFS.getManager();
FileObject listenPath = fsMan.resolveFile(res.getSource(), config.getString( ConfigUtil.Keys.CONTENT_FOLDER));
System.out.println("Watching for changes in [" + res.getSource() + "]");
DefaultFileMonitor monitor = new DefaultFileMonitor(new CustomFSChangeListener(res, config));
monitor.setRecursive(true);
monitor.addFile(listenPath);
monitor.start();
} catch (FileSystemException e) {
e.printStackTrace();
}
}
示例4: startThread
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
/**
* Start a worker thread to listen for directory changes.
*/
public void startThread() {
thread = new Thread(this);
listener = new WatchEventListener(config.getEvents(), config.getFolder());
fm = new DefaultFileMonitor(listener);
fm.setRecursive(false);
fm.addFile(resolvedAbsPath);
fm.start();
log.debug("Monitoring directory: " + resolvedAbsPath.toString());
thread.start();
}
示例5: startThread
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
/**
* Start a worker thread to listen for directory changes.
*/
public void startThread() {
thread = new Thread(this);
listener = new WatchEventListener(config.getEvents(), config.getFolder() + config.getConnection().getPathtomonitor());
fm = new DefaultFileMonitor(listener);
fm.setRecursive(false);
fm.addFile(resolvedAbsPath);
fm.start();
log.debug("Monitoring setup for directory: " + config.getFolder() + config.getConnection().getPathtomonitor());
thread.start();
}
示例6: setFileListener
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void setFileListener(File file, EncryptedFileDob dob){
FileObject listendir = null;
try {
FileSystemManager fsManager = VFS.getManager();
listendir = fsManager.resolveFile(file.getPath());
} catch (FileSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DefaultFileMonitor fm = new DefaultFileMonitor(new FileChangeListener(dob));
fm.setRecursive(true);
fm.addFile(listendir);
fm.start();
}
示例7: watch
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void watch() throws FileSystemException {
FileSystemManager manager = VFS.getManager();
FileObject file = manager.resolveFile(
this.compassCompiler.getConfigFile().getParentFile().getAbsolutePath());
DefaultFileMonitor fm = new DefaultFileMonitor(new CompassWatchListener(this.compassCompiler));
fm.setRecursive(true);
fm.setDelay(2000);
fm.addFile(file);
fm.start();
}
示例8: init
import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public static void init() throws TalesException {
try{
if(!inited){
inited = true;
for(DirListenerObj dirObj : Config.getDirListenerList()){
String dir = dirObj.getDir().replace("~", System.getProperty("user.home"));
FileSystemManager fsManager = VFS.getManager();
FileObject listendir = fsManager.resolveFile(dir);
DefaultFileMonitor fm = new DefaultFileMonitor(new OnChange(dirObj));
fm.setRecursive(true);
fm.addFile(listendir);
fm.start();
}
// prevents the app of exiting
while(true){
Thread.sleep(1000);
}
}
}catch(Exception e){
throw new TalesException(new Throwable(), e);
}
}