Package org.hobbit.core.components
Class AbstractPlatformConnectorComponent
- java.lang.Object
-
- org.hobbit.core.components.AbstractComponent
-
- org.hobbit.core.components.AbstractCommandReceivingComponent
-
- org.hobbit.core.components.AbstractPlatformConnectorComponent
-
- All Implemented Interfaces:
Closeable,AutoCloseable,CommandReceivingComponent,Component,PlatformConnector
- Direct Known Subclasses:
AbstractBenchmarkController,AbstractDataGenerator,AbstractEvaluationModule,AbstractEvaluationStorage,AbstractSystemAdapter,AbstractTaskGenerator
public abstract class AbstractPlatformConnectorComponent extends AbstractCommandReceivingComponent implements PlatformConnector
This extension of theAbstractCommandReceivingComponentoffers some platform functionalities to other classes by implementing thePlatformConnectorinterface.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,ContainerStateObserver>containerObservers-
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 AbstractPlatformConnectorComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddContainerObserver(String containerName, ContainerStateObserver observer)StringcreateContainer(String imageName, String[] envVariables, ContainerStateObserver observer)This method sends aCommands.DOCKER_CONTAINER_STARTcommand to create and start an instance of the given image using the given environment variables.RabbitQueueFactorygetFactoryForIncomingCmdQueues()RabbitQueueFactorygetFactoryForIncomingDataQueues()RabbitQueueFactorygetFactoryForOutgoingCmdQueues()RabbitQueueFactorygetFactoryForOutgoingDataQueues()voidreceiveCommand(byte command, byte[] data)This method is called if a command is received and might be interesting for this particular component.voidstopContainer(String containerName)This method sends aCommands.DOCKER_CONTAINER_STOPcommand to stop the container with the given id.-
Methods inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
addCommandHeaderId, close, createContainer, createContainer, getCmdResponseTimeout, handleCmd, init, sendToCmdQueue, sendToCmdQueue, sendToCmdQueue, setCmdResponseTimeout
-
Methods inherited from class org.hobbit.core.components.AbstractComponent
createConnection, generateSessionQueueName, getHobbitSessionId
-
-
-
-
Field Detail
-
containerObservers
private Map<String,ContainerStateObserver> containerObservers
-
-
Method Detail
-
createContainer
public String createContainer(String imageName, String[] envVariables, ContainerStateObserver observer)
Description copied from interface:PlatformConnectorThis method sends aCommands.DOCKER_CONTAINER_STARTcommand to create and start an instance of the given image using the given environment variables.- Specified by:
createContainerin interfacePlatformConnector- Parameters:
imageName- the name of the image of the docker containerenvVariables- environment variables that should be added to the created containerobserver- the container state observer that is called if the container terminates- Returns:
- the name of the container instance or null if an error occurred
-
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- Parameters:
command- the byte encoding the commanddata- additional data that was sent together with the command
-
stopContainer
public void stopContainer(String containerName)
Description copied from class:AbstractCommandReceivingComponentThis method sends aCommands.DOCKER_CONTAINER_STOPcommand to stop the container with the given id.- Specified by:
stopContainerin interfacePlatformConnector- Overrides:
stopContainerin classAbstractCommandReceivingComponent- Parameters:
containerName- the name of the container instance that should be stopped
-
addContainerObserver
protected void addContainerObserver(String containerName, ContainerStateObserver observer)
-
getFactoryForIncomingCmdQueues
public RabbitQueueFactory getFactoryForIncomingCmdQueues()
- Specified by:
getFactoryForIncomingCmdQueuesin interfacePlatformConnector
-
getFactoryForIncomingDataQueues
public RabbitQueueFactory getFactoryForIncomingDataQueues()
- Specified by:
getFactoryForIncomingDataQueuesin interfacePlatformConnector
-
getFactoryForOutgoingCmdQueues
public RabbitQueueFactory getFactoryForOutgoingCmdQueues()
- Specified by:
getFactoryForOutgoingCmdQueuesin interfacePlatformConnector
-
getFactoryForOutgoingDataQueues
public RabbitQueueFactory getFactoryForOutgoingDataQueues()
- Specified by:
getFactoryForOutgoingDataQueuesin interfacePlatformConnector
-
-