public abstract class AbstractPlatformConnectorComponent extends AbstractCommandReceivingComponent implements PlatformConnector
AbstractCommandReceivingComponent offers some
platform functionalities to other classes by implementing the
PlatformConnector interface.| Modifier and Type | Field and Description |
|---|---|
private Map<String,ContainerStateObserver> |
containerObservers |
cmdChannel, cmdConnection, defaultContainerTypeconnectionFactory, dataConnection, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY| Constructor and Description |
|---|
AbstractPlatformConnectorComponent() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addContainerObserver(String containerName,
ContainerStateObserver observer) |
String |
createContainer(String imageName,
String[] envVariables,
ContainerStateObserver observer)
This method sends a
Commands.DOCKER_CONTAINER_START command to
create and start an instance of the given image using the given
environment variables. |
RabbitQueue |
createDefaultRabbitQueue(String name)
This method opens a channel using the established
AbstractComponent.dataConnection
to RabbitMQ and creates a new queue using the given name and the
following configuration:
The channel number is automatically derived from the connection. |
void |
receiveCommand(byte command,
byte[] data)
This method is called if a command is received and might be interesting
for this particular component.
|
void |
stopContainer(String containerName)
This method sends a
Commands.DOCKER_CONTAINER_STOP command to
stop the container with the given id. |
addCommandHeaderId, close, createContainer, createContainer, handleCmd, init, sendToCmdQueue, sendToCmdQueue, sendToCmdQueuegenerateSessionQueueName, getHobbitSessionIdprivate Map<String,ContainerStateObserver> containerObservers
public RabbitQueue createDefaultRabbitQueue(String name) throws IOException
AbstractComponent.dataConnection
to RabbitMQ and creates a new queue using the given name and the
following configuration:
createDefaultRabbitQueue in interface RabbitQueueFactorycreateDefaultRabbitQueue in class AbstractComponentname - name of the queueRabbitQueue object comprising the Channel and the
name of the created queueIOException - if a communication error occurspublic String createContainer(String imageName, String[] envVariables, ContainerStateObserver observer)
PlatformConnectorCommands.DOCKER_CONTAINER_START command to
create and start an instance of the given image using the given
environment variables.createContainer in interface PlatformConnectorimageName - 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
terminatespublic void receiveCommand(byte command,
byte[] data)
CommandReceivingComponentreceiveCommand in interface CommandReceivingComponentcommand - the byte encoding the commanddata - additional data that was sent together with the commandpublic void stopContainer(String containerName)
AbstractCommandReceivingComponentCommands.DOCKER_CONTAINER_STOP command to
stop the container with the given id.stopContainer in interface PlatformConnectorstopContainer in class AbstractCommandReceivingComponentcontainerName - the name of the container instance that should be stoppedprotected void addContainerObserver(String containerName, ContainerStateObserver observer)
Copyright © 2017. All rights reserved.