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 the
AbstractCommandReceivingComponent offers some
platform functionalities to other classes by implementing the
PlatformConnector interface.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
Field Summary
FieldsFields 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 TypeMethodDescriptionprotected voidaddContainerObserver(String containerName, ContainerStateObserver observer) createContainer(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.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, createContainer, createContainerAsync, createContainerAsync, extendContainerEnvVariables, getCmdResponseTimeout, handleCmd, handleCmd, init, 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
run, setConfiguration
-
Field Details
-
containerObservers
-
-
Constructor Details
-
AbstractPlatformConnectorComponent
public AbstractPlatformConnectorComponent()Constructor.
-
-
Method Details
-
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
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
-
getFactoryForIncomingCmdQueues
- Specified by:
getFactoryForIncomingCmdQueuesin interfacePlatformConnector
-
getFactoryForIncomingDataQueues
- Specified by:
getFactoryForIncomingDataQueuesin interfacePlatformConnector
-
getFactoryForOutgoingCmdQueues
- Specified by:
getFactoryForOutgoingCmdQueuesin interfacePlatformConnector
-
getFactoryForOutgoingDataQueues
- Specified by:
getFactoryForOutgoingDataQueuesin interfacePlatformConnector
-