List of usage examples for org.apache.commons.vfs2 FileName getScheme
String getScheme();
From source file:org.pentaho.big.data.impl.vfs.hdfs.HDFSFileProvider.java
@Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { GenericFileName genericFileName = (GenericFileName) name.getRoot(); String hostName = genericFileName.getHostName(); int port = genericFileName.getPort(); // TODO: load from metastore NamedCluster namedCluster = namedClusterService.getClusterTemplate(); namedCluster.setHdfsHost(hostName);// ww w. java2 s. co m if (port > 0) { namedCluster.setHdfsPort(String.valueOf(port)); } else { namedCluster.setHdfsPort(""); } namedCluster.setMapr(MAPRFS.equals(name.getScheme())); try { return new HDFSFileSystem(name, fileSystemOptions, hadoopFileSystemLocator .getHadoopFilesystem(namedCluster, URI.create(name.getURI() == null ? "" : name.getURI()))); } catch (ClusterInitializationException e) { throw new FileSystemException(e); } }
From source file:org.pentaho.reporting.libraries.pensol.PentahoSolutionFileProvider.java
/** * Creates a {@link org.apache.commons.vfs2.FileSystem}. If the returned FileSystem implements {@link * org.apache.commons.vfs2.provider.VfsComponent}, it will be initialised. * * @param rootName The name of the root file of the file system to create. */// ww w . j a v a 2 s .c o m protected FileSystem doCreateFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) throws FileSystemException { final LayeredFileName genericRootName = (LayeredFileName) rootName; if ("jcr-solution".equals(rootName.getScheme())) { // bypass authentication if running inside server if (this.bypassAuthentication) { return createJCRDirectFileSystem(genericRootName, fileSystemOptions); } return createJCRFileSystem(genericRootName, fileSystemOptions); } return createWebFileSystem(genericRootName, fileSystemOptions); }
From source file:pl.otros.logview.api.io.UtilsTest.java
@Test private void testGetObjectShortName(String scheme, String url, String baseName, String output) { // given/* www .j a v a2 s . c o m*/ FileObject fileObjectMock = mock(FileObject.class); FileName fileNameMock = mock(FileName.class); when(fileObjectMock.getName()).thenReturn(fileNameMock); when(fileNameMock.getScheme()).thenReturn(scheme); when(fileNameMock.getURI()).thenReturn(url); when(fileNameMock.getBaseName()).thenReturn(baseName); // when String fileObjectShortName = Utils.getFileObjectShortName(fileObjectMock); // then AssertJUnit.assertEquals(output, fileObjectShortName); }
From source file:pl.otros.logview.io.UtilsTest.java
@Test(enabled = false) private void testGetObjectShortName(String scheme, String url, String baseName, String output) { // given/*from w ww. ja va 2 s . c o m*/ FileObject fileObjectMock = mock(FileObject.class); FileName fileNameMock = mock(FileName.class); when(fileObjectMock.getName()).thenReturn(fileNameMock); when(fileNameMock.getScheme()).thenReturn(scheme); when(fileNameMock.getURI()).thenReturn(url); when(fileNameMock.getBaseName()).thenReturn(baseName); // when String fileObjectShortName = Utils.getFileObjectShortName(fileObjectMock); // then AssertJUnit.assertEquals(output, fileObjectShortName); }
From source file:pl.otros.vfs.browser.FileNameWrapper.java
public FileNameWrapper(FileName fileName) { super(fileName.getScheme(), fileName.getPath(), fileName.getType()); this.fileName = fileName; }