public class VFSConnection
extends java.lang.Object
VFSConnectionDialog
.
Subclasses may add URL specific parameters as necessary.
Modifier and Type | Field and Description |
---|---|
protected com.lf.commons.config.Configuration |
config
Cache for the settings (driver parameters, expert settings).
|
protected org.apache.commons.vfs2.FileSystemOptions |
options
Cache for the scheme specific options like
FtpFileSystemConfigBuilder.getInstance().setPassiveMode() . |
static java.lang.String |
PARAM_HOST
The ip address or the name of the host (
String ). |
static java.lang.String |
PARAM_PATH
The (absolute) path on the host (
String ). |
static java.lang.String |
PARAM_PORT
The port number for the host access (
int ). |
static java.lang.String |
PARAM_SAVE_PASSWORD
Save the password for the user (
boolean )? |
static java.lang.String |
PARAM_USER
The name of the user (
String ). |
static java.lang.String |
PARAM_USER_PASSWORD
The password for the user (
String ). |
static java.lang.String |
VAR_CONNECTION_ID
Configuration variable name (
String ). |
static java.lang.String |
VAR_CONNECTION_NAME
Configuration variable name (
String ). |
static java.lang.String |
VAR_EXPERT_DISPLAY_BEFORE
Configuration variable name (
boolean ). |
static java.lang.String |
VAR_EXPERT_ENCODING
Configuration variable name (
String ). |
static java.lang.String |
VAR_EXPERT_KEEP_ALIVE
Configuration variable name (
boolean ). |
static java.lang.String |
VAR_EXPERT_KEEP_ALIVE_PING
Configuration variable name (
boolean ). |
static java.lang.String |
VAR_EXPERT_KEEP_ALIVE_RESOLVE
Configuration variable name (
boolean ). |
static java.lang.String |
VAR_EXPERT_KEEP_ALIVE_SECONDS
Configuration variable name (
int ). |
static java.lang.String |
VAR_EXPERT_MAX_WAIT
Configuration variable name (
boolean ). |
static java.lang.String |
VAR_EXPERT_MAX_WAIT_SECONDS
Configuration variable name (
int ). |
static java.lang.String |
VAR_PROTOCOL
Configuration variable name (
String ). |
static java.lang.String |
VAR_READONLY
Configuration variable name (
boolean ). |
protected VFSFileSystemManager |
vfsManager
The file system manager.
|
Constructor and Description |
---|
VFSConnection()
Constructor method for i18n purposes only.
|
VFSConnection(VFSFileSystemManager vfsmanager,
java.lang.String id)
Constructor method setting default values.
|
VFSConnection(VFSFileSystemManager vfsmanager,
java.lang.String id,
com.lf.commons.config.Configuration config,
org.apache.commons.vfs2.FileSystemOptions options)
Constructor method setting the container.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkUniqueName(java.util.Vector<VFSConnection> connections)
Checks if the name for the given connection is unique over all connections.
|
boolean |
checkUniqueUser(java.util.Vector<VFSConnection> connections)
Checks if the user for the given connection is unique over all connections of the same scheme.
|
VFSConnection |
clone()
Makes a copy of this object.
|
static VFSConnection |
createConnection(VFSFileSystemManager vfsmanager,
java.lang.String protocol,
java.lang.String id)
Creates a fresh new connection appropriate for the given VFS scheme/protocol.
|
static VFSConnection |
createConnection(VFSFileSystemManager vfsmanager,
java.lang.String protocol,
java.lang.String id,
com.lf.commons.config.Configuration config,
org.apache.commons.vfs2.FileSystemOptions options)
Creates a fresh new connection appropriate for the given VFS scheme/protocol.
|
com.lf.commons.config.Configuration |
getCache()
Provides access to the internal cache with properties.
|
static org.apache.commons.vfs2.FileSystemOptions |
getDefaultFileSystemOptions(java.lang.String scheme,
java.lang.String encoding)
Provides the default options for a certain protocol.
|
boolean |
getDisplayBefore(boolean fallback)
Provides the expert setting if settings shall be displayed before connection is established.
|
java.lang.String |
getDisplayURI()
Assembles the URI which can be displayed safely (no cleartext passwords).
|
java.lang.String |
getEncoding(java.lang.String fallback)
Provides the expert setting which file system encoding shall be used.
|
VFSFileSystemManager |
getFileSystemManager()
Provides the file system manager.
|
org.apache.commons.vfs2.FileSystemOptions |
getFileSystemOptions()
The file system specific options for this connection.
|
java.lang.String |
getHost(java.lang.String fallback)
Provides the URL host part.
|
java.lang.String |
getID(java.lang.String fallback)
Provides the unique connection identifier.
|
boolean |
getKeepAlive(boolean fallback)
Provides the expert setting if connection is kept alive automatically.
|
boolean |
getKeepAlivePing(boolean fallback)
Provides the expert setting if connection is kept alive with ping.
|
boolean |
getKeepAliveResolve(boolean fallback)
Provides the expert setting if connection is kept alive with entry resolves.
|
int |
getKeepAliveSeconds(int fallback)
Provides the keep alive interval.
|
boolean |
getMaxWait(boolean fallback)
Provides the expert setting if to wait for connect.
|
int |
getMaxWaitSeconds(int fallback)
Provides the maximum number of seconds to wait for connect.
|
java.lang.String |
getName(java.lang.String fallback)
Provides the connection name.
|
java.lang.String |
getPassword(java.lang.String fallback)
Provides the URL password part.
|
java.lang.String |
getPath(java.lang.String fallback)
Provides the URL path part.
|
int |
getPort(int fallback)
Provides the URL port part.
|
java.lang.String |
getProtocol(java.lang.String fallback)
Provides the type of protocol (aka scheme like "sftp").
|
java.lang.String |
getRootURI()
Assembles the root URI which can be used for VFS resolves etc.
|
java.lang.String |
getRootURI(java.lang.String username,
java.lang.String password)
Assembles the root URI which can be used for VFS resolves etc.
|
boolean |
getSavePassword(boolean save)
Provides the info if the password should be remembered.
|
static java.lang.String |
getUniqueConnectionID(java.util.Vector<VFSConnection> connections)
Provides the next connection identifier unique for this instance.
|
java.lang.String |
getURI()
Assembles the URI which can be used for VFS resolves etc.
|
java.lang.String |
getURI(java.lang.String username,
java.lang.String password)
Assembles the URI which can be used for VFS resolves etc.
|
java.lang.String |
getURIHost()
Convenience to get the host/IP address represented by this connection.
|
java.lang.String |
getUser(java.lang.String fallback)
Provides the URL user part.
|
boolean |
hasFileSystemOptions()
Any file system specific options for this connection available (internal cache not empty)?
|
boolean |
isApplicable(java.lang.String url,
boolean compareuser)
Checks if the given entry can be processed/listed by this connection instance.
|
boolean |
isAvailable()
Convenience method to get the info if the underlying VFS scheme is available.
|
boolean |
isCacheEmpty()
Provides the info if the internal cache is empty.
|
boolean |
isConnected()
Provides the info if this connection is currently alive.
|
boolean |
isReachable()
Provides the info if the connection host can be reached (connection test).
|
boolean |
isReadOnly(boolean fallback)
Provides the info if connection parameters are read-only.
|
java.lang.String |
isValid(java.util.Vector<VFSConnection> connections)
Provides the info if this connection is configured properly and can therefore be used.
|
void |
setFileSystemOptions(org.apache.commons.vfs2.FileSystemOptions options)
The file system specific options for this connection.
|
void |
setName(java.lang.String value)
Sets the connection name.
|
void |
setPassword(java.lang.String password)
Sets the URL password part.
|
void |
setProtocol(java.lang.String value)
Sets the type of protocol (aka scheme like "sftp").
|
void |
setReadOnly(boolean value)
Sets the info if connection parameters are read-only.
|
void |
setSavePassword(boolean save)
Sets the info if the password should be remembered.
|
void |
setUser(java.lang.String user)
Sets the URL user part.
|
java.lang.String |
toString()
Provides the characteristic textual representation of this connection (identifier).
|
public static final java.lang.String VAR_CONNECTION_ID
String
).public static final java.lang.String VAR_CONNECTION_NAME
String
).public static final java.lang.String VAR_PROTOCOL
String
).public static final java.lang.String VAR_READONLY
boolean
).public static final java.lang.String VAR_EXPERT_MAX_WAIT
boolean
).public static final java.lang.String VAR_EXPERT_MAX_WAIT_SECONDS
int
).public static final java.lang.String VAR_EXPERT_KEEP_ALIVE
boolean
).public static final java.lang.String VAR_EXPERT_KEEP_ALIVE_SECONDS
int
).public static final java.lang.String VAR_EXPERT_KEEP_ALIVE_PING
boolean
).public static final java.lang.String VAR_EXPERT_KEEP_ALIVE_RESOLVE
boolean
).public static final java.lang.String VAR_EXPERT_DISPLAY_BEFORE
boolean
).public static final java.lang.String VAR_EXPERT_ENCODING
String
).public static final java.lang.String PARAM_HOST
String
).public static final java.lang.String PARAM_PORT
int
).public static final java.lang.String PARAM_PATH
String
).public static final java.lang.String PARAM_USER
String
).public static final java.lang.String PARAM_USER_PASSWORD
String
).public static final java.lang.String PARAM_SAVE_PASSWORD
boolean
)?protected com.lf.commons.config.Configuration config
protected VFSFileSystemManager vfsManager
protected org.apache.commons.vfs2.FileSystemOptions options
FtpFileSystemConfigBuilder.getInstance().setPassiveMode()
.public VFSConnection() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic VFSConnection(VFSFileSystemManager vfsmanager, java.lang.String id)
vfsmanager
- The file system managerid
- The unique connection identifierjava.lang.NullPointerException
- If parameter is null
public VFSConnection(VFSFileSystemManager vfsmanager, java.lang.String id, com.lf.commons.config.Configuration config, org.apache.commons.vfs2.FileSystemOptions options)
vfsmanager
- The file system managerid
- The unique connection identifierconfig
- The container, empty is OKoptions
- Cache for the scheme specific options like FtpFileSystemConfigBuilder.getInstance().setPassiveMode()
java.lang.NullPointerException
- If parameter is null
public VFSFileSystemManager getFileSystemManager()
public org.apache.commons.vfs2.FileSystemOptions getFileSystemOptions()
null
public void setFileSystemOptions(org.apache.commons.vfs2.FileSystemOptions options)
options
- The options, may be emptypublic boolean hasFileSystemOptions()
public boolean isAvailable()
public java.lang.String getID(java.lang.String fallback)
fallback
- The default valuenull
public java.lang.String getName(java.lang.String fallback)
fallback
- The default valuenull
public void setName(java.lang.String value)
value
- The connection name, removed if null
public java.lang.String getProtocol(java.lang.String fallback)
fallback
- The default valuenull
public void setProtocol(java.lang.String value)
value
- The protocol, removed if null
public boolean isReadOnly(boolean fallback)
fallback
- The default valuepublic void setReadOnly(boolean value)
value
- Read-only?public boolean getMaxWait(boolean fallback)
fallback
- The default valuepublic int getMaxWaitSeconds(int fallback)
fallback
- The default valuepublic boolean getKeepAlive(boolean fallback)
fallback
- The default valuepublic int getKeepAliveSeconds(int fallback)
fallback
- The default valuepublic boolean getKeepAlivePing(boolean fallback)
fallback
- The default valuepublic boolean getKeepAliveResolve(boolean fallback)
fallback
- The default valuepublic boolean getDisplayBefore(boolean fallback)
fallback
- The default valuepublic java.lang.String getEncoding(java.lang.String fallback)
fallback
- The default valuepublic java.lang.String getHost(java.lang.String fallback)
fallback
- The default valuenull
public int getPort(int fallback)
fallback
- The default valuenull
public java.lang.String getPath(java.lang.String fallback)
fallback
- The default valuenull
public java.lang.String getUser(java.lang.String fallback)
fallback
- The default valuenull
public void setUser(java.lang.String user)
user
- The user namepublic java.lang.String getPassword(java.lang.String fallback)
fallback
- The default valuenull
public void setPassword(java.lang.String password)
password
- The user passwordpublic boolean getSavePassword(boolean save)
save
- The default valuepublic void setSavePassword(boolean save)
save
- Remember?public com.lf.commons.config.Configuration getCache()
public boolean isCacheEmpty()
public static java.lang.String getUniqueConnectionID(java.util.Vector<VFSConnection> connections)
connections
- The cache holding the IDs in usepublic static VFSConnection createConnection(VFSFileSystemManager vfsmanager, java.lang.String protocol, java.lang.String id)
vfsmanager
- The file system managerprotocol
- VFS scheme like "sftp"id
- The unique identifiernull
indicates errorpublic static VFSConnection createConnection(VFSFileSystemManager vfsmanager, java.lang.String protocol, java.lang.String id, com.lf.commons.config.Configuration config, org.apache.commons.vfs2.FileSystemOptions options)
vfsmanager
- The file system managerprotocol
- VFS scheme like "sftp"id
- The unique identifierconfig
- The settings to useoptions
- Cache for the scheme specific options like FtpFileSystemConfigBuilder.getInstance().setPassiveMode()
null
indicates errorpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isConnected()
public java.lang.String getURIHost()
null
public java.lang.String isValid(java.util.Vector<VFSConnection> connections)
connections
- The other connections (optional)public boolean isReachable()
public VFSConnection clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- If cloning is not supportedpublic java.lang.String getURI()
null
indicates errorpublic java.lang.String getURI(java.lang.String username, java.lang.String password)
username
- The login name, use connection credentials otherwisepassword
- The password, use connection credentials otherwisenull
indicates errorpublic java.lang.String getRootURI()
null
indicates errorpublic java.lang.String getRootURI(java.lang.String username, java.lang.String password)
username
- The login name, use connection credentials otherwisepassword
- The password, use connection credentials otherwisenull
indicates errorpublic java.lang.String getDisplayURI()
null
indicates errorpublic boolean isApplicable(java.lang.String url, boolean compareuser)
url
- The network file/directorycompareuser
- Compare user info?public static org.apache.commons.vfs2.FileSystemOptions getDefaultFileSystemOptions(java.lang.String scheme, java.lang.String encoding)
scheme
- The protocol/scheme like "sftp"encoding
- The encoding like UTF-8 (optional)java.lang.NullPointerException
- If parameter is null
public boolean checkUniqueUser(java.util.Vector<VFSConnection> connections)
connections
- The other connectionsjava.lang.NullPointerException
- If a parameter is null
public boolean checkUniqueName(java.util.Vector<VFSConnection> connections)
connections
- The other connectionsjava.lang.NullPointerException
- If a parameter is null
Copyright © 2005-2023 Leisenfels GmbH. All rights reserved.