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


Java FileChangeEvent类代码示例

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


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

示例1: callRaptureAction

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
private void callRaptureAction(EventType et, FileChangeEvent fe){
    String actionForEvent = getActionForEvent(et);
    
    if (!actionForEvent.isEmpty()) {
        //get the action type
        Scheme scheme = new RaptureURI(actionForEvent).getScheme();
        ImmutableMap<String, String> params = ImmutableMap.of("filetoprocess", fe.getFile().getName().toString());
        
        switch (scheme){
            case SCRIPT:
                String runScript = Kernel.getScript().runScript(ContextFactory.getKernelUser(), actionForEvent, params);
                log.info("Started script: " + runScript + " with params: " + params.toString());
                break;
            case WORKFLOW:
                String createWorkOrder = Kernel.getDecision().createWorkOrder(ContextFactory.getKernelUser(), actionForEvent, params);
                log.info("Started workorder: " + createWorkOrder + " with params: " + params.toString());
                break;
            default:
                log.error(scheme + " is not supported for " + folder + FilenameUtils.getName(fe.getFile().getName().getBaseName()));
                break;
        }
    } else {
        log.error(et + " has no associated action for monitor on " + folder);
    }
    
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:27,代码来源:WatchEventListener.java

示例2: 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

示例3: start

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@PostConstruct
public void start() throws Exception {

    log.info("LOG00100: {}", monitorPath);
    fileJobPath = MyVFS.getManager().resolveFile(jobPath);

    FileAlterationListener fl = new FileAlterationListener();
    FileObject path = MyVFS.getManager().resolveFile(monitorPath);
    scannerPath.addListener(path, fl);
    FileObject[] fileList = path.getChildren();

    for (FileObject file : fileList) {
        fl.fileCreated(new FileChangeEvent(file));
    }

}
 
开发者ID:OlegNyr,项目名称:GisGMP,代码行数:17,代码来源:BisLoaderSniffer.java

示例4: 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

示例5: 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

示例6: 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

示例7: shouldSaveConfigWhenNewFileCreated

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@Test
public void shouldSaveConfigWhenNewFileCreated() throws IOException {
    final String fileName = "res:config/org.motechproject.motech-module1/somemodule.properties";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);

    configFileMonitor.fileCreated(new FileChangeEvent(fileObject));

    verify(configurationService).addOrUpdate(new File(fileObject.getName().getPath()));
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:ConfigFileMonitorTest.java

示例8: shouldNotSaveConfigWhenNewFileCreatedIsNotSupported

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@Test
public void shouldNotSaveConfigWhenNewFileCreatedIsNotSupported() throws IOException {
    final String fileName = "res:config/motech-settings.conf";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);

    configFileMonitor.fileCreated(new FileChangeEvent(fileObject));

    verifyZeroInteractions(configurationService);
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:ConfigFileMonitorTest.java

示例9: shouldSaveConfigWhenFileIsChanged

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@Test
public void shouldSaveConfigWhenFileIsChanged() throws IOException {
    final String fileName = "res:config/org.motechproject.motech-module1/somemodule.properties";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);

    configFileMonitor.fileChanged(new FileChangeEvent(fileObject));

    verify(configurationService).addOrUpdate(new File(fileObject.getName().getPath()));
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:ConfigFileMonitorTest.java

示例10: shouldDeleteConfigWhenFileIsDeleted

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@Test
public void shouldDeleteConfigWhenFileIsDeleted() throws FileSystemException {
    final String fileName = "res:config/org.motechproject.motech-module1/somemodule.properties";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);

    configFileMonitor.fileDeleted(new FileChangeEvent(fileObject));

    verify(configurationService).deleteByBundle(new File(fileObject.getName().getPath()).getParentFile().getName());
}
 
开发者ID:motech,项目名称:motech,代码行数:10,代码来源:ConfigFileMonitorTest.java

示例11: fileChanged

import org.apache.commons.vfs2.FileChangeEvent; //导入依赖的package包/类
@Override
	public void fileChanged(FileChangeEvent arg0) throws Exception {
		// TODO Auto-generated method stub
		System.out.println("fileChanged");
		IFileSystemCom file = FileSystemCom.getInstance();	
//		if(dob.get(0).getId() == Integer.parseInt(XMLConstruct.getIdXMLFiles())){
//			file.encryptFile(destinationShareFolder, local)
//		}
		file.encryptFile(this.dob, true);

	}
 
开发者ID:dev131,项目名称:DropTillLate_Application,代码行数:12,代码来源:FileChangeListener.java

示例12: 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

示例13: 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

示例14: 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

示例15: 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
{
    FileListener listener = getListener();
    if (listener == null)
    {
        return;
    }
    listener.fileCreated(event);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:15,代码来源:WeakRefFileListener.java


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