List of usage examples for org.apache.commons.vfs FileSystem resolveFile
FileObject resolveFile(String name) throws FileSystemException;
From source file:com.jaspersoft.jasperserver.api.metadata.common.util.RepositoryFileProvider.java
public FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions) throws FileSystemException { final FileName rootName = new RepositoryFileName(getScheme(), null, FileType.FOLDER); FileSystem fs = findFileSystem(rootName.getRoot(), fileSystemOptions); if (fs == null) { fs = new RepositoryFileSystem(getScheme(), rootName, fileSystemOptions); addFileSystem(rootName.getRoot(), fs); }// ww w . j av a 2 s. c o m FileObject result = fs.resolveFile(uri); return result; }
From source file:com.bedatadriven.renjin.appengine.AppEngineLocalFilesSystemProvider.java
@Override public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions properties) throws FileSystemException { System.out.println(uri);/*from w w w . ja va 2s.co m*/ // Parse the name final StringBuffer buffer = new StringBuffer(uri); String scheme = UriParser.extractScheme(uri, buffer); if (scheme == null) { scheme = "file"; } UriParser.fixSeparators(buffer); FileType fileType = UriParser.normalisePath(buffer); final String path = buffer.toString(); // Create the temp file system if it does not exist // FileSystem filesystem = findFileSystem( this, (Properties) null); FileSystem filesystem = findFileSystem(this, properties); if (filesystem == null) { final FileName rootName = getContext().parseURI(scheme + ":" + FileName.ROOT_PATH); filesystem = new LocalFileSystem(rootName, rootFile.getAbsolutePath(), properties); addFileSystem(this, filesystem); } // Find the file return filesystem.resolveFile(path); }
From source file:org.codehaus.mojo.unix.maven.plugin.AssemblyOp.java
protected FileObject resolve(FileSystem basedir, File file) throws FileSystemException { return basedir.resolveFile(file.getAbsolutePath()); }
From source file:org.josso.tooling.gshell.install.provider.maven2.MavenProvider.java
public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions) throws FileSystemException { try {//from w ww .j ava 2s .c om if (uri.startsWith("mvn:") && uri.length() > 4) { uri = uri.substring(4); } else { throw new FileSystemException("uri should contain group and artifact id."); } final FileName rootName = getContext().parseURI(repositoryHome); Parser parser = new Parser(uri); uri = parser.getArtifactPath(); final String key = this.getClass().getName(); FileSystem fs = findFileSystem(key, fileSystemOptions); if (fs == null) { //rootname is path to .m2 repository (considering only local repos for now) fs = new MavenFileSystem(rootName, fileSystemOptions); addFileSystem(key, fs); } return fs.resolveFile(uri); } catch (MalformedURLException e) { throw new FileSystemException(e); } }