[ 
https://issues.apache.org/jira/browse/TUSCANY-2908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Sacauskis updated TUSCANY-2908:
---------------------------------------

    Attachment: ws.zip

This is a zip of my eclipse project which attempts to use the logger policy 
defined in modules policy-logging.

> stack trace: PolicyValidation exception
> ---------------------------------------
>
>                 Key: TUSCANY-2908
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2908
>             Project: Tuscany
>          Issue Type: Test
>          Components: Java SCA Policy
>         Environment: windows xp using eclipse plug-in tool 1.3.2. 
>            Reporter: Michael Sacauskis
>         Attachments: ws.zip
>
>
> (1) I've gained some insight into the issue.  It seams there are a default 
> set of policies as well as some other classes that are loaded when I Do 
> SCADomain scaDomain = SCADomain.newInstance("helloworld.composite");.  They 
> are:
>  org.apache.tuscany.sca.policy.security.SecurityPolicyDefinitionsProvider
>  org.apache.tuscany.sca.binding.ws.axis2.WSBindingDefinitionsProvider
>  org.apache.tuscany.sca.binding.sca.SCABindingDefinitionsProvider
>  org.apache.tuscany.sca.policy.logging.LoggingPolicyDefinitionsProvider
> This is done in the class 
> org.apache.tuscany.sca.definitions.imp.DefaultSCADefinitionsProviderExtensionPoint
>  and the method loadProviders.  My composite file is as follows:
> <?xml version="1.0" encoding="UTF-8"?>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
>     targetNamespace="http://helloworld";
>     xmlns:hw="http://helloworld.gdit.com.";
>     xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
>     name="helloworld">
>     <component name="HelloWorldServiceComponent">
>           <implementation.java class="helloworld.HelloWorldImpl">
>               <operation name="sayWorld" requires="tuscany:logging"/>
>       </implementation.java>
>     <service name="HelloWorld">
>     <interface.java interface="helloworld.HelloWorld"></interface.java>
>     <binding.ws/>
>     </service>
>         <reference name="helloService" target="HelloComponent" />
>         <reference name="worldService" target="WorldComponent" />
>     </component>
>     <component name="HelloComponent">
>         <implementation.java class="helloworld.HelloServiceImpl"/>
>     </component>
>     <component name="WorldComponent">
>         <implementation.java class="helloworld.WorldServiceImpl">
>       </implementation.java>
>     </component>
> </composite>
> (2)The Composite file specifies thet <operations name="sayWorld" 
> requires="tuscany.logging"> which specifies that it the method sayWorld needs 
> to be logged.  I have a definitions file associated with my test programs 
> which specifies the policy:
> <?xml version="1.0" encoding="UTF-8"?>
> <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:helloWorld="http://HelloWorld";>
>     <!-- PolicySets -->
>     <policySet name="JDKLoggingPolicy" provides="tuscany:logging" 
> appliesTo="sca:implementation.java"
>         xmlns="http://www.osoa.org/xmlns/sca/1.0";>
>         <!--tuscany:jdkLogger name="HelloWorld">
>             <logLevel>FINER</logLevel>
>         </tuscany:jdkLogger-->
>     </policySet>
> </definitions
> (3)My Understanding (and it may be wrong) is that the requires in the 
> composite file is supposed to map to <policySet name="JDKLoggingPolicy" 
> provides="tuscany:logging" appliesTo="sca:implementation.java" 
> xmlns="http://www.osoa.org/xmlns/sca/1.0";> line in the definitions.xml file 
> and somehow this is supposed to map to the implementation of the logger.  
> This apparently is not the case.  I ran my test program without the 
> definitions.xml file associated with it and it still runs without error. What 
> I found is that the <operation name="sayWorld" requires="tuscany:logging"/> 
> maps to the intent for the logger which is in the definitions.xml file in the 
> logger package.  The file is as follows:
> <?xml version="1.0" encoding="ASCII"?>
> <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";>
>       <!-- Policy Intents Defined by the SCA Runtime -->
>       <intent name="logging" 
>               constrains="sca:implementation.java">
>               <description>
>                       All messages to and from this implementation must be 
> logged
>               </description>
>       </intent>
> </definitions>
> If I change the intent name="logging" to something I then get the Policy 
> violation error.  So this leads me to the following questions and possible 
> issues:
> 1. Where does the list of polices that are being loaded as described in (1) 
> above come from?
> 2. Is there a way for me to add my policy to this list or somehow get it 
> resolved to my intent so that I can define my own policies?
> 3. Is the policy set the method of mapping a policy to an intent?
> 4. Is the definitions file associated with the composite app even used?
> I have my own driver and will uploaded it to the jira when the SCA Policy 
> component is created.
> -----Original Message-----
> From: Luciano Resende [mailto:[email protected]] 
> Sent: Thursday, March 05, 2009 7:32 PM
> To: [email protected]
> Subject: Re: stack trace: PolicyValidation exception
> Should your intent be                 <intent name="gdit:FooBarPolicy"
> instead of                 <intent name="FooBarPolicy" ?
> On Thu, Mar 5, 2009 at 5:23 PM, Sacauskis, Mike <[email protected]> 
> wrote:
> > <definitions xmlns="http://www.osoa.org/xmlns/sca/1.0";
> >
> >
> > targetNamespace="http://gdit.com/";
> >
> >
> > xmlns:sca="http://www.osoa.org/xmlns/sca/1.0";
> >
> >             xmlns:gdit="http://gdit.com/";>
> >
> >
> >
> >                 <!-- Policy Intents Defined by the SCA Runtime -->
> >
> >                 <intent name="FooBarPolicy"
> -- 
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to