Search in sources :

Example 1 with ApplicationYmlTemplate

use of org.eclipse.vorto.codegen.webdevice.tasks.templates.ApplicationYmlTemplate in project vorto by eclipse.

the class WebDeviceGenerator 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>();
        generator.addTask(new GeneratorTaskFromFileTemplate<>(new ServiceClassTemplate()));
        generator.addTask(new GeneratorTaskFromFileTemplate<>(new PageTemplate()));
        generator.generate(property.getType(), invocationContext, outputter);
    }
    ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>();
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new WebSocketConfigTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new PomFileTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new IndexHtmlFileTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceInfoTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceInfoServiceTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new ControllersScriptFileTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new AppScriptFileTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new ApplicationMainTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new CssTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new ApplicationYmlTemplate()));
    generator.addTask(new GeneratorTaskFromFileTemplate<>(new ReadmeTemplate()));
    generator.generate(context, invocationContext, outputter);
    IGenerationResult javaResult = invocationContext.lookupGenerator(JavabeanGenerator.KEY).generate(context, invocationContext, monitor);
    return GenerationResultBuilder.from(outputter).append(javaResult).build();
}
Also used : GenerationResultZip(org.eclipse.vorto.codegen.api.GenerationResultZip) PageTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.PageTemplate) ControllersScriptFileTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.ControllersScriptFileTemplate) InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) DeviceInfoServiceTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.DeviceInfoServiceTemplate) ChainedCodeGeneratorTask(org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask) ServiceClassTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.ServiceClassTemplate) IGenerationResult(org.eclipse.vorto.codegen.api.IGenerationResult) IndexHtmlFileTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.IndexHtmlFileTemplate) FunctionblockModel(org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel) PomFileTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.PomFileTemplate) ReadmeTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.ReadmeTemplate) AppScriptFileTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.AppScriptFileTemplate) ApplicationMainTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.ApplicationMainTemplate) CssTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.CssTemplate) WebSocketConfigTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.WebSocketConfigTemplate) DeviceInfoTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.DeviceInfoTemplate) ApplicationYmlTemplate(org.eclipse.vorto.codegen.webdevice.tasks.templates.ApplicationYmlTemplate) FunctionblockProperty(org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)

Aggregations

ChainedCodeGeneratorTask (org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask)1 GenerationResultZip (org.eclipse.vorto.codegen.api.GenerationResultZip)1 IGenerationResult (org.eclipse.vorto.codegen.api.IGenerationResult)1 AppScriptFileTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.AppScriptFileTemplate)1 ApplicationMainTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.ApplicationMainTemplate)1 ApplicationYmlTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.ApplicationYmlTemplate)1 ControllersScriptFileTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.ControllersScriptFileTemplate)1 CssTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.CssTemplate)1 DeviceInfoServiceTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.DeviceInfoServiceTemplate)1 DeviceInfoTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.DeviceInfoTemplate)1 IndexHtmlFileTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.IndexHtmlFileTemplate)1 PageTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.PageTemplate)1 PomFileTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.PomFileTemplate)1 ReadmeTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.ReadmeTemplate)1 ServiceClassTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.ServiceClassTemplate)1 WebSocketConfigTemplate (org.eclipse.vorto.codegen.webdevice.tasks.templates.WebSocketConfigTemplate)1 FunctionblockModel (org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel)1 FunctionblockProperty (org.eclipse.vorto.core.api.model.informationmodel.FunctionblockProperty)1 InformationModel (org.eclipse.vorto.core.api.model.informationmodel.InformationModel)1