public class ConnectionManagerImpl extends java.lang.Object implements ConnectionManager
Constructor and Description |
---|
ConnectionManagerImpl(PluginManager pluginManager) |
Modifier and Type | Method and Description |
---|---|
<T extends Connection> |
addConnection(T connection)
Adds the given connection to the framework.
|
void |
clear() |
Connection |
getConnection(ConnectionID id)
Returns the connection with the given ID.
|
java.util.Collection<ConnectionID> |
getConnectionIDs()
Returns a collection of connection IDs registered to this global context.
|
ConnectionObjectListener.ListenerList |
getConnectionListeners()
Returns the list of registered connectionObject listeners
|
<T extends Connection> |
getConnections(java.lang.Class<T> connectionType,
PluginContext context,
java.lang.Object... objects)
Returns a collection of connections between the objects specified, such
that the type of the connection is assignable from the given
connectionType (unless the parameter equals null).
|
<T extends Connection> |
getFirstConnection(java.lang.Class<T> connectionType,
PluginContext context,
java.lang.Object... objects)
Returns a connection between the objects specified, such that the type of
the connection is assignable from the given connectionType (unless the
parameter equals null).
|
boolean |
isEnabled()
Returns whether connections are enabled.
|
void |
setEnabled(boolean isEnabled)
Sets whether connections are enabled.
|
public ConnectionManagerImpl(PluginManager pluginManager)
public ConnectionObjectListener.ListenerList getConnectionListeners()
getConnectionListeners
in interface ConnectionManager
public boolean isEnabled()
ConnectionManager
isEnabled
in interface ConnectionManager
public void setEnabled(boolean isEnabled)
ConnectionManager
setEnabled
in interface ConnectionManager
isEnabled
- whether connections should be enabledpublic void clear()
clear
in interface ConnectionManager
public <T extends Connection> T addConnection(T connection)
ConnectionManager
addConnection
in interface ConnectionManager
connection
- The connection to be registeredpublic Connection getConnection(ConnectionID id) throws ConnectionCannotBeObtained
ConnectionManager
getConnection
in interface ConnectionManager
id
- the connection IDConnectionCannotBeObtained
public <T extends Connection> T getFirstConnection(java.lang.Class<T> connectionType, PluginContext context, java.lang.Object... objects) throws ConnectionCannotBeObtained
ConnectionManager
getFirstConnection
in interface ConnectionManager
T
- the type of the requested connection.connectionType
- The type of the object requested. This type can be null, in
which case all types are considered.context
- The context which requests the connection. If a plugin is
invoked to create a connection, a child context of this
context is instantiatedobjects
- the objects which should be connected by the requested
connection. There might be more objects involved in the
connectionConnectionCannotBeObtained
- if the requested connection does not exist and cannot be
produced in the given context.public <T extends Connection> java.util.Collection<T> getConnections(java.lang.Class<T> connectionType, PluginContext context, java.lang.Object... objects) throws ConnectionCannotBeObtained
ConnectionManager
getConnections
in interface ConnectionManager
T
- the type of the requested connection.connectionType
- The type of the object requested. This type can be null, in
which case all types are considered.context
- The context which requests the connection. If a plugin is
invoked to create a connection, a child context of this
context is instantiatedobjects
- the objects which should be connected by the requested
connection. There might be more objects involved in the
connectionConnectionCannotBeObtained
- if the requested connection does not exist and cannot be
produced in the given context.public java.util.Collection<ConnectionID> getConnectionIDs()
ConnectionManager
getConnectionIDs
in interface ConnectionManager