Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EGL Development Tools » How are Stereotypes supported in EGL?
How are Stereotypes supported in EGL? [message #538363] Mon, 07 June 2010 13:17 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Hi,

reading the project proposal the statement about support for
stereotypes in a programming language caught my attention.
Yet, in the linked documentation of the existing EGL tool
I could not identify how this concept is realized in EGL.

Could you please give a pointer that would make explicit
how the programming language supports stereotype-based
extensions?
More specifically, which are the elements that can be
characterized using stereotypes? Can concepts like, e.g.,
"class" and "association" be specialized using stereotypes?
What is the core meta model of EGL?

thanks,
Stephan

Re: How are Stereotypes supported in EGL? [message #539821 is a reply to message #538363] Sun, 13 June 2010 17:48 Go to previous messageGo to next message
Will Smythe is currently offline Will SmytheFriend
Messages: 41
Registered: July 2009
Member
The following answer is from Tim Wilson (EGL Chief Architect) ...

Hi Stephan,

Stereotypes can be applied to Classifier declarations. In EGL there are different kinds of Classifiers to be used for different purposes. Record, Program, Handler, Library, etc. are examples of classifiers one can use in EGL today. A typical example of stereotype usage is something like egl.io.sql.SQLRecord which is used to map a given record declaration to a relational database table or view:

record Customer type SQLRecord { tableNames=[["T1, "CUSTTBL"]], keyItems=custid } 
    custid int { columnName="CUSTID" };
    name string { columnName=...}
...
end


One purpose of stereotypes in EGL is to apply metadata to types that the code generators will then use to map the declarative data to various runtime situations. The above example allows variables that are typed by the given declaration to be used as operands in a category of statements in EGL called IOStatements. They express common concepts like GET, ADD, DELETE, etc. These statements are sensitive to the metadata associated with the operands of the given statement. Depending on the kind of stereotype associated with the operands the generators will generate the appropriate kind of code in the given target environment to realize the intended behavior. So if we continue with the example above:

// Define customer variable and GET an instance from the database
cust Customer { custid=12345 };
get cust;


There is another type of metadata called Annotation which can be applied on just about any model element. Stereotypes are really a kind of Annotation but have some further semantics such as specifying the set of Annotations that are valid to apply to members of the type being stereotyped or to specify the validation class that should be used by the front end validation to validate the use of the stereotype and its associated annotations. It should be noted that these concepts today have never been surfaced to general programmer use; meaning that only the internal EGL development team has had the ability to define Stereotypes and Annotations and then extend the generators to use this information. One long term purpose within this project is to surface these elements for general purpose usage. This brings us to the meta model.

One of the first drops of code into this project will be a so called "SDK" command line version the EGL that can take EGL source and compile it into its intermediate representation which is then serialized as the output of the compilation. The content of this serialization is a persistent form of instances of the EGL meta model. This model has concepts like Type, Classifier, TypedElement, Member, Function, Field, Statement, Expression, AnnotationType, StereotypeType, etc. The form of this content can be either XML or binary. The binary form is very important for performance reasons but the XML form is nice as it is easy to understand and read the content. There is a straight forward framework to read, bind and visit these models. The current EGL tooling is using an older form of this model so the current code generators have some work to move to this new model.

Hope this helps...I'm certain it just makes for more questions which I am happy to answer.

Cheers,
Tim
Re: How are Stereotypes supported in EGL? [message #570021 is a reply to message #538363] Sun, 13 June 2010 17:48 Go to previous message
Will Smythe is currently offline Will SmytheFriend
Messages: 41
Registered: July 2009
Member
The following answer is from Tim Wilson (EGL Chief Architect) ...

Hi Stephan,

Stereotypes can be applied to Classifier declarations. In EGL there are different kinds of Classifiers to be used for different purposes. Record, Program, Handler, Library, etc. are examples of classifiers one can use in EGL today. A typical example of stereotype usage is something like egl.io.sql.SQLRecord which is used to map a given record declaration to a relational database table or view:


record Customer type SQLRecord { tableNames=[["T1, "CUSTTBL"]], keyItems=custid }
custid int { columnName="CUSTID" };
name string { columnName=...}
...
end


One purpose of stereotypes in EGL is to apply metadata to types that the code generators will then use to map the declarative data to various runtime situations. The above example allows variables that are typed by the given declaration to be used as operands in a category of statements in EGL called IOStatements. They express common concepts like GET, ADD, DELETE, etc. These statements are sensitive to the metadata associated with the operands of the given statement. Depending on the kind of stereotype associated with the operands the generators will generate the appropriate kind of code in the given target environment to realize the intended behavior. So if we continue with the example above:


// Define customer variable and GET an instance from the database
cust Customer { custid=12345 };
get cust;


There is another type of metadata called Annotation which can be applied on just about any model element. Stereotypes are really a kind of Annotation but have some further semantics such as specifying the set of Annotations that are valid to apply to members of the type being stereotyped or to specify the validation class that should be used by the front end validation to validate the use of the stereotype and its associated annotations. It should be noted that these concepts today have never been surfaced to general programmer use; meaning that only the internal EGL development team has had the ability to define Stereotypes and Annotations and then extend the generators to use this information. One long term purpose within this project is to surface these elements for general purpose usage. This brings us to the meta model.

One of the first drops of code into this project will be a so called "SDK" command line version the EGL that can take EGL source and compile it into its intermediate representation which is then serialized as the output of the compilation. The content of this serialization is a persistent form of instances of the EGL meta model. This model has concepts like Type, Classifier, TypedElement, Member, Function, Field, Statement, Expression, AnnotationType, StereotypeType, etc. The form of this content can be either XML or binary. The binary form is very important for performance reasons but the XML form is nice as it is easy to understand and read the content. There is a straight forward framework to read, bind and visit these models. The current EGL tooling is using an older form of this model so the current code generators have some work to move to this new model.

Hope this helps...I'm certain it just makes for more questions which I am happy to answer.

Cheers,
Tim
Previous Topic:Interested parties
Next Topic:EGL project overview call - Tuesday, June 29
Goto Forum:
  


Current Time: Fri Apr 26 16:30:06 GMT 2024

Powered by FUDForum. Page generated in 0.02988 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top