Here are the examples of the java api class org.apache.hadoop.conf taken from open source projects.
1. NameNode#getTrashFileSystem()
Project: hadoop-20
File: NameNode.java
File: NameNode.java
private static FileSystem getTrashFileSystem(Configuration conf) throws IOException { conf = new Configuration(conf); InetSocketAddress serviceAddress = NameNode.getDNProtocolAddress(conf); if (serviceAddress != null) { URI defaultUri = FileSystem.getDefaultUri(conf); URI serviceUri = null; try { serviceUri = new URI(defaultUri.getScheme(), defaultUri.getUserInfo(), serviceAddress.getAddress().getHostAddress(), serviceAddress.getPort(), defaultUri.getPath(), defaultUri.getQuery(), defaultUri.getFragment()); } catch (URISyntaxException uex) { throw new IOException("Failed to initialize a uri for trash FS"); } Path trashFsPath = new Path(serviceUri.toString()); return trashFsPath.getFileSystem(conf); } else { return FileSystem.get(conf); } }
2. FileSystem#createFileSystem()
Project: hadoop-20
File: FileSystem.java
File: FileSystem.java
private static FileSystem createFileSystem(URI uri, Configuration conf, Key key) throws IOException { conf = ClientConfigurationUtil.mergeConfiguration(uri, conf); Class<?> clazz = conf.getClass("fs." + uri.getScheme() + ".impl", null); if (clazz == null) { throw new IOException("No FileSystem for scheme: " + uri.getScheme()); } FileSystem fs = (FileSystem) ReflectionUtils.newInstance(clazz, conf); if (key != null) { fs.key = key; } fs.initialize(uri, conf); return fs; }