Java Code Examples for org.apache.commons.vfs2.FileName

The following examples show how to use org.apache.commons.vfs2.FileName. These examples are extracted from open source projects. 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 Project: commons-vfs   Source File: NamingTests.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Checks that a relative name resolves to the expected absolute path. Tests both forward and back slashes.
 */
private void assertSameName(final String expectedPath, final FileName baseName, final String relName,
        final NameScope scope) throws Exception {
    // Try the supplied name
    FileName name = getManager().resolveName(baseName, relName, scope);
    assertEquals(expectedPath, name.getPath());

    String temp;

    // Replace the separators
    temp = relName.replace('\\', '/');
    name = getManager().resolveName(baseName, temp, scope);
    assertEquals(expectedPath, name.getPath());

    // And again
    temp = relName.replace('/', '\\');
    name = getManager().resolveName(baseName, temp, scope);
    assertEquals(expectedPath, name.getPath());
}
 
Example 2
Source Project: commons-vfs   Source File: AbstractLayeredFileProvider.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Locates a file object, by absolute URI.
 *
 * @param baseFile The base FileObject.
 * @param uri The name of the file to locate.
 * @param fileSystemOptions The FileSystemOptions.
 * @return The FileObject if it is located, null otherwise.
 * @throws FileSystemException if an error occurs.
 */
@Override
public FileObject findFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions)
        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(), fileSystemOptions);

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

    // Resolve the file
    return rootFile.resolveFile(name.getPath());
}
 
Example 3
Source Project: commons-vfs   Source File: Webdav4FileProvider.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@link FileSystem}.
 * <p>
 * If you're looking at this method and wondering how to get a FileSystemOptions object bearing the proxy host and
 * credentials configuration through to this method so it's used for resolving a
 * {@link org.apache.commons.vfs2.FileObject FileObject} in the FileSystem, then be sure to use correct signature of
 * the {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} resolveFile method.
 *
 * @see org.apache.commons.vfs2.impl.DefaultFileSystemManager#resolveFile(FileObject, String, FileSystemOptions)
 */
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    // Create the file system
    final GenericFileName rootName = (GenericFileName) name;
    // TODO: need to check null to create a non-null here???
    final FileSystemOptions fsOpts = fileSystemOptions == null ? new FileSystemOptions() : fileSystemOptions;

    UserAuthenticationData authData = null;
    HttpClient httpClient = null;
    HttpClientContext httpClientContext = null;

    try {
        final Webdav4FileSystemConfigBuilder builder = Webdav4FileSystemConfigBuilder.getInstance();
        authData = UserAuthenticatorUtils.authenticate(fsOpts, AUTHENTICATOR_TYPES);
        httpClientContext = createHttpClientContext(builder, rootName, fsOpts, authData);
        httpClient = createHttpClient(builder, rootName, fsOpts);
    } finally {
        UserAuthenticatorUtils.cleanup(authData);
    }

    return new Webdav4FileSystem(rootName, fsOpts, httpClient, httpClientContext);
}
 
Example 4
Source Project: pentaho-kettle   Source File: JobEntryUnZipTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void unzipPostProcessingTest() throws Exception {

  JobEntryUnZip jobEntryUnZip = new JobEntryUnZip();

  Method unzipPostprocessingMethod = jobEntryUnZip.getClass().getDeclaredMethod( "doUnzipPostProcessing", FileObject.class, FileObject.class, String.class );
  unzipPostprocessingMethod.setAccessible( true );
  FileObject sourceFileObject = Mockito.mock( FileObject.class );
  Mockito.doReturn( Mockito.mock( FileName.class ) ).when( sourceFileObject ).getName();

  //delete
  jobEntryUnZip.afterunzip = 1;
  unzipPostprocessingMethod.invoke( jobEntryUnZip, sourceFileObject, Mockito.mock( FileObject.class ), "" );
  Mockito.verify( sourceFileObject, Mockito.times( 1 ) ).delete();

  //move
  jobEntryUnZip.afterunzip = 2;
  unzipPostprocessingMethod.invoke( jobEntryUnZip, sourceFileObject, Mockito.mock( FileObject.class ), "" );
  Mockito.verify( sourceFileObject, Mockito.times( 1 ) ).moveTo( Mockito.anyObject() );
}
 
