List of usage examples for org.apache.commons.vfs2.provider UriParser normalisePath
public static FileType normalisePath(final StringBuilder path) throws FileSystemException
From source file:cz.lbenda.rcp.config.ConfigurationFileProvider.java
@Override public FileObject findFile(FileObject fileObject, String uri, FileSystemOptions fileSystemOptions) throws FileSystemException { final StringBuilder buffer = new StringBuilder(uri); UriParser.extractScheme(uri, buffer); UriParser.fixSeparators(buffer);//from www . jav a 2s. c o m UriParser.normalisePath(buffer); final String path = buffer.toString(); FileSystemManager fsManager = VFS.getManager(); return fsManager.resolveFile("file://" + configurationRW.configPath(path)); }
From source file:org.renjin.appengine.AppEngineLocalFilesSystemProvider.java
@Override public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions properties) throws FileSystemException { // Parse the name final StringBuilder buffer = new StringBuilder(uri); String scheme = UriParser.extractScheme(uri, buffer); if (scheme == null) { scheme = "file"; }/*from w ww .j a v a2 s . c o m*/ 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 AppEngineLocalFileSystem(rootName, rootFile.getAbsolutePath(), properties); addFileSystem(this, filesystem); } // Find the file return filesystem.resolveFile(path); }
From source file:org.wso2.carbon.inbound.endpoint.protocol.file.MockFileNameParser.java
public FileName parseUri(VfsComponentContext context, FileName base, String filename) throws FileSystemException { StringBuilder name = new StringBuilder(); String scheme = UriParser.extractScheme(filename.split("\\?")[0], name); if (scheme == null) { scheme = "test"; }// ww w.j a va 2s . c o m UriParser.canonicalizePath(name, 0, name.length(), this); UriParser.fixSeparators(name); String rootFile = this.extractRootPrefix(filename, name); FileType fileType = UriParser.normalisePath(name); String path = name.toString(); return new MockFileName(scheme, "", path, fileType); }