Skip to main content



      Home
Home » Modeling » EMF » Standalone EMF validation not registering constraints(how to add the modeledConstraintProviders extension point)
Standalone EMF validation not registering constraints [message #660339] Thu, 17 March 2011 21:23 Go to next message
Eclipse UserFriend
Hi,

I am trying to invoke EMF Validation from my class using
IBatchValidator validator =
(IBatchValidator)ModelValidationService.getInstance().newVal idator(EvaluationMode.BATCH);
ModelValidationService.getInstance().loadXmlConstraintDeclar ations();
validator.setIncludeLiveConstraints(true).

But going forward the constraints in plugin.xml are not invoked.
I was going through posts and found https://bugs.eclipse.org/bugs/show_bug.cgi?id=167972, can someone please give an example of how can I add modeledConstraintProviders extension point, what is the ConstraintResourceURI it is expecting.
I could not find the example in eclipse help content for this extension point

Thanks for your response
Re: Standalone EMF validation not registering constraints [message #660345 is a reply to message #660339] Thu, 17 March 2011 22:58 Go to previous messageGo to next message
Eclipse UserFriend
The subject line mentions "standalone" but the body of your comment
doesn't mention that. Nor does it contain any question marks. Perhaps
you'd like to spend a little more time formulating a coherent question...

ssaharan@cisco.com wrote:
> Hi,
>
> I am trying to invoke EMF Validation from my class using
> IBatchValidator validator =
> (IBatchValidator)ModelValidationService.getInstance().newVal
> idator(EvaluationMode.BATCH);
> ModelValidationService.getInstance().loadXmlConstraintDeclar
> ations();
> validator.setIncludeLiveConstraints(true).
>
> But going forward the constraints in plugin.xml are not invoked.
> I was going through posts and found
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=167972, can someone
> please give an example of how can I add modeledConstraintProviders
> extension point, what is the ConstraintResourceURI it is expecting.
> I could not find the example in eclipse help content for this
> extension point
>
> Thanks for your response
Re: Standalone EMF validation not registering constraints [message #660353 is a reply to message #660345] Fri, 18 March 2011 00:52 Go to previous messageGo to next message
Eclipse UserFriend
Okay let me ask my question again more clearly:
I am trying to invoke EMF Validation from a standalone jar i.e. it is not being used from within eclipse or eclipse RCP. I have a main method in one of my class from which I am invoking Validation using this code:
// Invoke validation framework as usual
IBatchValidator validator =
(IBatchValidator)
ModelValidationService.getInstance().newValidator(Evaluation Mode.BATCH);
validator.setIncludeLiveConstraints(true);
IStatus status = validator.validate(objs); // where objs is my EObjects to be validated

If I do System.out.println(status), I get "Status OK: org.eclipse.emf.validation code=10 No constraints were evaluated. null" even though Validation error is there.
While trying to investigate the issue, I found this post https://bugs.eclipse.org/bugs/show_bug.cgi?id=167972 where it is stated that EMF Validation 1.4.0 provides standalone support. My question is how to use modeledConstraintProviders extension point to get the constraints registered ? An example will be helpful as to what should be the ConstraintResourceURI in the extension point and the class it will define?

Thanks,
Surekha
Re: Standalone EMF validation not registering constraints [message #660451 is a reply to message #660353] Fri, 18 March 2011 09:35 Go to previous message
Eclipse UserFriend
Surekha,

Comments below.

ssaharan@cisco.com wrote:
> Okay let me ask my question again more clearly:
> I am trying to invoke EMF Validation from a standalone jar i.e. it is
> not being used from within eclipse or eclipse RCP.
So everything that's normally done via extension registrations in the
plugin.xmls will need to be done manually.
> I have a main method in one of my class from which I am invoking
> Validation using this code:
> // Invoke validation framework as usual
> IBatchValidator validator = (IBatchValidator)
> ModelValidationService.getInstance().newValidator(Evaluation Mode.BATCH);
> validator.setIncludeLiveConstraints(true);
> IStatus status = validator.validate(objs); // where objs is my
> EObjects to be validated
>
> If I do System.out.println(status), I get "Status OK:
> org.eclipse.emf.validation code=10 No constraints were evaluated.
> null" even though Validation error is there.
> While trying to investigate the issue, I found this post
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=167972 where it is
> stated that EMF Validation 1.4.0 provides standalone support. My
> question is how to use modeledConstraintProviders extension point to
> get the constraints registered ? An example will be helpful as to what
> should be the ConstraintResourceURI in the extension point and the
> class it will define?
I don't know the answer and I'm not sure anyone who does pays attention
to the newsgroup anymore. Wouldn't it be much easier to run a headless
Eclipse instance so that your extensions just work?
>
> Thanks,
> Surekha
Previous Topic:EMF generated projects don't compile
Next Topic:Proxy Resolution Problem
Goto Forum:
  


Current Time: Sun Jul 13 20:38:38 EDT 2025

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

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

Back to the top