On Thu, May 29, 2008 at 2:59 PM, Simon Laws <[EMAIL PROTECTED]> wrote:
> > > On Tue, May 27, 2008 at 4:45 PM, Simon Laws <[EMAIL PROTECTED]> > wrote: > >> >> >> On Tue, May 27, 2008 at 2:53 PM, Simon Laws <[EMAIL PROTECTED]> >> wrote: >> >>> Imagine PolicyOuterComposite.... >>> >>> <component name="TargetClientComponent"> >>> <implementation.java class="policy.TargetClientImpl"/> >>> <reference name="targetService" >>> target="OuterTargetServiceComponent"> >>> <binding.ws/> >>> </reference> >>> </component> >>> >>> <component name="OuterTargetServiceComponent"> >>> <implementation.composite name="policy:PolicyInnerComposite"/> >>> <service name="TargetService"> >>> <interface.java interface="policy.Target"/> >>> <binding.ws uri=" >>> http://localhost:8085/OuterTargetServiceComponent"/> >>> </service> >>> </component> >>> >>> And PolicyInnerComposite >>> >>> <service name="TargetService" promote="TargetServiceComponent"> >>> </service> >>> >>> <component name="TargetServiceComponent"> >>> <implementation.java class="policy.TargetServiceImpl"/> >>> </component> >>> >>> With our current code this doesn't work. The runtime complains that it >>> can't match the reference targetService with OuterTargetServiceComponent. I >>> guess my first question is should this work? >>> >>> This happens as there is a specific bit code code in the EndpointBuilder >>> that does the following. >>> >>> // if the target service is a promoted service then find the >>> // service it promotes >>> if (endpoint.getTargetComponentService().getService() instanceof >>> CompositeService) { >>> CompositeService compositeService = (CompositeService) >>> endpoint.getTargetComponentService().getService(); >>> // Find the promoted component service >>> ComponentService promotedComponentService = >>> ServiceConfigurationUtil.getPromotedComponentService(compositeService); >>> if (promotedComponentService != null && >>> !promotedComponentService.isUnresolved()) { >>> >>> endpoint.setTargetComponentService(promotedComponentService); >>> } >>> } >>> >>> Hence the outer service is replaced with the promoted component service >>> and the outer service configuration isn't used. In this case the service on >>> the inner component doesn't have the right bindings on it. Looking at the >>> logs this code has been there for a long time. Anyone know what the >>> intention is? >>> >>> Simon >>> >> >> I'm making a little bit more progress on this. It seems that, in the case >> of an automatically generated binding.sca at least, the wires are stored on >> the target component service. I don't understand why I'm seeing a difference >> in behaviour with different binding types. >> >> Simon >> > > Ok, I looked at this in some detail now and I think we do have a problem > here. > > <component name="OuterTargetServiceComponent"> > <implementation.composite name="policy:PolicyInnerComposite"/> > <service name="TargetService"> > <interface.java interface="policy.Target"/> > <binding.ws uri=" > http://localhost:8085/OuterTargetServiceComponent"/> > </service> > </component> > > And PolicyInnerComposite > > <service name="TargetService" promote="TargetServiceComponent"> > </service> > > <component name="TargetServiceComponent"> > <implementation.java class="policy.TargetServiceImpl"/> > </component> > > Doesn't work. Moving the binding down into the inner composite service > doesn't work but moving the binding down to the inner component service does > work. > > I believe the model is just about correct but this code in the builder that > is converting the target service into the inner target component service is > incorrect. Indeed the failing combinations are successful if I comment out > this code. However without this code tests which use binding.sca in this > situation fail because binding.sca has an "optimization" where it uses the > component service to create a target invoker for the outbound wire. There > doesn't seem to be a wire created for the promoted target service. Needs > further investigation so I'll raise a JIRA to track it. > > Simon > Raised as https://issues.apache.org/jira/browse/TUSCANY-2352 Simon