use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class EntryEventMapperStage method computePcmEntryCallEvent.
private void computePcmEntryCallEvent(final ComponentEntry componentEntry, final OperationEntry operationEntry, final AllocationEntry allocationEntry, final EntryCallEvent event) throws DBException {
/**
* retrieve PCM model elements from mapping.
*/
final AllocationContext allocationContext = this.allocationResource.findObjectByTypeAndId(AllocationContext.class, AllocationPackage.Literals.ALLOCATION_CONTEXT, ModelGraphFactory.getIdentification(allocationEntry.getAllocation()));
final OperationSignature operationSignature = this.repositoryResource.findAndLockObjectById(OperationSignature.class, RepositoryPackage.Literals.OPERATION_SIGNATURE, ModelGraphFactory.getIdentification(operationEntry.getOperation()));
final RepositoryComponent component = this.repositoryResource.findObjectByTypeAndId(RepositoryComponent.class, RepositoryPackage.Literals.REPOSITORY_COMPONENT, ModelGraphFactory.getIdentification(componentEntry.getComponent()));
/**
* assembly is inferred from allocation.
*/
final AssemblyContext assemblyContext = this.assemblyResource.findObjectByTypeAndId(AssemblyContext.class, CompositionPackage.Literals.ASSEMBLY_CONTEXT, ModelGraphFactory.getIdentification(allocationContext.getAssemblyContext_AllocationContext()));
/**
* assemble event.
*/
final PCMEntryCallEvent mappedEvent = new PCMEntryCallEvent(event.getEntryTime(), event.getExitTime(), component, operationSignature, assemblyContext, allocationContext);
this.outputPort.send(mappedEvent);
}
use of org.palladiosimulator.pcm.allocation.AllocationContext 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);
}
}
}
}
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class ProbeMapper method findAllocationEntry.
/**
* Find the corresponding AllocationEntry for an AllocationContext.
*
* @param allocation
* the allocation context
* @return returns the AllocationEntry
* @throws InvocationException
* @throws DBException
*/
private AllocationEntry findAllocationEntry(final AllocationContext allocation) throws InvocationException, DBException {
final List<AllocationEntry> allocations = this.correspondenceResource.collectAllObjectsByType(AllocationEntry.class, CorrespondencePackage.Literals.ALLOCATION_ENTRY);
for (final AllocationEntry entry : allocations) {
final AllocationContext entryAllocation = this.allocationResource.resolve(entry.getAllocation());
this.logger.debug("XXXXX entry id {} name {} / ac id {} name {}", entryAllocation.getId(), entryAllocation.getEntityName(), allocation.getId(), allocation.getEntityName());
if (entryAllocation.getId().equals(allocation.getId())) {
return entry;
}
}
throw new InternalError("Correspondence entry missing for " + allocation.getEntityName());
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class DataProtectionWarner method print.
private void print(final PrivacyGraph graph) {
java.lang.System.out.println("Graph-Name " + graph.getName());
java.lang.System.out.println("Vertices");
for (final Entry<String, Vertex> entry : graph.getVertices().entrySet()) {
final String entityName;
final AllocationContext context = entry.getValue().getAllocationContext();
if (context != null) {
entityName = context.getEntityName();
} else {
entityName = "<missing allocation context>";
}
java.lang.System.out.println("\t" + entry.getKey() + " = " + entry.getValue().getName() + " : " + entityName);
}
java.lang.System.out.println("Edges");
for (final Edge value : graph.getEdges()) {
final String entityName;
final OperationSignature context = value.getOperationSignature();
if (context != null) {
entityName = context.getEntityName();
} else {
entityName = "<missing operation signature>";
}
java.lang.System.out.println("\t" + entityName + " " + value.getSource().getName() + " -> " + value.getTarget().getName());
}
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class DataProtectionWarner method addDeployedComponents.
/**
* Adding deployment info.
*
* @param privacyGraph
* the graph containing privacy information
* @throws DBException
* @throws InvocationException
*/
private void addDeployedComponents(final PrivacyGraph privacyGraph) throws InvocationException, DBException {
DeploymentLock.lock();
for (final AllocationContext allocationContext : this.allocationRootElement.getAllocationContexts_Allocation()) {
final AssemblyContext proxyAssemblyContext = allocationContext.getAssemblyContext_AllocationContext();
final AssemblyContext assemblyContext = this.systemModelResource.resolve(proxyAssemblyContext);
final RepositoryComponent proxyComponent = assemblyContext.getEncapsulatedComponent__AssemblyContext();
final BasicComponent basicComponent = (BasicComponent) this.repositoryResource.resolve(proxyComponent);
/**
* Creating component vertices. *
*/
// TODO name should be allocation name or assembly name + instance count
final Vertex vertex = new Vertex(basicComponent.getEntityName(), this.computeStereotype(basicComponent));
vertex.setAllocationContext(allocationContext);
privacyGraph.addVertex(vertex);
this.vertices.put(basicComponent.getId(), vertex);
final ResourceContainer resourceContainer = this.resourceEnvironmentResource.resolve(allocationContext.getResourceContainer_AllocationContext());
final GeoLocation geo = this.geolocations.get(resourceContainer.getId());
if (geo == null) {
this.logger.info("Geolocation infomation not available {}", resourceContainer.getId());
} else {
final Vertex vGeo = new Vertex(geo.getIsocode().getName(), EStereoType.GEOLOCATION);
if (!this.vertices.containsKey(geo.getIsocode().getName())) {
// New Geolocation
privacyGraph.addVertex(vGeo);
privacyGraph.addEdge(vGeo, vertex);
this.vertices.put(geo.getIsocode().getName(), vGeo);
} else {
// Existing Geolocation
privacyGraph.addEdge(this.vertices.get(geo.getIsocode().getName()), vertex);
}
}
}
DeploymentLock.unlock();
}
Aggregations