Package org.apache.guacamole.net.auth
Class DelegatingConnection
- java.lang.Object
-
- org.apache.guacamole.net.auth.DelegatingConnection
-
- All Implemented Interfaces:
Attributes
,Connectable
,Connection
,Identifiable
,ReadableAttributes
- Direct Known Subclasses:
TokenInjectingConnection
public class DelegatingConnection extends Object implements Connection
Connection implementation which simply delegates all function calls to an underlying Connection.
-
-
Constructor Summary
Constructors Constructor Description DelegatingConnection(Connection connection)
Wraps the given Connection such that all function calls against this DelegatingConnection will be delegated to it.
-
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.org.apache.guacamole.protocol.GuacamoleConfiguration
getConfiguration()
Returns the GuacamoleConfiguration associated with this Connection.ActivityRecordSet<ConnectionRecord>
getConnectionHistory()
Returns an ActivityRecordSet containing ConnectionRecords that represent the usage history of this Connection, including any active users.protected Connection
getDelegateConnection()
Returns the underlying Connection wrapped by this DelegatingConnection.List<? extends ConnectionRecord>
getHistory()
Deprecated.String
getIdentifier()
Returns the unique identifier assigned to this object.Date
getLastActive()
Returns the date and time that this connection was last used.String
getName()
Returns the name assigned to this Connection.String
getParentIdentifier()
Returns the unique identifier of the parent ConnectionGroup for this Connection.Set<String>
getSharingProfileIdentifiers()
Returns identifiers of all readable sharing profiles that can be used to join this connection when it is active.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.void
setIdentifier(String identifier)
Sets the identifier assigned to this object.void
setName(String name)
Sets the name assigned to this Connection.void
setParentIdentifier(String parentIdentifier)
Sets the unique identifier of the parent ConnectionGroup for this Connection.
-
-
-
Constructor Detail
-
DelegatingConnection
public DelegatingConnection(Connection connection)
Wraps the given Connection such that all function calls against this DelegatingConnection will be delegated to it.- Parameters:
connection
- The Connection to wrap.
-
-
Method Detail
-
getDelegateConnection
protected Connection getDelegateConnection()
Returns the underlying Connection wrapped by this DelegatingConnection.- Returns:
- The Connection wrapped by this DelegatingConnection.
-
getIdentifier
public String getIdentifier()
Description copied from interface:Identifiable
Returns the unique identifier assigned to this object. All identifiable objects must have a deterministic, unique identifier which may not be null.- Specified by:
getIdentifier
in interfaceIdentifiable
- Returns:
- The unique identifier assigned to this object, which may not be null.
-
setIdentifier
public void setIdentifier(String identifier)
Description copied from interface:Identifiable
Sets the identifier assigned to this object.- Specified by:
setIdentifier
in interfaceIdentifiable
- Parameters:
identifier
- The identifier to assign.
-
getName
public String getName()
Description copied from interface:Connection
Returns the name assigned to this Connection.- Specified by:
getName
in interfaceConnection
- Returns:
- The name assigned to this Connection.
-
setName
public void setName(String name)
Description copied from interface:Connection
Sets the name assigned to this Connection.- Specified by:
setName
in interfaceConnection
- Parameters:
name
- The name to assign.
-
getParentIdentifier
public String getParentIdentifier()
Description copied from interface:Connection
Returns the unique identifier of the parent ConnectionGroup for this Connection.- Specified by:
getParentIdentifier
in interfaceConnection
- Returns:
- The unique identifier of the parent ConnectionGroup for this Connection.
-
setParentIdentifier
public void setParentIdentifier(String parentIdentifier)
Description copied from interface:Connection
Sets the unique identifier of the parent ConnectionGroup for this Connection.- Specified by:
setParentIdentifier
in interfaceConnection
- Parameters:
parentIdentifier
- The unique identifier of the parent ConnectionGroup for this Connection.
-
getConfiguration
public org.apache.guacamole.protocol.GuacamoleConfiguration getConfiguration()
Description copied from interface:Connection
Returns the GuacamoleConfiguration associated with this Connection. Note that because configurations may contain sensitive information, some data in this configuration may be omitted or tokenized.- Specified by:
getConfiguration
in interfaceConnection
- Returns:
- The GuacamoleConfiguration associated with this Connection.
-
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
- Parameters:
config
- The GuacamoleConfiguration to associate with this Connection.
-
getAttributes
public Map<String,String> getAttributes()
Description copied from interface:ReadableAttributes
Returns all attributes associated with this object. The returned map may not be modifiable.- Specified by:
getAttributes
in interfaceReadableAttributes
- 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.- Specified by:
setAttributes
in interfaceAttributes
- Parameters:
attributes
- A map of all attribute identifiers to their corresponding values.
-
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.- Specified by:
getLastActive
in interfaceConnection
- Returns:
- The date and time this connection was last used, or null if this information is unavailable or inapplicable.
-
getHistory
@Deprecated public List<? extends ConnectionRecord> getHistory() throws org.apache.guacamole.GuacamoleException
Deprecated.Description copied from interface:Connection
Returns a list of ConnectionRecords representing 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 is not implemented this method should throw GuacamoleUnsupportedException.- Specified by:
getHistory
in interfaceConnection
- Returns:
- A list of ConnectionRecrods 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.
-
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.- Specified by:
getConnectionHistory
in interfaceConnection
- 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.
-
getSharingProfileIdentifiers
public Set<String> getSharingProfileIdentifiers() throws org.apache.guacamole.GuacamoleException
Description copied from interface:Connection
Returns identifiers of all readable sharing profiles that can be used to join this connection when it is active. The level of access granted to a joining user is dictated by the connection parameters associated with the sharing profile, not necessarily the parameters of the primary connection being joined.- Specified by:
getSharingProfileIdentifiers
in interfaceConnection
- Returns:
- A Set of identifiers representing the sharing profiles for this connection.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while fetching the sharing profiles for this connection.
-
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.- Specified by:
connect
in interfaceConnectable
- 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
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. Implementations which support parameter tokens should apply the given tokens when configuring the connection, such as with aTokenFilter
.- Specified by:
connect
in interfaceConnectable
- 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
-
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.- Specified by:
getActiveConnections
in interfaceConnectable
- Returns:
- The number of active connections associated with this object.
-
-