当前位置: 首页>>代码示例>>Java>>正文


Java GenericFileName.getPort方法代码示例

本文整理汇总了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;
}
 
开发者ID:pentaho,项目名称:pentaho-hdfs-vfs,代码行数:23,代码来源:MapRFileSystem.java

示例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;
}
 
开发者ID:pentaho,项目名称:pentaho-hdfs-vfs,代码行数:33,代码来源:HDFSFileSystem.java

示例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
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:16,代码来源:GridFTPClientWrapper.java


注:本文中的org.apache.commons.vfs2.provider.GenericFileName.getPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。