Hi,

Simon Laws wrote:

Not sure what you mean by "bind" here. You can add the requires attribute to the composite, composite, reference, service etc and,

the basic idea of my policy extension is to provide Quality of Service
for Web Services. Since JDKLoggingPolicy constrains on
implementation.java and my extension should be independent of the
underlying language/technology I was wondering if it is possible to
apply the policy by adding an requires attribute to a service or a
reference. I'll give you an example:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
  targetNamespace="http://sample";
  xmlns:sample="http://sample";
  xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
  name="Calculator">

  <service name="CalculatorService"
     promote="CalculatorServiceComponent">
     <interface.java interface="calculator.CalculatorService" />
     <binding.ws/>
  </service>

  <component name="CalculatorServiceComponent">
     <implementation.java class="calculator.CalculatorServiceImpl"/>
     <reference name="addService" promote="">
       <interface.java interface="calculator.AddService" />
       <binding.ws
       uri="http://vs23:8080/sample-add-ws-webapp/AddService"/>
     </reference>
     ...
  </component>
</composite>

The above calculator.composite represents a calculator based upon web services. The basic idea of the QoS-Proxy is to offer several Quality of Service classes for a service. So I have a gold class and a silver class in the example below. I was thinking it was possible to enable the policy by setting the requires attribute on the service element. In fact I had to enable it on the implementation so the policy is now depend on the implementation instead of the service or to be precise on the binding.ws (I didn't see how to constrain on binding.ws since only service, implementation, composite and components support the requires attribute)

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
  targetNamespace="http://sample";
  xmlns:sample="http://sample";
  xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
  name="Calculator">

  <service name="CalculatorServiceGold"
     promote="CalculatorServiceComponent">
     <interface.java interface="calculator.CalculatorService" />
     <binding.ws/>
  </service>

  <service name="CalculatorServiceSilver"
     promote="CalculatorServiceComponent">
     <interface.java interface="calculator.CalculatorService" />
     <binding.ws/>
  </service>


  <component name="CalculatorServiceComponent">
     <implementation.java class="calculator.CalculatorServiceImpl"
     requires="tuscany:proxy"/>
     <reference name="addService" promote="">
       <interface.java interface="calculator.AddService" />
       <binding.ws
       uri="http://vs23:8080/sample-add-ws-webapp/AddService"/>
     </reference>
     ...
  </component>
</composite>

It is possible to 'filter' the service in the interceptor of the policy but I have to determine the clients address since I'm using some kind of service level management framework in the back. The idea is that there are several service level agreements about the calculator service (multiple silver and gold agreements). So if a client_1 uses the agreement gold_1_agreement it has probably a another priority than a client_2 with a gold_4_agreement. I hope it's not too confusing.

tuntime. I can give you more detail on what is going on under the covers if that helps.

That would be great!

Hmmm, tricky. The target URI is calculated inside the binding and probably isn't in the message directly. at the point at which the policy has access to it. Let me put it in the debugger and see what's available.

That would be really nice. To be precise I'm looking for the source URI or some kind of IP or hostname of the client who has sent the service request - probably you mean by target the recipient for the web service request response.

Thanks in advance!

Regards,
 Michael

Reply via email to