org.jboss.virtual.plugins.registry
Class DefaultVFSRegistry

java.lang.Object
  extended by org.jboss.virtual.spi.registry.VFSRegistry
      extended by org.jboss.virtual.plugins.registry.DefaultVFSRegistry

public class DefaultVFSRegistry
extends VFSRegistry

Default vfs registry.

Author:
Ales Justin

Constructor Summary
DefaultVFSRegistry()
           
 
Method Summary
 void addContext(VFSContext context)
          Add new vfs context.
protected static java.net.URI canonicalize(java.net.URI uri)
          Canonicalize uri.
protected  VirtualFileHandler findHandler(VirtualFileHandler root, java.lang.String path, boolean allowNotFound)
          Find the handler.
protected  VFSCache getCache()
          Get vfs cache.
 VFSContext getContext(java.net.URI uri)
          Get the context.
 VirtualFile getFile(java.net.URI uri)
          Get the file.
protected  boolean isCacheable(VFSContext context)
          Is the vfs context cacheable.
 void removeContext(VFSContext context)
          Remove the context.
 
Methods inherited from class org.jboss.virtual.spi.registry.VFSRegistry
getContext, getFile, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultVFSRegistry

public DefaultVFSRegistry()
Method Detail

getCache

protected VFSCache getCache()
Get vfs cache.

Returns:
the vfs cache

isCacheable

protected boolean isCacheable(VFSContext context)
Is the vfs context cacheable.

Parameters:
context - the vfs context
Returns:
true if context is cacheable, false otherwise

addContext

public void addContext(VFSContext context)
Description copied from class: VFSRegistry
Add new vfs context.

Specified by:
addContext in class VFSRegistry
Parameters:
context - the context

removeContext

public void removeContext(VFSContext context)
Description copied from class: VFSRegistry
Remove the context.

Specified by:
removeContext in class VFSRegistry
Parameters:
context - the context

canonicalize

protected static java.net.URI canonicalize(java.net.URI uri)
                                    throws java.io.IOException
Canonicalize uri.

Parameters:
uri - the uri
Returns:
canonical uri
Throws:
java.io.IOException - for any IO error

getContext

public VFSContext getContext(java.net.URI uri)
                      throws java.io.IOException
Description copied from class: VFSRegistry
Get the context.

Specified by:
getContext in class VFSRegistry
Parameters:
uri - the uri to match
Returns:
matching context or null
Throws:
java.io.IOException - for any IO error

getFile

public VirtualFile getFile(java.net.URI uri)
                    throws java.io.IOException
Description copied from class: VFSRegistry
Get the file. Check the cache for cached entry, return null if no matching entry exists.

Specified by:
getFile in class VFSRegistry
Parameters:
uri - the file's uri
Returns:
virtual file instance or null if it doesn't exist in cache
Throws:
java.io.IOException - for any error

findHandler

protected VirtualFileHandler findHandler(VirtualFileHandler root,
                                         java.lang.String path,
                                         boolean allowNotFound)
                                  throws java.io.IOException
Find the handler.

Parameters:
root - the root
path - the path
allowNotFound - do we allow not found
Returns:
child handler
Throws:
java.io.IOException - for any error