tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r1173361 - in /tuscany/sca-java-2.x/trunk/modules: binding-sca-runtime/META-INF/ binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/ core-spi/src/main/java/org/apache/tuscany/sca/runtime/ core/src/main/java/org/ap...
Date Tue, 20 Sep 2011 20:55:28 GMT
Author: rfeng
Date: Tue Sep 20 20:55:28 2011
New Revision: 1173361

URL: http://svn.apache.org/viewvc?rev=1173361&view=rev
Log:
Use domain info to decide if the binding.sca needs to be distributed

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
    tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF Tue Sep 20
20:55:28 2011
@@ -13,6 +13,7 @@ Import-Package: javax.xml.namespace,
  org.apache.tuscany.sca.assembly.builder;version="2.0.0",
  org.apache.tuscany.sca.assembly.xml;version="2.0.0";resolution:=optional,
  org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
+ org.apache.tuscany.sca.context;version="2.0.0",
  org.apache.tuscany.sca.contribution;version="2.0.0";resolution:=optional,
  org.apache.tuscany.sca.contribution.processor;version="2.0.0",
  org.apache.tuscany.sca.contribution.resolver;version="2.0.0";resolution:=optional,

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
Tue Sep 20 20:55:28 2011
@@ -20,8 +20,6 @@
 package org.apache.tuscany.sca.binding.sca.provider;
 
 import java.io.StringReader;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
@@ -46,10 +44,8 @@ import org.apache.tuscany.sca.policy.Pol
 import org.apache.tuscany.sca.provider.ProviderFactory;
 import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
 import org.apache.tuscany.sca.provider.SCABindingMapper;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.DomainRegistry;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
 import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
 import org.oasisopen.sca.ServiceRuntimeException;
@@ -64,7 +60,7 @@ public class DefaultSCABindingMapper imp
     protected StAXArtifactProcessorExtensionPoint processors;
     protected QName defaultMappedBinding;
     protected QName defaultLocalBinding;
-    protected boolean supportsDistributedSCA;
+    // protected boolean supportsDistributedSCA;
 
     public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map<String, String>
attributes) {
         this.registry = registry;
@@ -72,7 +68,7 @@ public class DefaultSCABindingMapper imp
         processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         defaultMappedBinding = getDefaultMappedBinding(attributes);
         defaultLocalBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.local");
-        supportsDistributedSCA = isDistributed();
+        // supportsDistributedSCA = isDistributed();
     }
 
     protected QName getDefaultMappedBinding(Map<String, String> attributes) {
@@ -140,21 +136,6 @@ public class DefaultSCABindingMapper imp
         return true;
     }
 
-    // FIXME: [rfeng] This is a HACK to check if we should make binding.sca remotable
-    // by checking if we have distributed domain registry present
-    protected boolean isDistributed() {
-        DomainRegistryFactoryExtensionPoint factories =
-            registry.getExtensionPoint(DomainRegistryFactoryExtensionPoint.class);
-        List<DomainRegistryFactory> list = factories.getDomainRegistryFactories();
-        if (list.size() == 1) {
-            String[] schemes = list.get(0).getSupportedSchemes();
-            if (Arrays.asList(schemes).contains("local")) {
-                return false;
-            }
-        }
-        return true;
-    }
-
     public RuntimeEndpoint map(RuntimeEndpoint endpoint) {
         QName bindingType = chooseBinding(endpoint);
         if (!isBindingSupported(bindingType)) {
@@ -264,11 +245,13 @@ public class DefaultSCABindingMapper imp
      * @return
      */
     protected QName chooseBinding(RuntimeEndpoint endpoint) {
+        DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry();
+        boolean distributed = domainRegistry.isDistributed();
         InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract();
         if(interfaceContract != null
            && interfaceContract.getInterface() != null
            && interfaceContract.getInterface().isRemotable()
-           && supportsDistributedSCA
+           && distributed
            && isBindingSupported(defaultMappedBinding)) {
         	return defaultMappedBinding;
         }
@@ -282,6 +265,8 @@ public class DefaultSCABindingMapper imp
      * @return
      */
     protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
+        DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
+        boolean distributed = domainRegistry.isDistributed();
         if(endpointReference.getTargetEndpoint().isRemote()) {
             RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
             if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable())
{
@@ -291,7 +276,7 @@ public class DefaultSCABindingMapper imp
                         + ref.getName());
             }
             
-            if(supportsDistributedSCA && isBindingSupported(defaultMappedBinding))
{
+            if(distributed && isBindingSupported(defaultMappedBinding)) {
                 return defaultMappedBinding;
             }
         }

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
Tue Sep 20 20:55:28 2011
@@ -195,4 +195,9 @@ public abstract class BaseDomainRegistry
         }
         return domainComposite;
     }
+
+    @Override
+    public boolean isDistributed() {
+        return true;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
Tue Sep 20 20:55:28 2011
@@ -34,6 +34,12 @@ import org.apache.tuscany.sca.assembly.E
  */
 public interface DomainRegistry {
     /**
+     * Indicate if the domain is distributed
+     * @return
+     */
+    boolean isDistributed();
+    
+    /**
      * Add an enpoint to the registry. If the endpoint URI is the same as an existing endpoint
in the registry,
      * the existing one will be updated
      * @param endpoint

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
Tue Sep 20 20:55:28 2011
@@ -265,4 +265,9 @@ public class DomainRegistryImpl extends 
         }
         return null;
     }
+
+    @Override
+    public boolean isDistributed() {
+        return false;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java?rev=1173361&r1=1173360&r2=1173361&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
Tue Sep 20 20:55:28 2011
@@ -939,5 +939,10 @@ public class DeployerImpl implements Dep
             // TODO Auto-generated method stub
             return null;
         }
+
+        @Override
+        public boolean isDistributed() {
+            return false;
+        }
     }
 }



Mime
View raw message