tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r567421 - in /incubator/tuscany/java/sca: modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/ modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/ modules/core/src/main/java/org/apach...
Date Sun, 19 Aug 2007 16:19:47 GMT
Author: slaws
Date: Sun Aug 19 09:19:44 2007
New Revision: 567421

URL: http://svn.apache.org/viewvc?view=rev&rev=567421
Log:
Fix url style in calculator-distributed test 
some tidying of distributed support

Removed:
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/BindingNotDistributedException.java
Modified:
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java
    incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java Sun Aug 19 09:19:44 2007
@@ -25,6 +25,12 @@
 import org.apache.tuscany.sca.runtime.EndpointReference;
 import org.osoa.sca.ServiceUnavailableException;
 
+/**
+ * A wrapper for the Axis2BindingInvoker that ensures that the url of the target
+ * service is correct by looking it up in the service registry if it is not provided
+ * 
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
 public class Axis2SCABindingInvoker implements Interceptor {
 
     private Invoker axis2Invoker;
@@ -42,12 +48,15 @@
         return null;
     }
 
+    /**
+     * Fix up the URL for the message. The "to" EndPoint comes from the wire
+     * target and needs to b replaced with the endpoint from the registry. 
+     * The default URL for an Endpoint URI where there is no 
+     * target component or service information, as in the case of a 
+     * wire crossing a node boundary, is "/"
+     */
     public Message invoke(Message msg) {
-        // fix up the URL for the message. The "to" EndPoint comes from the wire
-        // target and needs to b replaced with the endpoint from the registry
-        // The default URL for an Endpoint URI where there is no 
-        // target component or service information, as in the case of a 
-        // wire crossing a node boundary, is "/"
+
         EndpointReference ep = msg.getTo();
         
         if ((ep == null) || 

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java Sun Aug 19 09:19:44 2007
@@ -34,6 +34,8 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
 /**
+ * The factory for the Axis2 based implementation of the distributed sca binding
+ * 
  * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
  */
 public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java Sun Aug 19 09:19:44 2007
@@ -47,6 +47,10 @@
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 /**
+ * The reference binding provider for the remote sca binding implementation. Relies on the 
+ * binding-ws-axis implementation for sending messages to remote services to this provider
+ * just uses the ws-axis provider. 
+ * 
  * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
  */
 public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider2 {
@@ -64,20 +68,20 @@
     private EndpointReference serviceEPR = null;
 
     public Axis2SCAReferenceBindingProvider(RuntimeComponent component,
-                                              RuntimeComponentReference reference,
-                                              DistributedSCABinding binding,
-                                              ServletHost servletHost,
-                                              MessageFactory messageFactory) {
+                                            RuntimeComponentReference reference,
+                                            DistributedSCABinding binding,
+                                            ServletHost servletHost,
+                                            MessageFactory messageFactory) {
         this.component = component;
         this.reference = reference;
         this.binding = binding.getSCABinding();
         this.servletHost = servletHost;
         this.messageFactory = messageFactory;
         
-        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
-        
         // fix up the minimal things required to get the ws binding going. 
         
+        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+       
         // Turn the java interface contract into a wsdl interface contract
         InterfaceContract contract = reference.getInterfaceContract();
         if ((contract instanceof JavaInterfaceContract)) {
@@ -106,7 +110,6 @@
     }
 
     public Invoker createInvoker(Operation operation) {
-        //return axisReferenceBindingProvider.createInvoker(operation);
         return new Axis2SCABindingInvoker(this, axisReferenceBindingProvider.createInvoker(operation));
     }
 
@@ -119,6 +122,12 @@
         }
     }
     
+    /**
+     * Uses the distributed domain service discovery feature to locate remote
+     * service endpoints
+     * 
+     * @return An EPR for the target service that this reference refers to 
+     */
     public EndpointReference getServiceEndpoint(){
         
         if ( serviceEPR == null ){
@@ -151,10 +160,13 @@
     }    
 
     public void start() {
+        // Try and resolve the service endpoint just in case it is available now
         getServiceEndpoint();
+        axisReferenceBindingProvider.start();
     }
 
     public void stop() {
+        axisReferenceBindingProvider.stop();
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java Sun Aug 19 09:19:44 2007
@@ -51,6 +51,9 @@
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 /**
+ * The service binding provider for the remote sca binding implementation. Relies on the 
+ * binding-ws-axis implementation for providing a remote message endpoint for this service
+ * 
  * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
  */
 public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider2 {
@@ -78,9 +81,9 @@
         this.servletHost = servletHost;
         this.messageFactory = messageFactory;
         
-        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+        // fix up the minimal things required to get the ws binding going.
         
-        // fix up the minimal things required to get the ws binding going. 
+        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
         
         // Turn the java interface contract into a wsdl interface contract
         InterfaceContract contract = service.getInterfaceContract();

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java Sun Aug 19 09:19:44 2007
@@ -33,100 +33,95 @@
 /**
  * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
  * just used to locate the remote binding extension and pass the SCA binding to the remote
- * extentsion. It isn't used in the model itself
+ * extension. It isn't used in the model itself
  * 
  * @version $Rev: 564307 $ $Date: 2007-08-09 18:48:29 +0100 (Thu, 09 Aug 2007) $
  */
 public class DistributedSCABindingImpl implements DistributedSCABinding {
     
     private SCABinding scaBinding;
-
-    
-    public Component getComponent() {
-        return null;
-    }
-    
-    public void setComponent(Component component) {
-    }
-
-    public String getName() {
-        return null;
-    }
-
-    public String getURI() {
-        return null;
-    }
-
-    public void setName(String name) {
-    }
-
-    public void setURI(String uri) {
-    }
-
-    public List<Object> getExtensions() {
-        return null;
-    }
     
-    public boolean isUnresolved() {
-        return false;
+    /**
+     * Getter for the wrapped sca binding model object
+     * 
+     * @return the sca binding model element
+     */
+    public SCABinding getSCABinding(){
+        return scaBinding;
     }
     
-    public void setUnresolved(boolean unresolved) {
-    }
-
     /**
-     * @see java.lang.Object#clone()
+     * Setter for the wrapped sca binding model element
+     * 
+     * @param the sca binding model element
      */
-    @Override
-    public Object clone() throws CloneNotSupportedException {
-        return super.clone();
+    public void setSCABinging(SCABinding scaBinding){
+        this.scaBinding = scaBinding;
     }
 
+    
+    // Operation implementations provided to make this class a 
+    // valid Binding
+    
     /**
-     * @return the targetComponent
+     * Returns the binding URI.
+     * 
+     * @return the binding uri
      */
-    public Component getTargetComponent() {
+    public String getURI(){
         return null;
     }
 
     /**
-     * @param targetComponent the targetComponent to set
+     * Sets the binding URI.
+     * 
+     * @param uri the binding uri
      */
-    public void setTargetComponent(Component targetComponent) {
+    public void setURI(String uri){
     }
 
     /**
-     * @return the targetComponentService
+     * Returns the binding name.
+     * 
+     * @return the binding name
      */
-    public ComponentService getTargetComponentService() {
+    public String getName(){
         return null;
     }
 
     /**
-     * @param targetComponentService the targetComponentService to set
+     * Sets the binding name.
+     * 
+     * @param name the binding name
      */
-    public void setTargetComponentService(ComponentService targetComponentService) {
-        
+    public void setName(String name){
     }
-
+    
     /**
-     * @return the targetBinding
+     * Returns a list of extension objects contained in this model object.
+     * 
+     * @return a list of extension objects container in this model object
      */
-    public Binding getTargetBinding() {
+    public List<Object> getExtensions(){
         return null;
     }
 
     /**
-     * @param targetBinding the targetBinding to set
+     * Returns true if the model element is unresolved.
+     * 
+     * @return true if the model element is unresolved.
      */
-    public void setTargetBinding(Binding targetBinding) {
+    public boolean isUnresolved(){
+        return false;
     }
-    
-    public SCABinding getSCABinding(){
-        return scaBinding;
+
+    /**
+     * Sets whether the model element is unresolved.
+     * 
+     * @param unresolved whether the model element is unresolved
+     */
+    public void setUnresolved(boolean unresolved){
     }
     
-    public void setSCABinging(SCABinding scaBinding){
-        this.scaBinding = scaBinding;
-    }
+
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingInvoker.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingInvoker.java Sun Aug 19 09:19:44 2007
@@ -22,6 +22,12 @@
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
 
+/**
+ * The local SCA Binding invoker implementation. It is a no op as it passes message
+ * invocations onto the next invoker in the chain. 
+ * 
+ * * @version $Rev$
+ */
 public class RuntimeSCABindingInvoker implements Interceptor {
 
     private Invoker next;

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java Sun Aug 19 09:19:44 2007
@@ -28,6 +28,8 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 
 /**
+ * The local SCA Binding provider implementation. It is not currently used. 
+ * 
  * @version $Rev$ $Date$
  */
 public class RuntimeSCABindingProvider implements ReferenceBindingProvider {

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java Sun Aug 19 09:19:44 2007
@@ -38,6 +38,8 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
 /**
+ * The factory for creating SCA Binding providers
+ * 
  * @version $Rev$ $Date$
  */
 public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
@@ -52,18 +54,8 @@
     public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
                                                                    RuntimeComponentReference reference,
                                                                    SCABinding binding) {
-        RuntimeSCAReferenceBindingProvider provider = null;
-               
-        try {
-            provider = new RuntimeSCAReferenceBindingProvider(extensionPoints, component, reference, binding);
-        } catch (Exception ex) {
-            // The binding could not create a reference provider because either
-            // the sca binding does not have remote support or the interface
-            // in question is not remotable null will be returned
-            // TODO - throw and appropriate exception here SCARuntime?
-        }
-       
-        return provider;
+              
+        return  new RuntimeSCAReferenceBindingProvider(extensionPoints, component, reference, binding);
     }
 
     public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java Sun Aug 19 09:19:44 2007
@@ -36,6 +36,12 @@
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 /**
+ * The sca reference binding provider mediates between the twin requirements of 
+ * local sca bindings and remote sca bindings. In the local case is does 
+ * very little. When the sca binding model is set as being remote (because a 
+ * reference target can't be resolved in the current model) this binding will 
+ * try and create a remote connection to it
+ * 
  * @version $Rev$ $Date$
  */
 public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvider2 {
@@ -50,36 +56,56 @@
     public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
                                               RuntimeComponent component,
                                               RuntimeComponentReference reference,
-                                              SCABinding binding) throws BindingNotDistributedException {
+                                              SCABinding binding) {
         this.reference = reference;
         this.binding = binding;
 
-        // look to see if a distributed SCA binding implementation has
-        // been included on the classpath. This will be needed by the 
-        // provider itself to do it's thing
-        ProviderFactoryExtensionPoint factoryExtensionPoint =
-            extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-        BindingProviderFactory<DistributedSCABinding> distributedProviderFactory =
-            (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
-                .getProviderFactory(DistributedSCABinding.class);
-
-        // if there is a wire to this service that crosses the node boundary 
+        // if there is a wire from this reference that crosses the node boundary 
+        // then we need to create a remote binding
         if (((WireableBinding)binding).isRemote() == true) {
-            // Make sure that we have a distributed sca binding and 
-            // that the interface is remoteable
+            
+            // look to see if a distributed SCA binding implementation has
+            // been included on the classpath. This will be needed by the 
+            // provider itself to do it's thing
+            ProviderFactoryExtensionPoint factoryExtensionPoint =
+                extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+            BindingProviderFactory<DistributedSCABinding> distributedProviderFactory =
+                (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+                    .getProviderFactory(DistributedSCABinding.class);
+            
+            // Check the things that will generally be required to set up a 
+            // distributed sca domain reference provider. I.e. make sure that we have a
+            // - distributed implementation of the sca binding available
+            // - distributed domain in which to look for remote endpoints 
+            // - remotable interface on the target service
+            if (distributedProviderFactory == null) {
+                throw new IllegalStateException("No distributed SCA binding available for component: "+
+                                                component.getName() +
+                                                " and reference: " + 
+                                                reference.getName());
+            }
+            
+            if (((SCABindingImpl)binding).getDistributedDomain() == null) {
+                throw new IllegalStateException("No distributed domain available for component: "+
+                        component.getName() +
+                        " and reference: " + 
+                        reference.getName());
+            }
+            
+            if (!reference.getInterfaceContract().getInterface().isRemotable()) {
+                throw new IllegalStateException("Reference interface not remoteable for component: "+
+                        component.getName() +
+                        " and reference: " + 
+                        reference.getName());
+            }
 
-            if ((distributedProviderFactory != null) && (((SCABindingImpl)binding).getDistributedDomain() != null)
-                && (reference.getInterfaceContract().getInterface().isRemotable())) {
-                DistributedSCABinding distributedBinding = new DistributedSCABindingImpl();
-                distributedBinding.setSCABinging(binding);
-
-                distributedProvider =
-                    (ReferenceBindingProvider2)distributedProviderFactory
-                        .createReferenceBindingProvider(component, reference, distributedBinding);
+            DistributedSCABinding distributedBinding = new DistributedSCABindingImpl();
+            distributedBinding.setSCABinging(binding);
+
+            distributedProvider =
+                (ReferenceBindingProvider2)distributedProviderFactory
+                    .createReferenceBindingProvider(component, reference, distributedBinding);
 
-            } else {
-                throw new BindingNotDistributedException();
-            }
         }
     }
 

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java Sun Aug 19 09:19:44 2007
@@ -35,6 +35,11 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
 /**
+ * The sca service binding provider mediates between the twin requirements of 
+ * local sca bindings and remote sca bindings. In the local case is does 
+ * very little. When the sca binding model is set as being remote this binding will 
+ * try and create a remote service endpoint for remote references to connect to 
+ * 
  * @version $Rev$ $Date$
  */
 public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider2 {
@@ -62,43 +67,67 @@
         // if there is potentially a wire to this service that crosses the node boundary 
         if (((WireableBinding)binding).isRemote()) {        
             // look to see if a distributed SCA binding implementation has
-            // been included on the classpath and store it if it has
-            ProviderFactoryExtensionPoint factoryExtensionPoint = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-            distributedProviderFactory = (BindingProviderFactory<DistributedSCABinding>)
-                                         factoryExtensionPoint.getProviderFactory(DistributedSCABinding.class);
-            
-            // if a distributed sca binding is available then create a nested provider to handle the remote case
-            if ((distributedProviderFactory != null) &&
-                (((SCABindingImpl)binding).getDistributedDomain() != null)){
-                distributedBinding = new DistributedSCABindingImpl();
-                distributedBinding.setSCABinging(binding);
-                
-                distributedProvider = (ServiceBindingProvider2)
-                                      distributedProviderFactory.createServiceBindingProvider(component, service, distributedBinding);
-                
-                // get the url out of the binding and send it to the registry if
-                // a distributed domain is configured
-                DistributedSCADomain distributedDomain = ((SCABindingImpl)binding).getDistributedDomain();
-                
-                if (distributedDomain != null){
-                    ServiceDiscovery serviceDiscovery = distributedDomain.getServiceDiscovery();
-                    
-                    // register endpoint twice to take account the formats 
-                    //  ComponentName
-                    //  ComponentName/ServiceName
-                    // TODO - Can;t we get this from somewhere? What happens with nested components. 
-                    serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
-                                                             distributedDomain.getNodeName(), 
-                                                             component.getName(), 
-                                                             SCABinding.class.getName(), 
-                                                             binding.getURI());
-                    serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
-                                                             distributedDomain.getNodeName(), 
-                                                             component.getName() + "/" + service.getName(), 
-                                                             SCABinding.class.getName(), 
-                                                             binding.getURI());
-                }   
+            // been included on the classpath. This will be needed by the 
+            // provider itself to do it's thing
+            ProviderFactoryExtensionPoint factoryExtensionPoint =
+                extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+            distributedProviderFactory =
+                (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+                    .getProviderFactory(DistributedSCABinding.class);      
+            
+            // Check the things that will generally be required to set up a 
+            // distributed sca domain reference provider. I.e. make sure that we have a
+            // - distributed implementation of the sca binding available
+            // - distributed domain in which to look for remote endpoints 
+            // - remotable interface on the service
+            if (distributedProviderFactory == null) {
+                throw new IllegalStateException("No distributed SCA binding available for component: "+
+                                                component.getName() +
+                                                " and service: " + 
+                                                service.getName());
+            }
+            
+            if (((SCABindingImpl)binding).getDistributedDomain() == null) {
+                throw new IllegalStateException("No distributed domain available for component: "+
+                                                component.getName() +
+                                                " and service: " + 
+                                                service.getName());
             }
+            
+            if (!service.getInterfaceContract().getInterface().isRemotable()) {
+                throw new IllegalStateException("Reference interface not remoteable for component: "+
+                                                component.getName() +
+                                                " and service: " + 
+                                                service.getName());
+            }           
+            
+            //  create a nested provider to handle the remote case
+            distributedBinding = new DistributedSCABindingImpl();
+            distributedBinding.setSCABinging(binding);
+            
+            distributedProvider = (ServiceBindingProvider2)
+                                  distributedProviderFactory.createServiceBindingProvider(component, service, distributedBinding);
+            
+            // get the url out of the binding and send it to the registry if
+            // a distributed domain is configured
+            DistributedSCADomain distributedDomain = ((SCABindingImpl)binding).getDistributedDomain();
+            
+            ServiceDiscovery serviceDiscovery = distributedDomain.getServiceDiscovery();
+            
+            // register endpoint twice to take account the formats 
+            //  ComponentName
+            //  ComponentName/ServiceName
+            // TODO - Can't we get this from somewhere? What happens with nested components. 
+            serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
+                                                     distributedDomain.getNodeName(), 
+                                                     component.getName(), 
+                                                     SCABinding.class.getName(), 
+                                                     binding.getURI());
+            serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
+                                                     distributedDomain.getNodeName(), 
+                                                     component.getName() + "/" + service.getName(), 
+                                                     SCABinding.class.getName(), 
+                                                     binding.getURI());
         } 
     }
 

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java Sun Aug 19 09:19:44 2007
@@ -31,7 +31,7 @@
 import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
 
 /**
- * Represents an SCA binding.
+ * he assemly mode object for an SCA binding.
  * 
  * @version $Rev$ $Date$
  */
@@ -47,47 +47,78 @@
     
     private DistributedSCADomain distributedDomain;
 
-    
-    public void setDistributedDomain(DistributedSCADomain distributedDomain){
-        this.distributedDomain = distributedDomain;
-    }
-    
-    public DistributedSCADomain getDistributedDomain(){
-        return distributedDomain;
-    }
-
-   
     /**
      * Constructs a new SCA binding.
      */
     protected SCABindingImpl() {
     }
     
+    // SCA Binding operations
+    
+    /**
+     * Setters for the binding name. Defaults to the
+     * name of the service or reference with which the binding is
+     * associated
+     * 
+     * @return the biniding name
+     */
     public String getName() {
         return name;
     }
+    
+    /**
+     * Setter for the binding name
+     * 
+     * @param name the binding name
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
 
+    /**
+     * Getters for the binding URI. The computed URI for the 
+     * service that the reference is targetting or which the service represents
+     * depending on whether the biding is associated with a reference or
+     * service
+     * 
+     * @return the binding uri
+     */
     public String getURI() {
         return uri;
     }
 
-    public void setName(String name) {
-        this.name = name;
-    }
-
+    /**
+     * Setter for the binding uri
+     * 
+     * @para uri the binding uri
+     */
     public void setURI(String uri) {
         this.uri = uri;
     }
-
-
+    
+    /**
+     * Returns a list of extension objects contained in this model object.
+     * 
+     * @return a list of extension objects container in this model object
+     */
     public List<Object> getExtensions() {
         return extensions;
     }
     
+    /**
+     * Returns true if the model element is unresolved.
+     * 
+     * @return true if the model element is unresolved.
+     */
     public boolean isUnresolved() {
         return false;
     }
     
+    /**
+     * Sets whether the model element is unresolved.
+     * 
+     * @param unresolved whether the model element is unresolved
+     */    
     public void setUnresolved(boolean unresolved) {
     }
 
@@ -98,6 +129,8 @@
     public Object clone() throws CloneNotSupportedException {
         return super.clone();
     }
+    
+    // Wireable binding operations
 
     /**
      * @return the targetComponent
@@ -142,8 +175,9 @@
     }
     
     /**
-     * If a reference targets in a component running in a separate
-     * node then its binding will be set remote until runtime
+     * If a reference targets a component running in a separate
+     * node then its binding will be set remote to kick
+     * off runtime resolution
      * 
      * @param isRemote
      */
@@ -156,5 +190,16 @@
      */
     public boolean isRemote(){
         return isRemote;
+    }
+    
+    // Operations needed by the distributed SCA binding
+    // TODO - these are really runtime reference so need a better place for them 
+    
+    public void setDistributedDomain(DistributedSCADomain distributedDomain){
+        this.distributedDomain = distributedDomain;
+    }
+    
+    public DistributedSCADomain getDistributedDomain(){
+        return distributedDomain;
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java Sun Aug 19 09:19:44 2007
@@ -270,11 +270,10 @@
                             reference.getBindings().add(clonedSCABinding);
                         } else {
                             throw new IllegalStateException(
-                                                            "No distributed SCA Binding implementation found for reference: " + reference
-                                                                .getName()
+                                                            "Unable to create a distributed SCA binding provider for reference: " + 
+                                                             reference.getName()
                                                                 + " and target: "
-                                                                + service.getName()
-                                                                + " or the referenced interface is not remoteable");
+                                                                + service.getName());
                         }
                     }
                 }

Modified: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java (original)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java Sun Aug 19 09:19:44 2007
@@ -62,6 +62,12 @@
         this.nodeName = nodeName;
     }    
     
+    /**
+     * Returns the name of the distributed domain that this node
+     * is part of.
+     * 
+     * @return the domain name
+     */
     public String getDomainName(){
         return domainName;
     }
@@ -70,14 +76,23 @@
         this.domainName = domainName;
     }    
     
-    public void setLocalDomain(EmbeddedSCADomain localDomain){
-        this.domain = localDomain;
-    }
-    
+    /**
+     * Return an interface for registering and looking up remote services
+     * 
+     * @return The service discovery interface
+     */    
     public ServiceDiscovery getServiceDiscovery(){
         return null;
     }
     
+    /**
+     * Associates this distributed domain representation to all of the 
+     * sca binding objects within a composite. The sca binding uses this
+     * distributed domain representation for domain level operations like
+     * find the enpoints of remote services. 
+     * 
+     * @param composite the composite that this object will be added to 
+     */      
     public void addDistributedDomainToBindings(Composite composite){
         // traverse the composite adding in the distributed domain
         // reference into all sca bindings. 
@@ -121,6 +136,10 @@
                 }  
             }   
         }        
+    }    
+    
+    public void setManagementDomain(EmbeddedSCADomain localDomain){
+        this.domain = localDomain;
     }    
     
 }

Modified: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java (original)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java Sun Aug 19 09:19:44 2007
@@ -83,16 +83,16 @@
             } else {
                 throw new ActivationException("Can't find the management contribution on the classpath");
             }
-                        
+        } catch(ActivationException ex) {
+            throw ex;                        
         } catch(Exception ex) {
-            System.err.println("Exception when creating management components " + ex.getMessage());
-            domain = null;
             throw new ActivationException(ex);
         } 
 
     }
     
-    public SCADomain attachDomain(DistributedSCADomain distributedDomain){
+    public SCADomain attachDomain(DistributedSCADomain distributedDomain)
+      throws ActivationException {
         this.distributedDomain = (DistributedSCADomainImpl) distributedDomain;
         domainName = distributedDomain.getDomainName();
         
@@ -102,16 +102,15 @@
             // create and start the local domain
             domain = new EmbeddedSCADomain(cl, domainName);   
             domain.start();
-                     
+        } catch(ActivationException ex) {
+            throw ex;                     
         } catch(Exception ex) {
-            System.err.println("Exception when creating domain " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            domain = null;
+            throw new ActivationException(ex);
         }
         
         // add local information into the distributed domain
         this.distributedDomain.setNodeName(nodeName);
-        this.distributedDomain.setLocalDomain(management); 
+        this.distributedDomain.setManagementDomain(management); 
         
         // add domain information into the management components that need it
         
@@ -120,8 +119,8 @@
     }
       
     
-    protected void loadContribution(String domainName, URL contributionURL){
-        
+    protected void loadContribution(String domainName, URL contributionURL)
+      throws ActivationException {        
         try {        
             // Get ready to add contributions to the domain
             ContributionService contributionService = domain.getContributionService();
@@ -139,59 +138,47 @@
             
             distributedDomain.addDistributedDomainToBindings(composite);
             
-            domain.getCompositeActivator().activate(composite);            
+            domain.getCompositeActivator().activate(composite);     
+        } catch(ActivationException ex) {
+            throw ex;            
         } catch(Exception ex) {
-            System.err.println("Exception when loading contribution " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            domain = null;
+            throw new ActivationException(ex);
         }             
     }
     
-    public void addContribution(String domainName, String contributionURLString) {
+    public void addContribution(String domainName, URL contributionURL) 
+      throws ActivationException {
         try {
             
-            URL contributionURL = null;
             
-            if (contributionURLString == null){
+            if (contributionURL == null){
                 // find the current directory as a URL. This is where our contribution 
                 // will come from
                 contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/");
-            } else {
-                contributionURL = new URL(contributionURLString);
-            }
+            } 
          
-            loadContribution(domainName, contributionURL);
+            addContribution(domainName, contributionURL);
         
+        } catch(ActivationException ex) {
+            throw ex;
         } catch(Exception ex) {
-            System.err.println("Exception when adding contribution " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            domain = null;
+            throw new ActivationException(ex);
         }         
         
     }
     
-    public void start(){
-        
-        // start the domain composite
-        try {        
-            for (Composite composite : domain.getDomainComposite().getIncludes() ){
-                domain.getCompositeActivator().start(composite);
-            }
-        } catch(Exception ex) {
-            System.err.println("Exception when loading contribution " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            domain = null;
-        } 
+    public void start()
+      throws ActivationException {
+      
+        for (Composite composite : domain.getDomainComposite().getIncludes() ){
+            domain.getCompositeActivator().start(composite);
+        }
     }
 
-    public void stop(){
-        try {
-            domain.stop();
-        } catch(Exception ex) {
-            System.err.println("Exception when stopping domain " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            domain = null;
-        }        
+    public void stop() 
+        throws ActivationException {
+        domain.stop();
+       
     }
     
 }

Modified: incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java (original)
+++ incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java Sun Aug 19 09:19:44 2007
@@ -39,15 +39,32 @@
      * @return the node name
      */
     public abstract String getNodeName();
-    
     public abstract void setNodeName(String nodeName);    
     
+    /**
+     * Returns the name of the distributed domain that this node
+     * is part of.
+     * 
+     * @return the domain name
+     */
     public abstract String getDomainName();
-    
     public abstract void setDomainName(String domainName);
     
+    /**
+     * Associates this distributed domain representation to all of the 
+     * sca binding objects within a composite. The sca binding uses this
+     * distributed domain representation for domain level operations like
+     * find the enpoints of remote services. 
+     * 
+     * @param composite the composite that this object will be added to 
+     */    
     public void addDistributedDomainToBindings(Composite composite);
     
+    /**
+     * Return an interface for registering and looking up remote services
+     * 
+     * @return The service discovery interface
+     */
     public abstract ServiceDiscovery getServiceDiscovery();
     
 }

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java?view=diff&rev=567421&r1=567420&r2=567421
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java Sun Aug 19 09:19:44 2007
@@ -38,7 +38,7 @@
         System.out.println("Setting up distributed nodes");
         
         File currentDirectory = new File (".");
-        String contributionURL = null;
+        URL contributionURL = null;
 
         // Create the distributed domain representation
         distributedDomain = new DistributedSCADomainMemoryImpl(DEFULT_DOMAIN_NAME);
@@ -46,22 +46,22 @@
         // create the node that runs the 
         // calculator component
         nodeA = new EmbeddedNode("nodeA");
-        domainA = nodeA.attachDomain(distributedDomain);
-        contributionURL = "file:/" + currentDirectory.getCanonicalPath() + "/src/main/resources/nodeA/";        
+        domainA = nodeA.attachDomain(distributedDomain); 
+        contributionURL = Thread.currentThread().getContextClassLoader().getResource("nodeA/");
         nodeA.addContribution(DEFULT_DOMAIN_NAME, contributionURL);
 
         // create the node that runs the 
         // add component
         nodeB = new EmbeddedNode("nodeB");
         domainB = nodeB.attachDomain(distributedDomain);
-        contributionURL = "file:/" + currentDirectory.getCanonicalPath() + "/src/main/resources/nodeB/";
+        contributionURL = Thread.currentThread().getContextClassLoader().getResource("nodeB/");
         nodeB.addContribution(DEFULT_DOMAIN_NAME, contributionURL);         
  
         // create the node that runs the 
         // subtract component      
         nodeC = new EmbeddedNode("nodeC");
         domainC = nodeC.attachDomain(distributedDomain);
-        contributionURL = "file:/" + currentDirectory.getCanonicalPath() + "/src/main/resources/nodeC/";
+        contributionURL = Thread.currentThread().getContextClassLoader().getResource("nodeC/");
         nodeC.addContribution(DEFULT_DOMAIN_NAME, contributionURL);  
      
         



---------------------------------------------------------------------
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