In 1.x, and by implication 2.x, the definitions.xml processing is problematic in a number of ways. We have started to talk about revisiting the policy model [1] and although we haven't done that yet in 2.x I'm trying to get my mind around how definitions.xml files are processed by Tuscany. There seem to be a number of gaps, e.g. TUSCANY-2499 [2].
A) Resolve definitions gloabally given the set of contributions available. I think the ideal order of processing for a stand-alone node should be. - read all defintiions.xml files from extensions that the runtime loads - read all contributions (which in turn will read any definitions.xml files that appear in contributions) - resolve all the definitions that have been read (aggregate all the definitions models together and resolve them) - resolve all of the contributions I believe the contribution processing has been split up already in 2.x so this change should be straightforward there. I have a patch for 1.x. It relies on exposing interfaces on the contribution service to allow read and resolve to be called independently. This does solve 2499 so I'll attach the patch there for people to look at. I haven't commited directly as there workspace contribution processing is already in 1.x but I'm not sure yet what the implications of switching across to that would be. An interesting problem I uncovered is that the JAAS policy itself dependes on contribution artifacts (java classes) so you have to resolve the definitions in the context of the contributions that have previously been read. This feels a little odd to me. B) Global access to the definitions artifacts In 1.x the definitions model is owned by the RuntimeBootStrapper and is made available to the model through the resolver structure. It seems that it is not easy to use the resolver approach in some places, e,g the JMS binding where its gets data from the definitions.xml binding structure. We need to review this and see how access should be provided to the definitions.xml model. C) Retrieve domain definitions from the domain The problem described in A) raises it's head in the domain also. Here though the solution is not so straighforward as the domain level defintions model must be subsequently provided to all nodes (assuming that I understand the specs correctly of course). While there are some TODO comments in the code suggesting that defintions dependencies should be expressed through contribution import/export statements I don't think this is true as the spec considers defintiions.xml to be a domain level resource while Tuscany just happens to allow you to include them in a contribution. We could take the aggreated definitions.xml artifacts and create a special contribution and provide this to all nodes. Alternatively we could provide a specific endpoint from which to retrieve the defintiions.xml artifacts. The first approach would seem to be the simpler of the two. Regards Simon [1] http://cwiki.apache.org/confluence/display/TUSCANYWIKI/Policy [2] http://issues.apache.org/jira/browse/TUSCANY-2499
