use of org.iobserve.analysis.feature.IContainerManagementSinksStage in project iobserve-analysis by research-iobserve.
the class AnalysisConfiguration method createContainerManagementSink.
/**
* Create sinks for container management visualization.
*
* @param configuration
* configuration object
* @throws ConfigurationException
* when configuration fails
*/
private void createContainerManagementSink(final kieker.common.configuration.Configuration configuration) throws ConfigurationException {
final String[] containerManagementSinks = configuration.getStringArrayProperty(ConfigurationKeys.CONTAINER_MANAGEMENT_SINK, AnalysisConfiguration.DELIMETER);
if (containerManagementSinks.length == 1) {
final IContainerManagementSinksStage containerManagementSinksStage = InstantiationFactory.createWithConfiguration(IContainerManagementSinksStage.class, containerManagementSinks[0], configuration);
/**
* connect ports.
*/
this.connectPorts(this.allocationStage.getAllocationNotifyOutputPort(), containerManagementSinksStage.getAllocationInputPort());
this.connectPorts(this.deallocationStage.getDeallocationNotifyOutputPort(), containerManagementSinksStage.getDeallocationInputPort());
this.connectPorts(this.deploymentStage.getDeployedOutputPort(), containerManagementSinksStage.getDeployedInputPort());
this.connectPorts(this.undeploymentStage.getUndeployedOutputPort(), containerManagementSinksStage.getUndeployedInputPort());
} else if (containerManagementSinks.length > 1) {
/**
* In case of multiple outputs, we require distributors.
*/
final Distributor<ResourceContainer> allocationDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<ResourceContainer> deallocationDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<PCMDeployedEvent> deploymentDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<PCMUndeployedEvent> undeploymentDistributor = new Distributor<>(new CopyByReferenceStrategy());
/**
* link distributor to container management.
*/
this.connectPorts(this.allocationStage.getAllocationNotifyOutputPort(), allocationDistributor.getInputPort());
this.connectPorts(this.deallocationStage.getDeallocationNotifyOutputPort(), deallocationDistributor.getInputPort());
this.connectPorts(this.deploymentStage.getDeployedOutputPort(), deploymentDistributor.getInputPort());
this.connectPorts(this.undeploymentStage.getUndeployedOutputPort(), undeploymentDistributor.getInputPort());
/**
* Create and connect sinks.
*/
for (final String containerManagementSink : containerManagementSinks) {
final IContainerManagementSinksStage containerManagementSinksStage = InstantiationFactory.createWithConfiguration(IContainerManagementSinksStage.class, containerManagementSink, configuration);
/**
* connect ports.
*/
this.connectPorts(allocationDistributor.getNewOutputPort(), containerManagementSinksStage.getAllocationInputPort());
this.connectPorts(deallocationDistributor.getNewOutputPort(), containerManagementSinksStage.getDeallocationInputPort());
this.connectPorts(deploymentDistributor.getNewOutputPort(), containerManagementSinksStage.getDeployedInputPort());
this.connectPorts(undeploymentDistributor.getNewOutputPort(), containerManagementSinksStage.getUndeployedInputPort());
}
} else {
AnalysisConfiguration.LOGGER.warn("No container management sinks specified. Therefore, deployment and allocation changes will not be communicated.");
}
}
Aggregations