esa / CCSDS_MO_StubGenerator

Generates technology bindings for CCSDS MAL service specifications
Other
4 stars 9 forks source link

MALOperationStage objects are always created with an empty array for lastElementShortForms #4

Closed S-Gaertner closed 9 years ago

S-Gaertner commented 9 years ago

According to Table 3-22 MAL Java API lastElementShortForms parameter of the MALOperationStage constructor contains the short forms of the types that can be used for the last element of the message body in case of polymorphism.

However, the generated code seems to always pass an empty array when constructing MALOperationStage objects.

As an example see definition of TESTMALATTRIBUTE_OP field in org.ccsds.moims.mo.malprototype.datatest.DataTestHelper (line 355) that is generated from the MALPrototype.xml service definition.

If correcting this proves difficult, I would already be happy if lastElementShortForms contains all the attribute type short forms in case the MAL message body element is declared as MAL::Attribute, even if it is left empty in all other cases.

SamCooper commented 9 years ago

The trouble with this argument is that its very difficult to be correct here, because its entirely possible you don't know the complete set when generating. If it is set to Element for the operation definition then in theory every type should be possible. That would be a big array.

I think this is something that should be examined as part of the Java API update. Could you raise a RID on it.

But I'm happy to fill it in for Attribute. I'll see what I can do.

S-Gaertner commented 9 years ago

Yes, I can see the issue there and will raise a RID on the Java API.

Luckily I don't need this functionality except for the one case in which it correctly returns the attribute types for MAL::Attribute. There is no other way to detect if a declared abstract type for a MAL message body element is an Element or an Attribute. I guess that would be another RID for the Java API. Without this functionality one of the SPP binding clauses cannot be implemented in the framework of the Java API and thus will fail the test. In this case David would probably change the specification to something with more overhead which is a solution I'd like to avoid if possible.

SamCooper commented 9 years ago

Can you check the latest commit and see if that fixes it?

S-Gaertner commented 9 years ago

The problem is fixed partly. It works if the element has been declared MAL::Attribute. But if the element has been declared List lastElementShortForms also contains the Attribute short forms instead of their list type counterparts. Please either provide the possible list type short forms or return an empty list.

SamCooper commented 9 years ago

Try now

S-Gaertner commented 9 years ago

Now it works as expected. Thank you!