Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EObjectValidator.validate() is called multiple times for models that are based on several packages
EObjectValidator.validate() is called multiple times for models that are based on several packages [message #1117290] Thu, 26 September 2013 09:26 Go to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello,

I am using models that are based on multiple ecore packages.
For each package I have multiple (combined) EVL validation rules registered.
The combined EVL rules start off with the default EObjectValidator.

Since I have multiple ecore packages, not all rules are combined since they are registered to their corresponding package. (Which is a good thing!)

I manually find the used packages, and invoke the validation rules of each of these packages.
This results in the EObjectValidator rules getting activated multiple times. This is a waste of time and this result in errors on circular contained objects (because EObjectValidator does not expect to be called multiple times with the same context).

EObjectValidator sets ROOT_OBJECT to detect these circular containment problems.
When CompositeEValidator#validate(EClass, EObject, DiagnosticChain, Map<Object, Object>) gets modifies to check for this context entry just before the EObjectValidator gets invoked, so it can be skipped, the problem is solved.

Is this an acceptable solution and should I open a bug report and provide such a patch? Or is this too much of a 'hack'?

Regards,
Maarten
Re: EObjectValidator.validate() is called multiple times for models that are based on several packag [message #1117833 is a reply to message #1117290] Thu, 26 September 2013 21:24 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 913
Registered: July 2009
Senior Member
Hi Maarten,

Please see comments below.

> I manually find the used packages, and invoke the validation rules of each of these packages.

I'm not sure I understand what "manually" means in this context

> This is a waste of time and this result in errors on circular contained objects (because EObjectValidator does not expect to be called multiple times with the same context).

"circular contained objects" sounds scary

> Is this an acceptable solution and should I open a bug report and provide such a patch? Or is this too much of a 'hack'?

I'm not sure I can fully appreciate the nature of the problem. A minimal example and a description of what's expected/observed in the bugzilla would help a lot - a patch would be fantastic Smile

Cheers,
Dimitris
Re: EObjectValidator.validate() is called multiple times for models that are based on several packag [message #1121134 is a reply to message #1117833] Mon, 30 September 2013 09:54 Go to previous message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello Dimitris,

> > I manually find the used packages, and invoke the validation rules of each
> > of these packages.
> I'm not sure I understand what "manually" means in this context

Manually as in, my application determines (somehow) all meta-models/packages
that are used for a model. In contrast to some provided EMF/Ecore method to
grab all packages. (Which does not seem to exist..?)

> > This is a waste of time and this result in errors on circular contained
> > objects (because EObjectValidator does not expect to be called multiple
> > times with the same context).
> "circular contained objects" sounds scary

It should be..!

But in this case it is not, as the detection algorithms (EObjectValidator) for
these kinds of errors do not expect that it is called twice.
Which is the actual problem here.

> > Is this an acceptable solution and should I open a bug report and provide
> > such a patch? Or is this too much of a 'hack'?
> I'm not sure I can fully appreciate the nature of the problem. A minimal
> example and a description of what's expected/observed in the bugzilla would
> help a lot - a patch would be fantastic

A minimal example is tricky, it requires some complexity to manifest.
A more detailed (and careful) explanation is given at Bug #418308
Hopefully it is more understandable now...

The patch will (probably) follow soon.

Regards,
Maarten
Previous Topic:Package.getESuperPackage() returns null
Next Topic:Problem Opening Wizard
Goto Forum:
  


Current Time: Mon Nov 24 17:57:14 GMT 2014

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

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