Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Polarsys » Capella General » Custom validation rules plugin not loading(Created plugin following the tutorial and Capella does not load the validation rule.)
Custom validation rules plugin not loading [message #1829434] Fri, 03 July 2020 11:01 Go to next message
Fábio Guarita is currently offline Fábio GuaritaFriend
Messages: 64
Registered: December 2019
Member
Hi.

I just created a plugin for a custom validation rule using the Tutorial at https://wiki.eclipse.org/Capella/Tutorials/Extensibility/Validation_Rules

After meddling with the Capella Studio settings I was able to have a project free of errors and warnings and generate the .zip with the .jar plugin file.

I installed it in the Capella 1.4.0\eclipse\dropins\plugins folder as stated in the Tutorial.

Tried to check in Capella but it doesn't load the plugin. I checked the Validation rules to see if the rule was added and it wasn't there. I checked the Error log and couldn't find anything related to the plugin. I searched for my plugin on the list in About Capella > Installation Details > Plug-ins tab and nothing. It seems to be completely ignored.

I'd like to know if there's any way I can make Capella load (or try to load) the plug-in I created....

[Updated on: Fri, 03 July 2020 11:02]

Report message to a moderator

Re: Custom validation rules plugin not loading [message #1829439 is a reply to message #1829434] Fri, 03 July 2020 14:04 Go to previous messageGo to next message
Fábio Guarita is currently offline Fábio GuaritaFriend
Messages: 64
Registered: December 2019
Member
I'll add more information to help people engage in this post :D


About the project I built in Capella Studio (KitAlpha):

MANIFEST.MF file contents:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample_Validation_Rule_Project
Bundle-SymbolicName: Sample_Validation_Rule_Project;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: Sample_Validation_Rule_Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.polarsys.capella.core.validation;bundle-version="1.4.0",
 org.eclipse.emf.validation.doc;bundle-version="1.3.0",
 org.eclipse.emf.validation.examples;bundle-version="1.3.0",
 org.eclipse.emf.validation.ocl;bundle-version="1.4.0",
 org.eclipse.emf.validation.ocl.source;bundle-version="1.4.0",
 org.eclipse.emf.validation.source;bundle-version="1.8.0",
 org.eclipse.emf.validation.ui;bundle-version="1.7.0",
 org.eclipse.emf.validation.ui.ide;bundle-version="1.3.0",
 org.eclipse.emf.validation.ui.ide.source;bundle-version="1.3.0",
 org.eclipse.emf.validation.ui.source;bundle-version="1.7.0",
 org.polarsys.capella.core.validation.commandline;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.commandline.source;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.source;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.ui;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.ui.ide;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.ui.ide.source;bundle-version="1.4.0",
 org.polarsys.capella.core.validation.ui.source;bundle-version="1.4.0"
Export-Package: myfirstvalidationrule



The CapellaTutorialValidationRule.java file contents:

package myfirstvalidationrule;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.validation.IValidationContext;
import org.polarsys.capella.common.data.modellingcore.AbstractNamedElement;
import org.polarsys.capella.core.data.pa.PhysicalFunction;
import org.polarsys.capella.core.validation.rule.AbstractValidationRule;


public class CapellaTutorialValidationRule extends AbstractValidationRule {
	  /**
	   * {@inheritDoc}
	   */
	  @Override
	  public IStatus validate(IValidationContext ctx) {
	    EObject eObj = ctx.getTarget();
	    if (eObj instanceof PhysicalFunction) {
	      PhysicalFunction capellaElt = (PhysicalFunction) eObj;
	      String desc = capellaElt.getDescription();
	      String summary = capellaElt.getSummary();
	      if (desc == null || desc.isEmpty() || summary == null || summary.isEmpty()) {
	        if (capellaElt instanceof AbstractNamedElement) {
	          AbstractNamedElement namedElt = (AbstractNamedElement) capellaElt;
	          return ctx.createFailureStatus(new Object[] {capellaElt.eClass().getName(), namedElt.getName()});
	        }
	        return ctx.createFailureStatus(new Object[] {capellaElt.eClass().getName(), "<unnamed>"});
	      }
	    }
	    return ctx.createSuccessStatus();
	  }
	}


My plugin.xml file contents:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension point="org.eclipse.emf.validation.constraintProviders">
      <constraintProvider>
         <package namespaceUri="http://www.polarsys.org/capella/core/pa/1.4.0"/>
         <constraints categories="capella.category/design/well-formedness/data">
            <constraint
                  class="myfirstvalidationrule.CapellaTutorialValidationRule"
                  id="DWF_PA_99"
                  isEnabledByDefault="true"
                  lang="Java"
                  mode="Batch"
                  name="DWF_PA_99 - Physical Architecture Functions Description and Summary"
                  severity="ERROR"
                  statusCode="1">
               <message>
                  The function {1} has either no description or no summary!
               </message>
               <target class="PhysicalFunction"/>
               <description>
                  This validation rule checks that all Functions in Physical Architecture have a description and a summary.
               </description>
            </constraint>
         </constraints>
      </constraintProvider>
   </extension>
</plugin>


My build.properties file contents:

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.xml


Can anyone see a problem here? Using Capella [Studio] v1.4.0
Re: Custom validation rules plugin not loading [message #1829448 is a reply to message #1829439] Fri, 03 July 2020 18:33 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Fabio,

I think the issue is in you MANIFEST.NF file. It is missing the dependency to org.eclipse.emf.validation. (and you have declared quite a few dependencies that are not required, but it should be blocking though).

Here is my MANIFEST.MF file, I did the same thing as you and it worked:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyValidationRule
Bundle-SymbolicName: MyValidationRule;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: MyValidationRule
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.emf.validation;bundle-version="1.8.0",
org.polarsys.capella.core.validation;bundle-version="1.4.0"
Export-Package: myfirstvalidationrule


Stephane LACRAMPE
Obeo Canada
Re: Custom validation rules plugin not loading [message #1829471 is a reply to message #1829448] Sat, 04 July 2020 12:11 Go to previous messageGo to next message
Fábio Guarita is currently offline Fábio GuaritaFriend
Messages: 64
Registered: December 2019
Member
Hi Stephane, thanks for your response,

I added the 'org.polarsys.capella.core.validation;bundle-version="1.4.0"' line to my MANIFEST.MF file but it still did not work.

Then I noticed the Require-Bundle header in my MANIFEST.MF file was different of yours:

Require-Bundle: org.polarsys.capella.core.validation;bundle-version="1.4.0",

I replaced with yours and it worked! Thanks a lot for the help!

Also, I noticed I posted this Capella-Studio related question in the Capella-General forum, if you are or know the moderator, I'd like to request this topic to be moved to the Capella-Studio forum, if possible.

Thanks again!

Re: Custom validation rules plugin not loading [message #1829477 is a reply to message #1829471] Sat, 04 July 2020 15:05 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Well, I may be wrong, but your question is related to adding validation rules to Capella, I would see it in the Capella workbench forum :-)

Stephane LACRAMPE
Obeo Canada
Re: Custom validation rules plugin not loading [message #1829524 is a reply to message #1829477] Mon, 06 July 2020 07:20 Go to previous messageGo to next message
Philippe Dul is currently offline Philippe DulFriend
Messages: 25
Registered: November 2013
Junior Member
Hi,

Do you have exported your jar using "File > Export > Plugin Development > Deployable plug-ins and fragments" ?
The "File > Export > Java > JAR" doesn't export a plugin that can be installed directly on Eclipse dropins folder.

I have updated the tutorial for this step.
https://github.com/eclipse/capella/wiki/Create-Addons#export-as-deployable-plugin

Regards
Philippe
Re: Custom validation rules plugin not loading [message #1829543 is a reply to message #1829524] Mon, 06 July 2020 17:26 Go to previous messageGo to next message
Fábio Guarita is currently offline Fábio GuaritaFriend
Messages: 64
Registered: December 2019
Member
Hi Philippe, I used "File > Export > Plugin Development > Deployable plug-ins and fragments", thanks for your answer and updating the tutorial!
Re: Custom validation rules plugin not loading [message #1829564 is a reply to message #1829543] Mon, 06 July 2020 21:32 Go to previous message
Fábio Guarita is currently offline Fábio GuaritaFriend
Messages: 64
Registered: December 2019
Member
By the way,

I've already fixed the issue by following Stéphane's directions. It works great!
Previous Topic:ASIL ranking in missions diagram
Next Topic:Function automatic ID
Goto Forum:
  


Current Time: Wed Apr 24 18:23:42 GMT 2024

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

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

Back to the top