Hi Wang,

Apologies.  There is a bug in the the
JDKLoggingImplementationPolicyProvider.  We must be using
component.getPolicySets() and not getApplicablePolicySets().  I am in the
course of fixing this along with a few other things in the branch for our
1.2 release after which I will syncing up the trunk for this.  So in about
an couple of hours you should see all of this working from the trunk as
well.

There is one thing that I noted though in your definitions.xml.  It seems to
be providing the 'implementationType' definitions for the sca:
implementation.java extension.  You should not be doing this as this is
something which should be a part of implementation.java extension itself.
The trouble that this can cause is with the intents that you might specify
as 'mayProvides' and 'alwaysProvides'.  When you use the intents defined
under these, in your composite, they will never get matched with policysets
because, for these it is understood that the extension itself handles what
needs to be done.

Thanks.

- Venkat



On Wed, Mar 26, 2008 at 12:15 PM, wang feng <[EMAIL PROTECTED]> wrote:

> My definitions.xml file is in the class path of
> org\apache\tuscany\sca\policy\logging and find the processor has readed the
> file.
> The PolicyProvider.createInterceptor will return null,because it can't
> find any applicable policyset for the component.
> But I copy the definitions.xml to the same dir of the composite file,it
> run fine.
> Is something wrong?
>
> Thanks,
> Wang Feng
>
>
> On 2008-03-26,Raymond Feng <[EMAIL PROTECTED]> wrote:
>
> >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.xmlfile.
> >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" <tuscany-dev@ws.apache.org>
> >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]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to