Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370673 - Generate service and library from a data tools object
Summary: Generate service and library from a data tools object
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Song Fan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 370908 370909 371340
Blocks: 367261
  Show dependency tree
 
Reported: 2012-02-05 21:58 EST by Song Fan CLA
Modified: 2017-02-23 14:18 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Song Fan CLA 2012-02-05 21:58:50 EST
Build Identifier: 

Use Java2EGL generator to generate service and library from an entity record definition.

See Bug 367261 for more details.


Reproducible: Always
Comment 1 Brian Svihovec CLA 2012-02-06 10:43:54 EST
After reviewing the SQL Record to EGL wizard, I believe that we lead you down the wrong path by recommending that Java 2 EGL be used to implement this solution.

The SQL Record to EGL Wizard currently uses the EglSourceGenerator, which is located in the /org.eclipse.edt.gen.generator.eglsource plug-in.  This generator walks a Data Tools Object (Java class) and emits an EGL Record (i.e. there are NO IR files involved).  I think it would be best if the Service and Library wizards extend this generator to emit a Service or Library based on a DTO.  This should avoid the need to re-parse the newly created EGL Record to find out what information was used by walking the Data Tools Object.  In the Service/Library wizard, we can run both generators to produce both the Record and the Library/Service.  

NOTE: It may also be worth while to ask Jeff, Matt, or Joe if there is precedence for one generator producing two types of artifacts, in which case we can follow that approach here and produce both the record and Service/Library in one generator.
Comment 2 Will Smythe CLA 2012-02-06 10:56:05 EST
I agree with this approach.

One thought: the length of the service/library expected to be generated by this wizard is long (hundreds of lines). I wonder if the generator should read a file that contains the base content for the resulting service/library and then substitute strings throughout the file. This would make it easier for us (and possibly others in the future) to alter the source in the future. It would also require a LOT less code in the generator. 

For example, a line in the template file might look like this:

   function get{$TypeName}(id int in) returns ($TypeName)

The generator would substitute in the appropriate values.

I would definitely suggest following a pre-defined pattern - like in the current code templates in Preferences > EGL > Code Templates - and not try to invent some new syntax for this.
Comment 3 Song Fan CLA 2012-02-10 06:59:20 EST
I discuss with Jeff about how one generator produce two types of artifacts yesterday. Jeff said one generator only can produce one EGL file. If need to produce multiple EGL files, we need to modify the generator or call generators multiple times.

I created a new Java2EGL generator extends EGLGenerator, and make is return a Hashtable<filename, filecontent> after the generation operation, then save the files in the UI wizard performFinish function.
Comment 4 Song Fan CLA 2012-02-10 09:13:55 EST
Sorry, the a new Java2EGL generator extends EGLSourceGenerator instead of EGLGenerator
Comment 5 Song Fan CLA 2012-02-13 01:07:49 EST
=== Comment from Brian ===
I am wondering if it makes sense to extend the EGLSourceGenerator, or if we should just modify the EGLSourceGenerator to always return a map of EGL Source files.  This could also be tied into the fact that we want to generalize the Summary page of the wizard to always display a drop down for the file names if more than one file is available.  A general solution would allow us to write a Summary page for all EGLSourceGenerator users, where both the generator and the wizard page are capable of handling the creation of multiple EGL files.  This also seems like a good opportunity to test the extensible nature of our generator framework, where the Record, Service, and Library wizards will be contributing a different set of Templates to the same generator via the contributor.
Comment 6 Song Fan CLA 2012-03-05 10:14:37 EST
fixed
Comment 7 Song Fan CLA 2012-03-09 03:28:42 EST
fixed