Search in sources :

Example 1 with Generator

use of org.eclipse.vorto.codegen.gateway.model.Generator in project vorto by eclipse.

the class VortoService method generate.

public IGenerationResult generate(String key, String namespace, String name, String version, Map<String, String> parameters) {
    LOGGER.info(String.format("Generating for Platform [%s] and Model [%s.%s:%s]", key, namespace, name, version));
    Generator generator = repo.get(key).orElseThrow(GatewayUtils.notFound(String.format("[Generator %s]", key)));
    InformationModel model = getModel(namespace, name, version).orElseThrow(GatewayUtils.notFound(String.format("[Model %s.%s:%s]", namespace, name, version)));
    List<MappingModel> mappings = getMappings(key, namespace, name, version);
    InvocationContext invocationContext = new InvocationContext(mappings, repo.newGeneratorLookup(), parameters);
    return generate(generator.getInstance(), model, invocationContext);
}
Also used : InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) InvocationContext(org.eclipse.vorto.codegen.api.InvocationContext) MappingModel(org.eclipse.vorto.core.api.model.mapping.MappingModel) IVortoCodeGenerator(org.eclipse.vorto.codegen.api.IVortoCodeGenerator) Generator(org.eclipse.vorto.codegen.gateway.model.Generator)

Aggregations

IVortoCodeGenerator (org.eclipse.vorto.codegen.api.IVortoCodeGenerator)1 InvocationContext (org.eclipse.vorto.codegen.api.InvocationContext)1 Generator (org.eclipse.vorto.codegen.gateway.model.Generator)1 InformationModel (org.eclipse.vorto.core.api.model.informationmodel.InformationModel)1 MappingModel (org.eclipse.vorto.core.api.model.mapping.MappingModel)1