You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/03/07 19:48:05 UTC

svn commit: r634776 [1/2] - in /incubator/tuscany/java/sca/modules: contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ core-spi/src/main/java/org/apache/tuscany/sca/runtime/ core/src/main/java/org/apache/tuscany/sca/core/...

Author: rfeng
Date: Fri Mar  7 10:48:00 2008
New Revision: 634776

URL: http://svn.apache.org/viewvc?rev=634776&view=rev
Log:
Hook PolicyProviderFactory/PolicyProvider SPIs with the core and convert policy-logging and policy-transaction

Added:
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java   (with props)
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java   (with props)
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/definitions.xml   (with props)
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
Removed:
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyHandler.java
    incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionRuntimeWireProcessor.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml
Modified:
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
    incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
    incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
    incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java Fri Mar  7 10:48:00 2008
@@ -470,8 +470,7 @@
             
             byte[] transformedArtifactContent = addApplicablePolicySets(artifactURL);
             artifact.setContents(transformedArtifactContent);
-            XMLStreamReader reader = XMLInputFactory.newInstance().
-                                createXMLStreamReader(new ByteArrayInputStream(transformedArtifactContent));
+            XMLStreamReader reader = xmlFactory.createXMLStreamReader(new ByteArrayInputStream(transformedArtifactContent));
             reader.nextTag();
             Composite composite = (Composite)staxProcessor.read(reader);
             if (composite != null) {

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java Fri Mar  7 10:48:00 2008
@@ -19,8 +19,11 @@
 
 package org.apache.tuscany.sca.runtime;
 
+import java.util.List;
+
 import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 
 /**
  * The runtime component interface. Provides the bridge between the
@@ -65,4 +68,16 @@
      * @param the state to set
      */
     void setStarted(boolean started);
+    
+    /**
+     * Add a policy provider to the component
+     * @param policyProvider
+     */
+    void addPolicyProvider(PolicyProvider policyProvider);
+    
+    /**
+     * Get a list of policy providers configured for this component
+     * @return
+     */
+    List<PolicyProvider> getPolicyProviders();
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java Fri Mar  7 10:48:00 2008
@@ -25,6 +25,7 @@
 import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 
 /**
@@ -68,6 +69,19 @@
      */
     void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
     
+    /**
+     * Add a policy provider for the given binding to the reference
+     * @param binding The assembly model binding
+     * @param policyProvider The policy handler
+     */
+    void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+    
+    /**
+     * Get a list of policy providers for the given binding
+     * @param binding The assembly model binding
+     * @return A list of policy proviers for the given binding
+     */
+    List<PolicyProvider> getPolicyProviders(Binding binding);    
     
     /**
      * Get the invoker for the given binding and operation
@@ -77,7 +91,8 @@
      */
     Invoker getInvoker(Binding binding, Operation operation); 
     
-    /**Set the owning component
+    /**
+     * Set the owning component
      * @param component
      */
     void setComponent(RuntimeComponent component);

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java Fri Mar  7 10:48:00 2008
@@ -27,6 +27,7 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 
 /**
@@ -118,5 +119,20 @@
      * @param interfaceContract the client interface contract
      * @return The runtime invocation chain
      */
-    InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);  
+    InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
+    
+    /**
+     * Add a policy provider for the given binding to the service
+     * @param binding The assembly model binding
+     * @param policyProvider The policy handler
+     */
+    void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+    
+    /**
+     * Get a list of policy providers for the given binding
+     * @param binding The assembly model binding
+     * @return A list of policy proviers for the given binding
+     */
+    List<PolicyProvider> getPolicyProviders(Binding binding);
+
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java Fri Mar  7 10:48:00 2008
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.core.assembly;
 
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -51,6 +52,8 @@
 import org.apache.tuscany.sca.provider.BindingProviderFactory;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
 import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
@@ -180,6 +183,13 @@
             if (bindingProvider != null) {
                 ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
             }
+            for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+                PolicyProvider policyProvider = f.createReferencePolicyProvider(component, reference, binding);
+                if (policyProvider != null) {
+                    reference.addPolicyProvider(binding, policyProvider);
+                }
+            }
+
             return bindingProvider;
         } else {
             throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
@@ -387,10 +397,15 @@
             throw new IllegalStateException("Provider factory not found for class: " + implementation.getClass()
                 .getName());
         }
