Class SimpleConnection
- java.lang.Object
-
- org.apache.guacamole.net.auth.AbstractIdentifiable
-
- org.apache.guacamole.net.auth.AbstractConnection
-
- org.apache.guacamole.net.auth.simple.SimpleConnection
-
- All Implemented Interfaces:
Attributes
,Connectable
,Connection
,Identifiable
public class SimpleConnection extends AbstractConnection
A Connection implementation which establishes the underlying connection to guacd using the configuration information provided in guacamole.properties. Parameter tokens provided to connect() are automatically applied if explicitly requested. Tracking of active connections and connection history is not provided.
-
-
Constructor Summary
Constructors Constructor Description SimpleConnection()
Creates a completely uninitialized SimpleConnection.SimpleConnection(boolean interpretTokens)
Creates a completely uninitialized SimpleConnection.SimpleConnection(String name, String identifier, org.apache.guacamole.protocol.GuacamoleConfiguration config)
Creates a new SimpleConnection having the given identifier and GuacamoleConfiguration.SimpleConnection(String name, String identifier, org.apache.guacamole.protocol.GuacamoleConfiguration config, boolean interpretTokens)
Creates a new SimpleConnection having the given identifier and GuacamoleConfiguration.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.guacamole.net.GuacamoleTunnel
connect(org.apache.guacamole.protocol.GuacamoleClientInformation info)
Deprecated.org.apache.guacamole.net.GuacamoleTunnel
connect(org.apache.guacamole.protocol.GuacamoleClientInformation info, Map<String,String> tokens)
Establishes a connection to guacd using the information associated with this object.int
getActiveConnections()
Returns the number of active connections associated with this object.Map<String,String>
getAttributes()
Returns all attributes associated with this object.ActivityRecordSet<ConnectionRecord>
getConnectionHistory()
Returns an ActivityRecordSet containing ConnectionRecords that represent the usage history of this Connection, including any active users.protected org.apache.guacamole.protocol.GuacamoleConfiguration
getFullConfiguration()
Returns the GuacamoleConfiguration describing how to connect to this connection.Date
getLastActive()
Returns the date and time that this connection was last used.void
setAttributes(Map<String,String> attributes)
Sets the given attributes.void
setConfiguration(org.apache.guacamole.protocol.GuacamoleConfiguration config)
Sets the GuacamoleConfiguration associated with this Connection.-
Methods inherited from class org.apache.guacamole.net.auth.AbstractConnection
getConfiguration, getName, getParentIdentifier, getSharingProfileIdentifiers, setName, setParentIdentifier
-
Methods inherited from class org.apache.guacamole.net.auth.AbstractIdentifiable
equals, getIdentifier, hashCode, setIdentifier
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.guacamole.net.auth.Connection
getHistory
-
Methods inherited from interface org.apache.guacamole.net.auth.Identifiable
getIdentifier, setIdentifier
-
-
-
-
Constructor Detail
-
SimpleConnection
public SimpleConnection()
Creates a completely uninitialized SimpleConnection. The name, identifier, and configuration of this SimpleConnection must eventually be set before the SimpleConnection may be used. Parameter tokens within the GuacamoleConfiguration eventually supplied withsetConfiguration(org.apache.guacamole.protocol.GuacamoleConfiguration)
will not be interpreted.
-
SimpleConnection
public SimpleConnection(boolean interpretTokens)
Creates a completely uninitialized SimpleConnection. The name, identifier, and configuration of this SimpleConnection must eventually be set before the SimpleConnection may be used. Parameter tokens within the GuacamoleConfiguration eventually supplied withsetConfiguration(org.apache.guacamole.protocol.GuacamoleConfiguration)
will not be interpreted unless explicitly requested.- Parameters:
interpretTokens
- Whether parameter tokens in the underlying GuacamoleConfiguration should be automatically applied upon connecting. If false, parameter tokens will not be interpreted at all.
-
SimpleConnection
public SimpleConnection(String name, String identifier, org.apache.guacamole.protocol.GuacamoleConfiguration config)
Creates a new SimpleConnection having the given identifier and GuacamoleConfiguration. Parameter tokens within the GuacamoleConfiguration will not be interpreted unless explicitly requested.- Parameters:
name
- The name to associate with this connection.identifier
- The identifier to associate with this connection.config
- The configuration describing how to connect to this connection.
-
SimpleConnection
public SimpleConnection(String name, String identifier, org.apache.guacamole.protocol.GuacamoleConfiguration config, boolean interpretTokens)
Creates a new SimpleConnection having the given identifier and GuacamoleConfiguration. Parameter tokens will be interpreted if explicitly requested.- Parameters:
name
- The name to associate with this connection.identifier
- The identifier to associate with this connection.config
- The configuration describing how to connect to this connection.interpretTokens
- Whether parameter tokens in the underlying GuacamoleConfiguration should be automatically applied upon connecting. If false, parameter tokens will not be interpreted at all.
-
-
Method Detail
-
getFullConfiguration
protected org.apache.guacamole.protocol.GuacamoleConfiguration getFullConfiguration()
Returns the GuacamoleConfiguration describing how to connect to this connection. UnlikeAbstractConnection.getConfiguration()
, which is allowed to omit or tokenize information, the GuacamoleConfiguration returned by this function will always be the full configuration to be used to establish the connection, as provided when this SimpleConnection was created or viasetConfiguration(org.apache.guacamole.protocol.GuacamoleConfiguration)
.- Returns:
- The full GuacamoleConfiguration describing how to connect to this connection, without any information omitted or tokenized.
-
setConfiguration
public void setConfiguration(org.apache.guacamole.protocol.GuacamoleConfiguration config)
Description copied from interface:Connection
Sets the GuacamoleConfiguration associated with this Connection.- Specified by:
setConfiguration
in interfaceConnection
- Overrides:
setConfiguration
in classAbstractConnection
- Parameters:
config
- The GuacamoleConfiguration to associate with this Connection.
-
getActiveConnections
public int getActiveConnections()
Description copied from interface:Connectable
Returns the number of active connections associated with this object. Implementations may simply return 0 if this value is not tracked.- Returns:
- The number of active connections associated with this object.
-
getAttributes
public Map<String,String> getAttributes()
Description copied from interface:Attributes
Returns all attributes associated with this object. The returned map may not be modifiable.- Returns:
- A map of all attribute identifiers to their corresponding values, for all attributes associated with this object, which may not be modifiable.
-
setAttributes
public void setAttributes(Map<String,String> attributes)
Description copied from interface:Attributes
Sets the given attributes. If an attribute within the map is not supported, it will simply be dropped. Any attributes not within the given map will be left untouched. Attributes which are not declared within the associated UserContext MUST NOT be submitted, but other extensions may manipulate the declared attributes through decorate() and redecorate(). Implementations may optionally allow storage of unsupported attributes. Extensions which rely on other extensions to store their attribute values should verify that such storage is supported by first testing that the attribute value is retrievable via getAttributes() after being set.- Parameters:
attributes
- A map of all attribute identifiers to their corresponding values.
-
connect
@Deprecated public org.apache.guacamole.net.GuacamoleTunnel connect(org.apache.guacamole.protocol.GuacamoleClientInformation info) throws org.apache.guacamole.GuacamoleException
Deprecated.Description copied from interface:Connectable
Establishes a connection to guacd using the information associated with this object. The connection will be provided the given client information.- Parameters:
info
- Information associated with the connecting client.- Returns:
- A fully-established GuacamoleTunnel.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while connecting to guacd, or if permission to connect is denied.
-
connect
public org.apache.guacamole.net.GuacamoleTunnel connect(org.apache.guacamole.protocol.GuacamoleClientInformation info, Map<String,String> tokens) throws org.apache.guacamole.GuacamoleException
Establishes a connection to guacd using the information associated with this object. The connection will be provided the given client information. Implementations which support parameter tokens should apply the given tokens when configuring the connection, such as with aTokenFilter
.This implementation will connect using the GuacamoleConfiguration returned by
getFullConfiguration()
, honoring the "guacd-hostname", "guacd-port", and "guacd-ssl" properties set within guacamole.properties. Parameter tokens will be taken into account if the SimpleConnection was explicitly requested to do so when created.Implementations requiring more complex behavior should consider using the
AbstractConnection
base class or implementingConnection
directly.- Parameters:
info
- Information associated with the connecting client.tokens
- A Map containing the token names and corresponding values to be applied as parameter tokens when establishing the connection. If the implementation does not support parameter tokens, this Map may be ignored.- Returns:
- A fully-established GuacamoleTunnel.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while connecting to guacd, or if permission to connect is denied.- See Also:
- Parameter Tokens
-
getLastActive
public Date getLastActive()
Description copied from interface:Connection
Returns the date and time that this connection was last used. If the connection was never used, the time that the connection was last used is unknown, or this information is not visible to the current user, this may be null.- Returns:
- The date and time this connection was last used, or null if this information is unavailable or inapplicable.
-
getConnectionHistory
public ActivityRecordSet<ConnectionRecord> getConnectionHistory() throws org.apache.guacamole.GuacamoleException
Description copied from interface:Connection
Returns an ActivityRecordSet containing ConnectionRecords that represent the usage history of this Connection, including any active users. ConnectionRecords in this list will be sorted in descending order of end time (active connections are first), and then in descending order of start time (newer connections are first). If connection history tracking has not been implemented, or has been implemented using the deprecatedConnection.getHistory()
method, this function should throw GuacamoleUnsupportedExpcetion.- Returns:
- An ActivityRecordSet containing ConnectionRecords representing the usage history of this Connection.
- Throws:
org.apache.guacamole.GuacamoleException
- If history tracking is not implemented, if an error occurs while reading the history of this connection, or if permission is denied.
-
-