org.apache.commons.vfs2.provider.FileNameParser Java Examples
The following examples show how to use
org.apache.commons.vfs2.provider.FileNameParser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: S3FileNameParserIT.java From hop with Apache License 2.0 | 5 votes |
@Test public void testParseUri_withKeys() throws Exception { FileNameParser parser = S3FileNameParser.getInstance(); String origUri = "s3:///fooBucket/rcf-emr-staging"; S3FileName filename = (S3FileName) parser.parseUri( null, null, origUri ); assertEquals( "fooBucket", filename.getBucketId() ); assertEquals( origUri, filename.getURI() ); }
Example #2
Source File: S3FileNameParser.java From hop with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #3
Source File: KettleSftpFileSystemConfigBuilder.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * 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 ); } } }
Example #4
Source File: ConnectionFileNameParser.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public static AbstractFileName parseUri( String uri, FileNameParser fileNameParser ) throws FileSystemException { StringBuilder name = new StringBuilder(); String scheme = UriParser.extractScheme( uri, name ); UriParser.canonicalizePath( name, 0, name.length(), fileNameParser ); UriParser.fixSeparators( name ); FileType fileType = UriParser.normalisePath( name ); // Extract the named connection name final String connection = UriParser.extractFirstElement( name ); String path = name.toString(); return new ConnectionFileName( scheme, connection, path, fileType ); }
Example #5
Source File: Webdav4FileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #6
Source File: Webdav4sFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #7
Source File: Http4FileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #8
Source File: HttpFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #9
Source File: Http5sFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #10
Source File: HttpsFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #11
Source File: FtpFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #12
Source File: Http5FileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #13
Source File: Http4sFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #14
Source File: WebdavFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #15
Source File: SmbFileNameParser.java From commons-vfs with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #16
Source File: S3AFileNameParser.java From hop with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #17
Source File: S3NFileNameParser.java From hop with Apache License 2.0 | 4 votes |
public static FileNameParser getInstance() { return INSTANCE; }
Example #18
Source File: SftpFileNameParser.java From commons-vfs with Apache License 2.0 | 2 votes |
/** * Gets the singleton instance. * * @return the singleton instance. */ public static FileNameParser getInstance() { return INSTANCE; }