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


Java FileNameParser.parseUri方法代码示例

本文整理汇总了Java中org.apache.commons.vfs2.provider.FileNameParser.parseUri方法的典型用法代码示例。如果您正苦于以下问题:Java FileNameParser.parseUri方法的具体用法?Java FileNameParser.parseUri怎么用?Java FileNameParser.parseUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs2.provider.FileNameParser的用法示例。


在下文中一共展示了FileNameParser.parseUri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rootPathNoClusterName

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
@Test
public void rootPathNoClusterName() throws FileSystemException {
  final String URI = "maprfs:///";

  FileNameParser parser = new MapRFileNameParser();
  FileName name = parser.parseUri(null, null, URI);

  assertEquals(URI, name.getURI());
  assertEquals("maprfs", name.getScheme());
}
 
开发者ID:pentaho,项目名称:pentaho-hdfs-vfs,代码行数:11,代码来源:MapRFileNameParserTest.java

示例2: withPath

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
@Test
public void withPath() throws FileSystemException
{
  final String URI = "maprfs:///my/file/path";

  FileNameParser parser = new MapRFileNameParser();
  FileName name = parser.parseUri(null, null, URI);

  assertEquals(URI, name.getURI());
  assertEquals("maprfs", name.getScheme());
  assertEquals("/my/file/path", name.getPath());
}
 
开发者ID:pentaho,项目名称:pentaho-hdfs-vfs,代码行数:13,代码来源:MapRFileNameParserTest.java

示例3: withPathAndClusterName

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
@Test
public void withPathAndClusterName() throws FileSystemException {
  final String URI = "maprfs://cluster2/my/file/path";

  FileNameParser parser = new MapRFileNameParser();
  FileName name = parser.parseUri(null, null, URI);

  assertEquals(URI, name.getURI());
  assertEquals("maprfs", name.getScheme());
  assertTrue(name.getURI().startsWith("maprfs://cluster2/"));
  assertEquals("/my/file/path", name.getPath());
}
 
开发者ID:pentaho,项目名称:pentaho-hdfs-vfs,代码行数:13,代码来源:MapRFileNameParserTest.java

示例4: testParseUri_withKeys

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
@Test
public void testParseUri_withKeys() throws Exception {
  FileNameParser parser = S3FileNameParser.getInstance();
  String expected = buildS3URL( "/rcf-emr-staging", true );

  FileName filename =
    parser.parseUri( null, null, "s3://" + awsAccessKey + ":" + awsSecretKey + "@" + HOST + "/rcf-emr-staging" );
  assertEquals( expected, filename.getURI() );

}
 
开发者ID:pentaho,项目名称:pentaho-s3-vfs,代码行数:11,代码来源:S3FileNameParserIT.java

示例5: testParseUri_withoutKeys

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
@Test
public void testParseUri_withoutKeys() throws Exception {
  FileNameParser parser = S3FileNameParser.getInstance();
  String expected = buildS3URL( "/", false );

  FileName filename = parser.parseUri( null, null, "s3://" + HOST + "/" );
  assertEquals( expected, filename.getURI() );

}
 
开发者ID:pentaho,项目名称:pentaho-s3-vfs,代码行数:10,代码来源:S3FileNameParserIT.java

示例6: setParameter

import org.apache.commons.vfs2.provider.FileNameParser; //导入方法依赖的package包/类
/**
 * Publicly expose a generic way to set parameters
 */
@Override
public void setParameter( FileSystemOptions opts, String name, String value, String fullParameterName,
  String vfsUrl ) throws IOException {
  if ( !fullParameterName.startsWith( "vfs.sftp" ) ) {
    // This is not an SFTP parameter. Delegate to the generic handler
    super.setParameter( opts, name, value, fullParameterName, vfsUrl );
  } else {
    // Check for the presence of a host in the full variable name
    try {
      // Parse server name from vfsFilename
      FileNameParser sftpFilenameParser = SftpFileNameParser.getInstance();
      URLFileName file = (URLFileName) sftpFilenameParser.parseUri( null, null, vfsUrl );

      if ( !parameterContainsHost( fullParameterName ) || fullParameterName.endsWith( file.getHostName() ) ) {
        // Match special cases for parameter names
        if ( name.equalsIgnoreCase( "AuthKeyPassphrase" ) ) {
          setParam( opts, UserInfo.class.getName(), new PentahoUserInfo( value ) );
        } else if ( name.equals( "identity" ) ) {

          IdentityInfo[] identities = (IdentityInfo[]) this.getParam( opts, IDENTITY_KEY );

          if ( identities == null ) {
            identities = new IdentityInfo[] { new IdentityInfo( new File( value ) ) };
          } else {
            // Copy, in a Java 5 friendly manner, identities into a larger array
            IdentityInfo[] temp = new IdentityInfo[identities.length + 1];
            System.arraycopy( identities, 0, temp, 0, identities.length );
            identities = temp;

            identities[identities.length - 1] = new IdentityInfo( new File( value ) );
          }
          setParam( opts, IDENTITY_KEY, identities );
        } else {
          super.setParameter( opts, name, value, fullParameterName, vfsUrl );
        }
      } else {
        // No host match found
        log.logDebug( "No host match found for: " + fullParameterName );
      }
    } catch ( IOException e ) {
      log.logError( "Failed to set VFS parameter: [" + fullParameterName + "] " + value, e );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:48,代码来源:KettleSftpFileSystemConfigBuilder.java


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