Hi,

Are you packaging definitions.xml in your SCA contribution to try application-level configuration of the intents/policySets?

For tuscany extensions, we have switched to SCADefinitionsProvider to contribute definitions.xml model into Tuscany, not the definitions.xml file. Can you take the policy-logging module as an example?

Thanks,
Raymond
--------------------------------------------------
From: "wang feng" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2008 8:28 PM
To: "tuscany-dev" <[email protected]>
Subject: How to use logger policy?

Hi,all
I do a sample to test policy with logger policy,but the logger policy don't work. I debug the code and find the method component.getApplicablePolicySets() in PolicyProvider Impl alway return null. I look for the code and not find where the ApplicablePolicySets value on component or binding or reference was setted.
 Can anybody help me?

Config file like below

definitions.xml
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"; targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"; xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"; xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
   xmlns:calc="http://calculator";>

<implementationType type="sca:implementation.java" alwaysProvides="tuscany:logging"/>
   <intent name="logging"  constrains="sca:implementation.java">
<description>All messages to and from this implementation must be logged</description>
   </intent>
<policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.java"
       xmlns="http://www.osoa.org/xmlns/sca/1.0";>
       <tuscany:jdkLogger name="calculator">
           <logLevel>ALL</logLevel>
       </tuscany:jdkLogger>
   </policySet>
</definitions>

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

<component name="CalculatorServiceComponent" policyset="tuscany:JDKLoggingPolicy"> <implementation.java class="calculator.CalculatorServiceImpl" requires="tuscany:logging"/>
       <reference name="addService" target="AddServiceComponent" />
<reference name="subtractService" target="SubtractServiceComponent" /> <reference name="multiplyService" target="MultiplyServiceComponent" />
       <reference name="divideService" target="DivideServiceComponent" />
   </component>

   <component name="AddServiceComponent">
<implementation.java class="calculator.AddServiceImpl" requires="tuscany:logging"/>
   </component>

   <component name="SubtractServiceComponent">
       <implementation.java class="calculator.SubtractServiceImpl"/>
   </component>

   <component name="MultiplyServiceComponent">
       <implementation.java class="calculator.MultiplyServiceImpl"/>
   </component>

   <component name="DivideServiceComponent">
       <implementation.java class="calculator.DivideServiceImpl"/>
   </component>
</composite>
--------------
wang feng
2008-03-26


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to