Package au.edu.qut.prom.helpers
Class HeadlessConnectionManager
- java.lang.Object
-
- au.edu.qut.prom.helpers.HeadlessConnectionManager
-
- All Implemented Interfaces:
org.processmining.framework.connections.ConnectionManager
public class HeadlessConnectionManager extends java.lang.Object implements org.processmining.framework.connections.ConnectionManagerFor running plugins in headless mode from test scaffold or command line, even if they claim to require UIPluginContext and therefore be GUI only. Adapted from Andreas Rogge-Solti'sStochasticNetUtils
-
-
Constructor Summary
Constructors Constructor Description HeadlessConnectionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends org.processmining.framework.connections.Connection>
TaddConnection(T connection)Adds the given connection to the framework.voidclear()org.processmining.framework.connections.ConnectiongetConnection(org.processmining.framework.connections.ConnectionID id)Returns the connection with the given ID.java.util.Collection<org.processmining.framework.connections.ConnectionID>getConnectionIDs()Returns a collection of connection IDs registered to this global context.org.processmining.framework.plugin.events.ConnectionObjectListener.ListenerListgetConnectionListeners()Returns the list of registered connectionObject listeners<T extends org.processmining.framework.connections.Connection>
java.util.Collection<T>getConnections(java.lang.Class<T> connectionType, org.processmining.framework.plugin.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 org.processmining.framework.connections.Connection>
TgetFirstConnection(java.lang.Class<T> connectionType, org.processmining.framework.plugin.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).booleanisEnabled()Returns whether connections are enabled.voidsetEnabled(boolean isEnabled)Sets whether connections are enabled.
-
-
-
Method Detail
-
setEnabled
public void setEnabled(boolean isEnabled)
Description copied from interface:org.processmining.framework.connections.ConnectionManagerSets whether connections are enabled.- Specified by:
setEnabledin interfaceorg.processmining.framework.connections.ConnectionManager- Parameters:
isEnabled- whether connections should be enabled
-
isEnabled
public boolean isEnabled()
Description copied from interface:org.processmining.framework.connections.ConnectionManagerReturns whether connections are enabled. If not, then connecitons will not be added.- Specified by:
isEnabledin interfaceorg.processmining.framework.connections.ConnectionManager- Returns:
- whether connections are enabled
-
getFirstConnection
public <T extends org.processmining.framework.connections.Connection> T getFirstConnection(java.lang.Class<T> connectionType, org.processmining.framework.plugin.PluginContext context, java.lang.Object... objects) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.connections.ConnectionManagerReturns 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:
getFirstConnectionin interfaceorg.processmining.framework.connections.ConnectionManager- 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:
org.processmining.framework.connections.ConnectionCannotBeObtained- if the requested connection does not exist and cannot be produced in the given context.
-
getConnections
public <T extends org.processmining.framework.connections.Connection> java.util.Collection<T> getConnections(java.lang.Class<T> connectionType, org.processmining.framework.plugin.PluginContext context, java.lang.Object... objects) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.connections.ConnectionManagerReturns 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:
getConnectionsin interfaceorg.processmining.framework.connections.ConnectionManager- 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:
org.processmining.framework.connections.ConnectionCannotBeObtained- if the requested connection does not exist and cannot be produced in the given context.
-
getConnectionListeners
public org.processmining.framework.plugin.events.ConnectionObjectListener.ListenerList getConnectionListeners()
Description copied from interface:org.processmining.framework.connections.ConnectionManagerReturns the list of registered connectionObject listeners- Specified by:
getConnectionListenersin interfaceorg.processmining.framework.connections.ConnectionManager- Returns:
- the list of registered connectionObject listeners
-
getConnectionIDs
public java.util.Collection<org.processmining.framework.connections.ConnectionID> getConnectionIDs()
Description copied from interface:org.processmining.framework.connections.ConnectionManagerReturns a collection of connection IDs registered to this global context.- Specified by:
getConnectionIDsin interfaceorg.processmining.framework.connections.ConnectionManager- Returns:
- the ids of the registered connections
-
getConnection
public org.processmining.framework.connections.Connection getConnection(org.processmining.framework.connections.ConnectionID id) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.connections.ConnectionManagerReturns the connection with the given ID.- Specified by:
getConnectionin interfaceorg.processmining.framework.connections.ConnectionManager- Parameters:
id- the connection ID- Returns:
- the connection with the given ID
- Throws:
org.processmining.framework.connections.ConnectionCannotBeObtained
-
clear
public void clear()
- Specified by:
clearin interfaceorg.processmining.framework.connections.ConnectionManager
-
addConnection
public <T extends org.processmining.framework.connections.Connection> T addConnection(T connection)
Description copied from interface:org.processmining.framework.connections.ConnectionManagerAdds the given connection to the framework.- Specified by:
addConnectionin interfaceorg.processmining.framework.connections.ConnectionManager- Parameters:
connection- The connection to be registered- Returns:
- the given parameter connection
-
-