/** * The main factory method for creating a file system. Get a file system for * the URI's scheme and authority. The scheme of the <code>uri</code> * determines a configuration property name, * <tt>fs.AbstractFileSystem.<i>scheme</i>.impl</tt> whose value names the * AbstractFileSystem class. * * The entire URI and conf is passed to the AbstractFileSystem factory method. * * @param uri for the file system to be created. * @param conf which is passed to the file system impl. * * @return file system for the given URI. * * @throws UnsupportedFileSystemException if the file system for * <code>uri</code> is not supported. */ public static AbstractFileSystem get(final URI uri, final Configuration conf) throws UnsupportedFileSystemException { return createFileSystem(uri, conf); }
@Override protected AbstractFileSystem getTargetFileSystem(final URI uri) throws URISyntaxException, UnsupportedFileSystemException { String pathString = uri.getPath(); if (pathString.isEmpty()) { pathString = "/"; } return new ChRootedFs( AbstractFileSystem.createFileSystem(uri, config), new Path(pathString)); }
/** * The main factory method for creating a file system. Get a file system for * the URI's scheme and authority. The scheme of the <code>uri</code> * determines a configuration property name, * <tt>fs.AbstractFileSystem.<i>scheme</i>.impl</tt> whose value names the * AbstractFileSystem class. * * The entire URI and conf is passed to the AbstractFileSystem factory method. * * @param uri for the file system to be created. * @param conf which is passed to the file system impl. * * @return file system for the given URI. * * @throws UnsupportedFileSystemException if the file system for * <code>uri</code> is not supported. */ public static AbstractFileSystem get(final URI uri, final Configuration conf) throws UnsupportedFileSystemException { return createFileSystem(uri, conf); }
/** * The main factory method for creating a file system. Get a file system for * the URI's scheme and authority. The scheme of the <code>uri</code> * determines a configuration property name, * <tt>fs.AbstractFileSystem.<i>scheme</i>.impl</tt> whose value names the * AbstractFileSystem class. * * The entire URI and conf is passed to the AbstractFileSystem factory method. * * @param uri for the file system to be created. * @param conf which is passed to the file system impl. * * @return file system for the given URI. * * @throws UnsupportedFileSystemException if the file system for * <code>uri</code> is not supported. */ public static AbstractFileSystem get(final URI uri, final Configuration conf) throws UnsupportedFileSystemException { return createFileSystem(uri, conf); }
/** * The main factory method for creating a file system. Get a file system for * the URI's scheme and authority. The scheme of the <code>uri</code> * determines a configuration property name, * <tt>fs.AbstractFileSystem.<i>scheme</i>.impl</tt> whose value names the * AbstractFileSystem class. * * The entire URI and conf is passed to the AbstractFileSystem factory method. * * @param uri for the file system to be created. * @param conf which is passed to the file system impl. * * @return file system for the given URI. * * @throws UnsupportedFileSystemException if the file system for * <code>uri</code> is not supported. */ public static AbstractFileSystem get(final URI uri, final Configuration conf) throws UnsupportedFileSystemException { return createFileSystem(uri, conf); }
/** * The main factory method for creating a file system. Get a file system for * the URI's scheme and authority. The scheme of the <code>uri</code> * determines a configuration property name, * <tt>fs.AbstractFileSystem.<i>scheme</i>.impl</tt> whose value names the * AbstractFileSystem class. * * The entire URI and conf is passed to the AbstractFileSystem factory method. * * @param uri for the file system to be created. * @param conf which is passed to the file system impl. * * @return file system for the given URI. * * @throws UnsupportedFileSystemException if the file system for * <code>uri</code> is not supported. */ public static AbstractFileSystem get(final URI uri, final Configuration conf) throws UnsupportedFileSystemException { return createFileSystem(uri, conf); }
@Override protected AbstractFileSystem getTargetFileSystem(final URI uri) throws URISyntaxException, UnsupportedFileSystemException { String pathString = uri.getPath(); if (pathString.isEmpty()) { pathString = "/"; } return new ChRootedFs( AbstractFileSystem.createFileSystem(uri, config), new Path(pathString)); }
@Override protected AbstractFileSystem getTargetFileSystem(final URI uri) throws URISyntaxException, UnsupportedFileSystemException { String pathString = uri.getPath(); if (pathString.isEmpty()) { pathString = "/"; } return new ChRootedFs( AbstractFileSystem.createFileSystem(uri, config), new Path(pathString)); }
@Override protected AbstractFileSystem getTargetFileSystem(final URI uri) throws URISyntaxException, UnsupportedFileSystemException { String pathString = uri.getPath(); if (pathString.isEmpty()) { pathString = "/"; } return new ChRootedFs( AbstractFileSystem.createFileSystem(uri, config), new Path(pathString)); }
@Override protected AbstractFileSystem getTargetFileSystem(final URI uri) throws URISyntaxException, UnsupportedFileSystemException { String pathString = uri.getPath(); if (pathString.isEmpty()) { pathString = "/"; } return new ChRootedFs( AbstractFileSystem.createFileSystem(uri, config), new Path(pathString)); }
@Test(timeout = 300000) public void testHdfsGetCanonicalServiceName() throws Exception { Configuration conf = dfs.getConf(); URI haUri = HATestUtil.getLogicalUri(cluster); AbstractFileSystem afs = AbstractFileSystem.createFileSystem(haUri, conf); String haService = HAUtil.buildTokenServiceForLogicalUri(haUri, HdfsConstants.HDFS_URI_SCHEME).toString(); assertEquals(haService, afs.getCanonicalServiceName()); Token<?> token = afs.getDelegationTokens( UserGroupInformation.getCurrentUser().getShortUserName()).get(0); assertEquals(haService, token.getService().toString()); // make sure the logical uri is handled correctly token.renew(conf); token.cancel(conf); }