Package org.hobbit.core.components
Class AbstractEvaluationModule
- java.lang.Object
-
- org.hobbit.core.components.AbstractComponent
-
- org.hobbit.core.components.AbstractCommandReceivingComponent
-
- org.hobbit.core.components.AbstractPlatformConnectorComponent
-
- org.hobbit.core.components.AbstractEvaluationModule
-
- All Implemented Interfaces:
Closeable,AutoCloseable,CommandReceivingComponent,Component,PlatformConnector
public abstract class AbstractEvaluationModule extends AbstractPlatformConnectorComponent
This abstract class implements basic functions that can be used to implement a task generator.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description protected com.rabbitmq.client.QueueingConsumerconsumerConsumer used to receive the responses from the evaluation storage.protected RabbitQueueevalModule2EvalStoreQueueQueue to the evaluation storage.protected RabbitQueueevalStore2EvalModuleQueueIncoming queue from the evaluation storage.protected StringexperimentUriThe URI of the experiment.private static org.slf4j.LoggerLOGGER-
Fields inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
cmdChannel, cmdQueueFactory, cmdResponseTimeout, DEFAULT_CMD_RESPONSE_TIMEOUT, defaultContainerType
-
Fields inherited from class org.hobbit.core.components.AbstractComponent
connectionFactory, incomingDataQueueFactory, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, outgoingDataQueuefactory, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY
-
-
Constructor Summary
Constructors Constructor Description AbstractEvaluationModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidcollectResponses()This method communicates with the evaluation storage to collect all response pairs.protected org.apache.jena.rdf.model.ModelcreateDefaultModel()protected abstract voidevaluateResponse(byte[] expectedData, byte[] receivedData, long taskSentTimestamp, long responseReceivedTimestamp)Evaluates the given response pair.voidinit()This method initializes the component.voidreceiveCommand(byte command, byte[] data)This method is called if a command is received and might be interesting for this particular component.voidrun()This method executes the component.private voidsendResultModel(org.apache.jena.rdf.model.Model model)Sends the model to the benchmark controller.protected abstract org.apache.jena.rdf.model.ModelsummarizeEvaluation()Summarizes the evaluation and generates an RDF model containing the evaluation results.-
Methods inherited from class org.hobbit.core.components.AbstractPlatformConnectorComponent
addContainerObserver, createContainer, getFactoryForIncomingCmdQueues, getFactoryForIncomingDataQueues, getFactoryForOutgoingCmdQueues, getFactoryForOutgoingDataQueues, stopContainer
-
Methods inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
addCommandHeaderId, createContainer, createContainer, getCmdResponseTimeout, handleCmd, sendToCmdQueue, sendToCmdQueue, sendToCmdQueue, setCmdResponseTimeout
-
Methods inherited from class org.hobbit.core.components.AbstractComponent
createConnection, generateSessionQueueName, getHobbitSessionId
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
consumer
protected com.rabbitmq.client.QueueingConsumer consumer
Consumer used to receive the responses from the evaluation storage.
-
evalModule2EvalStoreQueue
protected RabbitQueue evalModule2EvalStoreQueue
Queue to the evaluation storage.
-
evalStore2EvalModuleQueue
protected RabbitQueue evalStore2EvalModuleQueue
Incoming queue from the evaluation storage.
-
experimentUri
protected String experimentUri
The URI of the experiment.
-
-
Method Detail
-
init
public void init() throws ExceptionDescription copied from interface:ComponentThis method initializes the component.- Specified by:
initin interfaceComponent- Overrides:
initin classAbstractCommandReceivingComponent- Throws:
Exception- if an error occurs during the initialization
-
run
public void run() throws ExceptionDescription copied from interface:ComponentThis method executes the component.- Throws:
Exception- if an error occurs during the execution
-
collectResponses
protected void collectResponses() throws ExceptionThis method communicates with the evaluation storage to collect all response pairs. For every pair theevaluateResponse(byte[], byte[], long, long)method is called.- Throws:
Exception- if a communication error occurs.
-
evaluateResponse
protected abstract void evaluateResponse(byte[] expectedData, byte[] receivedData, long taskSentTimestamp, long responseReceivedTimestamp) throws ExceptionEvaluates the given response pair.- Parameters:
expectedData- the data that has been expectedreceivedData- the data that has been received from the systemtaskSentTimestamp- the time at which the task has been sent to the systemresponseReceivedTimestamp- the time at which the response has been received from the system- Throws:
Exception- if an error occurs during the evaluation
-
summarizeEvaluation
protected abstract org.apache.jena.rdf.model.Model summarizeEvaluation() throws ExceptionSummarizes the evaluation and generates an RDF model containing the evaluation results.- Returns:
- an RDF model containing the evaluation results
- Throws:
Exception- if a sever error occurs
-
sendResultModel
private void sendResultModel(org.apache.jena.rdf.model.Model model) throws IOExceptionSends the model to the benchmark controller.- Parameters:
model- the model that should be sent- Throws:
IOException- if an error occurs during the commmunication
-
receiveCommand
public void receiveCommand(byte command, byte[] data)Description copied from interface:CommandReceivingComponentThis method is called if a command is received and might be interesting for this particular component.- Specified by:
receiveCommandin interfaceCommandReceivingComponent- Overrides:
receiveCommandin classAbstractPlatformConnectorComponent- Parameters:
command- the byte encoding the commanddata- additional data that was sent together with the command
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractCommandReceivingComponent- Throws:
IOException
-
createDefaultModel
protected org.apache.jena.rdf.model.Model createDefaultModel()
-
-