org.jboss.osgi.vfs
Interface VirtualFile

All Superinterfaces:
Closeable

public interface VirtualFile
extends Closeable

A basic abstraction of a VirtualFile used by the OSGi layer. This abstraction should be removed once we settle on a single jboss-vfs version.

Since:
02-Mar-2010
Author:
thomas.diesler@jboss.com

Field Summary
static String PROPERTY_VFS_LEAK_DEBUGGING
          System property to enable detection of unclosed virtual files: jboss.osgi.vfs.leakDebugging
 
Method Summary
 Enumeration<URL> findEntries(String path, String pattern, boolean recurse)
          Returns entries in this bundle and its attached fragments.
 Certificate[] getCertificates()
          Get the Certificates for the virtual file.
 VirtualFile getChild(String path)
          Get a child
 List<VirtualFile> getChildren()
          Get the children
 List<VirtualFile> getChildrenRecursively()
          Get all children recursively
 CodeSigner[] getCodeSigners()
          Get the CodeSigners for a the virtual file.
 Enumeration<String> getEntryPaths(String path)
          Returns an Enumeration of all the paths (String objects) to entries within this bundle whose longest sub-path matches the specified path.
 String getName()
          Get the simple VF name (X.java)
 VirtualFile getParent()
          Get the parent
 String getPathName()
          Get the VFS relative path name (org/jboss/X.java)
 URL getStreamURL()
          Get the URL used for streaming.
 boolean isDirectory()
          Whether it is a directory in the VFS.
 boolean isFile()
          Whether it is a file in the VFS.
 InputStream openStream()
          Access the file contents.
 URL toURL()
          Get the VF URL (vfs:/root/org/jboss/X.java)
 
Methods inherited from interface java.io.Closeable
close
 

Field Detail

PROPERTY_VFS_LEAK_DEBUGGING

static final String PROPERTY_VFS_LEAK_DEBUGGING
System property to enable detection of unclosed virtual files: jboss.osgi.vfs.leakDebugging

See Also:
Constant Field Values
Method Detail

getName

String getName()
Get the simple VF name (X.java)

Returns:
the simple file name
Throws:
IllegalStateException - if the file is closed

getPathName

String getPathName()
Get the VFS relative path name (org/jboss/X.java)

Returns:
the VFS relative path name
Throws:
IllegalStateException - if the file is closed

isFile

boolean isFile()
               throws IOException
Whether it is a file in the VFS.

Returns:
true if a simple file.
Throws:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

isDirectory

boolean isDirectory()
                    throws IOException
Whether it is a directory in the VFS.

Returns:
true if a directory.
Throws:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

toURL

URL toURL()
          throws IOException
Get the VF URL (vfs:/root/org/jboss/X.java)

Returns:
the full URL to the VF in the VFS.
Throws:
MalformedURLException - if a url cannot be parsed
IOException - for any problem accessing the virtual file system

getStreamURL

URL getStreamURL()
                 throws IOException
Get the URL used for streaming.

Returns:
The stream URL or null if this is not the mounted root file.
Throws:
IOException

getParent

VirtualFile getParent()
                      throws IOException
Get the parent

Returns:
the parent or null if there is no parent
Throws:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

getChild

VirtualFile getChild(String path)
                     throws IOException
Get a child

Parameters:
path - the path
Returns:
the child or null if not found
Throws:
IOException - for any problem accessing the VFS
IllegalArgumentException - if the path is null
IllegalStateException - if the file is closed or it is a leaf node

getChildrenRecursively

List<VirtualFile> getChildrenRecursively()
                                         throws IOException
Get all children recursively

This always uses VisitorAttributes#RECURSE

Returns:
the children
Throws:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

getChildren

List<VirtualFile> getChildren()
                              throws IOException
Get the children

This always uses VisitorAttributes#RECURSE

Returns:
the children
Throws:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

findEntries

Enumeration<URL> findEntries(String path,
                             String pattern,
                             boolean recurse)
                             throws IOException
Returns entries in this bundle and its attached fragments. This bundle's class loader is not used to search for entries. Only the contents of this bundle and its attached fragments are searched for the specified entries.

Throws:
IOException
See Also:
Bundle.findEntries(String path, String pattern, boolean recurse)

getEntryPaths

Enumeration<String> getEntryPaths(String path)
                                  throws IOException
Returns an Enumeration of all the paths (String objects) to entries within this bundle whose longest sub-path matches the specified path. This bundle's class loader is not used to search for entries. Only the contents of this bundle are searched.

Throws:
IOException
See Also:
Bundle.getEntryPaths(String path)

openStream

InputStream openStream()
                       throws IOException
Access the file contents.

Returns:
an InputStream for the file contents.
Throws:
IOException - for any error accessing the file system
IllegalStateException - if the file is closed

getCertificates

Certificate[] getCertificates()
Get the Certificates for the virtual file. Simply extracts the certificate entries from the code signers array.

Returns:
the certificates for the virtual file, or null if not signed

getCodeSigners

CodeSigner[] getCodeSigners()
Get the CodeSigners for a the virtual file.

Returns:
the CodeSigners for the virtual file, or null if not signed


Copyright © 2012. All Rights Reserved.