Example 5
Source Project: hop   Source File: S3FileNameParser.java    License: Apache License 2.0 6 votes vote down vote up
public FileName parseUri( VfsComponentContext context, FileName base, String uri ) throws FileSystemException {
  StringBuilder name = new StringBuilder();

  String scheme = UriParser.extractScheme( uri, name );
  UriParser.canonicalizePath( name, 0, name.length(), this );

  // Normalize separators in the path
  UriParser.fixSeparators( name );

  // Normalise the path
  FileType fileType = UriParser.normalisePath( name );

  String fullPath = name.toString();
  // Extract bucket name
  final String bucketName = UriParser.extractFirstElement( name );

  return new S3FileName( scheme, bucketName, fullPath, fileType );
}
 
Example 6
Source Project: commons-vfs   Source File: AbstractFileObject.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the parent of the file.
 *
 * @return the parent FileObject.
 * @throws FileSystemException if an error occurs.
 */
@Override
public FileObject getParent() throws FileSystemException {
    if (this.compareTo(fileSystem.getRoot()) == 0) // equals is not implemented :-/
    {
        if (fileSystem.getParentLayer() == null) {
            // Root file has no parent
            return null;
        }
        // Return the parent of the parent layer
        return fileSystem.getParentLayer().getParent();
    }

    synchronized (fileSystem) {
        // Locate the parent of this file
        if (parent == null) {
            final FileName name = fileName.getParent();
            if (name == null) {
                return null;
            }
            parent = fileSystem.resolveFile(name);
        }
        return parent;
    }
}
 
Example 7
Source Project: hop   Source File: S3AFileNameParser.java    License: Apache License 2.0 6 votes vote down vote up
public FileName parseUri( VfsComponentContext context, FileName base, String uri ) throws FileSystemException {
  StringBuilder name = new StringBuilder();

  String scheme = UriParser.extractScheme( uri, name );
  UriParser.canonicalizePath( name, 0, name.length(), this );

  // Normalize separators in the path
  UriParser.fixSeparators( name );

  // Normalise the path
  FileType fileType = UriParser.normalisePath( name );

  // Extract bucket name
  final String bucketName = UriParser.extractFirstElement( name );

  return new S3AFileName( scheme, bucketName, name.toString(), fileType );
}
 
Example 8
Source Project: commons-vfs   Source File: NamingTests.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Tests resolution of absolute names.
 */
private void checkAbsoluteNames(final FileName name) throws Exception {
    // Root
    assertSameName("/", name, "/");
    assertSameName("/", name, "//");
    assertSameName("/", name, "/.");
    assertSameName("/", name, "/some file/..");

    // Some absolute names
    assertSameName("/a", name, "/a");
    assertSameName("/a", name, "/./a");
    assertSameName("/a", name, "/a/.");
    assertSameName("/a/b", name, "/a/b");

    // Some bad names
    assertBadName(name, "/..", NameScope.FILE_SYSTEM);
    assertBadName(name, "/a/../..", NameScope.FILE_SYSTEM);
}
 
Example 9
Source Project: hop   Source File: S3NFileNameParserTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testParseUri() throws Exception {
  VfsComponentContext context = mock( VfsComponentContext.class );
  FileName fileName = mock( FileName.class );
  String uri = "s3n://bucket/file";
  FileName noBaseFile = parser.parseUri( context, null, uri );
  assertNotNull( noBaseFile );
  assertEquals( "bucket", ( (S3NFileName) noBaseFile ).getBucketId() );
  FileName withBaseFile = parser.parseUri( context, fileName, uri );
  assertNotNull( withBaseFile );
  assertEquals( "bucket", ( (S3NFileName) withBaseFile ).getBucketId() );

  // assumption is that the whole URL is valid until it comes time to resolve to S3 objects
  uri = "s3n://s3n/bucket/file";
  withBaseFile = parser.parseUri( context, fileName, uri );
  assertEquals( "s3n", ( (S3NFileName)withBaseFile ).getBucketId() );
}
 
