use of org.eclipse.vorto.codegen.kura.templates.KuraCloudDataServiceTemplate 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;
}
Aggregations