Class ConnectionManagerImpl
java.lang.Object
org.processmining.framework.connections.impl.ConnectionManagerImpl
- All Implemented Interfaces:
ConnectionManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends Connection>
TaddConnection
(T connection) Adds the given connection to the framework.void
clear()
Returns the connection with the given ID.Returns a collection of connection IDs registered to this global context.Returns the list of registered connectionObject listeners<T extends Connection>
Collection<T>getConnections
(Class<T> connectionType, PluginContext context, 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>
TgetFirstConnection
(Class<T> connectionType, PluginContext context, 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
Returns whether connections are enabled.void
setEnabled
(boolean isEnabled) Sets whether connections are enabled.
-
Constructor Details
-
ConnectionManagerImpl
-
-
Method Details
-
getConnectionListeners
Returns the list of registered connectionObject listeners- Specified by:
getConnectionListeners
in interfaceConnectionManager
- Returns:
- the list of registered connectionObject listeners
-
isEnabled
public boolean isEnabled()Description copied from interface:ConnectionManager
Returns whether connections are enabled. If not, then connecitons will not be added.- Specified by:
isEnabled
in interfaceConnectionManager
- Returns:
- whether connections are enabled
-
setEnabled
public void setEnabled(boolean isEnabled) Description copied from interface:ConnectionManager
Sets whether connections are enabled.- Specified by:
setEnabled
in interfaceConnectionManager
- Parameters:
isEnabled
- whether connections should be enabled
-
clear
public void clear()- Specified by:
clear
in interfaceConnectionManager
-
addConnection
Description copied from interface:ConnectionManager
Adds the given connection to the framework.- Specified by:
addConnection
in interfaceConnectionManager
- Parameters:
connection
- The connection to be registered- Returns:
- the given parameter connection
-
getConnection
Description copied from interface:ConnectionManager
Returns the connection with the given ID.- Specified by:
getConnection
in interfaceConnectionManager
- Parameters:
id
- the connection ID- Returns:
- the connection with the given ID
- Throws:
ConnectionCannotBeObtained
-
getFirstConnection
public <T extends Connection> T getFirstConnection(Class<T> connectionType, PluginContext context, Object... objects) throws ConnectionCannotBeObtained Description copied from interface:ConnectionManager
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). If no connections satisfying these criteria exist and the required type is specified and no required name is specified, then the global context searches for all available plugins with a ConnectionObjectFactory annotation, which can be executed in a child of the given PluginContext and accept the given objects as input If such plugins exist, the first of these plugins is selected and invoked on the given objects. The result is obtained from the plugin and a new connection is registered of the right type. This connection is then returned.- Specified by:
getFirstConnection
in interfaceConnectionManager
- Type Parameters:
T
- the type of the requested connection.- Parameters:
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 connection- Returns:
- A connection of the requested type T. If no connection exists, an exception is thrown, hence null is never returned.
- Throws:
ConnectionCannotBeObtained
- if the requested connection does not exist and cannot be produced in the given context.
-
getConnections
public <T extends Connection> Collection<T> getConnections(Class<T> connectionType, PluginContext context, Object... objects) throws ConnectionCannotBeObtained Description copied from interface:ConnectionManager
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). If no connections satisfying these criteria exist and the required type is specified and no required name is specified, then the global context searches for all available plugins with a ConnectionObjectFactory annotation, which can be executed in a child of the given PluginContext and accept the given objects as input If such plugins exist, the first of these plugins is selected and invoked on the given objects. The result is obtained from the plugin and a new connection is registered of the right type. This connection is then returned.- Specified by:
getConnections
in interfaceConnectionManager
- Type Parameters:
T
- the type of the requested connection.- Parameters:
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 connection- Returns:
- A collection of connections of the requested type T. If no connection exists, an exception is thrown, hence the collection is never empty.
- Throws:
ConnectionCannotBeObtained
- if the requested connection does not exist and cannot be produced in the given context.
-
getConnectionIDs
Description copied from interface:ConnectionManager
Returns a collection of connection IDs registered to this global context.- Specified by:
getConnectionIDs
in interfaceConnectionManager
- Returns:
- the ids of the registered connections
-