tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r440667 - in /incubator/tuscany/cpp/sca: ./ runtime/extensions/ runtime/extensions/ruby/ runtime/extensions/ruby/src/ runtime/extensions/ruby/src/tuscany/ runtime/extensions/ruby/src/tuscany/sca/ runtime/extensions/ruby/src/tuscany/sca/ruby...
Date Wed, 06 Sep 2006 09:27:10 GMT
Author: jsdelfino
Date: Wed Sep  6 02:27:09 2006
New Revision: 440667

URL: http://svn.apache.org/viewvc?view=rev&rev=440667
Log:
First pass at a Ruby component implementation extension

Added:
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/Makefile.am
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd   (with props)
Modified:
    incubator/tuscany/cpp/sca/configure.ac
    incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am

Modified: incubator/tuscany/cpp/sca/configure.ac
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/configure.ac?view=diff&rev=440667&r1=440666&r2=440667
==============================================================================
--- incubator/tuscany/cpp/sca/configure.ac (original)
+++ incubator/tuscany/cpp/sca/configure.ac Wed Sep  6 02:27:09 2006
@@ -52,6 +52,8 @@
                  runtime/extensions/ws/service/axis2c/src/Makefile
                  runtime/extensions/python/Makefile
                  runtime/extensions/python/src/Makefile
+                 runtime/extensions/ruby/Makefile
+                 runtime/extensions/ruby/src/Makefile
                  runtime/core/test/Makefile
                  runtime/core/test/CustomerInfo/Makefile
                  runtime/core/test/MyValue/Makefile

