List of usage examples for org.apache.commons.vfs2.provider LayeredFileName getOuterName
public FileName getOuterName()
From source file:org.pentaho.reporting.libraries.pensol.PentahoSolutionFileProvider.java
private FileSystem createJCRFileSystem(final LayeredFileName genericRootName, final FileSystemOptions fileSystemOptions) { UserAuthenticationData authData = null; try {/* w ww .ja v a2s .co m*/ authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); final GenericFileName outerName = (GenericFileName) genericRootName.getOuterName(); final String username = UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(outerName.getUserName()))); final String password = UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(outerName.getPassword()))); final PentahoSolutionsFileSystemConfigBuilder configBuilder = new PentahoSolutionsFileSystemConfigBuilder(); final int timeOut = configBuilder.getTimeOut(fileSystemOptions); final JCRSolutionFileModel model = new JCRSolutionFileModel(outerName.getURI(), username, password, timeOut); return new JCRSolutionFileSystem(genericRootName, fileSystemOptions, model); } finally { UserAuthenticatorUtils.cleanup(authData); } }
From source file:org.pentaho.reporting.libraries.pensol.PentahoSolutionFileProvider.java
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); }/*from w ww. j a v a 2 s . c o m*/ 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)); }