List of usage examples for org.apache.commons.vfs2.provider FileProvider findFile
FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions) throws FileSystemException;
From source file:org.efaps.db.store.VFSStoreResource.java
/** * @return DefaultFileSystemManager// www . ja v a 2s . co m * @throws EFapsException on error */ private DefaultFileSystemManager evaluateFileSystemManager() throws EFapsException { final DefaultFileSystemManager ret = new DefaultFileSystemManager(); final String baseName = getProperties().get(VFSStoreResource.PROPERTY_BASENAME); final String provider = getProperties().get(VFSStoreResource.PROPERTY_PROVIDER); try { ret.init(); final FileProvider fileProvider = (FileProvider) Class.forName(provider).newInstance(); ret.addProvider(baseName, fileProvider); ret.setBaseFile(fileProvider.findFile(null, baseName, null)); } catch (final FileSystemException e) { throw new EFapsException(VFSStoreResource.class, "evaluateFileSystemManager.FileSystemException", e, provider, baseName); } catch (final InstantiationException e) { throw new EFapsException(VFSStoreResource.class, "evaluateFileSystemManager.InstantiationException", e, baseName, provider); } catch (final IllegalAccessException e) { throw new EFapsException(VFSStoreResource.class, "evaluateFileSystemManager.IllegalAccessException", e, provider); } catch (final ClassNotFoundException e) { throw new EFapsException(VFSStoreResource.class, "evaluateFileSystemManager.ClassNotFoundException", e, provider); } return ret; }
From source file:org.pentaho.hadoop.shim.ActiveHadoopShimFileProvider.java
@Override public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions) throws FileSystemException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); FileProvider p = fsm.getActiveFileProvider(scheme); Thread.currentThread().setContextClassLoader(p.getClass().getClassLoader()); try {// w w w . j ava 2 s . c o m return p.findFile(baseFile, uri, fileSystemOptions); } finally { Thread.currentThread().setContextClassLoader(cl); } }