Modified: incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am?view=diff&rev=440667&r1=440666&r2=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am Wed Sep  6 02:27:09 2006
@@ -1 +1 @@
-SUBDIRS = cpp ws python
+SUBDIRS = cpp ws python ruby

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/Makefile.am?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/Makefile.am Wed Sep  6 02:27:09 2006
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+datadir=$(prefix)/extensions/ruby
+
+nobase_data_DATA = xsd/*.xsd
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am Wed Sep  6 02:27:09 2006
@@ -0,0 +1,26 @@
+libdir=$(prefix)/extensions/ruby/lib
+lib_LTLIBRARIES = libtuscany_sca_ruby.la
+includedir=$(prefix)/extensions/ruby/include
+nobase_include_HEADERS = \
+tuscany/sca/ruby/*.h \
+tuscany/sca/ruby/model/*.h
+
+libtuscany_sca_ruby_la_SOURCES = \
+tuscany/sca/ruby/RubyExtension.cpp \
+tuscany/sca/ruby/RubyImplementationExtension.cpp \
+tuscany/sca/ruby/RubyServiceProxy.cpp \
+tuscany/sca/ruby/RubyServiceWrapper.cpp \
+tuscany/sca/ruby/model/RubyImplementation.cpp \
+tuscany/sca/ruby/model/RubyReferenceBinding.cpp \
+tuscany/sca/ruby/model/RubyServiceBinding.cpp
+
+libtuscany_sca_ruby_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
+	-L$(top_builddir)/runtime/core/src -ltuscany_sca \
+	-L${RUBY_LIB} -lruby
+
+INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \
+           -I${TUSCANY_SDOCPP}/include \
+           -I${RUBY_INCLUDE}
+                   
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+                   
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+*   
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+#include "tuscany/sca/ruby/RubyExtension.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/ruby/RubyImplementationExtension.h"
+
+
+extern "C"
+{
+    #if defined(WIN32) || defined(_WINDOWS)
+    __declspec(dllexport) 
+    #endif
+        void tuscany_sca_extension_initialize()
+    {
+        tuscany::sca::ruby::RubyExtension::initialize();
+    }
+}
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            // ===================================================================
+            // Constructor for the RubyExtension class. 
+            // ===================================================================
+            RubyExtension::RubyExtension()
+            { 
+                LOGENTRY(1, "RubyExtension::constructor");     
+                LOGEXIT(1, "RubyExtension::constructor");
+            }
+            
+            // ===================================================================
+            // Destructor for the RubyExtension class.
+            // ===================================================================
+            RubyExtension::~RubyExtension()
+            { 
+                LOGENTRY(1, "RubyExtension::destructor");;           
+                LOGEXIT(1, "RubyExtension::destructor");
+            }
+
+            void RubyExtension::initialize()
+            { 
+                LOGENTRY(1, "RubyExtension::initialize");;           
+                SCARuntime::getInstance()->registerImplementationExtension(new RubyImplementationExtension());
+                LOGEXIT(1, "RubyExtension::initialize");;           
+            }
+
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_rubyextension_h
+#define tuscany_sca_ruby_rubyextension_h
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            
+            class RubyExtension 
+            {
+            public:
+               /**
+                * Default constructor
+                */
+                RubyExtension();            
+                
+                /**
+                * Destructor
+                */
+                virtual ~RubyExtension();            
+
+                static void initialize();
+                
+            private:
+                
+            };
+            
+            
+        } // End namespace ruby       
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_rubyextension_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/ruby/RubyImplementationExtension.h"
+#include "tuscany/sca/ruby/model/RubyImplementation.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            // ===================================================================
+            // Constructor for the RubyImplementationExtension class. 
+            // ===================================================================
+            RubyImplementationExtension::RubyImplementationExtension()
+            { 
+                LOGENTRY(1, "RubyImplementationExtension::constructor");     
+                LOGEXIT(1, "RubyImplementationExtension::constructor");
+            }
+            
+            // ===================================================================
+            // Destructor for the RubyImplementationExtension class.
+            // ===================================================================
+            RubyImplementationExtension::~RubyImplementationExtension()
+            { 
+                LOGENTRY(1, "RubyImplementationExtension::destructor");;           
+                LOGEXIT(1, "RubyImplementationExtension::destructor");
+            }
+
+            const string RubyImplementationExtension::extensionName("ruby");
+            const string RubyImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RubyImplementation");
+
+            // ===================================================================
+            // loadModelElement - load the info from implementation.ruby 
+            // ===================================================================
+            ComponentType* RubyImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
+            {
+                string implType = scdlImplementation->getType().getName();
+                if (implType == "RubyImplementation")
+                {
+                    string module = scdlImplementation->getCString("module");
+                    string className = scdlImplementation->getCString("class");
+                    string script = scdlImplementation->getCString("script");
+
+                    RubyImplementation* rubyImpl = new RubyImplementation(module, className, script);
+                    
+                    return rubyImpl;
+                }
+                else
+                {
+                    return NULL;
+                }
+            }
+
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_rubyimplementationextension_h
+#define tuscany_sca_ruby_rubyimplementationextension_h
+
+#include "tuscany/sca/extension/ImplementationExtension.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            
+            class RubyImplementationExtension : public ImplementationExtension 
+            {
+            public:
+            /**
+            * Default constructor
+                */
+                RubyImplementationExtension();
+                
+                /**
+                * Destructor
+                */
+                virtual ~RubyImplementationExtension();            
+                
+                /**
+                * return the name of the extension
+                */
+                virtual const string& getExtensionName() {return extensionName;}
+                
+                /**
+                * return the QName of schema elemant for this implementation extension
+                * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.ruby")
+                */
+                virtual const string& getExtensionTypeQName() {return typeQName;}
+                
+                virtual ComponentType* getImplementation(Composite* composite, DataObjectPtr scdlImplementation);
+                
+            private:
+                static const string extensionName;
+                static const string typeQName;
+                
+            };
+            
+            
+        } // End namespace ruby       
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_rubyimplementationextension_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/ruby/RubyServiceProxy.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ComponentType.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/ruby/model/RubyImplementation.h"
+#include "tuscany/sca/ruby/model/RubyReferenceBinding.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            
+            // ============================
+            // Constructor: Create a proxy
+            // ============================
+            RubyServiceProxy::RubyServiceProxy(Reference* reference)
+                : ServiceProxy(reference)
+            {
+                LOGENTRY(1,"RubyServiceProxy::constructor");
+    
+                // ----------------------
+                // Get the component
+                // ----------------------
+                Component* component = reference->getComponent();
+                string name = reference->getType()->getName();
+                
+                // Get the service wrapper
+                RubyReferenceBinding* referenceBinding = (RubyReferenceBinding*)reference->getBinding();
+                
+                serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
+    
+                // getProxy and getProxies will return "this"
+                proxies.push_back(this);
+    
+                LOGEXIT(1,"RubyServiceProxy::constructor");
+            }
+            
+            // ============================
+            // Constructor: Create a proxy
+            // ============================
+            RubyServiceProxy::RubyServiceProxy(Service* service)
+                : ServiceProxy(0)
+            {
+                LOGENTRY(1,"RubyServiceProxy::constructor");
+                
+                // ----------------------
+                // Get the component
+                // ----------------------
+                Component* component = service->getComponent();
+                string name = service->getType()->getName();
+                
+                // Get the service wrapper
+                serviceWrapper = service->getBinding()->getServiceWrapper();
+    
+                // getProxy and getProxies will return "this"
+                proxies.push_back(this);
+    
+                LOGEXIT(1,"RubyServiceProxy::constructor");
+            }
+            
+            // ==========
+            // Destructor
+            // ==========
+            RubyServiceProxy::~RubyServiceProxy()
+            {
+                LOGENTRY(1,"RubyServiceProxy::destructor");
+                LOGEXIT(1,"RubyServiceProxy::destructor");
+            }
+            
+            ServiceProxy::PROXIES RubyServiceProxy::getProxies()
+            {
+                return proxies;
+            }
+            
+            void* RubyServiceProxy::getProxy()
+            {
+                if (proxies.size() != 0)
+                {
+                    return proxies[0];
+                }
+                else
+                {
+                    return NULL;
+                }
+            }
+    
+        } // End namespace ruby        
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_rubyserviceproxy_h
+#define tuscany_sca_ruby_rubyserviceproxy_h
+
+#include "tuscany/sca/export.h"
+#include "tuscany/sca/core/ServiceProxy.h" 
+#include "tuscany/sca/core/ServiceWrapper.h" 
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/Service.h"
+
+using namespace tuscany::sca::model;
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            
+            /**
+             * Holds a proxy for a given component and reference.
+             * The proxy which is held inside a ServiceProxy will be specific to the component
+             * and reference and will have been code generated and be contained in a dll 
+             * created by a developer of an SCA application.
+             */
+            class RubyServiceProxy : public ServiceProxy
+            {
+            public:
+                /**
+                 * Create a new service proxy for a reference. The proxy will contain a pointer to
+                 * the target ServiceWrapper.
+                 * @param reference The reference on the source component.
+                 * @param target The wrapper of the service which is wired to this reference.
+                 */
+                RubyServiceProxy(Reference* reference);
+    
+                /**
+                 * Create a new service proxy for a service. The proxy will contain a pointer to
+                 * the target ServiceWrapper.
+                 * @param reference The service on the target component.
+                 * @param target The wrapper of the target service.
+                 */
+                RubyServiceProxy(Service* service);
+    
+                /**
+                 * Destructor.
+                 */
+                virtual ~RubyServiceProxy();
+    
+                /**
+                 * Return an instance of the proxy created for this particular component and reference.
+                 * @return The proxy.
+                 */
+                virtual void* getProxy();
+                
+                /**
+                 * Return the proxies created for this particular component and reference.
+                 * @return The proxies.
+                 */
+                virtual PROXIES getProxies();
+    
+            private:
+    
+                /**
+                 * The target service wrapper
+                 */
+                 ServiceWrapper* serviceWrapper;
+            
+                /**
+                 * Holds the instances of the Ruby proxies.
+                 */ 
+                PROXIES proxies;
+    
+            };
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_rubyserviceproxy_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/ruby/RubyServiceWrapper.h"
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/util/Library.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/ruby/model/RubyImplementation.h"
+#include "tuscany/sca/ruby/model/RubyServiceBinding.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            
+            // ===========
+            // Constructor
+            // ===========
+            RubyServiceWrapper::RubyServiceWrapper(Service* service)
+                : ServiceWrapper(service)
+            {
+                LOGENTRY(1,"RubyServiceWrapper::constructor");
+    
+                component = service->getComponent();
+                interf = service->getType()->getInterface();
+                remotable = interf->isRemotable();
+                
+                // Initialize the Ruby runtime
+                ruby_init();
+                
+                // Execute the specified Ruby script
+                RubyImplementation* impl = (RubyImplementation*)component->getType();
+                if (impl->getScript() != "")
+                {
+                    string script = component->getComposite()->getRoot() + '/' + impl->getScript();
+                    rb_require((char *)script.c_str());
+                }
+                
+                LOGEXIT(1,"RubyServiceWrapper::constructor");
+                
+            }
+            
+            // ==========
+            // Destructor
+            // ==========
+            RubyServiceWrapper::~RubyServiceWrapper()
+            {
+                LOGENTRY(1,"RubyServiceWrapper::destructor");
+                LOGEXIT(1,"RubyServiceWrapper::destructor");
+            }
+            
+            // ======================================================================
+            // invoke: wrapper call to service with setting the component context
+            // ======================================================================
+            void RubyServiceWrapper::invoke(Operation& operation)
+            {
+                LOGENTRY(1,"RubyServiceWrapper::invoke");
+    
+                SCARuntime* runtime = SCARuntime::getInstance();
+                runtime->setCurrentComponent(component);
+                
+                try
+                {
+                    // Create a new instance of the component implementation class
+                    RubyImplementation* impl = (RubyImplementation*)component->getType();
+                    
+                    string expr = impl->getClass() + ".new";
+                    VALUE instance = rb_eval_string(expr.c_str());
+
+                    // Get the ID of the specified method
+                    ID method = rb_intern(operation.getName().c_str());
+
+                    // Convert C arguments to Ruby arguments
+                    VALUE *args = NULL;
+                    int n = operation.getNParms();
+                    if (n != 0)
+                    {
+                        args=new VALUE[n];
+                        
+                        for(int i = 0; i < operation.getNParms(); i++) 
+                        {
+                            VALUE value;
+                            
+                            Operation::Parameter& parm = operation.getParameter(i);
+                            switch(parm.getType())
+                            {
+                                case Operation::BOOL: 
+                                {
+                                    if( *(bool*)parm.getValue())
+                                    {
+                                        //boolean true
+                                        value = rb_int2inum(1);
+                                    }
+                                    else
+                                    {
+                                        value = rb_int2inum(0);
+                                    }
+                                    break;
+                                }
+                                case Operation::SHORT: 
+                                {
+                                    value = rb_int2inum(*(short*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::USHORT: 
+                                {
+                                    value = rb_uint2inum(*(unsigned short*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::LONG: 
+                                {
+                                    value = rb_int2inum(*(long*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::ULONG: 
+                                {
+                                    value = rb_uint2inum(*(unsigned long*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::FLOAT: 
+                                {
+                                    value = rb_dbl2big(*(float*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::DOUBLE: 
+                                {
+                                    value = rb_dbl2big(*(double*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::LONGDOUBLE: 
+                                {
+                                    value = rb_dbl2big(*(long double*)parm.getValue());
+                                    break;
+                                }
+                                case Operation::CHARS: 
+                                {
+                                    value = rb_str_new2(*(char**)parm.getValue());
+                                    break;
+                                }
+                                case Operation::STRING: 
+                                {
+                                    value = rb_str_new2((*(string*)parm.getValue()).c_str());
+                                    break;
+                                }
+                                default:
+                                {
+                                    //throw new ComponentInvocationException("Operation parameter type not supported");
+                                    std::cout << "Operation parameter type not supported" << std::endl;
+                                }
+                            }
+                            
+                            args[i] = value;
+                        }
+                    }                    
+
+                    
+                    // Invoke the specified method
+                    VALUE value;
+                    if (n == 0)
+                    {
+                        value = rb_funcall(instance, method, 0);
+                    }
+                    else
+                    {
+                        value = rb_funcall2(instance, method, n, args);
+                    }
+                    
+                    // Convert the result to a C result
+                    switch(operation.getReturnType())
+                    {
+                    case Operation::BOOL: 
+                        {
+                            *(bool*)operation.getReturnValue() = (rb_num2long(value)!=0);
+                            break;
+                        }
+                    case Operation::SHORT: 
+                        {
+                            *(short*)operation.getReturnValue() = (short) rb_num2long(value);
+                            break;
+                        }
+                    case Operation::LONG: 
+                        {
+                            *(long*)operation.getReturnValue() =  (long) rb_num2long(value);
+                            break;
+                        }
+                    case Operation::USHORT: 
+                        {
+                            *(unsigned short*)operation.getReturnValue() = (unsigned short) rb_num2ulong(value);
+                            break;
+                        }
+                    case Operation::ULONG: 
+                        {
+                            *(unsigned long*)operation.getReturnValue() = (unsigned long) rb_num2ulong(value);
+                            break;
+                        }
+                    case Operation::FLOAT: 
+                        {
+                            *(float*)operation.getReturnValue() = (float) rb_num2dbl(value);
+                            break;
+                        }
+                    case Operation::DOUBLE: 
+                        {
+                            *(double*)operation.getReturnValue() = (double) rb_num2dbl(value);
+                            break;
+                        }
+                    case Operation::LONGDOUBLE: 
+                        {
+                            *(long double*)operation.getReturnValue() = (long double) rb_num2dbl(value);
+                            break;
+                        }
+                    case Operation::CHARS: 
+                        {
+                            *(char**)operation.getReturnValue() = strdup(rb_string_value_cstr(&value));
+                            break;
+                        }
+                    case Operation::STRING: 
+                        {
+                            *(string*)operation.getReturnValue() = string(rb_string_value_cstr(&value));
+                            break;
+                        }
+                    default:;
+                    }
+                    
+                }
+                catch (...)
+                {
+                    runtime->unsetCurrentComponent();
+                    throw;
+                }
+                runtime->unsetCurrentComponent();
+                LOGEXIT(1,"RubyServiceWrapper::invoke");
+                
+            }
+            
+        } // End namespace ruby        
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_rubyservicewrapper_h
+#define tuscany_sca_ruby_rubyservicewrapper_h
+
+#include "tuscany/sca/export.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Interface.h"
+
+#include <ruby.h>
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            class RubyInterface;
+            
+            /**
+             * Wraps the service on a component implementation.
+             * This abstract class is extended by generated code which provides 
+             * the implementation of some of the methods. 
+             * An instance of this class wraps the actual component implementation which 
+             * has been written by a developer of an SCA application.
+             */
+            class SCA_API RubyServiceWrapper : public ServiceWrapper
+            {
+            public:
+
+                /**
+                 * Constructor.
+                 * @param target The component service to which this wrapper refers.
+                 */
+                RubyServiceWrapper(Service* service);
+    
+                /**
+                 * Destructor.
+                 */ 
+                virtual    ~RubyServiceWrapper();
+    
+                /**
+                 * All business method calls to the target component go through the invoke method.
+                 * @param operation The details of the method, paramaters and return value for the
+                 * business method to be called on the target component.
+                 */
+                virtual void invoke(Operation& operation);
+    
+            private:
+
+                /**
+                 * The component to which this wrapper refers.
+                 */
+                Component* component;
+    
+                /**
+                 * Set to true if the service is remotable.
+                 */
+                bool remotable;
+                
+                /**
+                 * A pointer to the interface which the service exposes.
+                 */
+                Interface* interf;
+
+            };
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_rubyservicewrapper_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ruby/model/RubyImplementation.h"
+#include "tuscany/sca/ruby/model/RubyServiceBinding.h"
+#include "tuscany/sca/ruby/model/RubyReferenceBinding.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/util/Utils.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+
+        namespace ruby
+        {
+
+            // Constructor
+            RubyImplementation::RubyImplementation(const string& module, const string& className, const string& script)
+                : ComponentType(script.substr(0, script.find_last_of('.'))),
+                    module(module), className(className), script(script)
+            {
+            }
+
+            RubyImplementation::~RubyImplementation()
+            {
+            }
+            
+            void RubyImplementation::initializeComponent(Component* component)
+            {
+                ComponentType::initializeComponent(component);
+                
+                // Create Ruby bindings for all the services
+                const Component::SERVICE_MAP& services = component->getServices();
+                Component::SERVICE_MAP::const_iterator iter = services.begin();
+                for (int i=0; i< services.size(); i++)
+                {
+                    Service *service = iter->second;
+                    RubyServiceBinding* binding = new RubyServiceBinding(service);
+                    service->setBinding(binding);
+                    iter++;
+                }
+                
+                // Create Ruby bindings for all the references
+                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;
+                    RubyReferenceBinding* binding = new RubyReferenceBinding(reference);
+                    reference->setBinding(binding);
+                    refiter++;
+                }
+            }
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_model_rubyimplementation_h
+#define tuscany_sca_ruby_model_rubyimplementation_h
+#include "tuscany/sca/model/ComponentType.h"
+
+#include <map>
+using std::map;
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            /**
+             * Holds information about an SCA implementation written in Ruby
+             */
+            class RubyImplementation : public ComponentType
+            {
+                
+            public:
+                /**
+                 * Constructor.
+                 * @param module Name of the Ruby module.
+                 * @param className Name of the Ruby implementation class.
+                 * @param script Path of the Ruby script.
+                 */
+                RubyImplementation(const string& module, const string& className, const string& script);
+                
+                /**
+                 * Destructor
+                 */
+                virtual ~RubyImplementation();
+
+                /**
+                 * Initialize a component of this type.
+                 * @param component The component to initialize.
+                 */
+                virtual void initializeComponent(Component* component);
+
+                /**
+                 * Returns the name of the Ruby module.
+                 * @return The name of the Ruby module.
+                 */
+                const string& getModule() const { return module; }
+
+                /**
+                 * Returns the name of Ruby class.
+                 * @return Name of the Ruby class.
+                 */
+                const string& getClass() const { return className; }
+
+                /**
+                 * Returns the path of the Ruby script.
+                 * @return The path of the Ruby script.
+                 */
+                const string& getScript() const { return script; }
+
+            private:
+                
+                /**
+                 * Name of the Ruby module.
+                 */
+                string module;
+
+                /**
+                 * Name of the Ruby class.
+                 */
+                string className;
+
+                /**
+                 * Path of the Ruby script.
+                 */
+                string script;
+
+            };
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_model_rubyimplementation_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ruby/model/RubyReferenceBinding.h"
+#include "tuscany/sca/ruby/RubyServiceProxy.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+
+            // Constructor
+            RubyReferenceBinding::RubyReferenceBinding(Reference* reference)
+                : ReferenceBinding(reference, ""), serviceProxy(NULL)
+            {
+            }
+            
+            // Destructor
+            RubyReferenceBinding::~RubyReferenceBinding()
+            {
+            }
+            
+            ServiceProxy* RubyReferenceBinding::getServiceProxy()
+            {
+                return serviceProxy;
+            }
+            
+            void RubyReferenceBinding::configure(ServiceBinding* binding)
+            {
+                targetServiceBinding = binding;
+                
+                serviceProxy = new RubyServiceProxy(getReference());
+            }
+                
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_model_rubyreferencebinding_h
+#define tuscany_sca_ruby_model_rubyreferencebinding_h
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            /**
+             * Information about a Ruby service binding for service or a reference.
+             */
+            class RubyReferenceBinding : public ReferenceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 */
+                RubyReferenceBinding(Reference* reference);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~RubyReferenceBinding();
+                            
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RubyImplementationBinding"; };
+                            
+                /**
+                 * Create a proxy representing the reference to the
+                 * client component.
+                 */
+                 virtual ServiceProxy* getServiceProxy();
+                                
+                 /**
+                  * Configure this binding from a service binding.
+                  */
+                  virtual void configure(ServiceBinding* serviceBinding);
+                  
+                 /**
+                  * Returns the target service binding.
+                  */
+                  ServiceBinding* getTargetServiceBinding() const { return targetServiceBinding; };
+                                
+            private:
+                
+                /**
+                 * The proxy representing the reference to the client
+                 * component.
+                 */
+                ServiceProxy* serviceProxy;
+                
+                /**
+                 * The service binding of the target
+                 */
+                ServiceBinding* targetServiceBinding; 
+            };
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_model_rubyreferencebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp Wed Sep  6 02:27:09 2006
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ruby/model/RubyServiceBinding.h"
+#include "tuscany/sca/ruby/RubyServiceWrapper.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+
+            // Constructor
+            RubyServiceBinding::RubyServiceBinding(Service* service)
+                : ServiceBinding(service, "")
+            {
+                serviceWrapper = new RubyServiceWrapper(service);
+            }
+
+            // Destructor
+            RubyServiceBinding::~RubyServiceBinding()
+            {
+            }
+            
+            ServiceWrapper* RubyServiceBinding::getServiceWrapper()
+            {
+                return (ServiceWrapper*)serviceWrapper;
+            }
+                
+        } // End namespace ws
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h Wed Sep  6 02:27:09 2006
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_ruby_model_rubyservicebinding_h
+#define tuscany_sca_ruby_model_rubyservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+using namespace tuscany::sca::model;
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ruby
+        {
+            /**
+             * Information about a Ruby service binding for service or a reference.
+             */
+            class RubyServiceBinding : public ServiceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 */
+                RubyServiceBinding(Service* service);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~RubyServiceBinding();
+
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RubyImplementationBinding"; };
+                            
+                /**
+                 * Create a wrapper for the service configured by this
+                 * binding.
+                 */
+                 virtual ServiceWrapper* getServiceWrapper();
+                                
+            private:
+
+                /**
+                 * The wrapper for the service configured by this binding.
+                 */            
+                ServiceWrapper* serviceWrapper;
+            
+            };
+            
+        } // End namespace ruby
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ruby_model_rubyservicebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  6 02:27:09 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h

Added: incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd?view=auto&rev=440667
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd Wed Sep  6 02:27:09 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+    xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+    elementFormDefault="qualified">
+        
+    <element name="implementation.ruby" type="sca:RubyImplementation" substitutionGroup="sca:implementation"/>
+    <complexType name="RubyImplementation">
+        <complexContent>
+            <extension base="sca:Implementation">
+                <sequence>
+                    <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+                </sequence>
+				<attribute name="module" type="NCName" use="optional"/>
+                <attribute name="class" type="Name" use="optional"/>
+				<anyAttribute namespace="##any" processContents="lax"/>
+			</extension>
+		</complexContent>
+	</complexType>
+</schema>

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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