Template returns "invalid" after switching from "Acceleo Plug-in Application" to [message #1782558] |
Mon, 26 February 2018 08:16  |
Eclipse User |
|
|
|
What I want to do:
===================
I'm working with a SysML Model. I want to find all "Requirements" that are part of my "SysML" model and check what "Block" should fulfill the requirement. The following Acceleo template code does mainly do what I need (as a test case):
[for (aRequirement : Requirement | collectionOfAllRequirements())]
aRequirement: [aRequirement/]
aRequirement.satisfiedBy: [aRequirement.satisfiedBy/]
[for (satisfyingBlock : NamedElement | aRequirement.satisfiedBy)]
satisfyingBlock.name: [satisfyingBlock.name/]
[/for]
[/for]
The resulting output is is:
aRequirement: org.eclipse.papyrus.sysml14.requirements.RequirementCustomImpl@1f65433a (id: CONTRACT_System, text:
A: Input occurs every 33ms with jitter 5ms.
G: Reaction(Input,Output) within [0,33]ms.)
aRequirement.satisfiedBy: org.eclipse.uml2.uml.internal.impl.ClassImpl@4f33c0de (name: BLOCK_System, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
satisfyingBlock.name: BLOCK_System
Which is correct: I have a requirement named "CONTRACT_System" which is to be fulfilled by the block "BLOCK_System"
PROBLEM:
=========
Due to the issue https://www.eclipse.org/forums/index.php/t/1091816/ I learned that I should no longer use the "Acceleo Plug-in Application" and I switched to "Java Application". With this the same code now generates an invalid return:
aRequirement: org.eclipse.papyrus.sysml14.requirements.internal.impl.RequirementImpl@2f9a01c1 (id: CONTRACT_System, text:
A: Input occurs every 33ms with jitter 5ms.
G: Reaction(Input,Output) within [0,33]ms.)
aRequirement.satisfiedBy: invalid
With the "invalid" of course I get messages like: "Invalid loop iteration at line 41 in Module moduleBlock for block for (aRequirement.satisfiedBy)"
QUESTION:
==========
How come that "[aRequirement.satisfiedBy/]" suddenly becomes invalid when I change the runtime environment? Something else that needs to be done when switching from "Acceleo Plug-in Application" to "Java Application"? What are the difference between the two?
|
|
|
|
Re: Template returns "invalid" after switching from "Acceleo Plug-in Application& [message #1782571 is a reply to message #1782559] |
Mon, 26 February 2018 10:06   |
Eclipse User |
|
|
|
I'm not sure, if the last answer involved all of the situation I described above. But I'm also very new to all of this. So let me rephrase.
The template works with "Acceleo Plug-in Application"
The template does NOT work with "Java Application"
I created another test as follows:
[aRequirement.base_Class.name/].derived : [aRequirement.derived/]
[aRequirement.base_Class.name/].derivedFrom : [aRequirement.derivedFrom/]
[aRequirement.base_Class.name/].id : [aRequirement.id/]
[aRequirement.base_Class.name/].master : [aRequirement.master/]
[aRequirement.base_Class.name/].refinedBy : [aRequirement.refinedBy/]
[aRequirement.base_Class.name/].satisfiedBy : [aRequirement.satisfiedBy/]
[aRequirement.base_Class.name/].text : [aRequirement.text/]
[aRequirement.base_Class.name/].tracedTo : [aRequirement.tracedTo/]
[aRequirement.base_Class.name/].verifiedBy : [aRequirement.verifiedBy/]
The result that returns with "Acceleo Plug-in Application" is:
CONTRACT_System.derived :
CONTRACT_System.derivedFrom :
CONTRACT_System.id : CONTRACT_System
CONTRACT_System.master :
CONTRACT_System.refinedBy :
CONTRACT_System.satisfiedBy : org.eclipse.uml2.uml.internal.impl.ClassImpl@36f40ddf (name: BLOCK_System, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
CONTRACT_System.text :
A: Input occurs every 33ms with jitter 5ms.
G: Reaction(Input,Output) within [0,33]ms.
CONTRACT_System.tracedTo :
CONTRACT_System.verifiedBy :
If I change the configuration to "Java Application" (and change nothing else) I get:
CONTRACT_System.derived : invalid
CONTRACT_System.derivedFrom : invalid
CONTRACT_System.id : CONTRACT_System
CONTRACT_System.master : invalid
CONTRACT_System.refinedBy : invalid
CONTRACT_System.satisfiedBy : invalid
CONTRACT_System.text :
A: Input occurs every 33ms with jitter 5ms.
G: Reaction(Input,Output) within [0,33]ms.
CONTRACT_System.tracedTo : invalid
CONTRACT_System.verifiedBy : invalid
What else besides switching the configuration to "Java Application" has to be configured to make this work (again)?
Especially: "CONTRACT_System.id" and "CONTRACT_System.text " are working for both cases. So after change, the template is not broken completely. What is the difference between the call to ".id" and ".satisfiedBy"? (The first working, the second not working.)
[Updated on: Mon, 26 February 2018 10:09] by Moderator
|
|
|
|
Re: Template returns "invalid" after switching from "Acceleo Plug-in Application& [message #1782635 is a reply to message #1782572] |
Tue, 27 February 2018 05:00   |
Eclipse User |
|
|
|
Hello Frank,
"Acceleo plug-in application" was trying to run your generator in the context of your current eclipse.
"Acceleo Java application" is running your generator in standalone.
What this means is that for the second, you have to be careful to properly register all required packages and profiles. In your case, I'll wager you're missing the registration for SysML.
Please check that the "registerResourceFactories" method in your generated launcher has the line "UMLResourcesUtil.init(resourceSet)" so that everything from the UML side is properly registered.
As for SysML, there is no "all-in-one" utility method to properly set it up as far as I recall. You should raise a bug against Papyrus so that they provide a "SysMLResourcesUtil.init(...)" that will take care of registrations as the UMLResourcesUtil does for UML.
At the very least, you will need the following, hopefully I'm not forgetting too many:
resourceSet.getPackageRegistry().put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
uri = URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml14");
uriMap.put(URI.createURI(SysMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP), uri.appendSegment("model").appendSegment(""));
Laurent Goubet
Obeo
|
|
|
|
|
Re: Template returns "invalid" after switching from "Acceleo Plug-in Application& [message #1782709 is a reply to message #1782638] |
Wed, 28 February 2018 03:16   |
Eclipse User |
|
|
|
Update:
=================
We were working on this quite some time yesterday, but did not find the solution yet. Today I will (have to) with a debugger step through the working runtime and in parallel through the not working runtime, to figure out what the difference is. Hope I find something.
What I understand:
===================
In the meantime I got it, that we are not only talking about compiling/linking but also the execution where things have to be registered in a factory. Laurent Goubet answer gave me a good inside into this, but the Acceleo generated code already seems to contain all of this:
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
if (!isInWorkspace(org.eclipse.uml2.uml.UMLPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.sysmlPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.sysmlPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.sysmlPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.activities.ActivitiesPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.activities.ActivitiesPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.activities.ActivitiesPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.allocations.AllocationsPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.allocations.AllocationsPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.allocations.AllocationsPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.blocks.BlocksPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.blocks.BlocksPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.blocks.BlocksPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.constraintblocks.ConstraintblocksPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.constraintblocks.ConstraintblocksPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.constraintblocks.ConstraintblocksPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.deprecatedelements.DeprecatedelementsPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.deprecatedelements.DeprecatedelementsPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.deprecatedelements.DeprecatedelementsPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.portsandflows.PortsandflowsPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.portsandflows.PortsandflowsPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.portsandflows.PortsandflowsPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.modelelements.ModelelementsPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.modelelements.ModelelementsPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.modelelements.ModelelementsPackage.eINSTANCE);
}
if (!isInWorkspace(org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.sysml14.requirements.RequirementsPackage.eINSTANCE);
}
Never the less I added also to "registerResourceFactories" the following (which, too, did not do the trick):
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(sysmlPackage.eNS_URI, sysmlPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(ActivitiesPackage.eNS_URI, ActivitiesPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(AllocationsPackage.eNS_URI, AllocationsPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(ConstraintblocksPackage.eNS_URI, ConstraintblocksPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(DeprecatedelementsPackage.eNS_URI, DeprecatedelementsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(PortsandflowsPackage.eNS_URI, PortsandflowsPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(ModelelementsPackage.eNS_URI, ModelelementsPackage.eINSTANCE );
resourceSet.getPackageRegistry().put(RequirementsPackage.eNS_URI, RequirementsPackage.eINSTANCE );
Unless I don't receive further ideas, like I wrote, I will have to step through the code to figure this out.
=====================================================================================
IMPORTANT QUESTION: Is Accello mature enough to be used in a productive environment?
=====================================================================================
(Created a new Issue on this: https://www.eclipse.org/forums/index.php/m/1782710/#msg_1782710)
[Updated on: Wed, 28 February 2018 03:22] by Moderator
|
|
|
|
|
|
|
|
|
|
Re: Template returns "invalid" after switching from "Acceleo Plug-in Application& [message #1782867 is a reply to message #1782788] |
Fri, 02 March 2018 11:36  |
Eclipse User |
|
|
|
The code I mentioned above ...
uriMap.put(URI.createURI(SysMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(SysMLResource.PROFILES_PATHMAP), uri.appendSegment("model").appendSegment(""));
... when I print-debug the content of the uriMap I see ...
pathmap://UML_PROFILES/StandardL3.profile.uml pathmap://UML_PROFILES/Standard.profile.uml
pathmap://UML_PROFILES/StandardL2.profile.uml pathmap://UML_PROFILES/Standard.profile.uml
pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbnfB2L_5w http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/
pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2 pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml
pathmap://UML2_PROFILES/Basic.profile.uml2#_9vsGw686Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#BuildComponent
pathmap://UML2_PROFILES/Basic.profile.uml2#_9vsGyK86Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#BuildComponent-base_Component
pathmap://UML2_PROFILES/Basic.profile.uml2#_9vsGxq86Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Component_BuildComponent-extension_BuildComponent
pathmap://UML2_LIBRARIES/JavaPrimitiveTypes.library.uml2 pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml
pathmap://UML2_PROFILES/Complete.profile.uml2#_O1-5Ua87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Model_Metamodel
pathmap://UML2_METAMODELS/UML2.metamodel.uml2 pathmap://UML_METAMODELS/UML.metamodel.uml
pathmap://UML2_PROFILES/Complete.profile.uml2#_O2E_8a87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Model_SystemModel-extension_SystemModel
pathmap://UML2_LIBRARIES/EcorePrimitiveTypes.library.uml2 pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml
pathmap://UML2_PROFILES/Complete.profile.uml2#_O2E_8K87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Model_SystemModel
pathmap://UML2_PROFILES/Complete.profile.uml2#_O2E_8687Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#SystemModel-base_Model
pathmap://UML2_PROFILES/Complete.profile.uml2#_O1-5Uq87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Model_Metamodel-extension_Metamodel
pathmap://UML2_PROFILES/Basic.profile.uml2 pathmap://UML_PROFILES/Standard.profile.uml
pathmap://UML2_PROFILES/Complete.profile.uml2 pathmap://UML_PROFILES/Standard.profile.uml
pathmap://UML2_PROFILES/Ecore.profile.uml2 pathmap://UML_PROFILES/Ecore.profile.uml
pathmap://UML2_PROFILES/Basic.profile.uml2#_9vsGxa86Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Component_BuildComponent
pathmap://UML2_PROFILES/Complete.profile.uml2#_O1-5VK87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Metamodel-base_Model
pathmap://UML2_PROFILES/Complete.profile.uml2#_O1-5Va87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#SystemModel
pathmap://UML2_PROFILES/Intermediate.profile.uml2 pathmap://UML_PROFILES/Standard.profile.uml
pathmap://UML2_METAMODELS/Ecore.metamodel.uml2 pathmap://UML_METAMODELS/Ecore.metamodel.uml
pathmap://UML2_PROFILES/Complete.profile.uml2#_Ox98AK87Edih9-GG5afQ0g pathmap://UML_PROFILES/Standard.profile.uml#Metamodel
http://schema.omg.org/spec/UML/2.2/StandardProfileL2.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://www.omg.org/spec/UML/20110701/StandardProfileL2.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://www.omg.org/spec/UML/20110701/StandardProfileL3.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://www.omg.org/spec/UML/20100901/StandardProfileL3.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://www.omg.org/spec/UML/20100901/StandardProfileL2.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://www.omg.org/spec/UML/20131001/StandardProfile.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://schema.omg.org/spec/UML/2.2/StandardProfileL3.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://schema.omg.org/spec/UML/2.1/StandardProfileL2.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://schema.omg.org/spec/UML/2.1.1/StandardProfileL2.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://schema.omg.org/spec/UML/2.1/StandardProfileL3.xmi pathmap://UML_PROFILES/Standard.profile.uml
http://schema.omg.org/spec/UML/2.1.1/StandardProfileL3.xmi pathmap://UML_PROFILES/Standard.profile.uml
pathmap://SysML14_LIBRARIES/ platform:/plugin/org.eclipse.papyrus.sysml14/libraries/
pathmap://SysML14_PROFILES/ platform:/plugin/org.eclipse.papyrus.sysml14/model/
ANALYZIS:
My last two entries that I create according to the feedback here don't seem to fit the UML entries. It seems reversed. Opinion?
|
|
|
Powered by
FUDForum. Page generated in 0.05590 seconds