Example 10
Source Project: hop   Source File: WorkflowActionUnZipTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void unzipPostProcessingTest() throws Exception {

  ActionUnZip jobEntryUnZip = new ActionUnZip();

  Method unzipPostprocessingMethod = jobEntryUnZip.getClass().getDeclaredMethod( "doUnzipPostProcessing", FileObject.class, FileObject.class, String.class );
  unzipPostprocessingMethod.setAccessible( true );
  FileObject sourceFileObject = Mockito.mock( FileObject.class );
  Mockito.doReturn( Mockito.mock( FileName.class ) ).when( sourceFileObject ).getName();

  //delete
  jobEntryUnZip.afterunzip = 1;
  unzipPostprocessingMethod.invoke( jobEntryUnZip, sourceFileObject, Mockito.mock( FileObject.class ), "" );
  Mockito.verify( sourceFileObject, Mockito.times( 1 ) ).delete();

  //move
  jobEntryUnZip.afterunzip = 2;
  unzipPostprocessingMethod.invoke( jobEntryUnZip, sourceFileObject, Mockito.mock( FileObject.class ), "" );
  Mockito.verify( sourceFileObject, Mockito.times( 1 ) ).moveTo( Mockito.anyObject() );
}
 
Example 11
Source Project: commons-vfs   Source File: LayeredFileNameParser.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Parses the base and name into a FileName.
 *
 * @param context The component context.
 * @param baseFileName The base FileName.
 * @param fileName name The target file name.
 * @return The constructed FileName.
 * @throws FileSystemException if an error occurs.
 */
@Override
public FileName parseUri(final VfsComponentContext context, final FileName baseFileName, final String fileName)
        throws FileSystemException {
    final StringBuilder name = new StringBuilder();

    // Extract the scheme
    final String scheme = UriParser.extractScheme(context.getFileSystemManager().getSchemes(), fileName, name);

    // Extract the Layered file URI
    final String rootUriName = extractRootName(name);
    FileName rootUri = null;
    if (rootUriName != null) {
        rootUri = context.parseURI(rootUriName);
    }

    // Decode and normalise the path
    UriParser.canonicalizePath(name, 0, name.length(), this);
    UriParser.fixSeparators(name);
    final FileType fileType = UriParser.normalisePath(name);
    final String path = name.toString();

    return new LayeredFileName(scheme, rootUri, path, fileType);
}
 
Example 12
Source Project: commons-vfs   Source File: Http5FileSystem.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Construct {@code Http4FileSystem}.
 *
 * @param rootName root base name
 * @param fileSystemOptions file system options
 * @param httpClient {@link HttpClient} instance
 * @param httpClientContext {@link HttpClientContext} instance
 */
protected Http5FileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions, final HttpClient httpClient,
        final HttpClientContext httpClientContext) {
    super(rootName, null, fileSystemOptions);

    final String rootURI = getRootURI();
    final int offset = rootURI.indexOf(':');
    final char lastCharOfScheme = (offset > 0) ? rootURI.charAt(offset - 1) : 0;

    // if scheme is 'http*s' or 'HTTP*S', then the internal base URI should be 'https'. 'http' otherwise.
    if (lastCharOfScheme == 's' || lastCharOfScheme == 'S') {
        this.internalBaseURI = URI.create("https" + rootURI.substring(offset));
    } else {
        this.internalBaseURI = URI.create("http" + rootURI.substring(offset));
    }

    this.httpClient = httpClient;
    this.httpClientContext = httpClientContext;
}
 
Example 13
Source Project: commons-configuration   Source File: VFSFileSystem.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String getBasePath(final String path)
{
    if (UriParser.extractScheme(path) == null)
    {
        return super.getBasePath(path);
    }
    try
    {
        final FileSystemManager fsManager = VFS.getManager();
        final FileName name = fsManager.resolveURI(path);
        return name.getParent().getURI();
    }
    catch (final FileSystemException fse)
    {
        fse.printStackTrace();
        return null;
    }
}
 
Example 14
Source Project: commons-vfs   Source File: LRUFilesCache.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean putFileIfAbsent(final FileObject file) {
    final Map<FileName, FileObject> files = getOrCreateFilesystemCache(file.getFileSystem());

    writeLock.lock();
    try {
        final FileName name = file.getName();

        if (files.containsKey(name)) {
            return false;
        }

        files.put(name, file);
        return true;
    } finally {
        writeLock.unlock();
    }
}
 
Example 15
Source Project: commons-vfs   Source File: Http4FileSystem.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Construct {@code Http4FileSystem}.
 *
 * @param rootName root base name
 * @param fileSystemOptions file system options
 * @param httpClient {@link HttpClient} instance
 * @param httpClientContext {@link HttpClientContext} instance
 */
