Download presentation
Presentation is loading. Please wait.
Published byRandall Goodman Modified over 9 years ago
1
Using a generator Feedback on sharing a generator. Improvement’s on generation’s creation and maintenance.
2
Outline CIET/SURVEY implementation overview. – Intro to the common CIET/SURVEY generator. Review the differences that shared generator has made: – There’s no additional complexity in the templates! Further improvements: – Support the approach in the UAB Core.
3
UAB Architecture UAB Core SURVEY InterX FESA generator SURVEY InterX WCCOA generator SURVEY SAS FESA generator SURVEY SAS WCCOA generator CIET FESA generator CIET WCCOA generator SURVEY InterX FESA templates SURVEY InterX WCCOA templates SURVEY SAS FESA templates SURVEY SAS WCCOA templates CIET FESA templates CIET WCCOA templates
4
What do we do in generator? Execute templates: – As part of device type templates set – As a standalone template Provide an access to query data: – i.e. instance.getAttributeData Implement API for output file’s generation: – It could be one or several files – A file could be split in different sections (header, footer, …)
5
UAB Architecture UAB Core Stub generator SURVEY InterX FESA templates SURVEY InterX WCCOA templates SURVEY SAS FESA templates SURVEY SAS WCCOA templates CIET FESA templates CIET WCCOA templates SURVEY/CIET shared generator Stub generator
6
Generator classes
7
UAB SURVEY/CIET What we have now: 1 shared class – Serves all needs 6 stub generators (the class name holders) – Inherits superclass behaviour with no changes – Keep a UnicosApplication.xml piece for UABBootstrap
8
An example of stub generator /** * UNICOS * * Copyright (C) CERN 2013 All rights reserved */ package research.ch.cern.unicos.plugins.survey.interx.feig; import research.ch.cern.unicos.plugins.survey.core.SurveyGenerator; public class InterXFrontEndInstancesGenerator extends SurveyGenerator { @Override public String getVersionId() { return "1.0.0"; } @Override public String getDescription() { return "This code generation plug-in is designed for SURVEY FrontEnd instances generation."; }
9
CIET/SURVEY generator’s duties: Serves CIET/SURVEY needs: Generic execution workflow – Based on UnicosApplication.xml Generic output API – writeInstanceInfo(filename, instanceData) – writeInstanceInfo(filename, sectionID, instanceData) – setInstanceInfo(filename, instanceData) – setInstanceInfo(filename, sectionID, instanceData) – clearInstanceInfo(filename, sectionID) – formatInstanceInfoAsXML(filename) Generic Oracle API
10
Review of implementation 1.Launching templates – Affects UA.xml and generator 2.Writing files – Affects generator and templates 3.Accessing Oracle DB – Affects UA.xml, generators and templates There’s no additional complexity in templates! There’s not many differences from CPC!
11
Review: launching templates Dedicated plugin UnicosApplication.xml – Any place in plugin section – PluginID:Templates list by convention Generator.java – Implement which templates to run and in which order – Can pass additional info by parameters (very few, i.e. recipe buffer size) Reusing the plugin UnicosApplication.xml – PluginID:GenerationRules list only Inherited logic – Run all template from the list above – The same set of parameters – Template must get additional info by itself Difference: accessing additional info (from UA.xml or spec) has been moved to the templates. Templates used to have this access.
12
How we write files Global PLC Template Output.txt DeviceA Template DeviceB Template DeviceC Template #SASWinCCOAConfigGenerator #Generated Objects: #DeviceA: 2 #DeviceB: 1 #DeviceC: 55 #Delete;plcName;appName1 PLCCONFIG;plcType;plcName;appName;.. DeviceA;1;alias_a1;… DeviceA;2;alias_a2;… DeviceB;1;alias_b1;… DeviceC;1;alias_c1;… … DBHeader DeleteStatement PlcDeclaration Instances UAB Generator -calls templates -provides output API
13
Review: writing files Dedicated plugin Generator.java – Implement your way to generate files Templates – Call specific methods writeDBHeader(data) writeDeleteStatement(data) Reusing the plugin Inherited logic – Generic API Templates – Call generic methods writeInstanceInfo(filename, HEADER_SECTION, data) writeInstanceInfo(filename, DELETE_SECTION, data) Difference: calculate file name and manage file section constants. Defined in global template
14
Review: Accessing Oracle DB Dedicated plugin UnicosApplication.xml – Nothing? Generator.java – Implement querying db Templates – Query DB Reusing the plugin UnicosApplication.xml – Enable access DB Inherited logic – Use generic query API Templates – Query DB Difference: they are the same.
15
Achievements Less java maintenance: – 6x times less for CIET/SURVEY – Higher reusability rate – Easier upgrade to the new UAB Core Templates have more in common – Easier to support it writeDBHeader vs writeInstanceInfo New templates can reuse existing generators – Templates developers don’t need to do java
16
Next step Move the shared generator to the UABCore: Remove cross-dependencies Allows CPC to use it When it’s better: – Use-case: add a new template to existing project – Use-case: add a new output file Improve UAB Core to allow to reuse generator. Profits: To remove stub generators – Don’t keep the code we don’t need Use-case: add another touch panel implementations Fast and easy development start – Start straight with templates, add custom generator when it’s really needed
17
Workflow: new UAB component 1. Install UAB development env 3. Add a generation plugin 2. Set up Eclipse 6. Develop templates 5. Create a UAB project 4. Implement a generation plugin 7. Release a generation plugin
18
Workflow: new UAB component 1. Install UAB development env 3. Add a generation plugin 2. Set up Eclipse 6. Develop templates 5. Create a UAB project 4. Implement a generation plugin 7. Release a generation plugin 8. Share the project Use UAB instead!
19
Integration to UAB architecture The templates should define which plugin to use. We can think of sharing plugin between: – CPC WinCC OA and Generic SURVEY/CIET plugin – Touch panel and Generic SURVEY/CIET plugin – Schneider and CoDeSyS We should not change the old plugins if we don’t need it.
20
Requirements Use specified in UA.xml generator class – generator name != templates folder name – We already have it: GeneralData:MainClass Move UnicosApplication.xml piece to the resource package – Used by bootstrap, the big change is coming anyway with “versioning”
21
<PathParameter Name="ApplicationGeneralPLC" Value="GlobalTemplates/Survey_InterX_WinCCOA_GeneralRulesPLC.py" />
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.