Hi
I'm looking at why ASM_10002 is now failing.
The reported cause is that a reference intent
({http://docs.oasis-open.org/ns/opencsa/scatests/200903}Fred) is not
resolved. Here's the definition of the reference...
<reference name="reference1" target="TestComponent1/Service1"
requires="test:Fred" policySets="test:PolicySet1"/>
test:PolicySet1 is actually removed from the reference because the
infrastructure thinks that there is an externally attached policy set
that overrides it. Here is the definitions.xml file...
<intent name="Fred" constrains="sca:binding" intentType="interaction"/>
<policySet name="PolicySet1" provides="test:Fred"
appliesTo="//sca:service|//sca:reference"
attachTo="//sca:service|//sca:reference">
</policySet>
So currently Tuscany sees that a policy set associated with the
reference could be there due to external attachment and tries to
remove the directly attached policy sets. There is the following piece
of code in the CompositePolicyBuilder that does this....
private void removeDirectPolicySetsIfExternalExists(PolicySubject
subject,
BuilderContext context) {
boolean foundExternalPolicySet = false;
for (PolicySet ps : subject.getPolicySets() ) {
if ( ps.getAttachTo() != null )
foundExternalPolicySet = true;
}
if ( foundExternalPolicySet ) {
List<PolicySet> copy = new
ArrayList<PolicySet>(subject.getPolicySets());
for ( PolicySet ps : copy ) {
if ( ps.getAttachTo() == null ) {
subject.getPolicySets().remove(ps);
}
}
}
}
This raises a number of questions..
1/ A general spec question. Can you externally attach a policy to a
component and expect it to be flowed down to the components services
and references. Our code does this at present.
2/ The code above determines external attachment by looking for a
policy set that has an attachTo attribute. It doesn't check that the
attachTo actually relates to the current element.
3/ It then removes elements that have no attachTo details. Again it's
doesn't check if policy sets that do have attachTo details have been
directly or externally attached to this element.
If 1 is true we don't generally have the luxury of checking whether
external attachment overrides direct attachment at the point at which
the xpath is processed so it seems that we need a way of remembering
if a policy was attached externally or directly so the removal of any
directly attached policies can be done here.
Thoughts?
Simon
--
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com