Search in sources :

Example 11 with MappingEntity

use of io.github.edmm.core.parser.MappingEntity in project winery by eclipse.

the class EdmmTypeProperties method getDefaultConfiguration.

public static void getDefaultConfiguration(EdmmType edmmType, EntityGraph entityGraph) {
    EntityId e;
    switch(edmmType) {
        case COMPUTE:
            EntityId computeId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.COMPUTE.getValue());
            entityGraph.addEntity(new MappingEntity(computeId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(BASE, computeId.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case DATABASE:
            EntityId databaseId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.DATABASE.getValue());
            entityGraph.addEntity(new MappingEntity(databaseId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(BASE, databaseId.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case DBMS:
            EntityId dbmsId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.DBMS.getValue());
            entityGraph.addEntity(new MappingEntity(dbmsId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.SOFTWARE_COMPONENT.getValue(), dbmsId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.SOFTWARE_COMPONENT, entityGraph);
            break;
        case MYSQL_DATABASE:
            EntityId mySqlDatabaseId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.MYSQL_DATABASE.getValue());
            entityGraph.addEntity(new MappingEntity(mySqlDatabaseId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DATABASE.getValue(), mySqlDatabaseId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DATABASE, entityGraph);
            break;
        case MYSQL_DBMS:
            EntityId mySqlDbmsId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.MYSQL_DBMS.getValue());
            entityGraph.addEntity(new MappingEntity(mySqlDbmsId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DBMS.getValue(), mySqlDbmsId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DBMS, entityGraph);
            break;
        case SOFTWARE_COMPONENT:
            EntityId softwareComponent = EntityGraph.COMPONENT_TYPES.extend(EdmmType.SOFTWARE_COMPONENT.getValue());
            entityGraph.addEntity(new MappingEntity(softwareComponent, entityGraph));
            entityGraph.addEntity(new ScalarEntity(BASE, softwareComponent.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case TOMCAT:
            EntityId tomcatId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.TOMCAT.getValue());
            entityGraph.addEntity(new MappingEntity(tomcatId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.WEB_SERVER.getValue(), tomcatId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.WEB_SERVER, entityGraph);
            break;
        case WEB_APPLICATION:
            EntityId webApplication = EntityGraph.COMPONENT_TYPES.extend(EdmmType.WEB_APPLICATION.getValue());
            entityGraph.addEntity(new MappingEntity(webApplication, entityGraph));
            entityGraph.addEntity(new ScalarEntity(BASE, webApplication.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case WEB_SERVER:
            EntityId webServerId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.WEB_SERVER.getValue());
            entityGraph.addEntity(new MappingEntity(webServerId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.SOFTWARE_COMPONENT.getValue(), webServerId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.SOFTWARE_COMPONENT, entityGraph);
            break;
        case GO:
            EntityId goId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.GO.getValue());
            entityGraph.addEntity(new MappingEntity(goId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.WEB_SERVER.getValue(), goId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.WEB_SERVER, entityGraph);
            break;
        case CONNECTS_TO:
            EntityId connectsToId = EntityGraph.RELATION_TYPES.extend(EdmmType.CONNECTS_TO.getValue());
            entityGraph.addEntity(new MappingEntity(connectsToId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DEPENDS_ON.getValue(), connectsToId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DEPENDS_ON, entityGraph);
            break;
        case DEPENDS_ON:
            EntityId dependsOnId = EntityGraph.RELATION_TYPES.extend(EdmmType.DEPENDS_ON.getValue());
            entityGraph.addEntity(new MappingEntity(dependsOnId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(null, dependsOnId.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case HOSTED_ON:
            EntityId hostedOnId = EntityGraph.RELATION_TYPES.extend(EdmmType.HOSTED_ON.getValue());
            entityGraph.addEntity(new MappingEntity(hostedOnId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DEPENDS_ON.getValue(), hostedOnId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DEPENDS_ON, entityGraph);
            break;
        case PLATFORM:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.PLATFORM.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(BASE, e.extend(DefaultKeys.EXTENDS), entityGraph));
            break;
        case PAAS:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.PAAS.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.PLATFORM.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.PLATFORM, entityGraph);
            break;
        case DBAAS:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.DBAAS.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.PLATFORM.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.PLATFORM, entityGraph);
            break;
        case SAAS:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.SAAS.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.PLATFORM.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.PLATFORM, entityGraph);
            break;
        case AWS_BEANSTALK:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.AWS_BEANSTALK.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.PAAS.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.PAAS, entityGraph);
            break;
        case AWS_AURORA:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.AWS_AURORA.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DBAAS.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DBAAS, entityGraph);
            break;
        case AUTH0:
            e = EntityGraph.COMPONENT_TYPES.extend(EdmmType.AUTH0.getValue());
            entityGraph.addEntity(new MappingEntity(e, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.SAAS.getValue(), e.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.SAAS, entityGraph);
            break;
        case MOM:
            EntityId momId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.MOM.getValue());
            entityGraph.addEntity(new MappingEntity(momId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.SOFTWARE_COMPONENT.getValue(), momId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.SOFTWARE_COMPONENT, entityGraph);
            break;
        case RABBITMQ:
            EntityId rabbitMqId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.RABBITMQ.getValue());
            entityGraph.addEntity(new MappingEntity(rabbitMqId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.MOM.getValue(), rabbitMqId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.MOM, entityGraph);
            break;
        case MONGODB:
            EntityId mongoId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.MONGODB.getValue());
            entityGraph.addEntity(new MappingEntity(mongoId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DBMS.getValue(), mongoId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DBMS, entityGraph);
            break;
        case MONGODB_SCHEMA:
            EntityId mongoSchemaId = EntityGraph.COMPONENT_TYPES.extend(EdmmType.MONGODB_SCHEMA.getValue());
            entityGraph.addEntity(new MappingEntity(mongoSchemaId, entityGraph));
            entityGraph.addEntity(new ScalarEntity(EdmmType.DATABASE.getValue(), mongoSchemaId.extend(DefaultKeys.EXTENDS), entityGraph));
            getDefaultConfiguration(EdmmType.DATABASE, entityGraph);
            break;
    }
}
Also used : EntityId(io.github.edmm.core.parser.EntityId) ScalarEntity(io.github.edmm.core.parser.ScalarEntity) MappingEntity(io.github.edmm.core.parser.MappingEntity)

Aggregations

MappingEntity (io.github.edmm.core.parser.MappingEntity)11 EntityId (io.github.edmm.core.parser.EntityId)9 ScalarEntity (io.github.edmm.core.parser.ScalarEntity)9 SequenceEntity (io.github.edmm.core.parser.SequenceEntity)4 QName (javax.xml.namespace.QName)3 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)3 Entity (io.github.edmm.core.parser.Entity)2 EntityGraph (io.github.edmm.core.parser.EntityGraph)2 TNodeType (org.eclipse.winery.model.tosca.TNodeType)2 StringWriter (java.io.StringWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 Stream (java.util.stream.Stream)1 EdmmDependantTest (org.eclipse.winery.edmm.EdmmDependantTest)1 TEntityType (org.eclipse.winery.model.tosca.TEntityType)1 TInterface (org.eclipse.winery.model.tosca.TInterface)1