use of org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask in project vorto by eclipse.
the class KuraGenerator method generate.
@Override
public IGenerationResult generate(InformationModel context, InvocationContext invocationContext, IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
GenerationResultZip outputter = new GenerationResultZip(context, getServiceKey());
ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>();
generator.addTask(new GeneratorTaskFromFileTemplate<>(new EclipseClasspathTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new EclipseProjectFileTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ManifestTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new BuildPropertiesTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ComponentXmlTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new IDataServiceTemplate()));
if (invocationContext.getConfigurationProperties().getOrDefault("boschcloud", "false").equalsIgnoreCase("true")) {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new PomTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new BoschDataServiceTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ThingClientFactoryTemplate()));
} else if (invocationContext.getConfigurationProperties().getOrDefault("boschhub", "false").equalsIgnoreCase("true")) {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new PomTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new BoschHubDataService()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new BoschHubClientTemplate()));
} else {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new KuraCloudDataServiceTemplate()));
}
if (invocationContext.getConfigurationProperties().getOrDefault("bluetooth", "false").equalsIgnoreCase("true")) {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new MetatypeTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceBluetoothFinderTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ConfigurationTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceFilterTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceToInformationModelTransformerTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new InformationModelConsumerTemplate()));
} else {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DefaultAppTemplate()));
}
generator.addTask(new GeneratorTaskFromFileTemplate<>(new InformationModelTemplate()));
for (FunctionblockProperty fbProperty : context.getProperties()) {
new GeneratorTaskFromFileTemplate<>(new FunctionblockTemplate(context)).generate(fbProperty.getType(), invocationContext, outputter);
}
generator.generate(context, invocationContext, outputter);
return outputter;
}
use of org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask in project vorto by eclipse.
the class LatexGenerator 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>();
generator.addTask(new LatexInformationModelGeneratorTask(LATEX_FILE_EXTENSION, LATEX_TARGET_PATH));
generator.generate(infomodel, invocationContext, zipOutputter);
return zipOutputter;
}
use of org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask in project vorto by eclipse.
the class MQTTPlatformGenerator method generate.
@Override
public IGenerationResult generate(InformationModel context, InvocationContext invocationContext, IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
GenerationResultZip outputter = new GenerationResultZip(context, getServiceKey());
for (FunctionblockProperty property : context.getProperties()) {
ChainedCodeGeneratorTask<FunctionblockModel> generator = new ChainedCodeGeneratorTask<FunctionblockModel>();
if (property.getType().getFunctionblock().getStatus() != null) {
generator.addTask(new GeneratorTaskFromFileTemplate<>(new IClientHandlerTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new MqttConfigurationTemplate()));
}
generator.addTask(new GeneratorTaskFromFileTemplate<>(new PomTemplate()));
generator.generate(property.getType(), invocationContext, outputter);
}
IGenerationResult javaResult = invocationContext.lookupGenerator(JavabeanGenerator.KEY).generate(context, invocationContext, monitor);
return GenerationResultBuilder.from(outputter).append(javaResult).build();
}
use of org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask in project vorto by eclipse.
the class ProSystGenerator method generateForFunctionBlock.
private void generateForFunctionBlock(InformationModel infomodel, InvocationContext ctx, FunctionblockModel fbm, IGeneratedWriter outputter, String[] imports) {
ChainedCodeGeneratorTask<FunctionblockModel> generator = new ChainedCodeGeneratorTask<FunctionblockModel>();
generator.addTask(new FunctionalItemGeneratorTask(JAVA_FILE_EXTENSION, SOURCE, fbm.getNamespace()));
generator.addTask(new FunctionalItemImplGeneratorTask(JAVA_FILE_EXTENSION, SOURCE, fbm.getNamespace(), imports));
generator.generate(fbm, ctx, outputter);
}
use of org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask in project vorto by eclipse.
the class ProSystGenerator method generateForEnum.
private void generateForEnum(InformationModel infomodel, InvocationContext ctx, Enum en, IGeneratedWriter outputter) {
ChainedCodeGeneratorTask<Enum> generator = new ChainedCodeGeneratorTask<Enum>();
generator.addTask(new JavaEnumGeneratorTask(JAVA_FILE_EXTENSION, SOURCE, en.getNamespace()));
generator.generate(en, ctx, outputter);
}
Aggregations