Package org.hobbit.core.components
Class AbstractDataGenerator
- java.lang.Object
-
- org.hobbit.core.components.AbstractComponent
-
- org.hobbit.core.components.AbstractCommandReceivingComponent
-
- org.hobbit.core.components.AbstractPlatformConnectorComponent
-
- org.hobbit.core.components.AbstractDataGenerator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,CommandReceivingComponent,Component,PlatformConnector
public abstract class AbstractDataGenerator extends AbstractPlatformConnectorComponent
-
-
Field Summary
Fields Modifier and Type Field Description private intgeneratorIdprivate intnumberOfGeneratorsprotected DataSendersender2Systemprotected DataSendersender2TaskGenprivate SemaphorestartDataGenMutex-
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 AbstractDataGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract voidgenerateData()intgetGeneratorId()intgetNumberOfGenerators()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.protected voidsendDataToSystemAdapter(byte[] data)protected voidsendDataToTaskGenerator(byte[] data)-
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
-
startDataGenMutex
private Semaphore startDataGenMutex
-
generatorId
private int generatorId
-
numberOfGenerators
private int numberOfGenerators
-
sender2TaskGen
protected DataSender sender2TaskGen
-
sender2System
protected DataSender sender2System
-
-
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
-
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
-
sendDataToTaskGenerator
protected void sendDataToTaskGenerator(byte[] data) throws IOException- Throws:
IOException
-
sendDataToSystemAdapter
protected void sendDataToSystemAdapter(byte[] data) throws IOException- Throws:
IOException
-
getGeneratorId
public int getGeneratorId()
-
getNumberOfGenerators
public int getNumberOfGenerators()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractCommandReceivingComponent- Throws:
IOException
-
-