public class StandardFileSystemManager extends DefaultFileSystemManager
FileSystemManager
that configures itself
from an XML (Default: providers.xml) configuration file.
Certain providers are only loaded and available if the dependent library is in your classpath. You have to configure your debugging facility to log "debug" messages to see if a provider was skipped due to "unresolved externals".
DefaultFileSystemManager.VfsStreamHandlerFactory
Modifier and Type | Field and Description |
---|---|
private java.lang.ClassLoader |
classLoader |
private static java.lang.String |
CONFIG_RESOURCE |
private java.net.URL |
configUri |
private static java.lang.String |
PLUGIN_CONFIG_RESOURCE |
Constructor and Description |
---|
StandardFileSystemManager() |
Modifier and Type | Method and Description |
---|---|
private void |
addExtensionMap(org.w3c.dom.Element map)
Adds an extension map.
|
private void |
addMimeTypeMap(org.w3c.dom.Element map)
Adds a mime-type map.
|
private void |
addOperationProvider(org.w3c.dom.Element providerDef)
Adds a operationProvider from a operationProvider definition.
|
private void |
addProvider(org.w3c.dom.Element providerDef,
boolean isDefault)
Adds a provider from a provider definition.
|
private void |
configure(org.w3c.dom.Element config)
Configures this manager from an parsed XML configuration file
|
private void |
configure(java.lang.String configUri,
java.io.InputStream configStream)
Configures this manager from an XML configuration file.
|
private void |
configure(java.net.URL configUri)
Configures this manager from an XML configuration file.
|
protected void |
configurePlugins()
Scans the classpath to find any droped plugin.
|
protected DefaultFileReplicator |
createDefaultFileReplicator() |
private javax.xml.parsers.DocumentBuilder |
createDocumentBuilder()
Configure and create a DocumentBuilder
|
private java.lang.Object |
createInstance(java.lang.String className)
Creates a provider.
|
private boolean |
findClass(java.lang.String className)
Tests if a class is available.
|
private java.lang.ClassLoader |
findClassLoader() |
private java.lang.String[] |
getRequiredClasses(org.w3c.dom.Element providerDef)
Extracts the required classes from a provider definition.
|
private java.lang.String[] |
getRequiredSchemes(org.w3c.dom.Element providerDef)
Extracts the required schemes from a provider definition.
|
private java.lang.String[] |
getSchemas(org.w3c.dom.Element provider)
Extracts the schema names from a provider definition.
|
void |
init()
Initializes this manager.
|
private java.lang.Class<?> |
loadClass(java.lang.String className)
Load a class from different class loaders.
|
private java.util.Enumeration<java.net.URL> |
loadResources(java.lang.String name)
Resolve resources from different class loaders.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader to use to load the providers.
|
void |
setConfiguration(java.lang.String configUri)
Sets the configuration file for this manager.
|
void |
setConfiguration(java.net.URL configUri)
Sets the configuration file for this manager.
|
_closeFileSystem, addExtensionMap, addMimeTypeMap, addOperationProvider, addOperationProvider, addProvider, addProvider, canCreateFileSystem, close, closeFileSystem, createFileSystem, createFileSystem, createVirtualFileSystem, createVirtualFileSystem, freeUnusedResources, getBaseFile, getCacheStrategy, getFileContentInfoFactory, getFileObjectDecorator, getFileObjectDecoratorConst, getFilesCache, getFileSystemConfigBuilder, getLogger, getOperationProviders, getProviderCapabilities, getReplicator, getSchemes, getTemporaryFileStore, getURLStreamHandlerFactory, hasProvider, resolveFile, resolveFile, resolveFile, resolveFile, resolveFile, resolveFile, resolveFile, resolveName, resolveName, resolveURI, setBaseFile, setBaseFile, setCacheStrategy, setDefaultProvider, setFileContentInfoFactory, setFileObjectDecorator, setFilesCache, setLogger, setReplicator, setTemporaryFileStore, toFileObject
private static final java.lang.String CONFIG_RESOURCE
private static final java.lang.String PLUGIN_CONFIG_RESOURCE
private java.net.URL configUri
private java.lang.ClassLoader classLoader
public void setConfiguration(java.lang.String configUri)
configUri
- The URI for this manager.public void setConfiguration(java.net.URL configUri)
configUri
- The URI forthis manager.public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The ClassLoader.public void init() throws FileSystemException
init
in class DefaultFileSystemManager
FileSystemException
- if an error occurs.protected void configurePlugins() throws FileSystemException
The plugin-description has to be in /META-INF/vfs-providers.xml
.
FileSystemException
- if an error occurs.private java.lang.ClassLoader findClassLoader()
protected DefaultFileReplicator createDefaultFileReplicator()
private void configure(java.net.URL configUri) throws FileSystemException
configUri
- The URI of the configuration.FileSystemException
- if an error occus.private void configure(java.lang.String configUri, java.io.InputStream configStream) throws FileSystemException
configUri
- The URI of the configuration.configStream
- An InputStream containing the configuration.FileSystemException
- if an error occurs.private javax.xml.parsers.DocumentBuilder createDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
- if an error occurs.private void configure(org.w3c.dom.Element config) throws FileSystemException
config
- The configuration Element.FileSystemException
- if an error occurs.private void addExtensionMap(org.w3c.dom.Element map)
map
- containing the Elements.private void addMimeTypeMap(org.w3c.dom.Element map)
map
- containing the Elements.private void addProvider(org.w3c.dom.Element providerDef, boolean isDefault) throws FileSystemException
providerDef
- the provider definitionisDefault
- true if the default should be used.FileSystemException
- if an error occurs.private void addOperationProvider(org.w3c.dom.Element providerDef) throws FileSystemException
FileSystemException
private boolean findClass(java.lang.String className)
private java.lang.String[] getRequiredClasses(org.w3c.dom.Element providerDef)
private java.lang.String[] getRequiredSchemes(org.w3c.dom.Element providerDef)
private java.lang.String[] getSchemas(org.w3c.dom.Element provider)
private java.lang.Object createInstance(java.lang.String className) throws FileSystemException
FileSystemException
private java.lang.Class<?> loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
- if last loadClass
failed.findClassLoader()
private java.util.Enumeration<java.net.URL> loadResources(java.lang.String name) throws java.io.IOException
java.io.IOException
- if getResource
failed.findClassLoader()