You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Diego Ferraggine <df...@starmountsystems.com> on 2011/10/19 15:10:09 UTC

Using custom policy

Hi,
I'm trying to define a custom policy to be used on each invocation on a
Component.
- I've created a new class called EventTrackerInterceptor that implements
Interceptor.
- I've added a requires clause on the implementation:
*     <implementation.java
            class="..."
            requires="eventTracking"/>*
I've created a definitions.xml file where dfined an intent and a policySet:
    *<intent name="eventTracking" constrains="sca:implementation.java">
        <description>
            TODO Add a description
        </description>
    </intent>

    <policySet name="EventTrackingService" provides="eventTracking"
        appliesTo="sca:implementation.java">


    </policySet>*

How can complete this policySet definition to use my Interceptor?
I need something else to get my Interceptor being invoked by Ttuscany?
Can I invoke another Tuscany component from inside an Interceptor? It is
possible "reference" another service?

Thanks,
Diego.
-
_________________________________________
*Ing. Diego Ferraggine*

Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s).  If you have received this communication in error, any disclosure or use of such information is strictly prohibited.  Please notify the sender immediately and destroy all copies.  Thank you.

Re: Using custom policy

Posted by Anuj Bhatia <an...@gmail.com>.
On Wed, Oct 19, 2011 at 6:40 PM, Diego Ferraggine <
dferraggine@starmountsystems.com> wrote:

> *    <policySet name="EventTrackingService" provides="eventTracking"
>         appliesTo="sca:implementation.java">
>
> *
> How can complete this policySet definition to use my Interceptor?
> I need something else to get my Interceptor being invoked by Ttuscany?
>

Adding an attachTo attribute to the policySet element might help. For an
example see -
https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/testing/itest/policies/



> Can I invoke another Tuscany component from inside an Interceptor? It is
> possible "reference" another service?


Don't know that one (am a beginner myself)

Hope this helps,
Anuj