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


Java FileSystemOptions类代码示例

本文整理汇总了Java中org.apache.commons.vfs.FileSystemOptions的典型用法代码示例。如果您正苦于以下问题:Java FileSystemOptions类的具体用法?Java FileSystemOptions怎么用?Java FileSystemOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
public void init(ServletConfig servletConfig) throws ServletException {
  super.init(servletConfig);
  String rootUri = servletConfig.getInitParameter("vfs.uri");
  String authDomain = servletConfig.getInitParameter("vfs.auth.domain");
  String authUser = servletConfig.getInitParameter("vfs.auth.user");
  String authPass = servletConfig.getInitParameter("vfs.auth.password");
  try {
    StaticUserAuthenticator userAuthenticator =
            new StaticUserAuthenticator(authDomain, authUser, authPass);
    FileSystemOptions options = new FileSystemOptions();
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, userAuthenticator);

    VFSBackend.initialize(rootUri, options);
  } catch (FileSystemException e) {
    LOG.error(String.format("can't create file system backend for '%s'", rootUri));
  }
}
 
开发者ID:thinkberg,项目名称:moxo,代码行数:18,代码来源:MoxoWebDAVServlet.java

示例2: setParameter

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
public void setParameter(FileSystemOptions opts, String name, String value, String fullParameterName, String vfsUrl) throws IOException {
  // Use the DelgatingFileSystemOptionsBuilder to insert generic parameters
  // This must be done to assure the correct VFS FileSystem drivers will process the parameters
  String scheme = extractScheme(fullParameterName);
  try {
    DelegatingFileSystemOptionsBuilder delegateFSOptionsBuilder = new DelegatingFileSystemOptionsBuilder(KettleVFS.getInstance().getFileSystemManager());
    if(scheme != null) {
      delegateFSOptionsBuilder.setConfigString(opts, scheme, name, value);
    } else {
  	  log.logMinimal("Warning: Cannot process VFS parameters if no scheme is specified: " + vfsUrl); //$NON-NLS-1$
    }
  } catch (FileSystemException e) {
    if(e.getCode().equalsIgnoreCase("vfs.provider/config-key-invalid.error")) { //$NON-NLS-1$
      // This key is not supported by the default scheme config builder. This may be a custom key of another config builder
      log.logMinimal("Warning: The configuration parameter [" + name + "] is not supported by the default configuration builder for scheme: " + scheme);  //$NON-NLS-1$//$NON-NLS-2$
    } else {
      // An unexpected error has occurred loading in parameters
      throw new IOException(e.getLocalizedMessage());
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:KettleGenericFileSystemConfigBuilder.java

示例3: buildFsOptions

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
private static FileSystemOptions buildFsOptions(VariableSpace varSpace, FileSystemOptions sourceOptions, String vfsFilename, String scheme) throws IOException {
  if(varSpace == null || vfsFilename == null) {
    // We cannot extract settings from a non-existant variable space
    return null;
  }
  
  IKettleFileSystemConfigBuilder configBuilder = KettleFileSystemConfigBuilderFactory.getConfigBuilder(varSpace, scheme);
  
  FileSystemOptions fsOptions = (sourceOptions == null) ? new FileSystemOptions() : sourceOptions;

  String[] varList = varSpace.listVariables();
  
  for(String var : varList) {
    if(var.startsWith("vfs.")) { //$NON-NLS-1$
      String param = configBuilder.parseParameterName(var, scheme);
      if(param != null) {
        configBuilder.setParameter(fsOptions, param, varSpace.getVariable(var), var, vfsFilename);
      } else {
        throw new IOException("FileSystemConfigBuilder could not parse parameter: " + var); //$NON-NLS-1$
      }
    }
  }
  return fsOptions;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:25,代码来源:KettleVFS.java

示例4: ZipFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
public ZipFileSystem( final FileName rootName,
                      final FileObject parentLayer,
                      final FileSystemOptions fileSystemOptions )
  throws FileSystemException {
  super( rootName, parentLayer, fileSystemOptions );

  // Make a local copy of the file
  file = parentLayer.getFileSystem().replicateFile( parentLayer, Selectors.SELECT_SELF );

  // Open the Zip file
  if ( !file.exists() ) {
    // Don't need to do anything
    zipFile = null;
    return;
  }

  // zipFile = createZipFile(this.file);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:19,代码来源:ZipFileSystem.java

示例5: findFile

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Locates a file object, by absolute URI.
 * @param baseFile The base FileObject.
 * @param uri The name of the file to locate.
 * @param properties The FileSystemOptions.
 * @return The FileObject if it is located, null otherwise.
 * @throws FileSystemException if an error occurs.
 */
public FileObject findFile(final FileObject baseFile,
                           final String uri,
                           final FileSystemOptions properties) throws FileSystemException
{
    // Split the URI up into its parts
    final LayeredFileName name = (LayeredFileName) parseUri(baseFile != null ? baseFile.getName() : null, uri);

    // Make the URI canonical

    // Resolve the outer file name
    final FileName fileName = name.getOuterName();
    final FileObject file = getContext().resolveFile(baseFile, fileName.getURI(), properties);

    // Create the file system
    final FileObject rootFile = createFileSystem(name.getScheme(), file, properties);

    // Resolve the file
    return rootFile.resolveFile(name.getPath());
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:28,代码来源:AbstractLayeredFileProvider.java

示例6: findFile

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Locates a file object, by absolute URI.
 *
 * @param baseFile The base file object.
 * @param uri The URI of the file to locate
 * @param fileSystemOptions The FileSystem options.
 * @return The located FileObject
 * @throws FileSystemException if an error occurs.
 */
public FileObject findFile(final FileObject baseFile,
                           final String uri,
                           final FileSystemOptions fileSystemOptions) throws FileSystemException
{
    // Parse the URI
    final FileName name;
    try
    {
        name = parseUri(baseFile != null ? baseFile.getName() : null, uri);
    }
    catch (FileSystemException exc)
    {
        throw new FileSystemException("vfs.provider/invalid-absolute-uri.error", uri, exc);
    }

    // Locate the file
    return findFile(name, fileSystemOptions);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:28,代码来源:AbstractOriginatingFileProvider.java

示例7: findFile

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Locates a file object, by absolute URI.
 * @param baseFile The base FileObject.
 * @param uri The file to find.
 * @param fileSystemOptions The options for the FileSystem.
 * @return A FileObject for the located file.
 * @throws FileSystemException if an error occurs.
 */
public FileObject findFile(final FileObject baseFile,
                           final String uri,
                           final FileSystemOptions fileSystemOptions)
    throws FileSystemException
{
    StringBuffer buf = new StringBuffer(INITIAL_BUFSZ);

    UriParser.extractScheme(uri, buf);

    String[] schemes = getSchemes();
    for (int iterSchemes = 0; iterSchemes < schemes.length; iterSchemes++)
    {
        buf.insert(0, ":");
        buf.insert(0, schemes[iterSchemes]);
    }

    FileObject fo = getContext().getFileSystemManager().resolveFile(buf.toString(), fileSystemOptions);
    return fo;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:28,代码来源:CompositeFileProvider.java

示例8: findFile

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Locates a file object, by absolute URI.
 */
public FileObject findFile(final FileObject baseFile,
                           final String uri,
                           final FileSystemOptions fileSystemOptions)
    throws FileSystemException
{
    StringBuffer buf = new StringBuffer(80);
    UriParser.extractScheme(uri, buf);
    String resourceName = buf.toString();

    ClassLoader cl = ResourceFileSystemConfigBuilder.getInstance().getClassLoader(fileSystemOptions);
    if (cl == null)
    {
        cl = getClass().getClassLoader();
    }
    final URL url = cl.getResource(resourceName);

    if (url == null)
    {
        throw new FileSystemException("vfs.provider.url/badly-formed-uri.error", uri);
    }

    FileObject fo = getContext().getFileSystemManager().resolveFile(url.toExternalForm());
    return fo;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:28,代码来源:ResourceFileProvider.java

示例9: TarFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
protected TarFileSystem( final FileName rootName,
                         final FileObject parentLayer,
                         final FileSystemOptions fileSystemOptions )
  throws FileSystemException {
  super( rootName, parentLayer, fileSystemOptions );

  // Make a local copy of the file
  file = parentLayer.getFileSystem().replicateFile( parentLayer, Selectors.SELECT_SELF );

  // Open the Tar file
  if ( !file.exists() ) {
    // Don't need to do anything
    tarFile = null;
    return;
  }

  // tarFile = createTarFile(this.file);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:19,代码来源:TarFileSystem.java

示例10: doCreateFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Create a file system with the S3 root provided.
 * 
 * @param fileName
 *          the S3 file name that defines the root (bucket)
 * @param fileSystemOptions
 *          file system options
 * @return an S3 file system
 * @throws FileSystemException
 *           if the file system cannot be created
 */
protected FileSystem doCreateFileSystem(FileName fileName, FileSystemOptions fileSystemOptions) throws FileSystemException {
	FileSystemOptions fsOptions = fileSystemOptions != null ? fileSystemOptions : getDefaultFileSystemOptions();
	
	// Initialize S3 service.
	UserAuthenticationData authData = null;

	try {
		// Read authData from file system options
		authData = UserAuthenticatorUtils.authenticate(fsOptions, AUTHENTICATOR_TYPES);

		// Fetch AWS key-id and secret key from authData
		String keyId 	= UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, null));
		String secret	= UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, null));
		String domain = UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.DOMAIN, null));

		if (keyId.length() + secret.length() == 0) {
			throw new FileSystemException("Empty AWS credentials");
		}
		
		// Construct S3 file system
		return new S3FileSystem( (S3FileName)fileName, new S3AwImpl(keyId,secret,domain), fsOptions);
	} finally {
		UserAuthenticatorUtils.cleanup(authData);
	}

}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:38,代码来源:S3FileProvider.java

示例11: Context

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
private Context(final FileSystemOptions fso, final String scheme, final String name, final Object[] values)
{
    this.fso = fso;
    this.scheme = scheme;
    this.name = name;
    this.values = values;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:8,代码来源:DelegatingFileSystemOptionsBuilder.java

示例12: doCreateFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
    * Creates the filesystem.
    */
   protected FileSystem doCreateFileSystem(String scheme, final FileObject file, final FileSystemOptions fileSystemOptions)
       throws FileSystemException
{
	final FileName name =
		new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER);
       return new MimeFileSystem(name, file, fileSystemOptions);
   }
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:11,代码来源:MimeFileProvider.java

示例13: doCreateFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Creates a layered file system.  This method is called if the file system
 * is not cached.
 *
 * @param scheme The URI scheme.
 * @param file   The file to create the file system on top of.
 * @return The file system.
 */
protected FileSystem doCreateFileSystem(final String scheme,
                                        final FileObject file,
                                        final FileSystemOptions fileSystemOptions)
    throws FileSystemException
{
    final FileName rootName =
        new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER);
    return new ZipFileSystem(rootName, file, fileSystemOptions);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:18,代码来源:ZipFileProvider.java

示例14: doCreateFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
/**
 * Creates a layered file system.  This method is called if the file system
 * is not cached.
 *
 * @param scheme The URI scheme.
 * @param file   The file to create the file system on top of.
 * @return The file system.
 */
protected FileSystem doCreateFileSystem(final String scheme,
                                        final FileObject file,
                                        final FileSystemOptions fileSystemOptions)
    throws FileSystemException
{
    final FileName name =
        new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER);
    return new JarFileSystem(name, file, fileSystemOptions);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:18,代码来源:JarFileProvider.java

示例15: LocalFileSystem

import org.apache.commons.vfs.FileSystemOptions; //导入依赖的package包/类
public LocalFileSystem(final FileName rootName,
                       final String rootFile,
                       final FileSystemOptions opts)
{
    super(rootName, null, opts);
    this.rootFile = rootFile;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:8,代码来源:LocalFileSystem.java


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