protected Http4FileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions, final HttpClient httpClient,
        final HttpClientContext httpClientContext) {
    super(rootName, null, fileSystemOptions);

    final String rootURI = getRootURI();
    final int offset = rootURI.indexOf(':');
    final char lastCharOfScheme = (offset > 0) ? rootURI.charAt(offset - 1) : 0;

    // if scheme is 'http*s' or 'HTTP*S', then the internal base URI should be 'https'. 'http' otherwise.
    if (lastCharOfScheme == 's' || lastCharOfScheme == 'S') {
        this.internalBaseURI = URI.create("https" + rootURI.substring(offset));
    } else {
        this.internalBaseURI = URI.create("http" + rootURI.substring(offset));
    }

    this.httpClient = httpClient;
    this.httpClientContext = httpClientContext;
}
 
Example 16
Source Project: commons-vfs   Source File: WebdavFileProvider.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@link FileSystem}.
 * <p>
 * If you're looking at this method and wondering how to get a FileSystemOptions object bearing the proxy host and
 * credentials configuration through to this method so it's used for resolving a
 * {@link org.apache.commons.vfs2.FileObject FileObject} in the FileSystem, then be sure to use correct signature of
 * the {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} resolveFile method.
 * </p>
 *
 * @see org.apache.commons.vfs2.impl.DefaultFileSystemManager#resolveFile(FileObject, String, FileSystemOptions)
 */
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    // Create the file system
    final GenericFileName rootName = (GenericFileName) name;
    final FileSystemOptions fsOpts = fileSystemOptions == null ? new FileSystemOptions() : fileSystemOptions;

    UserAuthenticationData authData = null;
    HttpClient httpClient;
    try {
        authData = UserAuthenticatorUtils.authenticate(fsOpts, AUTHENTICATOR_TYPES);

        httpClient = HttpClientFactory.createConnection(WebdavFileSystemConfigBuilder.getInstance(), "http",
                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()))),
                fsOpts);
    } finally {
        UserAuthenticatorUtils.cleanup(authData);
    }

    return new WebdavFileSystem(rootName, httpClient, fsOpts);
}
 
Example 17
@Before
public void setUp() throws Exception {
  repositoryRoot = mock( FileObject.class );
  childFile1 = mock( FileObject.class );
  childFile2 = mock( FileObject.class );
  childFile3 = mock( FileObject.class );
  childFile4 = mock( FileObject.class );
  childFileName1 = mock( FileName.class );
  childFileName2 = mock( FileName.class );
  childFileName3 = mock( FileName.class );
}
 
Example 18
@Before
public void setUp() throws Exception {
  fileObject = mock( FileObject.class );
  childFile1 = mock( FileObject.class );
  childFile2 = mock( FileObject.class );
  childFile3 = mock( FileObject.class );
  childFileName1 = mock( FileName.class );
  childFileName2 = mock( FileName.class );
  childFileName3 = mock( FileName.class );
  childFileContent1 = mock( FileContent.class );
  childFileContent2 = mock( FileContent.class );
  childFileContent3 = mock( FileContent.class );
}
 
Example 19
Source Project: commons-vfs   Source File: HttpFileProvider.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 20
Source Project: commons-vfs   Source File: AbstractFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
protected AbstractFileSystem(final FileName rootName, final FileObject parentLayer,
        final FileSystemOptions fileSystemOptions) {
    this.parentLayer = parentLayer;
    this.rootName = rootName;
    this.fileSystemOptions = fileSystemOptions;
    final FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance();
    String uri = builder.getRootURI(fileSystemOptions);
    if (uri == null) {
        uri = rootName.getURI();
    }
    this.rootURI = uri;
}
 
Example 21
Source Project: commons-vfs   Source File: FtpFileProvider.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the file system.
 */
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    // Create the file system
    final GenericFileName rootName = (GenericFileName) name;

    final FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);
    /*
     * FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(),
     * rootName.getUserName(), rootName.getPassword(), rootName.getPath(), fileSystemOptions);
     */

    return new FtpFileSystem(rootName, ftpClient, fileSystemOptions);
}
 
Example 22
@Override
public void createFolder( final FileName fullName ) throws FileSystemException {
  /*
  /api/repo/dirs/{0}
  public Response createDirs(
    @PathParam( "pathId" ) String pathId )
  */
  logger.debug( "createFolder: " + fullName );

  Response response = this.dirRes.createDirs( pathToId( fullName.getPath() ) );
  throwExceptionOnBadResponse( response );
  refresh();
}
 
