You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/09/10 19:34:38 UTC

svn commit: r441977 - in /incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby: RubyServiceProxy.h RubyServiceWrapper.cpp

Author: jsdelfino
Date: Sun Sep 10 10:34:38 2006
New Revision: 441977

URL: http://svn.apache.org/viewvc?view=rev&rev=441977
Log:
Added code to initialize Ruby reference attributes in RubyServiceWrapper

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h?view=diff&rev=441977&r1=441976&r2=441977
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h Sun Sep 10 10:34:38 2006
@@ -29,6 +29,8 @@
 
 using namespace tuscany::sca::model;
 
+#include <ruby.h>
+
 
 namespace tuscany
 {
@@ -67,13 +69,23 @@
                  */
                 virtual ~RubyServiceProxy();
     
+                /**
+                 * Returns the Ruby value of the proxy
+                 */
+                 VALUE getValue() const { return value; };
+            
             private:
     
                 /**
                  * The target service wrapper
                  */
                  ServiceWrapper* serviceWrapper;
-            
+
+                /**
+                 * The Ruby value of the proxy
+                 */
+                 VALUE value;
+                 
             };
             
         } // End namespace ruby

Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp?view=diff&rev=441977&r1=441976&r2=441977
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp Sun Sep 10 10:34:38 2006
@@ -26,9 +26,12 @@
 #include "tuscany/sca/model/Composite.h"
 #include "tuscany/sca/model/Service.h"
 #include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/ruby/model/RubyImplementation.h"
 #include "tuscany/sca/ruby/model/RubyServiceBinding.h"
+#include "tuscany/sca/ruby/RubyServiceProxy.h"
 
 namespace tuscany
 {
@@ -78,6 +81,18 @@
 
                     // Create a new instance of the Ruby implementation class
                     VALUE instance = rb_class_new_instance(0, NULL, implementation->getImplementationClass());
+
+                    // Set all the references and properties
+                    const Component::REFERENCE_MAP& references = component->getReferences();
+                    Component::REFERENCE_MAP::const_iterator refiter = references.begin();
+                    for (int ri=0; ri< references.size(); ri++)
+                    {
+                        Reference* reference = refiter->second;
+                        RubyServiceProxy* proxy = (RubyServiceProxy*)reference->getBinding()->getServiceProxy();
+                        VALUE referenceValue = proxy->getValue();
+                        rb_iv_set(instance, refiter->first.c_str(), referenceValue);
+                        refiter++;
+                    }
                     
                     // Get the ID of the specified method
                     ID method = rb_intern(operation.getName().c_str());



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