+        for(PolicyProviderFactory f: providerFactories.getPolicyProviderFactories()){
+            component.addPolicyProvider(f.createImplementationPolicyProvider(component, implementation));
+        }
+        
     }
 
     private void removeImplementationProvider(RuntimeComponent component) {
         component.setImplementationProvider(null);
+        component.getPolicyProviders().clear();
     }
 
     /**
@@ -412,6 +427,12 @@
             if (bindingProvider != null) {
                 ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
             }
+            for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+                PolicyProvider policyProvider = f.createServicePolicyProvider(component, service, binding);
+                if (policyProvider != null) {
+                    service.addPolicyProvider(binding, policyProvider);
+                }
+            }
             return bindingProvider;
         } else {
             throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
@@ -422,12 +443,24 @@
                                               RuntimeComponentService service,
                                               Binding binding) {
         service.setBindingProvider(binding, null);
+        for (Binding b : service.getBindings()) {
+            List<PolicyProvider> pps = service.getPolicyProviders(b);
+            if (pps != null) {
+                pps.clear();
+            }
+        }
     }
 
     private void removeReferenceBindingProvider(RuntimeComponent component,
                                                 RuntimeComponentReference reference,
                                                 Binding binding) {
         reference.setBindingProvider(binding, null);
+        for (Binding b : reference.getBindings()) {
+            List<PolicyProvider> pps = reference.getPolicyProviders(b);
+            if (pps != null) {
+                pps.clear();
+            }
+        }
     }
 
     public void start(Composite composite) {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java Fri Mar  7 10:48:00 2008
@@ -19,10 +19,14 @@
 
 package org.apache.tuscany.sca.core.assembly;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
 import org.apache.tuscany.sca.core.scope.ScopeContainer;
 import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
 
@@ -32,6 +36,7 @@
 public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent, ScopedRuntimeComponent {
     protected RuntimeComponentContext componentContext;
     protected ImplementationProvider implementationProvider;
+    protected List<PolicyProvider> policyProviders = new ArrayList<PolicyProvider>();
     protected ScopeContainer scopeContainer;
     protected boolean started;
 
@@ -77,5 +82,13 @@
      */
     public void setComponentContext(RuntimeComponentContext componentContext) {
         this.componentContext = componentContext;
+    }
+
+    public void addPolicyProvider(PolicyProvider policyProvider) {
+        policyProviders.add(policyProvider);
+    }
+
+    public List<PolicyProvider> getPolicyProviders() {
+        return policyProviders;
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java Fri Mar  7 10:48:00 2008
@@ -22,23 +22,26 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implements RuntimeComponentReference {
-    private List<RuntimeWire> wires;
-    private Map<Binding, ReferenceBindingProvider> bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
+    private ArrayList<RuntimeWire> wires;
+    private HashMap<Binding, ReferenceBindingProvider> bindingProviders =
+        new HashMap<Binding, ReferenceBindingProvider>();
+    private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
 
     private RuntimeComponent component;
+
     public RuntimeComponentReferenceImpl() {
         super();
     }
@@ -96,10 +99,24 @@
      */
     @Override
     public Object clone() throws CloneNotSupportedException {
-        RuntimeComponentReferenceImpl ref = (RuntimeComponentReferenceImpl) super.clone();
+        RuntimeComponentReferenceImpl ref = (RuntimeComponentReferenceImpl)super.clone();
         ref.wires = null;
         ref.bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
+        ref.policyProviders = new HashMap<Binding, List<PolicyProvider>>();
         return ref;
+    }
+
+    public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+        List<PolicyProvider> providers = policyProviders.get(binding);
+        if (providers == null) {
+            providers = new ArrayList<PolicyProvider>();
+            policyProviders.put(binding, providers);
+        }
+        providers.add(policyProvider);
+    }
+
+    public List<PolicyProvider> getPolicyProviders(Binding binding) {
+        return policyProviders.get(binding);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java Fri Mar  7 10:48:00 2008
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
@@ -30,15 +29,18 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 import org.osoa.sca.ServiceRuntimeException;
 
 public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements RuntimeComponentService {
-    private List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
-    private List<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
-    private Map<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
+    private ArrayList<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+    private ArrayList<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
+    private HashMap<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
+    private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+
     public RuntimeComponentServiceImpl() {
         super();
     }
@@ -71,10 +73,10 @@
                 throw new ServiceRuntimeException(e);
             }
         }
-        
+
         return wire;
     }
