List of usage examples for org.apache.commons.vfs2 VFS getManager
public static synchronized FileSystemManager getManager() throws FileSystemException
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesStore.java
public ApacheVfsPropertiesStore(final String parentUri, final String childPropertiesName) throws IOException { final FileObject baseDir = mapChecked(() -> VFS.getManager().resolveFile(parentUri), em); parentDirObj = mapChecked(() -> VFS.getManager().resolveFile(baseDir, cleanPath(childPropertiesName)), em); }
From source file:fi.mystes.synapse.mediator.vfs.VFSTestHelper.java
public static void assertFilesExists(String directory, int expectedCount) throws FileSystemException { FileSystemManager fsManager = VFS.getManager(); FileObject file = fsManager.resolveFile(directory); FileObject[] children = file.getChildren(); assertEquals("File count doesn't match", expectedCount, children.length); }
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesReader.java
public ApacheVfsPropertiesReader(final String parentUri, final String childPropertiesName) throws IOException { final FileObject baseDir = mapChecked(() -> VFS.getManager().resolveFile(parentUri), em); parentDirObj = mapChecked(() -> VFS.getManager().resolveFile(baseDir, cleanPath(childPropertiesName)), em); }
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesStore.java
public ApacheVfsPropertiesStore(final String pathUri) throws IOException { parentDirObj = mapChecked(() -> VFS.getManager().resolveFile(pathUri), em); }
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesReader.java
public ApacheVfsPropertiesReader(final String pathUri) throws IOException { parentDirObj = mapChecked(() -> VFS.getManager().resolveFile(pathUri), em); }
From source file:com.stratuscom.harvester.classloading.VFSClassLoaderTest.java
@Before public void setUp() throws Exception { fileSystemManager = VFS.getManager(); FileObject currentDir = fileSystemManager.toFileObject(new File(".")); FileObject reggieModuleJar = currentDir.resolveFile("target/reggie-module/reggie-module.jar"); reggieModuleRoot = fileSystemManager.createFileSystem(Strings.JAR, reggieModuleJar); libRoot = reggieModuleRoot.resolveFile(Strings.LIB); }
From source file:gsn.wrappers.general.FileSystemMonitorWrapper.java
public boolean initialize() { this.addressBean = getActiveAddressBean(); try {/*from w w w.ja v a 2 s . c o m*/ FileSystemManager manager = VFS.getManager(); DefaultFileMonitor fm = new DefaultFileMonitor(new FyleSystemListener()); String folder = this.addressBean.getPredicateValue("folder"); pattern = Pattern.compile(this.addressBean.getPredicateValue("pattern")); FileObject file = manager.resolveFile(folder); fm.setDelay(rate); fm.addFile(file); fm.start(); } catch (FileSystemException e) { logger.info("FileSystemException.", e); } return true; }
From source file:fi.mystes.synapse.mediator.vfs.VFSTestHelper.java
public static void assertFileContentEquals(String path, String expectedContent) throws IOException { FileObject file = VFS.getManager().resolveFile(path); InputStream in = file.getContent().getInputStream(); int length = 0; byte[] buffer = new byte[256]; ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length);/*from w w w. j a va 2 s . c o m*/ } assertEquals("Unexpected file content", expectedContent, out.toString()); }
From source file:com.msopentech.odatajclient.testservice.utils.FSManager.java
private FSManager(final ODataVersion version) throws Exception { this.version = version; fsManager = VFS.getManager(); }
From source file:edu.scripps.fl.pubchem.app.RelationDownloader.java
public void call() throws Exception { Pattern pattern = Pattern.compile("^AID(\\d+)\\s+AID(\\d+)$"); FileObject folder = VFS.getManager().resolveFile(assayNeighborURL); for (FileObject rFile : folder.getChildren()) { String name = rFile.getName().getBaseName(); log.info("Processing file: " + name); BufferedReader reader = new BufferedReader(new InputStreamReader(rFile.getContent().getInputStream())); String line = null;/*from w w w . j av a 2s . co m*/ long lastFrom = 0; List<Relation> relations = new ArrayList(100); while (null != (line = reader.readLine())) { Matcher matcher = pattern.matcher(line); if (!matcher.matches()) throw new java.lang.UnsupportedOperationException("Cannot determine AIDs from line: " + line); long from = Long.parseLong(matcher.group(1)); long to = Long.parseLong(matcher.group(2)); if (lastFrom == 0) // very first time only. lastFrom = from; if (from != lastFrom) { // when we change to the next aid in the file update(from, name, relations); PubChemDB.getSession().clear(); lastFrom = from; } Relation relation = new Relation(); relation.setFromDb("pcassay"); relation.setToDb("pcassay"); relation.setFromId(from); relation.setToId(to); relation.setRelationName(name); relations.add(relation); } update(lastFrom, name, relations); } }