List of usage examples for org.apache.commons.vfs VFS getManager
public static synchronized FileSystemManager getManager() throws FileSystemException
From source file:org.jbpm.form.builder.services.impl.fs.FSMenuService.java
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 {//from w ww . java 2s .c o m return FileUtils.readFileToString(FileUtils.toFile(url)); } }
From source file:org.jclouds.vfs.tools.blobstore.BlobStoreShell.java
private BlobStoreShell(String uri) throws FileSystemException { remoteMgr = new DefaultFileSystemManager(); remoteMgr.setFilesCache(new SoftRefFilesCache()); remoteMgr.addProvider("blobstore", new BlobStoreFileProvider()); remoteMgr.init();//from w w w.j av a 2 s .c o m remoteCwd = remoteMgr.resolveFile(checkNotNull(uri, "uri")); mgr = VFS.getManager(); cwd = mgr.resolveFile(System.getProperty("user.dir")); reader = new BufferedReader(new InputStreamReader(System.in)); }
From source file:org.josso.tooling.gshell.core.support.VfsCommandSupport.java
protected FileSystemManager getFileSystemManager() { if (fsManager == null) { try {/* ww w.ja v a2 s . c o m*/ fsManager = VFS.getManager(); } catch (FileSystemException e) { throw new RuntimeException(e); } } return fsManager; }
From source file:org.josso.tooling.gshell.install.commands.InstallJavaAgentCommand.java
protected void setup() throws Exception { // ----------------------------------------------------------------------- // TODO : We could use a remote repository to get our artifacts instead of the vfs or we could use vfs providers. FileSystemManager fs = VFS.getManager(); homeDir = fs.resolveFile(getHomeDir()); libsDir = homeDir.resolveFile("dist/agents/bin"); srcsDir = homeDir.resolveFile("dist/agents/src"); trdpartyDir = libsDir.resolveFile("3rdparty"); confDir = homeDir.resolveFile("dist/agents/config/" + getTargetPlatformId()); iis32Dir = libsDir.resolveFile("Win32"); iis64Dir = libsDir.resolveFile("Win64"); }
From source file:org.josso.tooling.gshell.install.commands.InstallWebGatewayCommand.java
protected void setup() throws Exception { // ----------------------------------------------------------------------- // TODO : We could use a remote repository to get our artifacts instead of the vfs or we could use vfs providers. FileSystemManager fs = VFS.getManager(); homeDir = fs.resolveFile(getHomeDir()); appDir = homeDir.resolveFile("dist/gateway/apps"); confDir = homeDir.resolveFile("dist/gateway/config/"); log.debug("JAVA TMP : " + System.getProperty("java.io.tmpdir")); tmpDir = fs.resolveFile(System.getProperty("java.io.tmpdir")); }
From source file:org.josso.tooling.gshell.install.commands.InstallWebSamplesCommand.java
protected void setup() throws Exception { // ----------------------------------------------------------------------- // TODO : We could use a remote repository to get our artifacts instead of the vfs or we could use vfs providers. FileSystemManager fs = VFS.getManager(); homeDir = fs.resolveFile(getHomeDir()); appDir = homeDir.resolveFile("dist/samples/apps"); }
From source file:org.josso.tooling.gshell.install.installer.VFSInstaller.java
protected FileSystemManager getFileSystemManager() { if (fsManager == null) { try {/* w w w . ja v a 2 s . co m*/ fsManager = VFS.getManager(); } catch (FileSystemException e) { log.error(e.getMessage(), e); throw new RuntimeException(e); } } return fsManager; }
From source file:org.openossad.util.ImageUtil.java
public static java.awt.Image createImageIconWithVFS(String location) { try {//w w w.java 2 s . c om return new ImageIcon(VFS.getManager().resolveFile(base, location).getURL(), "").getImage(); } catch (FileSystemException e) { throw new RuntimeException("Unable to load image with name [" + location + "]", e); } }
From source file:org.openossad.util.ImageUtil.java
public static String createImagePath(String location) { try {/*from www .ja v a2 s .com*/ return VFS.getManager().resolveFile(base, location).getURL().toString(); } catch (FileSystemException e) { throw new RuntimeException("Unable to load image with name [" + location + "]", e); } }
From source file:org.openossad.util.ImageUtil.java
public static Image getImageAsResource(String location) { Display display = new Display(); // assume the classloader for the active thread ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL res = cl.getResource(location); if (res != null) { try {/*from ww w .ja v a2s .co m*/ java.io.InputStream s = res.openStream(); if (s != null) { return new Image(display, s); } } catch (IOException e) { //do nothing. just move on to trying to load via file system } } try { FileObject imageFileObject = VFS.getManager().resolveFile(base, location); return new Image(display, OpenDESIGNERVFS.getInputStream(imageFileObject)); } catch (FileSystemException e) { throw new RuntimeException("Unable to load image with name [" + location + "]", e); } }