Example 23
Source Project: hop   Source File: GoogleDriveFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
private synchronized FileObject processFile( FileName name, boolean useCache ) throws FileSystemException {
  if ( !super.getRootName().getRootURI().equals( name.getRootURI() ) ) {
    throw new FileSystemException( "vfs.provider/mismatched-fs-for-name.error",
        new Object[] { name, super.getRootName(), name.getRootURI() } );
  } else {
    FileObject file;
    if ( useCache ) {
      file = super.getFileFromCache( name );
    } else {
      file = null;
    }

    if ( file == null ) {
      try {
        file = this.createFile( (AbstractFileName) name );
      } catch ( Exception e ) {
        throw new FileSystemException( "Unable to get Google Drive file object for '"+name+"'", e );
      }

      file = super.decorateFileObject( file );
      if ( useCache ) {
        super.putFileToCache( file );
      }
    }

    if ( super.getFileSystemManager().getCacheStrategy().equals( CacheStrategy.ON_RESOLVE ) ) {
      file.refresh();
    }

    return file;
  }
}
 
Example 24
private RepositoryFileDto getFile( FileName fullName ) throws FileSystemException {
  final RepositoryFileTreeDto tree = getTreeNode( fullName );
  if ( tree == null ) {
    throw new FileSystemException( FILE_NOT_FOUND, fullName );
  }
  return tree.getFile();
}
 
Example 25
@Override
public FileName resolveName( FileName base, String name, NameScope scope ) throws FileSystemException {
  lock.readLock().lock();
  try {
    return super.resolveName( base, name, scope );
  } finally {
    lock.readLock().unlock();
  }
}
 
Example 26
Source Project: commons-vfs   Source File: FtpFileObject.java    License: Apache License 2.0 5 votes vote down vote up
private FileObject getLinkDestination() throws FileSystemException {
    if (linkDestination == null) {
        final String path;
        synchronized (getFileSystem()) {
            path = this.fileInfo == null ? null : this.fileInfo.getLink();
        }
        final FileName parent = getName().getParent();
        final FileName relativeTo = parent == null ? getName() : parent;
        final FileName linkDestinationName = getFileSystem().getFileSystemManager().resolveName(relativeTo, path);
        linkDestination = getFileSystem().resolveFile(linkDestinationName);
    }
    return linkDestination;
}
 
Example 27
public void setDescription( final FileName file, final String description ) throws FileSystemException {
  final String[] fileName = computeFileNames( file );
  final FileInfo fileInfo = lookupNode( fileName );
  if ( fileInfo == null ) {
    throw new FileSystemException( "File is not valid." );
  }
  fileInfo.setDescription( description );
}
 
Example 28
Source Project: commons-vfs   Source File: AbstractLayeredFileProvider.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a layered file system.
 *
 * @param scheme The protocol to use.
 * @param file a FileObject.
 * @param fileSystemOptions Options to access the FileSystem.
 * @return A FileObject associated with the new FileSystem.
 * @throws FileSystemException if an error occurs.
 */
@Override
public synchronized FileObject createFileSystem(final String scheme, final FileObject file,
        final FileSystemOptions fileSystemOptions) throws FileSystemException {
    // Check if cached
    final FileName rootName = file.getName();
    FileSystem fs = findFileSystem(rootName, fileSystemOptions);
    if (fs == null) {
        // Create the file system
        fs = doCreateFileSystem(scheme, file, fileSystemOptions);
        addFileSystem(rootName, fs);
    }
    return fs.getRoot();
}
 
Example 29
public String getUrl( final FileName file ) throws FileSystemException {
  final String[] fileName = computeFileNames( file );
  final FileInfo fileInfo = lookupNode( fileName );
  if ( fileInfo == null ) {
    throw new FileSystemException( "File is not valid." );
  }
  return fileInfo.getUrl();
}
 
Example 30
Source Project: otroslogviewer   Source File: FileObjectToImport.java    License: Apache License 2.0 5 votes vote down vote up
FileObjectToImport(FileObject fileObject, FileName fileName, FileSize fileSize, Level level, OpenMode openMode, CanParse canParse,PossibleLogImporters possibleLogImporters) {
  this.fileObject = fileObject;
  this.fileName = fileName;
  this.fileSize = fileSize;
  this.level = level;
  this.openMode = openMode;
  this.canParse = canParse;
  this.possibleLogImporters = possibleLogImporters;
}