use of org.eclipse.vorto.codegen.utils.GenerationResultBuilder in project vorto by eclipse.
the class EclipseDittoGenerator method generate.
@Override
public IGenerationResult generate(InformationModel infomodel, InvocationContext invocationContext, IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
GenerationResultZip zipOutputter = new GenerationResultZip(infomodel, getServiceKey());
ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>();
generator.addTask(new SchemaValidatorTask());
generator.generate(infomodel, invocationContext, zipOutputter);
GenerationResultBuilder result = GenerationResultBuilder.from(zipOutputter);
return result.build();
}
use of org.eclipse.vorto.codegen.utils.GenerationResultBuilder in project vorto by eclipse.
the class BoschIoTThingsGenerator method generate.
public IGenerationResult generate(InformationModel infomodel, InvocationContext invocationContext, IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
GenerationResultZip zipOutputter = new GenerationResultZip(infomodel, getServiceKey());
ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>();
GenerationResultBuilder result = GenerationResultBuilder.from(zipOutputter);
if (hasNoTarget(invocationContext)) {
result.append(generateSchema(infomodel, monitor, invocationContext));
} else {
if (invocationContext.getConfigurationProperties().getOrDefault(SIMULATOR, FALSE).equalsIgnoreCase(TRUE)) {
generator.addTask(new JavaClientTask());
}
if (invocationContext.getConfigurationProperties().getOrDefault(SCHEMAVALIDATOR, FALSE).equalsIgnoreCase(TRUE)) {
result.append(generateSchema(infomodel, monitor, invocationContext));
}
}
generator.generate(infomodel, invocationContext, zipOutputter);
if (invocationContext.getConfigurationProperties().getOrDefault("kura", FALSE).equalsIgnoreCase(TRUE)) {
Map<String, String> props = new HashMap<>();
props.put("boschcloud", "true");
props.put("bluetooth", "true");
IGenerationResult kuraResult = invocationContext.lookupGenerator("kura").generate(infomodel, InvocationContext.simpleInvocationContext(props), monitor);
result.append(kuraResult);
}
if (invocationContext.getConfigurationProperties().getOrDefault("alexa", FALSE).equalsIgnoreCase(TRUE)) {
Map<String, String> props = new HashMap<>();
props.put("cloud", "bosch");
props.put("thingId", invocationContext.getConfigurationProperties().getOrDefault("thingId", ""));
IGenerationResult awsResult = invocationContext.lookupGenerator("aws").generate(infomodel, InvocationContext.simpleInvocationContext(props), monitor);
result.append(awsResult);
}
if (invocationContext.getConfigurationProperties().getOrDefault("webui", FALSE).equalsIgnoreCase(TRUE)) {
Map<String, String> props = new HashMap<>();
props.put("boschcloud", "true");
props.put("swagger", "true");
props.put("persistence", "true");
IGenerationResult webuiResult = invocationContext.lookupGenerator("webui").generate(infomodel, InvocationContext.simpleInvocationContext(props), monitor);
result.append(webuiResult);
}
return result.build();
}
Aggregations