Search in sources :

Example 1 with TcpUpdateParameterEvent

use of org.iobserve.utility.tcp.events.TcpUpdateParameterEvent in project iobserve-analysis by research-iobserve.

the class ProbeMapper method createMethodsToUpdate.

private void createMethodsToUpdate(final ProbeManagementData element) throws ControlEventCreationFailedException, InvocationException, DBException {
    final Map<AllocationContext, Set<OperationSignature>> methodsToUpdate = element.getMethodsToUpdate();
    if (methodsToUpdate != null && element.getWhitelist() != null) {
        for (final AllocationContext allocation : methodsToUpdate.keySet()) {
            this.logger.debug("AllocationContext to update {}", allocation.getEntityName());
            for (final OperationSignature operationSignature : methodsToUpdate.get(allocation)) {
                try {
                    final String pattern = this.computeAllocationComponentIdentifierPattern(allocation, operationSignature);
                    this.logger.debug("AllocationContext update operation {} -- {}", operationSignature.getEntityName(), pattern);
                    final Map<String, List<String>> parameters = new HashMap<>();
                    parameters.put("whitelist", element.getWhitelist());
                    final TcpUpdateParameterEvent currentEvent = new TcpUpdateParameterEvent(pattern, element.getTriggerTime(), parameters);
                    this.fillTcpControlEvent(currentEvent, allocation);
                    this.outputPort.send(currentEvent);
                } catch (final ControlEventCreationFailedException e) {
                    this.logger.error("Could not construct activation event for: {} {}", operationSignature.toString(), e.getLocalizedMessage());
                }
            }
        }
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) TcpUpdateParameterEvent(org.iobserve.utility.tcp.events.TcpUpdateParameterEvent) Set(java.util.Set) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) HashMap(java.util.HashMap) EList(org.eclipse.emf.common.util.EList) List(java.util.List) ControlEventCreationFailedException(org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException)

Aggregations

HashMap (java.util.HashMap)1 List (java.util.List)1 Set (java.util.Set)1 EList (org.eclipse.emf.common.util.EList)1 ControlEventCreationFailedException (org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException)1 TcpUpdateParameterEvent (org.iobserve.utility.tcp.events.TcpUpdateParameterEvent)1 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)1 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)1