-    
+
     public List<RuntimeWire> getCallbackWires() {
         return callbackWires;
     }
@@ -129,10 +131,23 @@
     @Override
     public Object clone() throws CloneNotSupportedException {
         RuntimeComponentServiceImpl clone = (RuntimeComponentServiceImpl)super.clone();
-        clone.bindingProviders =
-            (Map<Binding, ServiceBindingProvider>)((HashMap<Binding, ServiceBindingProvider>)bindingProviders).clone();
-        clone.wires = (List<RuntimeWire>)((ArrayList<RuntimeWire>)wires).clone();
-        clone.callbackWires = (List<RuntimeWire>)((ArrayList<RuntimeWire>)callbackWires).clone();
+        clone.bindingProviders = (HashMap<Binding, ServiceBindingProvider>)bindingProviders.clone();
+        clone.wires = (ArrayList<RuntimeWire>)wires.clone();
+        clone.callbackWires = (ArrayList<RuntimeWire>)callbackWires.clone();
+        clone.policyProviders = (HashMap<Binding, List<PolicyProvider>>)policyProviders.clone();
         return clone;
+    }
+
+    public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+        List<PolicyProvider> providers = policyProviders.get(binding);
+        if (providers == null) {
+            providers = new ArrayList<PolicyProvider>();
+            policyProviders.put(binding, providers);
+        }
+        providers.add(policyProvider);
+    }
+
+    public List<PolicyProvider> getPolicyProviders(Binding binding) {
+        return policyProviders.get(binding);
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java Fri Mar  7 10:48:00 2008
@@ -35,12 +35,14 @@
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.invocation.Phase;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 import org.apache.tuscany.sca.runtime.EndpointReference;
@@ -89,7 +91,8 @@
                            InterfaceContractMapper interfaceContractMapper,
                            WorkScheduler workScheduler,
                            RuntimeWireProcessor wireProcessor,
-                           MessageFactory messageFactory, ConversationManager conversationManager) {
+                           MessageFactory messageFactory,
+                           ConversationManager conversationManager) {
         super();
         this.wireSource = source;
         this.wireTarget = target;
@@ -161,7 +164,7 @@
                 if (operation.isNonBlocking()) {
                     addNonBlockingInterceptor(reference, refBinding, chain);
                 }
-                addBindingInterceptor(reference, refBinding, chain, operation);
+                addReferenceBindingInterceptor(reference, refBinding, chain, operation);
                 chains.add(chain);
             }
         } else {
@@ -209,6 +212,36 @@
     }
 
     /**
+     * Add the interceptor for a reference binding
+     * 
+     * @param reference
+     * @param binding
+     * @param chain
+     * @param operation
+     */
+    private void addReferenceBindingInterceptor(ComponentReference reference,
+                                                Binding binding,
+                                                InvocationChain chain,
+                                                Operation operation) {
+        ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+        if (provider != null) {
+            Invoker invoker = provider.createInvoker(operation);
+            if (invoker != null) {
+                chain.addInvoker(invoker);
+            }
+        }
+        List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(binding);
+        if (pps != null) {
+            for (PolicyProvider p : pps) {
+                Interceptor interceptor = p.createInterceptor(operation);
+                if (interceptor != null) {
+                    chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+                }
+            }
+        }
+    }
+
+    /**
      * Add the interceptor for a binding
      * 
      * @param reference
@@ -216,20 +249,18 @@
      * @param chain
      * @param operation
      */
