Kieker 1.8

kieker.analysis.plugin.reader.list
Class ListReader<T>

java.lang.Object
  extended by kieker.analysis.analysisComponent.AbstractAnalysisComponent
      extended by kieker.analysis.plugin.AbstractPlugin
          extended by kieker.analysis.plugin.reader.AbstractReaderPlugin
              extended by kieker.analysis.plugin.reader.list.ListReader<T>
Type Parameters:
T -
All Implemented Interfaces:
IAnalysisComponent, IPlugin, IReaderPlugin

public class ListReader<T>
extends AbstractReaderPlugin

Helper class that reads records added using the methods addAllObjects(List) or addObject(Object). Depending on the value of the Configuration variable "awaitTermination", either the read() method returns immediately, or awaits a termination via AnalysisController.terminate(). Additions after this reader starts reading are ignored.

Since:
1.6
Author:
Andre van Hoorn, Jan Waller

Nested Class Summary
 
Nested classes/interfaces inherited from interface kieker.analysis.plugin.IPlugin
IPlugin.PluginInputPortReference, IPlugin.STATE
 
Field Summary
static String CONFIG_PROPERTY_NAME_AWAIT_TERMINATION
          The name of the configuration determining whether the reader terminates after all objects have been delivered of whether it waits for a terminate signal.
static String OUTPUT_PORT_NAME
          The name of the output port delivering the read objects.
 
Fields inherited from class kieker.analysis.analysisComponent.AbstractAnalysisComponent
CONFIG_NAME
 
Constructor Summary
ListReader(Configuration configuration, IProjectContext projectContext)
          Creates a new instance of this class using the given parameters.
 
Method Summary
 void addAllObjects(List<T> records)
          This method adds all given records to our list.
 void addObject(T object)
          This method adds the given object to our list.
 Configuration getCurrentConfiguration()
          This method should deliver a Configuration object containing the current configuration 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.
 boolean read()
          Starts the reader.
 void terminate(boolean error)
          Initiates a termination of the plugin.
 
Methods inherited from class kieker.analysis.plugin.reader.AbstractReaderPlugin
init
 
Methods inherited from class kieker.analysis.plugin.AbstractPlugin
areAllRepositoryPortsConnected, connect, connect, getAllDisplayNames, getAllInputPortNames, getAllOutputPortNames, getAllRepositoryPortNames, getConnectedPlugins, getCurrentRepositories, getIncomingPlugins, getPluginDescription, getPluginName, getState, isConnectionAllowed, shutdown, start
 
Methods inherited from class kieker.analysis.analysisComponent.AbstractAnalysisComponent
getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface kieker.analysis.plugin.IPlugin
connect, getAllDisplayNames, getAllInputPortNames, getAllOutputPortNames, getAllRepositoryPortNames, getConnectedPlugins, getCurrentRepositories, getName, getPluginDescription, getPluginName, getState
 

Field Detail

OUTPUT_PORT_NAME

public static final String OUTPUT_PORT_NAME
The name of the output port delivering the read objects.

See Also:
Constant Field Values

CONFIG_PROPERTY_NAME_AWAIT_TERMINATION

public static final String CONFIG_PROPERTY_NAME_AWAIT_TERMINATION
The name of the configuration determining whether the reader terminates after all objects have been delivered of whether it waits for a terminate signal.

See Also:
Constant Field Values
Constructor Detail

ListReader

public ListReader(Configuration configuration,
                  IProjectContext projectContext)
Creates a new instance of this class using the given parameters.

Parameters:
configuration - The configuration for this component.
projectContext - The project context for this component.
Method Detail

addAllObjects

public void addAllObjects(List<T> records)
This method adds all given records to our list.

Parameters:
records - The records to be added.

addObject

public void addObject(T object)
This method adds the given object to our list.

Parameters:
object - The object to be added.

read

public boolean read()
Starts the reader. This method is intended to be a blocking operation, i.e., it is assumed that reading has finished before this method returns. The method should indicate an error by the return value false. In asynchronous scenarios, the IPlugin.terminate(boolean) method can be used to initiate the termination of this method.

Returns:
true if reading was successful; false if an error occurred

terminate

public void terminate(boolean error)
Initiates a termination of the plugin. This method is only used by the framework and should not be called manually. Use the method AnalysisController.terminate(boolean) instead. After receiving this notification, the plugin should terminate any running methods, e.g., read for readers.

Parameters:
error - Determines whether the plugin is terminated due to an error or not.

getCurrentConfiguration

public Configuration getCurrentConfiguration()
This method should deliver a Configuration object containing the current configuration 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.

Specified by:
getCurrentConfiguration in interface IAnalysisComponent
Specified by:
getCurrentConfiguration in interface IPlugin
Specified by:
getCurrentConfiguration in class AbstractAnalysisComponent
Returns:
A completely filled configuration object.

Kieker 1.8

Copyright 2013 Kieker Project, http://kieker-monitoring.net