本文整理汇总了Java中org.apache.commons.vfs2.provider.GenericFileName.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java GenericFileName.getPort方法的具体用法?Java GenericFileName.getPort怎么用?Java GenericFileName.getPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.vfs2.provider.GenericFileName
的用法示例。
在下文中一共展示了GenericFileName.getPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHDFSFileSystem
import org.apache.commons.vfs2.provider.GenericFileName; //导入方法依赖的package包/类
@Override
public HadoopFileSystem getHDFSFileSystem() throws FileSystemException {
if (fs == null) {
Configuration conf = new Configuration();
conf.set("fs.maprfs.impl", MapRFileProvider.FS_MAPR_IMPL);
GenericFileName rootName = (GenericFileName) getRootName();
String url = rootName.getScheme() + "://" + rootName.getHostName().trim();
if (rootName.getPort() != MapRFileNameParser.DEFAULT_PORT) {
url += ":" + rootName.getPort();
}
url += "/";
conf.set("fs.default.name", url);
setFileSystemOptions( getFileSystemOptions(), conf );
try {
fs = new HadoopFileSystemImpl( org.apache.hadoop.fs.FileSystem.get(conf) );
} catch (Throwable t) {
throw new FileSystemException("Could not get MapR FileSystem for " + url, t);
}
}
return fs;
}
示例2: getHDFSFileSystem
import org.apache.commons.vfs2.provider.GenericFileName; //导入方法依赖的package包/类
public HadoopFileSystem getHDFSFileSystem() throws FileSystemException {
if (mockHdfs != null) {
return mockHdfs;
}
if (hdfs == null) {
Configuration conf = new Configuration();
GenericFileName genericFileName = (GenericFileName) getRootName();
StringBuffer urlBuffer = new StringBuffer("hdfs://");
urlBuffer.append(genericFileName.getHostName());
int port = genericFileName.getPort();
if(port >= 0) {
urlBuffer.append(":");
urlBuffer.append(port);
}
String url = urlBuffer.toString();
conf.set("fs.default.name", url);
String replication = System.getProperty("dfs.replication", "3");
conf.set("dfs.replication", replication);
if (genericFileName.getUserName() != null && !"".equals(genericFileName.getUserName())) {
conf.set("hadoop.job.ugi", genericFileName.getUserName() + ", " + genericFileName.getPassword());
}
setFileSystemOptions( getFileSystemOptions(), conf );
try {
hdfs = new HadoopFileSystemImpl( org.apache.hadoop.fs.FileSystem.get( conf ) );
} catch (Throwable t) {
throw new FileSystemException("Could not getHDFSFileSystem() for " + url, t);
}
}
return hdfs;
}
示例3: GridFTPClientWrapper
import org.apache.commons.vfs2.provider.GenericFileName; //导入方法依赖的package包/类
/**
* Instantiates a new grid ftp client wrapper.
*
* @param root the root
* @param fileSystemOptions the file system options
*
* @throws ServerException the server exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public GridFTPClientWrapper(final GenericFileName root, final FileSystemOptions fileSystemOptions) throws ServerException, IOException {
super(root.getHostName(), root.getPort());
this.root = root;
this.fileSystemOptions = fileSystemOptions;
getGridFtpClient(); // fail-fast
}