Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » dependency cycle in plugins
dependency cycle in plugins [message #650603] Tue, 25 January 2011 16:59 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1813
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I have a (sort of) design question:

my dsl uses the ecore generated by an xtext project, say projectFIRST,
and generates code that uses the EMF generated Java classes which are in
projectFIRST.

Now, if the program of my dsl is in a plugin projectSECOND, then the
code generated needs a dependency on projectFIRST, since it needs the
generated EMF classes. And that's OK.

Now, I'd like to use in projectFIRST the classes generated by my dsl
project, which are in projectSECOND. So projectFIRST needs to depend on
projectSECOND, and here we have a dependency loop.

Just to give some context: my dsl generates a validator for projectFIRST
into projectSECOND, and I'd like to use such generated validator into
projectFIRST...

I suppose there's no way to solve the problem but to put my dsl program
into projectFIRST and make my dsl generate code there, am I right?

thanks in advance
Lore

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: dependency cycle in plugins [message #650733 is a reply to message #650603] Wed, 26 January 2011 10:07 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
You could go for imported metamodels and keep the generated classes in a
separate common plugin.

Am 25.01.11 17:59, schrieb Lorenzo Bettini:
> Hi
>
> I have a (sort of) design question:
>
> my dsl uses the ecore generated by an xtext project, say projectFIRST,
> and generates code that uses the EMF generated Java classes which are in
> projectFIRST.
>
> Now, if the program of my dsl is in a plugin projectSECOND, then the
> code generated needs a dependency on projectFIRST, since it needs the
> generated EMF classes. And that's OK.
>
> Now, I'd like to use in projectFIRST the classes generated by my dsl
> project, which are in projectSECOND. So projectFIRST needs to depend on
> projectSECOND, and here we have a dependency loop.
>
> Just to give some context: my dsl generates a validator for projectFIRST
> into projectSECOND, and I'd like to use such generated validator into
> projectFIRST...
>
> I suppose there's no way to solve the problem but to put my dsl program
> into projectFIRST and make my dsl generate code there, am I right?
>
> thanks in advance
> Lore
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: dependency cycle in plugins [message #650761 is a reply to message #650733] Wed, 26 January 2011 12:49 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1813
Registered: July 2009
Location: Firenze, Italy
Senior Member
mh... I don't think this would solve the problem:

1. my dsl should be able to act on any existing ecore generated by an
xtext based dsl

2. the problem would still be there, since in projectFIRST I would like
to use the validator generated in projectSECOND (and also the scope
provider of projectFIRST should be able to use the code generated in
projectSECOND)...

cheers
Lorenzo

On 01/26/2011 11:07 AM, Jan Koehnlein wrote:
> You could go for imported metamodels and keep the generated classes in a
> separate common plugin.
>
> Am 25.01.11 17:59, schrieb Lorenzo Bettini:
>> Hi
>>
>> I have a (sort of) design question:
>>
>> my dsl uses the ecore generated by an xtext project, say projectFIRST,
>> and generates code that uses the EMF generated Java classes which are in
>> projectFIRST.
>>
>> Now, if the program of my dsl is in a plugin projectSECOND, then the
>> code generated needs a dependency on projectFIRST, since it needs the
>> generated EMF classes. And that's OK.
>>
>> Now, I'd like to use in projectFIRST the classes generated by my dsl
>> project, which are in projectSECOND. So projectFIRST needs to depend on
>> projectSECOND, and here we have a dependency loop.
>>
>> Just to give some context: my dsl generates a validator for projectFIRST
>> into projectSECOND, and I'd like to use such generated validator into
>> projectFIRST...
>>
>> I suppose there's no way to solve the problem but to put my dsl program
>> into projectFIRST and make my dsl generate code there, am I right?
>>
>> thanks in advance
>> Lore
>>
>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: dependency cycle in plugins [message #650985 is a reply to message #650761] Thu, 27 January 2011 11:10 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
In Eclipse, such dependency cycles are usually resolved by means of
extension points or singleton registries. For a given service, there is
a single entry point that reads the registry to which service providers
can provide implementations.

For the validator, there is such singleton registry
(EValidator.Registry.INSTANCE) and plain EMF validation always uses the
same entry point (Diagnostician) which runs the validators from the
registry. Xtext also puts its validators into the registry, so if your
projectSECOND defines validation rules for elements of projectFIRST this
should work OOTB.

I don't really get why you want to also reuse the scope provider, but
there is no such registry for scope providers, so you might have to
implement that yourself, e.g. by means of an extension point.

Am 26.01.11 13:49, schrieb Lorenzo Bettini:
> mh... I don't think this would solve the problem:
>
> 1. my dsl should be able to act on any existing ecore generated by an
> xtext based dsl
>
> 2. the problem would still be there, since in projectFIRST I would like
> to use the validator generated in projectSECOND (and also the scope
> provider of projectFIRST should be able to use the code generated in
> projectSECOND)...
>
> cheers
> Lorenzo
>
> On 01/26/2011 11:07 AM, Jan Koehnlein wrote:
>> You could go for imported metamodels and keep the generated classes in a
>> separate common plugin.
>>
>> Am 25.01.11 17:59, schrieb Lorenzo Bettini:
>>> Hi
>>>
>>> I have a (sort of) design question:
>>>
>>> my dsl uses the ecore generated by an xtext project, say projectFIRST,
>>> and generates code that uses the EMF generated Java classes which are in
>>> projectFIRST.
>>>
>>> Now, if the program of my dsl is in a plugin projectSECOND, then the
>>> code generated needs a dependency on projectFIRST, since it needs the
>>> generated EMF classes. And that's OK.
>>>
>>> Now, I'd like to use in projectFIRST the classes generated by my dsl
>>> project, which are in projectSECOND. So projectFIRST needs to depend on
>>> projectSECOND, and here we have a dependency loop.
>>>
>>> Just to give some context: my dsl generates a validator for projectFIRST
>>> into projectSECOND, and I'd like to use such generated validator into
>>> projectFIRST...
>>>
>>> I suppose there's no way to solve the problem but to put my dsl program
>>> into projectFIRST and make my dsl generate code there, am I right?
>>>
>>> thanks in advance
>>> Lore
>>>
>>
>>
>
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: dependency cycle in plugins [message #650994 is a reply to message #650985] Thu, 27 January 2011 12:11 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1813
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi Jan

my DSL generates code to be used in another xtext DSL (not fixed in
advance)...

if I write a program in my DSL in projectSECOND, the code generated
needs the classes of the other xtext project projectFIRST...

then I want to reuse the code generated in projectSECOND in projectFIRST...

that's the cycle...

I guess there's no easy solution but to write the program in my DSL in
projectFIRST itself, and have the code generated there...

On 01/27/2011 12:10 PM, Jan Koehnlein wrote:
> In Eclipse, such dependency cycles are usually resolved by means of
> extension points or singleton registries. For a given service, there is
> a single entry point that reads the registry to which service providers
> can provide implementations.
>
> For the validator, there is such singleton registry
> (EValidator.Registry.INSTANCE) and plain EMF validation always uses the
> same entry point (Diagnostician) which runs the validators from the
> registry. Xtext also puts its validators into the registry, so if your
> projectSECOND defines validation rules for elements of projectFIRST this
> should work OOTB.
>
> I don't really get why you want to also reuse the scope provider, but
> there is no such registry for scope providers, so you might have to
> implement that yourself, e.g. by means of an extension point.
>
> Am 26.01.11 13:49, schrieb Lorenzo Bettini:
>> mh... I don't think this would solve the problem:
>>
>> 1. my dsl should be able to act on any existing ecore generated by an
>> xtext based dsl
>>
>> 2. the problem would still be there, since in projectFIRST I would like
>> to use the validator generated in projectSECOND (and also the scope
>> provider of projectFIRST should be able to use the code generated in
>> projectSECOND)...
>>
>> cheers
>> Lorenzo
>>
>> On 01/26/2011 11:07 AM, Jan Koehnlein wrote:
>>> You could go for imported metamodels and keep the generated classes in a
>>> separate common plugin.
>>>
>>> Am 25.01.11 17:59, schrieb Lorenzo Bettini:
>>>> Hi
>>>>
>>>> I have a (sort of) design question:
>>>>
>>>> my dsl uses the ecore generated by an xtext project, say projectFIRST,
>>>> and generates code that uses the EMF generated Java classes which
>>>> are in
>>>> projectFIRST.
>>>>
>>>> Now, if the program of my dsl is in a plugin projectSECOND, then the
>>>> code generated needs a dependency on projectFIRST, since it needs the
>>>> generated EMF classes. And that's OK.
>>>>
>>>> Now, I'd like to use in projectFIRST the classes generated by my dsl
>>>> project, which are in projectSECOND. So projectFIRST needs to depend on
>>>> projectSECOND, and here we have a dependency loop.
>>>>
>>>> Just to give some context: my dsl generates a validator for
>>>> projectFIRST
>>>> into projectSECOND, and I'd like to use such generated validator into
>>>> projectFIRST...
>>>>
>>>> I suppose there's no way to solve the problem but to put my dsl program
>>>> into projectFIRST and make my dsl generate code there, am I right?
>>>>
>>>> thanks in advance
>>>> Lore
>>>>
>>>
>>>
>>
>>
>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Need suggestion on how to create unique ids for tokens (or rules)
Next Topic:Exploiting types in a DSL: creating new types and referring to existing ones
Goto Forum:
  


Current Time: Wed Sep 25 11:37:09 GMT 2024

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

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

Back to the top