/** * Create a FileName. * * @param absPath The absolute path. * @param type The FileType. * @return The created FileName. */ @Override public FileName createName(final String absPath, final FileType type) { return new GenericFileName(getScheme(), hostName, port, defaultPort, userName, password, absPath, type); }
/** * Create a FileName. * * @param absPath The absolute path. * @param type The FileType. * @return The created FileName. */ @Override public FileName createName(final String absPath, final FileType type) { return new GenericFileName(getScheme(), hostName, port, defaultPort, userName, password, absPath, type); }
/** * Create a FileName. * * @param absPath The absolute path. * @param type The FileType. * @return The created FileName. */ @Override public FileName createName(final String absPath, final FileType type) { return new GenericFileName(getScheme(), hostName, port, defaultPort, userName, password, absPath, type); }
/** * Builds the root URI for this file name. */ @Override protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { buffer.append(getScheme()); buffer.append("://"); buffer.append(hostName); if (port != getDefaultPort()) { buffer.append(':'); buffer.append(port); } } }
/** * Create a FileName. * @param absPath The absolute path. * @param type The FileType. * @return The created FileName. */ @Override public FileName createName(final String absPath, final FileType type) { return new GenericFileName( getScheme(), hostName, port, defaultPort, absPath, type); }
/** * Builds the root URI for this file name. */ @Override protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { buffer.append(getScheme()); buffer.append("://"); appendCredentials(buffer, addPassword); buffer.append(hostName); if (port != getDefaultPort()) { buffer.append(':'); buffer.append(port); } }
/** * Builds the root URI for this file name. */ @Override protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { buffer.append(getScheme()); buffer.append("://"); appendCredentials(buffer, addPassword); buffer.append(hostName); if (port != getDefaultPort()) { buffer.append(':'); buffer.append(port); } }
/** * Builds the root URI for this file name. */ @Override protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { buffer.append(getScheme()); buffer.append("://"); appendCredentials(buffer, addPassword); buffer.append(hostName); if (port != getDefaultPort()) { buffer.append(':'); buffer.append(port); } }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); final String fileScheme = rootName.getScheme(); final char lastChar = fileScheme.charAt(fileScheme.length() - 1); final String internalScheme = (lastChar == 's' || lastChar == 'S') ? "https" : "http"; httpClient = HttpClientFactory.createConnection(internalScheme, rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
private FileSystem createWebFileSystem( final LayeredFileName genericRootName, final FileSystemOptions fileSystemOptions ) throws FileSystemException { final GenericFileName outerName = (GenericFileName) genericRootName.getOuterName(); String scheme = outerName.getScheme(); String hostName = outerName.getHostName(); int port = outerName.getPort(); String userName = outerName.getUserName(); String password = outerName.getPassword(); HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder(); if ( !StringUtil.isEmpty( hostName ) ) { clientBuilder.setProxy( hostName, port, scheme ); } if ( !StringUtil.isEmpty( userName ) ) { clientBuilder.setCredentials( userName, password ); } final PentahoSolutionsFileSystemConfigBuilder configBuilder = new PentahoSolutionsFileSystemConfigBuilder(); final int timeOut = configBuilder.getTimeOut( fileSystemOptions ); clientBuilder.setSocketTimeout( Math.max( 0, timeOut ) ); return new WebSolutionFileSystem( genericRootName, fileSystemOptions, new LocalFileModel( outerName.getURI(), clientBuilder, userName, password, hostName, port ) ); }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); httpClient = HttpClientFactory.createConnection(rootName.getScheme(), rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); httpClient = HttpClientFactory.createConnection(rootName.getScheme(), rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
assertEquals("ftp", name.getScheme()); assertEquals("hostname", name.getHostName()); assertEquals(21, name.getPort()); assertEquals("ftp", name.getScheme()); assertEquals("hostname", name.getHostName()); assertEquals(9090, name.getPort()); assertEquals("ftp", name.getScheme()); assertEquals("hostname", name.getHostName()); assertEquals(21, name.getPort());
assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user", name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user", name.getUserName()); assertEquals("password", name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user:", name.getUserName()); assertEquals("@", name.getPassword());
assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user", name.getUserName()); assertNull(name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user", name.getUserName()); assertEquals("password", name.getPassword()); assertEquals("ftp", name.getScheme()); assertEquals("user:", name.getUserName()); assertEquals("@", name.getPassword());