public RepositoryManager() { try { fsManager = VFS.getManager(); } catch (FileSystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Returns the default {@link FileSystemManager} instance */ public static synchronized FileSystemManager getManager() throws FileSystemException { if (instance == null) { instance = createManager("org.apache.commons.vfs.impl.StandardFileSystemManager"); } return instance; }
/** * Returns the absolute path of the file, relative to the root of the * file system that the file belongs to. */ public String getPath() { if (VFS.isUriStyle()) { return absPath + getUriTrailer(); } return absPath; }
protected void writeToURL(URL url, String json) throws FileNotFoundException, IOException { if (url.toExternalForm().startsWith("vfs")) { FileObject to = VFS.getManager().resolveFile(url.toExternalForm()); File tmpFile = File.createTempFile("xxFilexx", ".json"); FileUtils.writeStringToFile(tmpFile, json); FileObject from = VFS.getManager().toFileObject(tmpFile); to.copyFrom(from, new AllFileSelector()); FileUtils.deleteQuietly(tmpFile); } else { FileUtils.writeStringToFile(FileUtils.toFile(url), json); } }
protected void writeToURL(URL url, String json) throws FileNotFoundException, IOException { if (url.toExternalForm().startsWith("vfs")) { FileObject to = VFS.getManager().resolveFile(url.toExternalForm()); File tmpFile = File.createTempFile("xxFilexx", ".json"); FileUtils.writeStringToFile(tmpFile, json); FileObject from = VFS.getManager().toFileObject(tmpFile); to.copyFrom(from, new AllFileSelector()); FileUtils.deleteQuietly(tmpFile); } else { FileUtils.writeStringToFile(FileUtils.toFile(url), json); } }
protected String readURL(URL url) throws FileNotFoundException, IOException { if (url.toExternalForm().startsWith("vfs")) { FileObject from = VFS.getManager().resolveFile(url.toExternalForm()); return IOUtils.toString(from.getContent().getInputStream()); } else { return FileUtils.readFileToString(FileUtils.toFile(url)); } } }
protected String readURL(URL url) throws FileNotFoundException, IOException { if (url.toExternalForm().startsWith("vfs")) { FileObject from = VFS.getManager().resolveFile(url.toExternalForm()); return IOUtils.toString(from.getContent().getInputStream()); } else { return FileUtils.readFileToString(FileUtils.toFile(url)); } } }
if (base != null && VFS.isUriStyle() && base.getType() == FileType.FILE) if (!VFS.isUriStyle())
protected void logout() throws TinkException, IOException { VFS.getManager().closeFileSystem(remote.getFileSystem()); }
if (baseFile != null && VFS.isUriStyle() && baseFile.getName().getType() == FileType.FILE)
/** * Constructor, creates instance of class. * * @param location location to resolve * @param parameters protocol specific parameters * @throws FileSystemException if an error occurs */ public CommonsVFSSource(final String location, final Map parameters) throws FileSystemException { m_location = location; m_manager = VFS.getManager(); m_fileObject = m_manager.resolveFile(location); // REVISIT: parameters m_fileContent = m_fileObject.getContent(); }
FileSystemManager fsManager = VFS.getManager(); List<FileObject> innerJarFiles = new ArrayList<FileObject>(); String classPathContent = System.getProperty("java.class.path");
private void setupLocation() throws FileSystemException { ConfigLocation configLocation = coreConfigurationService.getConfigLocation(); monitoredDir = VFS.getManager().resolveFile(configLocation.getLocation()); fileMonitor.addFile(monitoredDir); LOGGER.info(String.format("Setting up monitoring for location: %s", monitoredDir)); }
/** * Private constructor to init the singleton. * * @throws FileManipulatorException in <code>FileManipulator</code> init failed. */ public FileManipulator() throws FileManipulatorException { try { LOGGER.debug( "Creating VFS file system manager ..." ); this.fileSystemManager = VFS.getManager(); // this.fileSystemManager = new StandardFileSystemManager(); // fileSystemManager.setCacheStrategy(CacheStrategy.ON_CALL); ( (StandardFileSystemManager) this.fileSystemManager ).setReplicator( new KalumetFileReplicator() ); // fileSystemManager.init(); } catch ( Exception e ) { throw new FileManipulatorException( e ); } }
/** * Creates a VFS file handler with the default file system manager. */ public VFSFileHandler() { try { this.fileSystemManager = VFS.getManager(); } catch (FileSystemException e) { throw new CargoException("Failed to get VFS system manager", e); } }
/** * Constructor * * @param rootFileUrl * The root directory of the repository. */ public LocalRepository(String rootFileUrl) { try { this.setFsManager(VFS.getManager()); this.root = this.fsManager.resolveFile(rootFileUrl); this.fsManager.createFileSystem(root); } catch (FileSystemException e) { e.printStackTrace(); } }
/** * Constructor * * @param rootFileUrl */ public WebDAVRepository(String rootFileUrl) { try { this.setFsManager(VFS.getManager()); this.root = this.fsManager.resolveFile(rootFileUrl); this.fsManager.createFileSystem(root); } catch (FileSystemException e) { e.printStackTrace(); } }