List of usage examples for org.apache.commons.vfs FileName getScheme
public String getScheme();
From source file:com.newatlanta.appengine.vfs.provider.GaeFileSystem.java
@Override public synchronized FileObject resolveFile(FileName name) throws FileSystemException { if (!"gae".equals(name.getScheme())) { return getFileSystemManager().resolveFile(name.toString()); }/*from w ww. j a va 2 s . c o m*/ return super.resolveFile(name); }
From source file:de.ecclesia.kipeto.RepositoryResolver.java
/** * Versucht, im bergebenen Repository die Konfigurations-Datei zu finden * und daraus ein passendes Repository abzuleiten. Schlgt dies fehlt oder * tritt ein Fehler auf, wird dieser Fehler gelogt, und das bergebene * Repository zurckgegeben./* w w w . j a va2s . c o m*/ * * @return * @throws IOException */ public String resolveReposUrl() throws IOException { try { URL url; FileName filename; FileSystemManager fsm = VFS.getManager(); filename = fsm.resolveURI(defaultRepositoryUrl); if (!filename.getScheme().equalsIgnoreCase("http") && !filename.getScheme().equalsIgnoreCase("sftp")) { log.info("Resolving repository-config not implemented for protocol {} yet", filename.getScheme()); return defaultRepositoryUrl; } Properties config = loadVfsConfig(); if (config == null) { return defaultRepositoryUrl; } String localIp = determinateLocalIP(); return resolveRepos(localIp, config); } catch (Exception e) { log.error(e.getMessage(), e); return defaultRepositoryUrl; } }
From source file:org.pentaho.hdfs.vfs.test.MapRFileNameParserTest.java
@Test public void rootPathNoClusterName() throws FileSystemException { final String URI = "maprfs:///"; FileNameParser parser = new MapRFileNameParser(); FileName name = parser.parseUri(null, null, URI); assertEquals(URI, name.getURI()); assertEquals("maprfs", name.getScheme()); }
From source file:org.pentaho.hdfs.vfs.test.MapRFileNameParserTest.java
@Test public void withPath() throws FileSystemException { final String URI = "maprfs:///my/file/path"; FileNameParser parser = new MapRFileNameParser(); FileName name = parser.parseUri(null, null, URI); assertEquals(URI, name.getURI()); assertEquals("maprfs", name.getScheme()); assertEquals("/my/file/path", name.getPath()); }
From source file:org.pentaho.hdfs.vfs.test.MapRFileNameParserTest.java
@Test public void withPathAndClusterName() throws FileSystemException { final String URI = "maprfs://cluster2/my/file/path"; FileNameParser parser = new MapRFileNameParser(); FileName name = parser.parseUri(null, null, URI); assertEquals(URI, name.getURI()); assertEquals("maprfs", name.getScheme()); assertTrue(name.getURI().startsWith("maprfs://cluster2/")); assertEquals("/my/file/path", name.getPath()); }