Search in sources :

Example 1 with PomTemplate

use of org.eclipse.vorto.codegen.kura.templates.PomTemplate 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;
}
Also used : EclipseClasspathTemplate(org.eclipse.vorto.codegen.kura.templates.EclipseClasspathTemplate) PomTemplate(org.eclipse.vorto.codegen.kura.templates.PomTemplate) InformationModelConsumerTemplate(org.eclipse.vorto.codegen.kura.templates.bluetooth.InformationModelConsumerTemplate) ComponentXmlTemplate(org.eclipse.vorto.codegen.kura.templates.osgiinf.ComponentXmlTemplate) InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) BoschHubClientTemplate(org.eclipse.vorto.codegen.kura.templates.cloud.bosch.BoschHubClientTemplate) ConfigurationTemplate(org.eclipse.vorto.codegen.kura.templates.bluetooth.ConfigurationTemplate) ManifestTemplate(org.eclipse.vorto.codegen.kura.templates.ManifestTemplate) BoschHubDataService(org.eclipse.vorto.codegen.kura.templates.cloud.bosch.BoschHubDataService) EclipseProjectFileTemplate(org.eclipse.vorto.codegen.kura.templates.EclipseProjectFileTemplate) KuraCloudDataServiceTemplate(org.eclipse.vorto.codegen.kura.templates.KuraCloudDataServiceTemplate) GeneratorTaskFromFileTemplate(org.eclipse.vorto.codegen.api.GeneratorTaskFromFileTemplate) DeviceBluetoothFinderTemplate(org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceBluetoothFinderTemplate) MetatypeTemplate(org.eclipse.vorto.codegen.kura.templates.osgiinf.MetatypeTemplate) DeviceToInformationModelTransformerTemplate(org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceToInformationModelTransformerTemplate) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty) BuildPropertiesTemplate(org.eclipse.vorto.codegen.kura.templates.BuildPropertiesTemplate) GenerationResultZip(org.eclipse.vorto.codegen.api.GenerationResultZip) IDataServiceTemplate(org.eclipse.vorto.codegen.kura.templates.IDataServiceTemplate) ThingClientFactoryTemplate(org.eclipse.vorto.codegen.kura.templates.cloud.bosch.ThingClientFactoryTemplate) ChainedCodeGeneratorTask(org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask) FunctionblockTemplate(org.eclipse.vorto.codegen.kura.templates.cloud.FunctionblockTemplate) BoschDataServiceTemplate(org.eclipse.vorto.codegen.kura.templates.cloud.bosch.BoschDataServiceTemplate) InformationModelTemplate(org.eclipse.vorto.codegen.kura.templates.cloud.InformationModelTemplate) DefaultAppTemplate(org.eclipse.vorto.codegen.kura.templates.DefaultAppTemplate) DeviceFilterTemplate(org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceFilterTemplate)

Aggregations

ChainedCodeGeneratorTask (org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask)1 GenerationResultZip (org.eclipse.vorto.codegen.api.GenerationResultZip)1 GeneratorTaskFromFileTemplate (org.eclipse.vorto.codegen.api.GeneratorTaskFromFileTemplate)1 BuildPropertiesTemplate (org.eclipse.vorto.codegen.kura.templates.BuildPropertiesTemplate)1 DefaultAppTemplate (org.eclipse.vorto.codegen.kura.templates.DefaultAppTemplate)1 EclipseClasspathTemplate (org.eclipse.vorto.codegen.kura.templates.EclipseClasspathTemplate)1 EclipseProjectFileTemplate (org.eclipse.vorto.codegen.kura.templates.EclipseProjectFileTemplate)1 IDataServiceTemplate (org.eclipse.vorto.codegen.kura.templates.IDataServiceTemplate)1 KuraCloudDataServiceTemplate (org.eclipse.vorto.codegen.kura.templates.KuraCloudDataServiceTemplate)1 ManifestTemplate (org.eclipse.vorto.codegen.kura.templates.ManifestTemplate)1 PomTemplate (org.eclipse.vorto.codegen.kura.templates.PomTemplate)1 ConfigurationTemplate (org.eclipse.vorto.codegen.kura.templates.bluetooth.ConfigurationTemplate)1 DeviceBluetoothFinderTemplate (org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceBluetoothFinderTemplate)1 DeviceFilterTemplate (org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceFilterTemplate)1 DeviceToInformationModelTransformerTemplate (org.eclipse.vorto.codegen.kura.templates.bluetooth.DeviceToInformationModelTransformerTemplate)1 InformationModelConsumerTemplate (org.eclipse.vorto.codegen.kura.templates.bluetooth.InformationModelConsumerTemplate)1 FunctionblockTemplate (org.eclipse.vorto.codegen.kura.templates.cloud.FunctionblockTemplate)1 InformationModelTemplate (org.eclipse.vorto.codegen.kura.templates.cloud.InformationModelTemplate)1 BoschDataServiceTemplate (org.eclipse.vorto.codegen.kura.templates.cloud.bosch.BoschDataServiceTemplate)1 BoschHubClientTemplate (org.eclipse.vorto.codegen.kura.templates.cloud.bosch.BoschHubClientTemplate)1