Search in sources :

Example 1 with Interface

use of org.opentosca.toscana.model.operation.Interface in project TOSCAna by StuPro-TOSCAna.

the class LinkResolver method resolveImplementationArtifacts.

private static void resolveImplementationArtifacts(ServiceGraph graph) {
    logger.debug(LogFormat.indent(1, "artifacts"));
    Map<String, RootNode> nodes = new TypeWrapper().wrapNodes(graph);
    for (RootNode node : nodes.values()) {
        for (Interface thisInterface : node.getInterfaces()) {
            for (Operation operation : thisInterface.getOperations()) {
                Optional<Artifact> optionalArtifact = operation.getArtifact();
                if (optionalArtifact.isPresent()) {
                    Artifact operationArtifact = optionalArtifact.get();
                    for (Artifact nodeArtifact : node.getArtifacts()) {
                        if (operationArtifact.getFilePath().equals(nodeArtifact.getEntityName())) {
                            graph.replaceEntity(operationArtifact.getBackingEntity(), nodeArtifact.getBackingEntity());
                            logger.debug(LogFormat.pointAt(2, operationArtifact.getBackingEntity().getId(), nodeArtifact.getBackingEntity().getId()));
                        // at this point it's obvious: we need a better solution for navigating the service graph...
                        }
                    }
                }
            }
        }
    }
}
Also used : RootNode(org.opentosca.toscana.model.node.RootNode) Operation(org.opentosca.toscana.model.operation.Operation) Interface(org.opentosca.toscana.model.operation.Interface) Artifact(org.opentosca.toscana.model.artifact.Artifact)

Aggregations

Artifact (org.opentosca.toscana.model.artifact.Artifact)1 RootNode (org.opentosca.toscana.model.node.RootNode)1 Interface (org.opentosca.toscana.model.operation.Interface)1 Operation (org.opentosca.toscana.model.operation.Operation)1