1

ajxmlcop and ajcodegen.py contradict one another

asked 2015-09-23 09:42:47 -0700

Jo3 gravatar image

What ho;

I made what I believe is the simplest introspection possible.

<node name="/com/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.allseenalliance.org/schemas/introspect.xsd"> <interface name="com.Test"> <method name="Beep"> </method> </interface> </node>

And ajxmlcop says this:

WARNING-24: interface 'com.Test' is missing annotation org.alljoyn.Bus.Secure="true" WARNING-29: interface 'com.Test' missing description element WARNING-30: method 'com.Test.Beep' missing description element INFO-43: consider adding a uint16 Version property to interface 'com.Test'

But, if I add the annotation and descriptions

<node name="/com/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.allseenalliance.org/schemas/introspect.xsd"> <interface name="com.Test"> <annotation name="org.alljoyn.Bus.Secure" value="true" /> <description>Test</description> <method name="Beep"> <description>Beep</description> </method> </interface> </node>

and then run ajcodegen.py it says this:

`Input XML file = 'testcode.xml'. Object path = '/ignored/not/relevant'. Output path is '.'. Target language option is 'ddcpp'. Well known name = 'com.test'.

Warning! Ignoring interface annotation 'org.alljoyn.Bus.Secure'. Found here: <interface name="com.Test"> <annotation name="org.alljoyn.Bus.Secure" value="true"/> <description>Test</description> <method name="Test"> <description>Test</description> </method> </interface>

Warning! Ignoring interface xml object 'description'. Found here: <interface name="com.Test"> <annotation name="org.alljoyn.Bus.Secure" value="true"/> <description>Test</description> <method name="Test"> <description>Test</description> </method> </interface>

Warning! Ignoring method xml object 'description'. Found here: <method name="Test"> <description>Test</description> </method>

Done.`

The directly contradict each other. Any help would be greatly appreciated.

Tally ho,

Jo3

edit retag flag offensive close merge delete

Comments

You might want to open a JIRA ticket at https://jira.allseenalliance.org

praveenb ( 2015-09-24 00:09:46 -0700 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-09-24 01:46:27 -0700

chanetd gravatar image

Let me start off by saying that the code generator (ajcodegen.py) is somewhat out of date and needs some loving care by a developer in the near future. Hopefully, this can be done in the R16.04 time frame.

context

The practices around interface definition are very much in flux right now.

ajxmlcop has grown out of best practices that emerged from the work in the Interface Review Board (a subcommittee of the TSC that works to make sure standardized interfaces are of high quality and similar style). If you follow ajxmlcop's recommendations, you're well on your way to define a high quality interface yourself.

The AllJoyn Code Generator (ajcodegen.py) is currently lagging w.r.t. these best practices. It hasn't really seen any new functionality in the last year, and hence it does not yet incorporate (or even support) some of the best practices ajxmlcop encourages you to follow.

suggestion

For your concrete example here, I'd say the following applies:

  • the ajxmlcop output were WARNINGs and INFOs, not ERRORs. Hence, they can be ignored if you have a good reason. Not wanting to standardize your interface (it's a toy example anyway) is one, wanting to use the code generator can be another.
  • the ajcodegen output you see tells you that:
    • the <description> elements are ignored -> that's not that bad, the descriptions are informational only
    • the secure annotation is ignored -> that's worse, it basically means that your formal interface description tells the world it's supposed to be used in a secure way, while the code generated by ajcodegen.py will expose the interface in an insecure way.

So what I'd do, is leave the <description> elements in, but remove the secure annotation for now. If you do want to use secured interfaces, don't use the code generator, as it doesn't generate the right code for them.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-09-23 09:42:47 -0700

Seen: 36 times

Last updated: Sep 24 '15