Search in sources :

Example 11 with Artifact

use of org.opentosca.toscana.model.artifact.Artifact 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)11 Test (org.junit.Test)5 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)5 Operation (org.opentosca.toscana.model.operation.Operation)5 Entity (org.opentosca.toscana.core.parse.model.Entity)3 MappingEntity (org.opentosca.toscana.core.parse.model.MappingEntity)3 ScalarEntity (org.opentosca.toscana.core.parse.model.ScalarEntity)3 EffectiveModel (org.opentosca.toscana.model.EffectiveModel)3 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)3 EntityId (org.opentosca.toscana.model.EntityId)3 RootNode (org.opentosca.toscana.model.node.RootNode)3 TransformationFailureException (org.opentosca.toscana.plugins.util.TransformationFailureException)3 ServiceGraph (org.opentosca.toscana.core.parse.model.ServiceGraph)2 WebApplication (org.opentosca.toscana.model.node.WebApplication)2 WebServer (org.opentosca.toscana.model.node.WebServer)2 JavaApplication (org.opentosca.toscana.model.node.custom.JavaApplication)2 SdkClientException (com.amazonaws.SdkClientException)1 SecurityGroup (com.scaleset.cfbuilder.ec2.SecurityGroup)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1