Search in sources :

Example 1 with ControlEventCreationFailedException

use of org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException in project iobserve-analysis by research-iobserve.

the class ProbeMapper method createMethodsToActivate.

private void createMethodsToActivate(final ProbeManagementData element) throws ControlEventCreationFailedException, InvocationException, DBException {
    final Map<AllocationContext, Set<OperationSignature>> methodsToActivate = element.getMethodsToActivate();
    if (methodsToActivate != null) {
        this.logger.debug("methods to activate");
        for (final AllocationContext allocation : methodsToActivate.keySet()) {
            this.logger.debug("AllocationContext to activate {}", allocation.getEntityName());
            for (final OperationSignature operationSignature : methodsToActivate.get(allocation)) {
                this.logger.debug("AllocationContext activate operation {}", operationSignature.getEntityName());
                try {
                    final String pattern = this.computeAllocationComponentIdentifierPattern(allocation, operationSignature);
                    this.logger.debug("AllocationContext activate operation {} -- {}", operationSignature.getEntityName(), pattern);
                    final TcpActivationControlEvent currentEvent = this.createActivationEvent(pattern, element.getTriggerTime(), element.getWhitelist());
                    this.fillTcpControlEvent(currentEvent, allocation);
                    this.outputPort.send(currentEvent);
                } catch (final ControlEventCreationFailedException e) {
                    this.logger.error("Could not construct activation event for: " + operationSignature.toString(), e);
                }
            }
        }
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) TcpActivationControlEvent(org.iobserve.utility.tcp.events.TcpActivationControlEvent) Set(java.util.Set) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ControlEventCreationFailedException(org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException)

Example 2 with ControlEventCreationFailedException

use of org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException 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)

Example 3 with ControlEventCreationFailedException

use of org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException in project iobserve-analysis by research-iobserve.

the class ProbeMapper method createMethodsToDeactivate.

private void createMethodsToDeactivate(final ProbeManagementData element) throws ControlEventCreationFailedException, InvocationException, DBException {
    final Map<AllocationContext, Set<OperationSignature>> methodsToDeactivate = element.getMethodsToDeactivate();
    if (methodsToDeactivate != null) {
        this.logger.debug("methods to deactivate");
        for (final AllocationContext allocation : methodsToDeactivate.keySet()) {
            this.logger.debug("AllocationContext to deactivate {}", allocation.getEntityName());
            for (final OperationSignature operationSignature : methodsToDeactivate.get(allocation)) {
                try {
                    final String pattern = this.computeAllocationComponentIdentifierPattern(allocation, operationSignature);
                    this.logger.debug("AllocationContext deactivate operation {} -- {}", operationSignature.getEntityName(), pattern);
                    // deactivation -> no parameters needed
                    final TcpDeactivationControlEvent currentEvent = new TcpDeactivationControlEvent(pattern, element.getTriggerTime());
                    this.fillTcpControlEvent(currentEvent, allocation);
                    this.outputPort.send(currentEvent);
                } catch (final ControlEventCreationFailedException e) {
                    this.logger.error("Could not construct deactivation event for: " + operationSignature.toString(), e);
                }
            }
        }
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) Set(java.util.Set) TcpDeactivationControlEvent(org.iobserve.utility.tcp.events.TcpDeactivationControlEvent) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ControlEventCreationFailedException(org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException)

Aggregations

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