The implementation of an Architecture is divided into its configuration and its execution.

Configuring the Architecture

When writing an own Architecture, i.e., a set of connected stages, you should inherit from Configuration to save you some work. A configuration creates and connects the stages you want to execute.

Consider the following example configuration RecordReaderConfiguration. It represents a configuration for an analysis that reads monitoring records from a directory and collects them in a list. The invoked buildProducerPipeline() creates three stages, namely an instance of InitialElementProducer, Dir2RecordsFilter and CollectorSink.

We then uses the method connectPorts to connect the stages’ ports with each other.

public class RecordReaderConfiguration extends Configuration {

	private final List<IMonitoringRecord> elementCollection = new LinkedList<IMonitoringRecord>();

	public RecordReaderConfiguration() {
		this.buildProducerPipeline();
	}

	private void buildProducerPipeline() {
		ClassNameRegistryRepository classNameRegistryRepository = new ClassNameRegistryRepository();
		File logDir = new File("src/test/data/bookstore-logs");
		
		// create stages
		InitialElementProducer<File> initialElementProducer = new InitialElementProducer<File>(logDir);
		Dir2RecordsFilter dir2RecordsFilter = new Dir2RecordsFilter(classNameRegistryRepository);
		CollectorSink<IMonitoringRecord> collector = new CollectorSink<IMonitoringRecord>(this.elementCollection);

		// connect stages
		connectPorts(initialElementProducer.getOutputPort(), dir2RecordsFilter.getInputPort());
		connectPorts(dir2RecordsFilter.getOutputPort(), collector.getInputPort());

	}

	public List<IMonitoringRecord> getElementCollection() {
		return this.elementCollection;
	}

}

Executing the Architecture

The following snippet shows the default code for creating and running an own execution:

	Configuration configuration = ... // e.g., new RecordReaderConfiguration();

	final Execution execution = new Execution(configuration);
	execution.executeBlocking();

The executeBlocking method of an Execution starts the execution and waits for it to finish successfully.

With 2.1 you will also be able to run configurations from command line. This feature is under development and is available in our snapshot release.
To execute a configuration run the command java -cp ... teetime.framework.Execution your.own.Configuration where the classpath is set to the directory of the configuration and also the directory where TeeTime is located. In order to enable this feature you need to add all dependencies to the classpath or you can simply make use of the provided “teetime-…-jar-with-dependencies.jar” file. This feature only allows to execute configurations without any arguments in their constructor. You can also run multiple configurations by adding them to the end of the command.

Back to top

Reflow Maven skin by Andrius Velykis.