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
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
FieldsModifier and TypeFieldDescriptionprotected QueueingConsumerConsumer used to receive the responses from the evaluation storage.protected RabbitQueueQueue to the evaluation storage.protected RabbitQueueIncoming queue from the evaluation storage.protected StringThe URI of the experiment.private static final org.slf4j.Loggerprivate static final intTimeout parameter for delivery queue message poll.Fields inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
cmdChannel, cmdQueueFactory, cmdResponseTimeout, DEFAULT_CMD_RESPONSE_TIMEOUT, defaultContainerType, gson, reportUnhandledExceptionsFields inherited from class org.hobbit.core.components.AbstractComponent
configuration, connectionFactory, incomingDataQueueFactory, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, outgoingDataQueuefactory, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidThis method communicates with the evaluation storage to collect all response pairs.protected org.apache.jena.rdf.model.Modelprotected 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.ModelSummarizes 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, stopContainerMethods inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
addCommandHeaderId, createContainer, createContainer, createContainer, createContainerAsync, createContainerAsync, extendContainerEnvVariables, getCmdResponseTimeout, handleCmd, handleCmd, isReportUnhandledExceptions, reportAndWrap, reportError, reportErrorSavely, reportExceptionSavely, reportUnhandledExceptionSavely, sendToCmdQueue, sendToCmdQueue, sendToCmdQueue, setCmdResponseTimeout, setReportUnhandledExceptionsMethods inherited from class org.hobbit.core.components.AbstractComponent
createConnection, generateSessionQueueName, getConfiguration, getHobbitSessionId, setConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hobbit.core.components.Component
setConfiguration
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
consumer
Consumer used to receive the responses from the evaluation storage. -
evalModule2EvalStoreQueue
Queue to the evaluation storage. -
evalStore2EvalModuleQueue
Incoming queue from the evaluation storage. -
experimentUri
The URI of the experiment. -
QUEUEPOLLTIMEOUT
private static final int QUEUEPOLLTIMEOUTTimeout parameter for delivery queue message poll.- See Also:
-
-
Constructor Details
-
AbstractEvaluationModule
public AbstractEvaluationModule()
-
-
Method Details
-
init
Description 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
Description copied from interface:ComponentThis method executes the component.- Throws:
Exception- if an error occurs during the execution
-
collectResponses
This 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 Exception Evaluates 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
Summarizes 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
Sends 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
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractCommandReceivingComponent- Throws:
IOException
-
createDefaultModel
protected org.apache.jena.rdf.model.Model createDefaultModel()
-