public abstract class AbstractPlugin extends AbstractAnalysisComponent implements IPlugin
AbstractFilterPlugin
or
AbstractReaderPlugin
.IPlugin.PluginInputPortReference, IPlugin.STATE
CONFIG_NAME, configuration, log, LOG, projectContext, recordsTimeUnitFromProjectContext
Constructor and Description |
---|
AbstractPlugin(Configuration configuration,
IProjectContext projectContext)
Each Plugin requires a constructor with a Configuration object and an IProjectContext.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areAllRepositoryPortsConnected()
This method checks whether all repository ports of the current plugin are connected.
|
static void |
connect(AbstractPlugin src,
java.lang.String outputPortName,
AbstractPlugin dst,
java.lang.String inputPortName)
This method connects two plugins.
|
void |
connect(java.lang.String reponame,
AbstractRepository repository)
Connects the given repository to this plugin via the given name.
|
protected boolean |
deliver(java.lang.String outputPortName,
java.lang.Object data)
Delivers the given data to all registered input ports of the given output port.
|
java.lang.String[] |
getAllDisplayNames()
Delivers an array containing all display names.
|
java.lang.String[] |
getAllInputPortNames()
Delivers an array containing all input port names.
|
java.lang.String[] |
getAllOutputPortNames()
Delivers an array containing all output port names.
|
java.lang.String[] |
getAllRepositoryPortNames()
Delivers an array containing all repository port names.
|
java.util.List<IPlugin.PluginInputPortReference> |
getConnectedPlugins(java.lang.String outputPortName)
Delivers the plugins with their ports which are connected with the given output port.
|
java.util.Map<java.lang.String,AbstractRepository> |
getCurrentRepositories()
This method delivers an array of
AbstractRepository containing the current repositories of this instance. |
protected Configuration |
getDefaultConfiguration()
This method delivers an instance of
Configuration containing the default properties for this class. |
java.util.Set<AbstractPlugin> |
getIncomingPlugins(boolean transitive)
Returns the plugins which provide data to this plugin.
|
java.lang.String |
getPluginDescription()
This method delivers the description of this plugin type.
|
java.lang.String |
getPluginName()
This method delivers the plugin name of this plugin.
|
protected AbstractRepository |
getRepository(java.lang.String reponame)
Delivers the registered repository for the given name or null, if it doesn't exist.
|
IPlugin.STATE |
getState() |
static boolean |
isConnectionAllowed(AbstractPlugin src,
java.lang.String output,
AbstractPlugin dst,
java.lang.String input)
This method checks whether two plugins can be connected.
|
protected void |
notifyNewIncomingConnection(java.lang.String inputPortName,
AbstractPlugin connectedPlugin,
java.lang.String outputPortName)
Notification method which is called when a new incoming connection to this plugin is established.
|
protected void |
notifyNewOutgoingConnection(java.lang.String outputPortName,
AbstractPlugin connectedPlugin,
java.lang.String inputPortName)
Notification method which is called when a new outgoing connection from this plugin is established.
|
void |
shutdown(boolean error)
Initializes a shutdown of this and all incoming plugins.
|
boolean |
start()
Starts this plugin.
|
getCurrentConfiguration, getName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCurrentConfiguration, getName, init, terminate
public AbstractPlugin(Configuration configuration, IProjectContext projectContext)
configuration
- The configuration for this component.projectContext
- The project context for this component. The component will be registered.protected final boolean deliver(java.lang.String outputPortName, java.lang.Object data)
outputPortName
- The output port to be used to send the given data.data
- The data to be send; must not be null.public final void connect(java.lang.String reponame, AbstractRepository repository) throws AnalysisConfigurationException
AnalysisController.connect
instead!connect
in interface IPlugin
reponame
- The name of the port to connect the repository.repository
- The repository which should be used.AnalysisConfigurationException
- if the repository-port is invalid, the repository itself is incompatible or the port is already used.public static final void connect(AbstractPlugin src, java.lang.String outputPortName, AbstractPlugin dst, java.lang.String inputPortName) throws AnalysisConfigurationException
AnalysisController.connect
instead!src
- The source plugin.outputPortName
- The output port of the source plugin.dst
- The destination plugin.inputPortName
- The input port of the destination port.AnalysisConfigurationException
- if any given plugin is invalid, any output or input port doesn't exist or if they are incompatible.
Furthermore the destination plugin must not be a reader.public static final boolean isConnectionAllowed(AbstractPlugin src, java.lang.String output, AbstractPlugin dst, java.lang.String input)
src
- The source plugin.output
- The output port of the source plugin.dst
- The destination plugin.input
- The input port of the destination port.protected final Configuration getDefaultConfiguration()
Configuration
containing the default properties for this class.getDefaultConfiguration
in class AbstractAnalysisComponent
public final java.lang.String getPluginName()
getPluginName
in interface IPlugin
public final java.lang.String getPluginDescription()
getPluginDescription
in interface IPlugin
public final boolean areAllRepositoryPortsConnected()
public final java.util.Map<java.lang.String,AbstractRepository> getCurrentRepositories()
AbstractRepository
containing the current repositories of this instance. In other words: The constructor should
be able to use the given object to initialize a new instance of this class with the same intern properties.getCurrentRepositories
in interface IPlugin
protected final AbstractRepository getRepository(java.lang.String reponame)
reponame
- The name (key) of the repository.public final java.lang.String[] getAllOutputPortNames()
getAllOutputPortNames
in interface IPlugin
public final java.lang.String[] getAllInputPortNames()
getAllInputPortNames
in interface IPlugin
public final java.lang.String[] getAllDisplayNames()
getAllDisplayNames
in interface IPlugin
public final java.lang.String[] getAllRepositoryPortNames()
getAllRepositoryPortNames
in interface IPlugin
public final java.util.List<IPlugin.PluginInputPortReference> getConnectedPlugins(java.lang.String outputPortName)
getConnectedPlugins
in interface IPlugin
outputPortName
- The name of the output port.public final IPlugin.STATE getState()
public final boolean start()
public final void shutdown(boolean error)
error
- A flag determining whether this plugin has to be shutdown due to an error or not.public java.util.Set<AbstractPlugin> getIncomingPlugins(boolean transitive)
transitive
- Denotes whether indirect (i.e. non-immediate) providers should be returnedprotected void notifyNewIncomingConnection(java.lang.String inputPortName, AbstractPlugin connectedPlugin, java.lang.String outputPortName) throws AnalysisConfigurationException
inputPortName
- The input port name to which the connection was establishedconnectedPlugin
- The plugin that was connectedoutputPortName
- The opposing plugin's output port from which the connection was establishedAnalysisConfigurationException
- If an error occurs while processing of this notificationprotected void notifyNewOutgoingConnection(java.lang.String outputPortName, AbstractPlugin connectedPlugin, java.lang.String inputPortName) throws AnalysisConfigurationException
outputPortName
- The output port name to which the connection was establishedconnectedPlugin
- The plugin that was connectedinputPortName
- The opposing plugin's input port from which the connection was establishedAnalysisConfigurationException
- If an error occurs while processing of this notificationCopyright 2017 Kieker Project, http://kieker-monitoring.net