public abstract class Connection
extends java.lang.Object
getRoot()
method.
This functionality may be broadened or narrowed in the future.
When constructed, a Connection should be live, and hopefully remain
so until logOut()
is called.
Modifier | Constructor and Description |
---|---|
protected |
Connection()
Constructs a connection with no information.
|
protected |
Connection(Connector connector,
java.util.Map<AuthKey,?> keys)
Constructs a connection recording the circumstances under which
it was created.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getAuthValue(AuthKey key)
Returns the value for a given authorization key used when opening
this connection, if known
|
Connector |
getConnector()
Returns the connector which generated this connection, if known.
|
abstract Branch |
getRoot()
Returns the root of the remote filesystem provided by this connection.
|
abstract boolean |
isConnected()
Indicates whether this connection is currently up and running.
|
abstract void |
logOut()
Closes this connection.
|
void |
setLogoutOnExit(boolean tidy)
Controls whether an attempt is made to shut down this connection
when the JVM exits if it has not been done within the program.
|
java.lang.String |
toString() |
protected Connection()
protected Connection(Connector connector, java.util.Map<AuthKey,?> keys)
connector
- Connector which generated this connectionkeys
- map giving the set of authorization values
used when opening this connectionpublic java.lang.Object getAuthValue(AuthKey key)
key
- authorization keykey
(of type key.getValueType()
),
or nullpublic Connector getConnector()
public abstract boolean isConnected()
logOut()
has been called,
but it's possible that the connection may expire for some reason
before that.public abstract void logOut() throws java.io.IOException
java.io.IOException
- if something went wrongpublic abstract Branch getRoot()
public void setLogoutOnExit(boolean tidy)
isConnected()
returns true
an attempt is made to call logOut()
. Note this might
cause JVM shutdown to be prolonged. This is set false by
default.tidy
- true if you want this connection to be shut down on exitpublic java.lang.String toString()
toString
in class java.lang.Object