public class VFSConnection
extends java.lang.Object
VFSConnectionDialog
.
Subclasses may add URL specific parameters as necessary.
Modifier and Type | Field and Description |
---|---|
protected Configuration |
config
Cache for the settings (driver parameters, expert settings, etc.).
|
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_AUTO_RECONNECT
Configuration variable name (
boolean ). |
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,
Configuration config)
Constructor method setting the container.
|
Modifier and Type | Method and Description |
---|---|
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,
Configuration config)
Creates a fresh new connection appropriate for the given VFS scheme/protocol.
|
boolean |
getAutoReconnect(boolean fallback)
Provides the expert setting if to reconnect to dead peers.
|
Configuration |
getCache()
Provides access to the internal cache with properties.
|
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(java.lang.String protocol)
The file system specific options (optional).
|
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").
|
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 |
isApplicable(org.apache.commons.vfs2.FileObject url)
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.
|
boolean |
isValid()
Provides the info if this connection is configured properly and can therefore be used.
|
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_AUTO_RECONNECT
boolean
).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 Configuration config
protected VFSFileSystemManager vfsManager
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, Configuration config)
vfsmanager
- The file system managerid
- The unique connection identifierconfig
- The container, empty is OKjava.lang.NullPointerException
- If parameter is null
public VFSFileSystemManager getFileSystemManager()
public org.apache.commons.vfs2.FileSystemOptions getFileSystemOptions(java.lang.String protocol)
protocol
- The VFS scheme like "sftp"null
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 getAutoReconnect(boolean 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 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, Configuration config)
vfsmanager
- The file system managerprotocol
- VFS scheme like "sftp"id
- The unique identifierconfig
- The settings to usenull
indicates errorpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isConnected()
public java.lang.String getURIHost()
null
public boolean isValid()
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 getDisplayURI()
null
indicates errorpublic boolean isApplicable(org.apache.commons.vfs2.FileObject url)
url
- The network file/directoryCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.