-    private void addBindingInterceptor(ComponentReference reference,
-                                       Binding binding,
-                                       InvocationChain chain,
-                                       Operation operation) {
-        try {
-            ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
-            if (provider != null) {
-                Invoker invoker = provider.createInvoker(operation);
-                if (invoker != null) {
-                    chain.addInvoker(invoker);
+    private void addServiceBindingInterceptor(ComponentReference service,
+                                              Binding binding,
+                                              InvocationChain chain,
+                                              Operation operation) {
+        List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(binding);
+        if (pps != null) {
+            for (PolicyProvider p : pps) {
+                Interceptor interceptor = p.createInterceptor(operation);
+                if (interceptor != null) {
+                    chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
                 }
             }
-        } catch (RuntimeException e) {
-            throw e;
         }
     }
 
@@ -265,7 +296,7 @@
             }
         }
     }
- 
+
     /**
      * Add the interceptor for a component implementation
      * 
@@ -283,6 +314,15 @@
             Invoker invoker = null;
             invoker = provider.createInvoker((RuntimeComponentService)service, operation);
             chain.addInvoker(invoker);
+        }
+        List<PolicyProvider> pps = ((RuntimeComponent)component).getPolicyProviders();
+        if (pps != null) {
+            for (PolicyProvider p : pps) {
+                Interceptor interceptor = p.createInterceptor(operation);
+                if (interceptor != null) {
+                    chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+                }
+            }
         }
     }
 

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java Fri Mar  7 10:48:00 2008
@@ -21,6 +21,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.assembly.ConfiguredOperation;
@@ -40,6 +41,8 @@
  * Processor to inject policy handling interceptor wheneve PolicySets are specified in a Java Implementation 
  */
 public class JavaPolicyHandlingRuntimeWireProcessor implements RuntimeWireProcessor {
+    private final static Logger logger = Logger.getLogger(JavaPolicyHandlingRuntimeWireProcessor.class.getName());
+
     public JavaPolicyHandlingRuntimeWireProcessor() {
         super();
     }
@@ -49,69 +52,70 @@
         if (!(contract instanceof RuntimeComponentReference)) {
             return;
         }*/
-        
+
         RuntimeComponent component = wire.getTarget().getComponent();
-        if ( component != null && component.getImplementation() instanceof JavaImplementation ) {
+        if (component != null && component.getImplementation() instanceof JavaImplementation) {
             JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
-            if ( javaImpl instanceof PolicySetAttachPoint ) {
+            if (javaImpl instanceof PolicySetAttachPoint) {
                 PolicyHandler policyHandler = null;
                 List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
                 PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;
-                
+
                 try {
                     //for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
-                    for ( PolicySet policySet : component.getPolicySets() ) {
-                        policyHandler = 
+                    for (PolicySet policySet : component.getPolicySets()) {
+                        policyHandler =
                             PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
-                        if ( policyHandler != null ) {
+                        if (policyHandler != null) {
                             policyHandler.setUp(javaImpl);
                             implPolicyHandlers.add(policyHandler);
                         } else {
                             //FIXME: to be removed after the PolicyHandler story has crystalized..
                             //maybe replace with exception then...
-                            System.out.println("No PolicyHandler registered for PolicySet - " + policySet.getName());
+                            logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
                         }
-                    }    
-                    
+                    }
+
                     List<PolicyHandler> applicablePolicyHandlers = null;
-                    for (InvocationChain chain : wire.getInvocationChains() ) {
+                    for (InvocationChain chain : wire.getInvocationChains()) {
                         applicablePolicyHandlers = new ArrayList<PolicyHandler>();
-                        if ( javaImpl instanceof OperationsConfigurator ) {
+                        if (javaImpl instanceof OperationsConfigurator) {
                             String operationName = chain.getTargetOperation().getName();
                             OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
-                            for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
-                                if ( confOp.getName().equals(operationName)) {
-                                    for ( PolicySet policySet : confOp.getPolicySets() ) {
-                                        policyHandler = 
-                                            PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
-                                        if ( policyHandler != null ) {
+                            for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+                                if (confOp.getName().equals(operationName)) {
+                                    for (PolicySet policySet : confOp.getPolicySets()) {
+                                        policyHandler =
+                                            PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
+                                                .getPolicyHandlerClassNames());
+                                        if (policyHandler != null) {
                                             policyHandler.setUp(javaImpl);
                                             applicablePolicyHandlers.add(policyHandler);
                                         } else {
-                                            System.out.println("WARNING : No PolicyHandler registered for " + policySet);
+                                            logger.warning("No PolicyHandler registered for " + policySet);
                                         }
                                     }
                                     break;
                                 }
                             }
-                            
+
                             //if no policies have been specified at the operation level then simply
                             //apply whatever is specified for the implementation level
-                            if ( applicablePolicyHandlers.isEmpty() ) {
+                            if (applicablePolicyHandlers.isEmpty()) {
                                 applicablePolicyHandlers = implPolicyHandlers;
                             }
                         }
-                        
-                        if ( !applicablePolicyHandlers.isEmpty() ) {
+
+                        if (!applicablePolicyHandlers.isEmpty()) {
                             String phase =
-                                (wire.getSource().getContract() instanceof ComponentReference)
-                                    ? Phase.REFERENCE_POLICY : Phase.SERVICE_POLICY;
+                                (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_POLICY
+                                    : Phase.SERVICE_POLICY;
 
                             chain.addInterceptor(phase, new PolicyHandlingInterceptor(chain.getTargetOperation(),
                                                                                       applicablePolicyHandlers));
                         }
                     }
-                } catch ( Exception e ) {
+                } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
             }

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingImplementationPolicyProvider implements PolicyProvider {
+    private RuntimeComponent component;
+    private Implementation implementation;
+
+    public JDKLoggingImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+        super();
+        this.component = component;
+        this.implementation = implementation;
+    }
+
+    private String getContext() {
+        return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
+    }
+
+    private PolicySet findPolicySet() {
+        for (PolicySet ps : component.getApplicablePolicySets()) {
+            for (Object p : ps.getPolicies()) {
+                if (JDKLoggingPolicy.class.isInstance(p)) {
+                    return ps;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+     */
+    public Interceptor createInterceptor(Operation operation) {
+        PolicySet ps = findPolicySet();
+        return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+     */
+    public String getPhase() {
+        return Phase.SERVICE_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java (original)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java Fri Mar  7 10:48:00 2008
@@ -20,38 +20,63 @@
 
 import java.util.logging.Level;
 
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
 /**
  * Implementation for policies that could be injected as parameter
  * into the axis2config.
  */
-public class JDKLoggingPolicy {
+public class JDKLoggingPolicy implements Policy {
+    private static final QName JDK_LOGGING_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jdkLogger");
+
     private String loggerName;
     private String resourceBundleName;
     private Level logLevel;
     private boolean useParentHandlers = false;
-    
+
     public String getLoggerName() {
         return loggerName;
     }
+
     public void setLoggerName(String loggerName) {
         this.loggerName = loggerName;
     }
+
     public Level getLogLevel() {
         return logLevel;
     }
+
     public void setLogLevel(Level logLevel) {
         this.logLevel = logLevel;
     }
+
     public String getResourceBundleName() {
         return resourceBundleName;
     }
+
     public void setResourceBundleName(String resourceBundleName) {
         this.resourceBundleName = resourceBundleName;
     }
+
     public boolean isUseParentHandlers() {
         return useParentHandlers;
     }
+
     public void setUseParentHandlers(boolean useParentHandlers) {
         this.useParentHandlers = useParentHandlers;
+    }
+
+    public QName getSchemaName() {
+        return JDK_LOGGING_POLICY_QNAME;
+    }
+
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
     }
 }

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,129 @@
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ */
+public class JDKLoggingPolicyInterceptor implements Interceptor {
+    public static final String loggingPolicy = "JDKLoggingPolicy";
+    public static final QName policySetQName = new QName(Constants.SCA10_TUSCANY_NS, loggingPolicy);
+    private Logger logger = null;
+
+    private Invoker next;
+    private Operation operation;
+    private PolicySet policySet = null;
+    private String context;
+
+    public JDKLoggingPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+        super();
+        this.operation = operation;
+        this.policySet = policySet;
+        this.context = context;
+        init();
+    }
+
+    private final void init() {
+        if (policySet != null) {
+            JDKLoggingPolicy policy = (JDKLoggingPolicy)policySet.getPolicies().get(0);
+            logger = Logger.getLogger(policy.getLoggerName());
+            logger.setLevel(policy.getLogLevel());
+            logger.setUseParentHandlers(policy.isUseParentHandlers());
+
+            boolean found = false;
+            for (Handler handler : logger.getHandlers()) {
+                if (handler instanceof ConsoleHandler) {
+                    found = true;
+                    break;
+                }
+            }
+
+            if (!found) {
+                ConsoleHandler consoleHandler = new ConsoleHandler();
+                consoleHandler.setLevel(Level.ALL);
+                logger.addHandler(consoleHandler);
+            }
+        }
+    }
+
+    public Message invoke(Message msg) {
+        if (logger == null) {
+            return getNext().invoke(msg);
+        }
+        Object msgBody = msg.getBody();
+        if (msgBody instanceof Object[]) {
+            logger.logp(Level.INFO, context, "", "Invoking operation - " + operation.getName());
+
+            StringBuffer sb = new StringBuffer();
+            if (msgBody == null) {
+                sb.append("");
+            } else {
+                Object[] args = (Object[])msgBody;
+                for (int i = 0; i < args.length; i++) {
+                    sb.append(args[i]);
+                    if (i != args.length - 1) {
+                        sb.append(", ");
+                    }
+                }
+            }
+
+            Object[] logParams = new Object[] {operation.getName(), sb.toString()};
+            logger.logp(Level.FINER, context, "", "Invoking operation {0} with arguments {1}", logParams);
+        }
+
+        Message responseMsg = null;
+        try {
+            responseMsg = getNext().invoke(msg);
+            return responseMsg;
+        } catch (RuntimeException e) {
+            logger.logp(Level.SEVERE, context, "", "Exception thrown from operation - " + operation.getName(), e);
+            throw e;
+        } finally {
+            if (responseMsg != null) {
+                Object[] logParams = new Object[] {operation.getName(), responseMsg.getBody()};
+                logger.logp(Level.INFO, context, "", "Returned from operation - " + operation.getName());
+                logger.logp(Level.FINER, context, "", "Returning from operation {0} with return value {1}", logParams);
+            }
+        }
+    }
+
+    public Invoker getNext() {
+        return next;
+    }
+
+    public void setNext(Invoker next) {
+        this.next = next;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingPolicyProviderFactory implements PolicyProviderFactory<JDKLoggingPolicy> {
+    private ExtensionPointRegistry registry;
+    
+    public JDKLoggingPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        this.registry = registry;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+     */
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+        return new JDKLoggingImplementationPolicyProvider(component, implementation);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+                                                        RuntimeComponentReference reference,
+                                                        Binding binding) {
+        return new JDKLoggingReferencePolicyProvider(component, reference, binding);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+                                                      RuntimeComponentService service,
+                                                      Binding binding) {
+        return new JDKLoggingServicePolicyProvider(component, service, binding);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+     */
+    public Class getModelType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingReferencePolicyProvider implements PolicyProvider {
+    private RuntimeComponent component;
+    private RuntimeComponentReference reference;
+    private Binding binding;
+
+    public JDKLoggingReferencePolicyProvider(RuntimeComponent component,
+                                             RuntimeComponentReference reference,
+                                             Binding binding) {
+        super();
+        this.component = component;
+        this.reference = reference;
+        this.binding = binding;
+    }
+
+    private PolicySet findPolicySet() {
+        if (binding instanceof PolicySetAttachPoint) {
+            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (JDKLoggingPolicy.class.isInstance(p)) {
+                        return ps;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    private String getContext() {
+        return "component.reference: " + component.getURI()
+            + "#"
+            + reference.getName()
+            + "("
+            + binding.getClass().getName()
+            + ")";
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+     */
+    public Interceptor createInterceptor(Operation operation) {
+        PolicySet ps = findPolicySet();
+        return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+     */
+    public String getPhase() {
+        return Phase.REFERENCE_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingServicePolicyProvider implements PolicyProvider {
+    private RuntimeComponent component;
+    private RuntimeComponentService service;
+    private Binding binding;
+
+    public JDKLoggingServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
+        super();
+        this.component = component;
+        this.service = service;
+        this.binding = binding;
+    }
+
+    private PolicySet findPolicySet() {
+        if (binding instanceof PolicySetAttachPoint) {
+            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (JDKLoggingPolicy.class.isInstance(p)) {
+                        return ps;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    private String getContext() {
+        return "component.service: " + component.getURI()
+            + "#"
+            + service.getName()
+            + "("
+            + binding.getClass().getName()
+            + ")";
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+     */
+    public Interceptor createInterceptor(Operation operation) {
+        PolicySet ps = findPolicySet();
+        return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+     */
+    public String getPhase() {
+        return Phase.SERVICE_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory (added)
+++ incubator/tuscany/java/sca/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory Fri Mar  7 10:48:00 2008
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License. 
+
+# Implementation class for the policy extension
+org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProviderFactory;model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy

Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionImplementationPolicyProvider implements PolicyProvider {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+
+    public TransactionImplementationPolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+        super();
+        this.helper = helper;
+        this.policySets = attachPoint.getApplicablePolicySets();
+    }
+
+    public Interceptor createInterceptor(Operation operation) {
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, false, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.IMPLEMENTATION_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java Fri Mar  7 10:48:00 2008
@@ -23,7 +23,6 @@
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
 
 /**
  * @version $Rev$ $Date$
@@ -39,10 +38,10 @@
             TransactionManager transactionManager = registry.getExtensionPoint(TransactionManager.class);
             if (transactionManager != null) {
                 // The transaction manage is provided by the hosting environment
-                RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
-                    registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
-                TransactionManagerHelper helper = new TransactionManagerHelper(transactionManager);
-                wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+//                RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+//                    registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+//                TransactionManagerHelper helper = new TransactionManagerHelper(transactionManager);
+//                wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
                 return;
             }
         }
@@ -54,10 +53,10 @@
         }
         if (registry != null) {
             registry.addExtensionPoint(wrapper.getTransactionManager());
-            RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
-                registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
-            TransactionManagerHelper helper = new TransactionManagerHelper(wrapper.getTransactionManager());
-            wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+//            RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+//                registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+//            TransactionManagerHelper helper = new TransactionManagerHelper(wrapper.getTransactionManager());
+//            wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
         }
     }
 
@@ -68,6 +67,7 @@
         try {
             if (wrapper != null) {
                 wrapper.stop();
+                wrapper = null;
             }
             if (registry != null && wrapper != null) {
                 registry.removeExtensionPoint(wrapper.getTransactionManager());

Modified: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java (original)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java Fri Mar  7 10:48:00 2008
@@ -22,13 +22,14 @@
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
 
 /**
  * The model for Tuscany transaction policy
  * 
  * @version $Rev$ $Date$
  */
-public interface TransactionPolicy {
+public interface TransactionPolicy extends Policy {
     QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "transactionPolicy");
 
     enum Action {

Modified: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java?rev=634776&r1=634775&r2=634776&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java (original)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java Fri Mar  7 10:48:00 2008
@@ -19,10 +19,13 @@
 
 package org.apache.tuscany.sca.policy.transaction;
 
+import javax.xml.namespace.QName;
+
 /**
  * @version $Rev$ $Date$
  */
 public class TransactionPolicyImpl implements TransactionPolicy {
+    private boolean unresolved;
     private int transactionTimeout = 1200;
     private Action action = Action.PROPAGATE;
 
@@ -40,5 +43,17 @@
 
     public void setAction(Action policy) {
         this.action = policy;
+    }
+
+    public QName getSchemaName() {
+        return NAME;
+    }
+
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
     }
 }

Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.transaction;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProviderFactory implements PolicyProviderFactory<TransactionPolicy> {
+    private TransactionManagerHelper helper;
+
+    public TransactionPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        TransactionManager tm = registry.getExtensionPoint(TransactionManager.class);
+        this.helper = new TransactionManagerHelper(tm);
+    }
+    
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+     */
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+        if (component instanceof PolicySetAttachPoint) {
+            return new TransactionImplementationPolicyProvider(helper, (PolicySetAttachPoint)component);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+                                                        RuntimeComponentReference reference,
+                                                        Binding binding) {
+        if (binding instanceof PolicySetAttachPoint) {
+            return new TransactionReferencePolicyProvider(helper, (PolicySetAttachPoint)binding);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+                                                      RuntimeComponentService service,
+                                                      Binding binding) {
+        if (binding instanceof PolicySetAttachPoint) {
+            return new TransactionServicePolicyProvider(helper, (PolicySetAttachPoint)binding);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+     */
+    public Class<TransactionPolicy> getModelType() {
+        return TransactionPolicy.class;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionReferencePolicyProvider implements PolicyProvider {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+
+    public TransactionReferencePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+        super();
+        this.helper = helper;
+        this.policySets = attachPoint.getApplicablePolicySets();
+    }
+
+    public Interceptor createInterceptor(Operation operation) {
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.REFERENCE_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java?rev=634776&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java Fri Mar  7 10:48:00 2008
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionServicePolicyProvider implements PolicyProvider {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+
+    public TransactionServicePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+        super();
+        this.helper = helper;
+        this.policySets = attachPoint.getApplicablePolicySets();
+    }
+
+    public Interceptor createInterceptor(Operation operation) {
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.SERVICE_POLICY;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org