public class VFSFileSystemManager
extends org.apache.commons.vfs2.impl.StandardFileSystemManager
implements com.lf.commons.model.ConfigurableUnit
FileSystemManager
managing protocol options etc.
Main reason for this class is the possiblity to install options for each of the schemes
which are used by the overwritten resolve()
methods automatically. The original
FileSystemManager
implementations also lack support for various functions
as to mention the direct removal of already installed schemes.
Modifier and Type | Field and Description |
---|---|
protected int |
autoWarnSeconds
If monitoring is enabled this is the time period to automatically warn the user (dialog/log messages).
|
protected java.util.Vector<VFSConnection> |
connections
Cache for the currently configured VFS connections.
|
protected javax.swing.JFrame |
mainWindow
Set for GUI applications, dialog is displayed automatically if resolving takes very long.
|
protected boolean |
monitored
If enabled this manager shows a dialog or prints log messages for long running resolves.
|
Constructor and Description |
---|
VFSFileSystemManager()
Constructor method using the default configuration.
|
VFSFileSystemManager(java.net.URL configuri)
Constructor method using the given configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnection(VFSConnection vfsconn)
Adds a new network connections for this manager.
|
void |
configureUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Restores values from persistent data stores.
|
protected void |
finalize()
Cares for proper cleanup after releasing the object.
|
VFSConnection |
getBestConnection(java.lang.String uri)
Searches the configured connections for an appropriate instance (scheme, host, ...).
|
protected org.apache.commons.vfs2.FileSystemOptions |
getBestFileSystemOptions(java.lang.String uri)
Searches the configured connections for an appropriate instance (scheme, host, ...) and provides its options.
|
java.util.Vector<VFSConnection> |
getConnections()
Provides the currently configured network connections for this manager.
|
org.apache.commons.vfs2.provider.FileProvider |
getProvider(java.lang.String scheme)
Provides the provider for the given scheme/protocol.
|
java.util.Map |
getProviders()
Provides the cache with scheme providers.
|
org.apache.commons.vfs2.operations.FileOperationProvider |
removeOperationProvider(java.lang.String protocol)
Removes the
FileOperationProvider for the specified scheme. |
org.apache.commons.vfs2.FileObject |
resolveFile(org.apache.commons.vfs2.FileObject baseFile,
java.lang.String uri)
Resolves a URI, relative to a base file.
|
org.apache.commons.vfs2.FileObject |
resolveFile(org.apache.commons.vfs2.FileObject baseFile,
java.lang.String uri,
VFSConnection vfsconn)
Resolves a URI, relative to a base file.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.io.File baseFile,
java.lang.String uri)
Resolves a URI, relative to a base file.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.io.File baseFile,
java.lang.String uri,
VFSConnection vfsconn)
Resolves a URI, relative to a base file.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.lang.String uri)
Locates a file by URI.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.lang.String uri,
org.apache.commons.vfs2.FileSystemOptions options)
Locates a file by URI and file system options.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.lang.String uri,
org.apache.commons.vfs2.FileSystemOptions options,
VFSConnection vfsconn)
Locates a file by URI.
|
org.apache.commons.vfs2.FileObject |
resolveFile(java.lang.String uri,
VFSConnection vfsconn)
Locates a file by URI.
|
void |
setAutoWarnSeconds(int seconds)
If monitoring is enabled this is the time period to automatically warn the user (dialog/log messages).
|
void |
setConnections(java.util.Vector<VFSConnection> connections)
Sets the currently configured network connections for this manager.
|
void |
setMainWindow(javax.swing.JFrame window)
Set for GUI applications, dialog is displayed automatically if resolving takes very long.
|
void |
setMonitored(boolean enable)
If enabled this manager shows a dialog or prints log messages for long running resolves.
|
void |
storeUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
configurePlugins, createDefaultFileReplicator, init, setClassLoader, setConfiguration, setConfiguration
_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, resolveName, resolveName, resolveURI, setBaseFile, setBaseFile, setCacheStrategy, setDefaultProvider, setFileContentInfoFactory, setFileObjectDecorator, setFilesCache, setLogger, setReplicator, setTemporaryFileStore, toFileObject
protected java.util.Vector<VFSConnection> connections
protected boolean monitored
protected javax.swing.JFrame mainWindow
protected int autoWarnSeconds
public VFSFileSystemManager()
public VFSFileSystemManager(java.net.URL configuri)
configuri
- The descriptor resource pathjava.lang.NullPointerException
- If a parameter is null
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.util.Map getProviders()
null
public org.apache.commons.vfs2.provider.FileProvider getProvider(java.lang.String scheme)
scheme
- The protocol like "sftp"null
public org.apache.commons.vfs2.operations.FileOperationProvider removeOperationProvider(java.lang.String protocol)
FileOperationProvider
for the specified scheme.
Another alternative would be to specify a modified "providers.xml" for the 2nd constructor.
The original FileSystemManager
lacks this functionality of directly removing
already installed providers.
protocol
- The VFS scheme like "sftp"null
public org.apache.commons.vfs2.FileObject resolveFile(java.lang.String uri) throws org.apache.commons.vfs2.FileSystemException
resolveFile
in interface org.apache.commons.vfs2.FileSystemManager
resolveFile
in class org.apache.commons.vfs2.impl.DefaultFileSystemManager
uri
- The URI to resolveorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(java.lang.String uri, VFSConnection vfsconn) throws org.apache.commons.vfs2.FileSystemException
uri
- The URI to resolvevfsconn
- The connection with optionsorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(java.lang.String uri, org.apache.commons.vfs2.FileSystemOptions options) throws org.apache.commons.vfs2.FileSystemException
resolveFile
in interface org.apache.commons.vfs2.FileSystemManager
resolveFile
in class org.apache.commons.vfs2.impl.DefaultFileSystemManager
uri
- The URI to resolveoptions
- The file system optionsorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(java.lang.String uri, org.apache.commons.vfs2.FileSystemOptions options, VFSConnection vfsconn) throws org.apache.commons.vfs2.FileSystemException
uri
- The URI to resolveoptions
- The file system optionsvfsconn
- The connection with optionsorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(java.io.File baseFile, java.lang.String uri) throws org.apache.commons.vfs2.FileSystemException
resolveFile
in interface org.apache.commons.vfs2.FileSystemManager
resolveFile
in class org.apache.commons.vfs2.impl.DefaultFileSystemManager
baseFile
- The base fileuri
- The URI to resolveorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(java.io.File baseFile, java.lang.String uri, VFSConnection vfsconn) throws org.apache.commons.vfs2.FileSystemException
baseFile
- The base fileuri
- The URI to resolvevfsconn
- The connection with optionsorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(org.apache.commons.vfs2.FileObject baseFile, java.lang.String uri) throws org.apache.commons.vfs2.FileSystemException
resolveFile
in interface org.apache.commons.vfs2.FileSystemManager
resolveFile
in class org.apache.commons.vfs2.impl.DefaultFileSystemManager
baseFile
- The base fileuri
- The URI to resolveorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic org.apache.commons.vfs2.FileObject resolveFile(org.apache.commons.vfs2.FileObject baseFile, java.lang.String uri, VFSConnection vfsconn) throws org.apache.commons.vfs2.FileSystemException
baseFile
- The base fileuri
- The URI to resolvevfsconn
- The connection with optionsorg.apache.commons.vfs2.FileSystemException
- If an error occurspublic java.util.Vector<VFSConnection> getConnections()
public void setConnections(java.util.Vector<VFSConnection> connections)
connections
- The connectionsjava.lang.NullPointerException
- If a parameter is null
public void addConnection(VFSConnection vfsconn)
vfsconn
- The connectionjava.lang.NullPointerException
- If a parameter is null
public VFSConnection getBestConnection(java.lang.String uri)
uri
- The network file to checknull
protected org.apache.commons.vfs2.FileSystemOptions getBestFileSystemOptions(java.lang.String uri)
uri
- The network file to checknull
public void configureUnit(java.lang.String id, com.lf.commons.config.Configuration config)
configureUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, com.lf.commons.config.Configuration config)
storeUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitRegistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitUnregistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void setMonitored(boolean enable)
enable
- Enabled?public void setMainWindow(javax.swing.JFrame window)
window
- The main windowpublic void setAutoWarnSeconds(int seconds)
seconds
- Time in seconds, -1 deactivates automatismCopyright © 2005-2014 Leisenfels UG. All rights reserved.