use of org.iobserve.model.persistence.neo4j.InvocationException in project iobserve-analysis by research-iobserve.
the class NonAdaptiveModelProbeController method computeAvailableProbes.
/**
* Compute available probes.
*
* @return returns a map of {@link AllocationContext}s and their relevant
* {@link OperationSignature}s
* @throws DBException
*/
private Map<AllocationContext, Set<OperationSignature>> computeAvailableProbes() throws DBException {
final Repository repositoryModel = this.repositoryResource.getModelRootNode(Repository.class, RepositoryPackage.Literals.REPOSITORY);
final List<AllocationContext> allocations = this.allocationResource.collectAllObjectsByType(AllocationContext.class, AllocationPackage.Literals.ALLOCATION_CONTEXT);
final Map<AllocationContext, Set<OperationSignature>> availableProbes = new HashMap<>();
this.logger.debug("Found " + allocations.size() + " allocation context entries");
for (final AllocationContext allocation : allocations) {
final Set<OperationSignature> allocationMethods = new LinkedHashSet<>();
try {
final AssemblyContext assemblyContext = this.systemModelResource.resolve(allocation.getAssemblyContext_AllocationContext());
final RepositoryComponent component = this.repositoryResource.resolve(assemblyContext.getEncapsulatedComponent__AssemblyContext());
final List<ProvidedRole> providingRoles = component.getProvidedRoles_InterfaceProvidingEntity();
for (final ProvidedRole providedRole : providingRoles) {
this.logger.debug("Providing roles: " + providingRoles);
final String roleName = providedRole.getEntityName();
for (final Interface iface : repositoryModel.getInterfaces__Repository()) {
if (iface instanceof OperationInterface) {
if (roleName.contains(iface.getEntityName())) {
this.logger.debug("Matching operation interfaces: " + ((OperationInterface) iface).getSignatures__OperationInterface());
// found interface
allocationMethods.addAll(((OperationInterface) iface).getSignatures__OperationInterface());
}
}
}
}
} catch (InvocationException | DBException e) {
this.logger.error("Could not resolve elements of the PCM during the computation of the available probes", e);
}
availableProbes.put(allocation, allocationMethods);
}
return availableProbes;
}
use of org.iobserve.model.persistence.neo4j.InvocationException in project iobserve-analysis by research-iobserve.
the class WhitelistFilter method computeForbiddenIps.
private Set<String> computeForbiddenIps(final Map<AllocationContext, Set<OperationSignature>> warnedMethods) {
final Set<AllocationContext> allocationSet = new LinkedHashSet<>();
allocationSet.addAll(warnedMethods.keySet());
final Set<String> blacklistSet = new HashSet<>();
for (final AllocationContext allocation : allocationSet) {
try {
blacklistSet.add(this.resourceEnvironmentResource.resolve(allocation.getResourceContainer_AllocationContext()).getEntityName());
} catch (InvocationException | DBException e) {
this.logger.error("Could not resolve resource container during the computation of the IP of the black list from: " + allocation, e);
}
}
return blacklistSet;
}
use of org.iobserve.model.persistence.neo4j.InvocationException in project iobserve-analysis by research-iobserve.
the class WhitelistFilter method computeAvailableIps.
private Set<String> computeAvailableIps() throws DBException {
final List<AllocationContext> allocations = this.allocationResource.collectAllObjectsByType(AllocationContext.class, AllocationPackage.Literals.ALLOCATION_CONTEXT);
final Set<String> availableIps = new LinkedHashSet<>();
for (final AllocationContext allocation : allocations) {
try {
availableIps.add(this.resourceEnvironmentResource.resolve(allocation.getResourceContainer_AllocationContext()).getEntityName());
} catch (InvocationException | DBException e) {
this.logger.error("Could not resolve resource container during the computation of the IP from: " + allocation, e);
}
}
return availableIps;
}
Aggregations