当前位置: 首页>>代码示例>>Java>>正文


Java FileChangeEvent.getFile方法代码示例

本文整理汇总了Java中org.apache.commons.vfs2.FileChangeEvent.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileChangeEvent.getFile方法的具体用法?Java FileChangeEvent.getFile怎么用?Java FileChangeEvent.getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs2.FileChangeEvent的用法示例。


在下文中一共展示了FileChangeEvent.getFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fileCreated

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
@Override
public void fileCreated(FileChangeEvent event) throws Exception {
    FileObject file = event.getFile();
    try {
        log.info("LOG00040:load file {}", file);
        long id = executtor.loadMessageFromFileBisFormat(file);
        log.debug("SUCCESS load file {}", file);
        moveFileObrab(file, id, false);
    } catch (Throwable th) {
        log.error("LOG00050:" + file, th);
        try {
            moveFileObrab(file, 0, true);
        } catch (Exception e) {
            log.error("LOG00030:", e);
        }
    }
}
 
开发者ID:OlegNyr,项目名称:GisGMP,代码行数:18,代码来源:BisLoaderSniffer.java

示例2: fileCreated

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
@Override
public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException {
    FileObject fileObject = fileChangeEvent.getFile();
    LOGGER.info(String.format("Received file creation event for file: %s", fileObject));

    File file = new File(fileObject.getName().getPath());
    if (ConfigFileFilter.isFileSupported(file)) {
        configurationService.addOrUpdate(file);

        Map<String, Object> params = new HashMap<>();
        params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath());

        sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:16,代码来源:ConfigFileMonitor.java

示例3: fileChanged

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
@Override
public void fileChanged(FileChangeEvent fileChangeEvent) {
    FileObject fileObject = fileChangeEvent.getFile();
    LOGGER.info(String.format("Received file update event for file: %s", fileObject));

    File file = new File(fileObject.getName().getPath());
    if (ConfigFileFilter.isFileSupported(file)) {
        configurationService.addOrUpdate(file);

        Map<String, Object> params = new HashMap<>();
        params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath());

        sendEvent(ConfigurationConstants.FILE_CHANGED_EVENT_SUBJECT, params);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:16,代码来源:ConfigFileMonitor.java

示例4: fileDeleted

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
@Override
public void fileDeleted(FileChangeEvent fileChangeEvent) throws FileSystemException {
    FileObject fileObject = fileChangeEvent.getFile();
    LOGGER.info(String.format("Received file deletion event for file: %s", fileObject));

    File file = new File(fileObject.getName().getPath());
    if (ConfigFileFilter.isFileSupported(file)) {
        configurationService.deleteByBundle(file.getParentFile().getName());

        Map<String, Object> params = new HashMap<>();
        params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath());

        sendEvent(ConfigurationConstants.FILE_DELETED_EVENT_SUBJECT, params);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:16,代码来源:ConfigFileMonitor.java

示例5: fileCreated

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
/**
 * Called when a file is created.
 * @param event The FileChangeEvent.
 * @throws Exception if an error occurs.
 */
public void fileCreated(final FileChangeEvent event) throws Exception
{
    if (event.getFile() != file)
    {
        return;
    }
    if (!ignoreEvent)
    {
        handleCreate(file.getType());
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:17,代码来源:DelegateFileObject.java

示例6: fileDeleted

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
/**
 * Called when a file is deleted.
 * @param event The FileChangeEvent.
 * @throws Exception if an error occurs.
 */
public void fileDeleted(final FileChangeEvent event) throws Exception
{
    if (event.getFile() != file)
    {
        return;
    }
    if (!ignoreEvent)
    {
        handleDelete();
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:17,代码来源:DelegateFileObject.java

示例7: fileChanged

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
/**
 * Called when a file is changed.
 * <p/>
 * This will only happen if you monitor the file using {@link org.apache.commons.vfs2.FileMonitor}.
 * @param event The FileChangeEvent.
 * @throws Exception if an error occurs.
 */
public void fileChanged(FileChangeEvent event) throws Exception
{
    if (event.getFile() != file)
    {
        return;
    }
    if (!ignoreEvent)
    {
        handleChanged();
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:19,代码来源:DelegateFileObject.java

示例8: fileCreated

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
private void fileCreated(FileChangeEvent event) throws FileSystemException {
  String path = event.getFile().getName().getPath();
  String dirPath = event.getFile().getParent().getName().getPath();

  logger.debug(path + " has been created.");

  DirPattern dirPattern = null;
  dirPattern = pathMap.get(dirPath);

  if (dirPattern == null) {
    logger.warn("Occurred create event from un-indexed directory. "
        + dirPath);
    return;
  }

  // 파일명이 대상인지 검사한다.
  if (!isInFilePattern(event.getFile(), dirPattern.getFilePattern())) {
    logger.debug(path + " is not in file pattern.");
    return;
  }

  FileSet fileSet;

  fileSet = fileSetMap.get(event.getFile().getName().getPath());

  if (fileSet == null) {
    try {
      logger.info(path
          + " is not in monitoring list. It's going to be listed.");
      fileSet = new FileSet(source, event.getFile());
      //a little synchronized bug here.fixed by tqli,2014-08-07 ,E-mail:[email protected]
      synchronized(fileSetMap){
        fileSetMap.put(path, fileSet);
      }
    } catch (IOException e) {
      logger.error(e.getMessage(), e);
      return;
    }
  }
}
 
开发者ID:javiroman,项目名称:flume-taildirectory-source,代码行数:41,代码来源:DirectoryTailSource.java

示例9: fileChanged

import org.apache.commons.vfs2.FileChangeEvent; //导入方法依赖的package包/类
private void fileChanged(FileChangeEvent event) throws FileSystemException {
  String path = event.getFile().getName().getPath();
  String dirPath = event.getFile().getParent().getName().getPath();

  logger.debug(path + " has been changed.");

  DirPattern dirPattern = pathMap.get(dirPath);
  if (dirPattern == null) {
    logger.warn("Occurred change event from un-indexed directory. "
        + dirPath);
    return;
  }

  // 파일명이 대상인지 검사한다.
  if (!isInFilePattern(event.getFile(), dirPattern.getFilePattern())) {
    logger.debug("Not in file pattern, " + path);
    return;
  }

  FileSet fileSet = fileSetMap.get(event.getFile().getName().getPath());

  if (fileSet == null) {
    logger.warn(path + "is not in monitoring list.");
    try {
      fileSet = new FileSet(source, event.getFile());
      synchronized (fileSetMap) {
        fileSetMap.put(path, fileSet);
      }
    } catch (IOException e) {
      logger.error(e.getMessage(), e);
      return;
    }
    return;
  }

  readMessage(fileSet);
}
 
开发者ID:javiroman,项目名称:flume-taildirectory-source,代码行数:38,代码来源:DirectoryTailSource.java


注:本文中的org.apache.commons.vfs2.FileChangeEvent.getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。