Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EOperation at runtime
EOperation at runtime [message #423208] Wed, 24 September 2008 21:22 Go to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

How to invoke programmatically a EOperation at runtime and add the methode
body to the generated Validator Methode, without using the Dynamic
template?

Thanks,
Sam
Re: EOperation at runtime [message #423209 is a reply to message #423208] Wed, 24 September 2008 21:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30820
Registered: July 2009
Senior Member
Sam,

There's nothing to support EObject.eInvoke, but there is support for
specifying a method body on an EOperation; i.e., an EAnnotation with a
source that the nsURI of the GenModelPackage and key named "body" with a
value specifying the string to be generated as the method body. You've
looked at
http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html?


Sam Julian wrote:
> Hi,
>
> How to invoke programmatically a EOperation at runtime and add the
> methode body to the generated Validator Methode, without using the
> Dynamic template?
>
> Thanks,
> Sam
>
>
Re: EOperation at runtime [message #423210 is a reply to message #423209] Wed, 24 September 2008 21:44 Go to previous messageGo to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Ed,

Thank you! I will take a look at the ocl example.
Sam
Re: EOperation at runtime [message #423213 is a reply to message #423209] Wed, 24 September 2008 22:24 Go to previous messageGo to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Ed,

the link didnŽt satisfy my needs. Maybe you can help with some advice to
solve the my Problem? so here is a snippet of my code
1- EmptinessType emptyType = RulesWrapperConfigFactory.eINSTANCE
.createEmptinessType();
2- Object emptyState = emptyType.eGet(emptyType.eClass()
.getEAllAttributes().get(index));
3- emptyType.eSet(verAtt, converted);

4- if(emptyType.eGet(verAtt).equals(true))----> then bind new Validation
Methode to the generated Validator class
like ExtrinsicShaderValidator validator =
ExtrinsicShaderValidator.INSTANCE;
validator.validateEmptyVal(emptyVal, diagnostics, context);

5- HOW TO bind this external Validation to the generated ones, so the
intrinsic Validation make use of this too, when call Validate Methode of
the generated Editor?
is my Problem understandable?

thanks,
Sam
Re: EOperation at runtime [message #423217 is a reply to message #423213] Wed, 24 September 2008 23:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30820
Registered: July 2009
Senior Member
Sam,

I've read this several times and I just don't get it. Sorry. Maybe
your can describe what you need in English...


Sam Julian wrote:
> Hi Ed,
>
> the link didnŽt satisfy my needs. Maybe you can help with some advice
> to solve the my Problem? so here is a snippet of my code 1-
> EmptinessType emptyType = RulesWrapperConfigFactory.eINSTANCE
> .createEmptinessType();
> 2- Object emptyState = emptyType.eGet(emptyType.eClass()
> .getEAllAttributes().get(index));
> 3- emptyType.eSet(verAtt, converted);
>
> 4- if(emptyType.eGet(verAtt).equals(true))----> then bind new
> Validation Methode to the generated Validator class
> like ExtrinsicShaderValidator validator =
> ExtrinsicShaderValidator.INSTANCE;
> validator.validateEmptyVal(emptyVal, diagnostics, context);
>
> 5- HOW TO bind this external Validation to the generated ones, so the
> intrinsic Validation make use of this too, when call Validate Methode
> of the generated Editor?
> is my Problem understandable?
>
> thanks,
> Sam
>
>
>
Re: EOperation at runtime [message #423221 is a reply to message #423217] Thu, 25 September 2008 08:13 Go to previous messageGo to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi, Ed,

Shame on me, Sorry :-) . I try to explain my problem.
the aim is to augment the intrinsic Validation of the generated Ecore
Model, let us call this Model "A".for this purpose I have provide several
external Validation Methodes.These Validation methodes are based on a
extrinsic Rules-Validation-Framework,let us call that Model "B". B is also
based on Ecore. B shall verify the Data integrity of in "A". the question
is: How to inject, at runtime, generated validator facility of B in A ,
without take any manupulating on the Ecore Model of A?
by the way the EMF Validation Framework is inapplicable in my use case.
Sam
Re: EOperation at runtime [message #423231 is a reply to message #423221] Thu, 25 September 2008 10:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30820
Registered: July 2009
Senior Member
Sam,

Comments below.

Sam Julian wrote:
> Hi, Ed,
>
> Shame on me, Sorry :-) . I try to explain my problem.
> the aim is to augment the intrinsic Validation of the generated Ecore
> Model, let us call this Model "A".for this purpose I have provide
> several external Validation Methodes.
Not sure what such external methods are...
> These Validation methodes are based on a extrinsic
> Rules-Validation-Framework,let us call that Model "B". B is also based
> on Ecore. B shall verify the Data integrity of in "A". the question
> is: How to inject, at runtime, generated validator facility of B in A
> , without take any manupulating on the Ecore Model of A? by the way
> the EMF Validation Framework is inapplicable in my use case.
Yet the validation framework is defined for exactly this purpose.

Given that nothing in EMF does exactly what you want, you'll just need
to code something yourself. I could imagine defining an
""ExtendedConstraints" constraint on each classifier in A and
implementing those methods to invoke rules from some type of rule engine
that B plugs into. Again, the EMF validation framework is defined for
exactly this type of purpose, but if it doesn't seem to fit, you'll need
to implement your own framework.
> Sam
Re: EOperation at runtime [message #423243 is a reply to message #423231] Thu, 25 September 2008 12:20 Go to previous messageGo to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi, Ed,

Yet the validation framework is defined for exactly this purpose.
1-I agree with you, but it dosenŽt fit to my requirement. I discuss this
also with Christian Damus.

Given that nothing in EMF does exactly what you want, you'll just need to
code something yourself.
2- I am your opinion, that is what already I have done.
----
I could imagine defining an ""ExtendedConstraints" constraint on each
classifier in A and implementing those methods to invoke rules from some
type of rule engine that B plugs into.
3- i defined the "ExtendedConstraints" in Model B and the rules engine.
what i am missing, is something releated to the EMF Idea of code
generation, that could be similar to:

EValidator validator =
EValidator.Registry.INSTANCE.getEValidator(dataType.eClass() .getEPackage());

for the moment i have a work around doing so:

aHelperBean.setExtendedConstraintsValidator(RulesWrapperConf igFactory.eINSTANCE
.createValidatorType());

this will create for each EDataType a validator Methode, provided by the
rule engine.
-------
Again, the EMF validation framework is defined for exactly this type of
purpose, but if it doesn't seem to fit, you'll need to implement your own
framework.
4- I need to define Constraint on EDataType Not on EClass. this need a
fine grained constaint Binding to the required EDataType.
----

Thanks for the support!!
Sam
Re: EOperation at runtime [message #423244 is a reply to message #423243] Thu, 25 September 2008 12:35 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30820
Registered: July 2009
Senior Member
Sam,

Comments below.

Sam Julian wrote:
> Hi, Ed,
>
> Yet the validation framework is defined for exactly this purpose.
> 1-I agree with you, but it dosenŽt fit to my requirement. I discuss
> this also with Christian Damus.
I vaguely to recall such an exchange.
>
> Given that nothing in EMF does exactly what you want, you'll just need
> to code something yourself.
> 2- I am your opinion, that is what already I have done.
> ----
> I could imagine defining an ""ExtendedConstraints" constraint on each
> classifier in A and implementing those methods to invoke rules from
> some type of rule engine that B plugs into.
> 3- i defined the "ExtendedConstraints" in Model B and the rules
> engine. what i am missing, is something releated to the EMF Idea of
> code generation, that could be similar to:
>
> EValidator validator =
> EValidator.Registry.INSTANCE.getEValidator(dataType.eClass() .getEPackage());
>
> for the moment i have a work around doing so:
>
> aHelperBean.setExtendedConstraintsValidator(RulesWrapperConf igFactory.eINSTANCE
>
> .createValidatorType());
>
> this will create for each EDataType a validator Methode, provided by
> the rule engine. ------- Again, the EMF validation framework is
> defined for exactly this type of purpose, but if it doesn't seem to
> fit, you'll need to implement your own framework.
> 4- I need to define Constraint on EDataType Not on EClass. this need a
> fine grained constaint Binding to the required EDataType.
I mentioned defining them on each classifier, where both EDataTypes and
EClasses are classifiers. Maybe you could override
EObjectValidator.validate_DataValueConforms to enforce the extra
constraints you've associated with the data types...
> ----
>
> Thanks for the support!!
> Sam
Previous Topic:Re: Has anyone experienced something like this?
Next Topic:CDO-Hibernate setup problems
Goto Forum:
  


Current Time: Mon Jan 27 11:41:09 GMT 2020

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

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

Back to the top