本文整理汇总了Java中org.apache.hadoop.hdfs.web.HsftpFileSystem类的典型用法代码示例。如果您正苦于以下问题:Java HsftpFileSystem类的具体用法?Java HsftpFileSystem怎么用?Java HsftpFileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HsftpFileSystem类属于org.apache.hadoop.hdfs.web包,在下文中一共展示了HsftpFileSystem类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testHsftpCustomUriPortWithCustomDefaultPorts
import org.apache.hadoop.hdfs.web.HsftpFileSystem; //导入依赖的package包/类
@Test
public void testHsftpCustomUriPortWithCustomDefaultPorts()
throws IOException {
Configuration conf = new Configuration();
conf.setInt("dfs.http.port", 123);
conf.setInt("dfs.https.port", 456);
URI uri = URI.create("hsftp://localhost:789");
HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);
assertEquals(456, fs.getDefaultPort());
assertEquals(456, fs.getDefaultSecurePort());
assertEquals(uri, fs.getUri());
assertEquals("127.0.0.1:789", fs.getCanonicalServiceName());
}
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:TestHftpFileSystem.java
示例2: testHsftpDefaultPorts
import org.apache.hadoop.hdfs.web.HsftpFileSystem; //导入依赖的package包/类
@Test
public void testHsftpDefaultPorts() throws IOException {
Configuration conf = new Configuration();
URI uri = URI.create("hsftp://localhost");
HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);
assertEquals(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
fs.getDefaultPort());
assertEquals(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
fs.getDefaultSecurePort());
assertEquals(uri, fs.getUri());
assertEquals("127.0.0.1:" + DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
fs.getCanonicalServiceName());
}
开发者ID:hopshadoop,项目名称:hops,代码行数:16,代码来源:TestHftpFileSystem.java
示例3: testHsftpCustomDefaultPorts
import org.apache.hadoop.hdfs.web.HsftpFileSystem; //导入依赖的package包/类
@Test
public void testHsftpCustomDefaultPorts() throws IOException {
Configuration conf = new Configuration();
conf.setInt("dfs.http.port", 123);
conf.setInt("dfs.https.port", 456);
URI uri = URI.create("hsftp://localhost");
HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);
assertEquals(456, fs.getDefaultPort());
assertEquals(456, fs.getDefaultSecurePort());
assertEquals(uri, fs.getUri());
assertEquals("127.0.0.1:456", fs.getCanonicalServiceName());
}
开发者ID:hopshadoop,项目名称:hops,代码行数:16,代码来源:TestHftpFileSystem.java
示例4: testHsftpCustomUriPortWithDefaultPorts
import org.apache.hadoop.hdfs.web.HsftpFileSystem; //导入依赖的package包/类
@Test
public void testHsftpCustomUriPortWithDefaultPorts() throws IOException {
Configuration conf = new Configuration();
URI uri = URI.create("hsftp://localhost:123");
HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);
assertEquals(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
fs.getDefaultPort());
assertEquals(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
fs.getDefaultSecurePort());
assertEquals(uri, fs.getUri());
assertEquals("127.0.0.1:123", fs.getCanonicalServiceName());
}
开发者ID:hopshadoop,项目名称:hops,代码行数:15,代码来源:TestHftpFileSystem.java
示例5: getDTfromRemote
import org.apache.hadoop.hdfs.web.HsftpFileSystem; //导入依赖的package包/类
static public Credentials getDTfromRemote(URLConnectionFactory factory,
URI nnUri, String renewer, String proxyUser) throws IOException {
StringBuilder buf = new StringBuilder(nnUri.toString())
.append(GetDelegationTokenServlet.PATH_SPEC);
String separator = "?";
if (renewer != null) {
buf.append("?").append(GetDelegationTokenServlet.RENEWER).append("=")
.append(renewer);
separator = "&";
}
if (proxyUser != null) {
buf.append(separator).append("doas=").append(proxyUser);
}
boolean isHttps = nnUri.getScheme().equals("https");
HttpURLConnection conn = null;
DataInputStream dis = null;
InetSocketAddress serviceAddr = NetUtils.createSocketAddr(nnUri
.getAuthority());
try {
if(LOG.isDebugEnabled()) {
LOG.debug("Retrieving token from: " + buf);
}
conn = run(factory, new URL(buf.toString()));
InputStream in = conn.getInputStream();
Credentials ts = new Credentials();
dis = new DataInputStream(in);
ts.readFields(dis);
for (Token<?> token : ts.getAllTokens()) {
token.setKind(isHttps ? HsftpFileSystem.TOKEN_KIND : HftpFileSystem.TOKEN_KIND);
SecurityUtil.setTokenService(token, serviceAddr);
}
return ts;
} catch (Exception e) {
throw new IOException("Unable to obtain remote token", e);
} finally {
IOUtils.cleanup(LOG, dis);
if (conn != null) {
conn.disconnect();
}
}
}
开发者ID:yncxcw,项目名称:big-c,代码行数:46,代码来源:DelegationTokenFetcher.java
注:本文中的org.apache.hadoop.hdfs.web.HsftpFileSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论