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 2007/04/13 23:51:39 UTC

svn commit: r528679 - in /incubator/tuscany/java/sca/modules: core/src/main/java/org/apache/tuscany/core/deployer/ core/src/main/java/org/apache/tuscany/core/runtime/ interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/ interface/src...

Author: rfeng
Date: Fri Apr 13 14:51:38 2007
New Revision: 528679

URL: http://svn.apache.org/viewvc?view=rev&rev=528679
Log:
Relax the remotable operation mapping

Modified:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/JavaInterfaceUtil.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/DefaultInterfaceContractMapper.java

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=528679&r1=528678&r2=528679
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Fri Apr 13 14:51:38 2007
@@ -36,7 +36,6 @@
 import org.apache.tuscany.assembly.Multiplicity;
 import org.apache.tuscany.assembly.SCABinding;
 import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.core.builder.BuilderRegistryImpl;
 import org.apache.tuscany.core.builder.ComponentNotFoundException;
 import org.apache.tuscany.core.builder.IncompatibleInterfacesException;
 import org.apache.tuscany.core.builder.WireCreationException;
@@ -125,7 +124,7 @@
 
         // build runtime artifacts
         build(componentDef, deploymentContext);
-        
+
         Collection<Component> components = deploymentContext.getComponents().values();
         for (Component toRegister : components) {
             try {
@@ -134,7 +133,7 @@
                 throw new BuilderInstantiationException("Error registering component", e);
             }
         }
-        
+
         List<SCAObject> scaObjects = componentManager.getSCAObjects();
         List<Object> modelObjects = componentManager.getModelObjects();
         for (int i = 0; i < scaObjects.size(); i++) {
@@ -157,7 +156,6 @@
             }
         }
 
-
         return components;
     }
 
@@ -285,10 +283,15 @@
         }
         URI sourceURI = service.getUri();
         URI targetURI = URI.create(target.getUri() + "#" + definition.getPromotedService().getName());
+        InterfaceContract sourceContract = definition.getInterfaceContract();
+        InterfaceContract targetContract = definition.getPromotedService().getService().getInterfaceContract();
+        if (sourceContract == null) {
+            sourceContract = targetContract;
+        }
+
         // TODO if no binding, do local
         for (ServiceBinding binding : service.getServiceBindings()) {
-            Wire wire = createWire(sourceURI, targetURI, definition.getInterfaceContract(), definition
-                .getPromotedService().getService().getInterfaceContract(), binding.getBindingType());
+            Wire wire = createWire(sourceURI, targetURI, sourceContract, targetContract, binding.getBindingType());
             binding.setWire(wire);
             if (postProcessorRegistry != null) {
                 postProcessorRegistry.process(wire);

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=528679&r1=528678&r2=528679
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java Fri Apr 13 14:51:38 2007
@@ -255,6 +255,7 @@
     protected Bootstrapper createBootstrapper() {
         TuscanyManagementService tms = (TuscanyManagementService)getManagementService();
         componentManager = new ComponentManagerImpl(tms);
+        extensionRegistry.addExtensionPoint(ComponentManager.class, componentManager);
         return new DefaultBootstrapper(getMonitorFactory(), xmlFactory, componentManager);
     }
 

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/JavaInterfaceUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/JavaInterfaceUtil.java?view=diff&rev=528679&r1=528678&r2=528679
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/JavaInterfaceUtil.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/interfacedef/java/impl/JavaInterfaceUtil.java Fri Apr 13 14:51:38 2007
@@ -49,6 +49,14 @@
      */
     public static  Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
         String name = operation.getName();
+        if(operation.getInterface().isRemotable()) {
+            for(Method m: implClass.getMethods()) {
+                if(m.getName().equals(name)) {
+                    return m;
+                }
+            }
+            throw new NoSuchMethodException(name);
+        }
         Class<?>[] paramTypes = getPhysicalTypes(operation);
         return implClass.getMethod(name, paramTypes);
     }

Modified: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/DefaultInterfaceContractMapper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/DefaultInterfaceContractMapper.java?view=diff&rev=528679&r1=528678&r2=528679
==============================================================================
--- incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/DefaultInterfaceContractMapper.java (original)
+++ incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/DefaultInterfaceContractMapper.java Fri Apr 13 14:51:38 2007
@@ -55,7 +55,7 @@
         if (!source.getName().equals(target.getName())) {
             return false;
         }
-        
+
         // FIXME: We need to deal with wrapped<-->unwrapped conversion
 
         // Check output type
@@ -144,12 +144,15 @@
                     return false;
                 }
             }
-            if (!operation.equals(targetOperation)) {
-                if (!silent) {
-                    throw new IncompatibleInterfaceContractException("Target operations are not compatible", source,
-                                                                     target);
-                } else {
-                    return false;
+            if (!source.getInterface().isRemotable()) {
+                // FIXME: for remotable operation, only compare name for now
+                if (!operation.equals(targetOperation)) {
+                    if (!silent) {
+                        throw new IncompatibleInterfaceContractException("Target operations are not compatible",
+                                                                         source, target);
+                    } else {
+                        return false;
+                    }
                 }
             }
         }



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