tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r572283 - in /incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo: EchoBinding.java impl/EchoBindingImpl.java impl/EchoBindingProcessor.java provider/EchoReferenceBindingProvider.java
Date Mon, 03 Sep 2007 11:02:40 GMT
Author: jsdelfino
Date: Mon Sep  3 04:02:39 2007
New Revision: 572283

URL: http://svn.apache.org/viewvc?rev=572283&view=rev
Log:
Changed EchoBinding sample to implement PolicySetAttachPoint without polluting its Binding
interface.

Modified:
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java?rev=572283&r1=572282&r2=572283&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
(original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
Mon Sep  3 04:02:39 2007
@@ -20,11 +20,10 @@
 package echo;
 
 import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 
 /**
  * A model for the sample Echo binding.
  */
-public interface EchoBinding extends Binding, PolicySetAttachPoint {
+public interface EchoBinding extends Binding {
     
 }

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java?rev=572283&r1=572282&r2=572283&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
(original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
Mon Sep  3 04:02:39 2007
@@ -25,13 +25,14 @@
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 
 import echo.EchoBinding;
 
 /**
  * Implementation of the Echo binding model.
  */
-public class EchoBindingImpl implements EchoBinding {
+public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint {
     
     private String name;
     private String uri;

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java?rev=572283&r1=572282&r2=572283&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
(original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
Mon Sep  3 04:02:39 2007
@@ -36,6 +36,7 @@
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 
 import echo.EchoBinding;
 import echo.EchoBindingFactory;
@@ -99,22 +100,23 @@
     }
 
     public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException
{
+        PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding;
         List<Intent> requiredIntents = new ArrayList<Intent>();
         Intent resolvedIntent = null;
-        for ( Intent intent : echoBinding.getRequiredIntents() ) {
+        for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
             resolvedIntent = resolver.resolveModel(Intent.class, intent);
             requiredIntents.add(resolvedIntent);
         }
-        echoBinding.getRequiredIntents().clear();
-        echoBinding.getRequiredIntents().addAll(requiredIntents);
+        policySetAttachPoint.getRequiredIntents().clear();
+        policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
         
         List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
         PolicySet resolvedPolicySet = null;
-        for ( PolicySet policySet : echoBinding.getPolicySets() ) {
+        for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
             resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
             resolvedPolicySets.add(resolvedPolicySet);
         }
-        echoBinding.getPolicySets().clear();
-        echoBinding.getPolicySets().addAll(resolvedPolicySets);
+        policySetAttachPoint.getPolicySets().clear();
+        policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
     }
 }

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java?rev=572283&r1=572282&r2=572283&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
(original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
Mon Sep  3 04:02:39 2007
@@ -19,14 +19,9 @@
 
 package echo.provider;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -53,11 +48,13 @@
         if (isCallback) {
             throw new UnsupportedOperationException();
         } else {
-            if ( !binding.getPolicySets().isEmpty() ){
-                return new EchoBindingPoliciedInvoker(((PolicySetAttachPoint)binding).getPolicySets());
-            } else {
-                return new EchoBindingInvoker();
+            if (binding instanceof PolicySetAttachPoint) {
+                PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding;
+                if ( !policySetAttachPoint.getPolicySets().isEmpty() ){
+                    return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets());
+                }
             }
+            return new EchoBindingInvoker();
         }
     }
 



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


Mime
View raw message