/** * Constructor * * @param root */ public SFTPRepository(String root) { try { this.root = this.fsManager.resolveFile(root); } catch (FileSystemException e) { e.printStackTrace(); } }
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)); } } }
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); } }
/** * 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(); }
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)); }
public FileObject createVirtualFileSystem(final String rootUri) throws FileSystemException { assert rootUri != null; FileObject file = getManager().resolveFile(rootUri); return getManager().createVirtualFileSystem(file); }
public FileObject resolveFile(final FileObject baseFile, final String name) throws FileSystemException { FileObject f = getManager().resolveFile(baseFile, name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
public FileObject resolveFile(final FileObject baseFile, final String name) throws FileSystemException { FileObject f = getManager().resolveFile(baseFile, name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
public FileObject resolveFile(final FileObject baseFile, final String name) throws FileSystemException { FileObject f = getManager().resolveFile(baseFile, name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
public FileObject createVirtualFileSystem(final String rootUri) throws FileSystemException { assert rootUri != null; FileObject file = getManager().resolveFile(rootUri); return getManager().createVirtualFileSystem(file); }
public FileObject createVirtualFileSystem(final String rootUri) throws FileSystemException { assert rootUri != null; FileObject file = getManager().resolveFile(rootUri); return getManager().createVirtualFileSystem(file); }
public FileObject resolveFile(final String name) throws FileSystemException { FileObject f = getManager().resolveFile(getCurrentDirectory(), name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
public FileObject resolveFile(final String name) throws FileSystemException { FileObject f = getManager().resolveFile(getCurrentDirectory(), name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
public FileObject resolveFile(final String name) throws FileSystemException { FileObject f = getManager().resolveFile(getCurrentDirectory(), name); FileObject d = dereference(f); if (d != null) { d.refresh(); } return f; }
/** * 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(); } }
/** * 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(); } }
/** * Create a file. {@inheritDoc} * @param file File name. */ @Override public void createFile(String file) { try { getFileSystemManager().resolveFile(file).createFile(); } catch (FileSystemException e) { throw new CargoException("Failed to create file [" + file + "]", e); } }
protected void login() throws TinkException, IOException { URI location = getConfig().getRemote(); StaticUserAuthenticator auth = new StaticUserAuthenticator(null, getConfig().getUser(), getConfig().getPassword()); FileSystemOptions opts = new FileSystemOptions(); FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); remote = VFS.getManager().resolveFile(location.toString(), opts); }