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/11/20 09:50:11 UTC

svn commit: r477110 [1/2] - in /incubator/tuscany/cpp/sca: ./ runtime/extensions/ runtime/extensions/rest/ runtime/extensions/rest/interface/ runtime/extensions/rest/interface/src/ runtime/extensions/rest/interface/src/tuscany/ runtime/extensions/rest/...

Author: jsdelfino
Date: Mon Nov 20 00:50:08 2006
New Revision: 477110

URL: http://svn.apache.org/viewvc?view=rev&rev=477110
Log:
Created structure for a REST extension and added it to the Linux build files. The model classes are working. The ServiceProxy and ServiceWrapper classes are under construction but useful to verify that the build works.

Added:
    incubator/tuscany/cpp/sca/runtime/extensions/rest/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/Makefile.am   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/ModREST.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.h   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/xsd/   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/xsd/sca-binding-rest.xsd   (with props)
    incubator/tuscany/cpp/sca/runtime/extensions/rest/xsd/sca-interface-rest.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=477110&r1=477109&r2=477110
==============================================================================
--- incubator/tuscany/cpp/sca/configure.ac (original)
+++ incubator/tuscany/cpp/sca/configure.ac Mon Nov 20 00:50:08 2006
@@ -127,6 +127,23 @@
 )
 AM_CONDITIONAL([WANT_SCABINDING], [test x$want_scabinding = xtrue])
 
+AC_MSG_CHECKING(whether to build REST binding extension)
+AC_ARG_ENABLE(scabinding, [AS_HELP_STRING([--enable-restbinding],[build REST binding extension [default=no]])],
+[ case "${enableval}" in
+  no)
+    AC_MSG_RESULT(no)
+    want_restbinding=false
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    want_restbinding=true
+    ;;
+  esac ],
+[ AC_MSG_RESULT(no)
+  want_restbinding=false ]
+)
+AM_CONDITIONAL([WANT_RESTBINDING], [test x$want_restbinding = xtrue])
+
 AC_MSG_CHECKING(whether to build Python component type extension)
 AC_ARG_ENABLE(python, [AS_HELP_STRING([--enable-python],[build Python component type extension [default=no]])],
 [ case "${enableval}" in
@@ -225,6 +242,15 @@
                  runtime/extensions/sca/service/Makefile
                  runtime/extensions/sca/service/axis2c/Makefile
                  runtime/extensions/sca/service/axis2c/src/Makefile
+                 runtime/extensions/rest/Makefile
+                 runtime/extensions/rest/interface/Makefile
+                 runtime/extensions/rest/interface/src/Makefile
+                 runtime/extensions/rest/reference/Makefile
+                 runtime/extensions/rest/reference/curl/Makefile
+                 runtime/extensions/rest/reference/curl/src/Makefile
+                 runtime/extensions/rest/service/Makefile
+                 runtime/extensions/rest/service/httpd/Makefile
+                 runtime/extensions/rest/service/httpd/src/Makefile
                  runtime/extensions/python/Makefile
                  runtime/extensions/python/src/Makefile
                  runtime/extensions/ruby/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=477110&r1=477109&r2=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/Makefile.am Mon Nov 20 00:50:08 2006
@@ -22,6 +22,7 @@
   PHP_EXTENSION = php
   WSBINDING_EXTENSION = ws
   SCABINDING_EXTENSION = sca
+  RESTBINDING_EXTENSION = rest
 endif
 if WANT_CPP
   CPP_EXTENSION = cpp
@@ -41,4 +42,7 @@
 if WANT_SCABINDING
   SCABINDING_EXTENSION = sca
 endif
-SUBDIRS = ${CPP_EXTENSION} ${WSBINDING_EXTENSION} ${SCABINDING_EXTENSION} ${PYTHON_EXTENSION} ${RUBY_EXTENSION} ${PHP_EXTENSION}
+if WANT_RESTBINDING
+  RESTBINDING_EXTENSION = rest
+endif
+SUBDIRS = ${CPP_EXTENSION} ${WSBINDING_EXTENSION} ${SCABINDING_EXTENSION} ${RESTBINDING_EXTENSION} ${PYTHON_EXTENSION} ${RUBY_EXTENSION} ${PHP_EXTENSION}

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1,4 @@
+SUBDIRS = interface reference service 
+datadir=$(prefix)/extensions/rest
+
+nobase_data_DATA = xsd/*.xsd

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1 @@
+SUBDIRS = src
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1,19 @@
+libdir=$(prefix)/extensions/rest/interface/lib
+lib_LTLIBRARIES = libtuscany_sca_rest_interface.la
+
+noinst_HEADERS = tuscany/sca/rest/*.h tuscany/sca/rest/model/*.h
+
+libtuscany_sca_rest_interface_la_SOURCES = \
+tuscany/sca/rest/RESTInterfaceExtension.cpp \
+tuscany/sca/rest/model/RESTInterface.cpp
+
+libtuscany_sca_rest_interface_la_LIBADD = \
+  -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
+  -L$(top_builddir)/runtime/core/src -ltuscany_sca
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+  -I${TUSCANY_SDOCPP}/include \
+  -I${CURL_HOME}/include
+                   
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+                   
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/src/tuscany/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/src/tuscany/sca/rest/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp Mon Nov 20 00:50:08 2006
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/rest/RESTInterfaceExtension.h"
+#include "tuscany/sca/rest/model/RESTInterface.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/SCARuntime.h"
+
+
+extern "C"
+{
+    #if defined(WIN32) || defined(_WINDOWS)
+    __declspec(dllexport) 
+    #endif
+        void tuscany_sca_extension_initialize()
+    {
+        tuscany::sca::rest::RESTInterfaceExtension::initialize();
+    }
+}
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            // ===================================================================
+            // Constructor for the RESTInterfaceExtension class. 
+            // ===================================================================
+            RESTInterfaceExtension::RESTInterfaceExtension()
+            { 
+                logentry();
+            }
+            
+            // ===================================================================
+            // Destructor for the RESTInterfaceExtension class.
+            // ===================================================================
+            RESTInterfaceExtension::~RESTInterfaceExtension()
+            { 
+                logentry();
+            }
+
+            const string RESTInterfaceExtension::extensionName("rest");
+            const string RESTInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTInterface");
+
+            // ===================================================================
+            // loadModelElement - load the info from interface.rest 
+            // ===================================================================
+            tuscany::sca::model::Interface* RESTInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
+            {
+                logentry();
+
+                // Determine the type
+                string ifType = scdlInterface->getType().getName();
+                if (ifType == "RESTInterface")
+                {
+                    return new RESTInterface();
+                }
+                return 0;
+            }
+
+           void RESTInterfaceExtension::initialize()
+            { 
+                logentry();
+                SCARuntime::getInstance()->registerInterfaceExtension(new RESTInterfaceExtension());
+            }
+
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h Mon Nov 20 00:50:08 2006
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_rest_restinterfaceextension_h
+#define tuscany_sca_rest_restinterfaceextension_h
+
+#include "tuscany/sca/extension/InterfaceExtension.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            
+            class RESTInterfaceExtension : public InterfaceExtension 
+            {
+            public:
+            /**
+            * Default constructor
+                */
+                RESTInterfaceExtension();            
+                
+                /**
+                * Destructor
+                */
+                virtual ~RESTInterfaceExtension();            
+                
+                /**
+                * return the name of the extension
+                */
+                virtual const string& getExtensionName() {return extensionName;}
+                
+                /**
+                * return the QName of schema type for this interface extension
+                * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.rest")
+                */
+                virtual const string& getExtensionTypeQName() {return typeQName;}
+ 
+                virtual tuscany::sca::model::Interface* getInterface(Composite* composite, DataObjectPtr scdlInterface);
+                 
+                static void initialize();
+
+            private:
+                static const string extensionName;
+                static const string typeQName;
+                
+            };
+            
+            
+        } // End namespace rest       
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_rest_restinterfaceextension_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp Mon Nov 20 00:50:08 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/rest/model/RESTInterface.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+
+            const string RESTInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTInterface");
+            
+            // Constructor
+            RESTInterface::RESTInterface()  
+                    : Interface(true, false)
+            {
+            }
+
+            RESTInterface::~RESTInterface()
+            {
+            }
+
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h Mon Nov 20 00:50:08 2006
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_rest_model_restinterface_h
+#define tuscany_sca_rest_model_restinterface_h
+
+#include "tuscany/sca/model/Interface.h"
+
+#include <map>
+using std::map;
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            /**
+             * Holds information about a REST interface
+             */
+            class RESTInterface : public Interface
+            {
+                
+            public:    
+                /**
+                 * Constuctor.
+                 * @param header Name of the header file containing the class that
+                 * describes the interface.
+                 * @param className Name of the class in the header file that 
+                 * describes the interface. 
+                 * @param scope The scope of the interface (stateless or composite).
+                 * @param remotable True if the interface is remotable.
+                 */
+                RESTInterface();  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~RESTInterface();
+                
+                /**
+                * return the QName of the schema type for this interface type
+                * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.rest")
+                */
+                virtual const string& getInterfaceTypeQName() { return typeQName; };
+    
+           private:
+           
+                /**
+                 * The QName of the schema type for this interface type.
+                 */
+                static const string typeQName;
+            };
+            
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_rest_model_restinterface_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1 @@
+SUBDIRS = curl
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1 @@
+SUBDIRS = src
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1,21 @@
+libdir=$(prefix)/extensions/rest/reference/lib
+lib_LTLIBRARIES = libtuscany_sca_rest_reference.la
+
+noinst_HEADERS = tuscany/sca/rest/*.h tuscany/sca/rest/model/*.h
+
+libtuscany_sca_rest_reference_la_SOURCES = \
+tuscany/sca/rest/RESTServiceBindingExtension.cpp \
+tuscany/sca/rest/model/RESTServiceBinding.cpp \
+tuscany/sca/rest/RESTServiceWrapper.cpp
+
+libtuscany_sca_rest_reference_la_LIBADD = \
+  -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
+  -L$(top_builddir)/runtime/core/src -ltuscany_sca \
+  -L${CURL_HOME}/lib -lcurl
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+  -I${TUSCANY_SDOCPP}/include \
+  -I${CURL_HOME}/include
+                   
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+                   
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/src/tuscany/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/src/tuscany/sca/rest/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp Mon Nov 20 00:50:08 2006
@@ -0,0 +1,92 @@
+/*
+* 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 "RESTServiceBindingExtension.h"
+#include "model/RESTServiceBinding.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/core/SCARuntime.h"
+
+extern "C"
+{
+    #if defined(WIN32) || defined(_WINDOWS)
+    __declspec(dllexport) 
+    #endif
+        void tuscany_sca_extension_initialize()
+    {
+        tuscany::sca::rest::RESTServiceBindingExtension::initialize();
+    }
+}
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            // ===================================================================
+            // Constructor for the RESTServiceBinding class. 
+            // ===================================================================
+            RESTServiceBindingExtension::RESTServiceBindingExtension()
+            { 
+                logentry();
+            }
+            
+            // ===================================================================
+            // Destructor for the RESTServiceBindingExtension class.
+            // ===================================================================
+            RESTServiceBindingExtension::~RESTServiceBindingExtension()
+            { 
+                logentry();
+            }
+
+            const string RESTServiceBindingExtension::extensionName("rest");
+            const string RESTServiceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTBinding");
+                                                                                                    
+
+            // ===================================================================
+            // loadModelElement - load the info from binding.rest
+            // ===================================================================
+            ServiceBinding* RESTServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding)
+            {
+                string bindingType = scdlBinding->getType().getName();
+                if (bindingType == "RESTBinding")
+                {
+                    string uri = scdlBinding->getCString("uri");
+
+                    RESTServiceBinding* serviceBinding = new RESTServiceBinding(service, uri);
+                    
+                    return serviceBinding;
+                }
+                else
+                {
+                    return NULL;
+                }
+            }
+
+            void RESTServiceBindingExtension::initialize()
+            { 
+                logentry();
+                SCARuntime::getInstance()->registerServiceBindingExtension(new RESTServiceBindingExtension());
+            }
+
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h Mon Nov 20 00:50:08 2006
@@ -0,0 +1,72 @@
+/*
+ * 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_extension_rest_restservicebindingextension_h
+#define tuscany_sca_extension_rest_restservicebindingextension_h
+
+#include "tuscany/sca/extension/ServiceBindingExtension.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            
+            class RESTServiceBindingExtension : public ServiceBindingExtension 
+            {
+            public:
+            /**
+            * Default constructor
+                */
+                RESTServiceBindingExtension();
+                
+                /**
+                * Destructor
+                */
+                virtual ~RESTServiceBindingExtension();            
+                
+                /**
+                * 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#binding.rest")
+                */
+                virtual const string& getExtensionTypeQName() {return typeQName;}
+                
+                virtual ServiceBinding* getServiceBinding(Composite* composite, Service* service, DataObjectPtr scdlBinding);
+                
+                static void initialize();
+
+            private:
+                static const string extensionName;
+                static const string typeQName;
+                
+            };
+            
+            
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif //tuscany_sca_extension_rest_restservicebindingextension_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp Mon Nov 20 00:50:08 2006
@@ -0,0 +1,697 @@
+/*
+ *
+ *  Copyright 2005 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.
+ */
+
+/* $Rev$ $Date$ */
+#if defined(WIN32)  || defined (_WINDOWS)
+#pragma warning(disable: 4091)
+#endif
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include "RESTServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/CompositeReference.h"
+#include "model/RESTServiceBinding.h"
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+#include <curl/curl.h>
+#include <curl/types.h>
+#include <curl/easy.h>
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+
+extern "C"
+{
+    struct Chunk {
+        char *memory;
+        size_t size;
+    };
+
+    static void *my_realloc(void *ptr, size_t size)
+    {
+        if (ptr)
+            return realloc(ptr, size);
+        else
+            return malloc(size);
+    }
+
+    static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *data)
+    {
+        size_t realsize = size * nmemb;
+        struct Chunk *mem = (struct Chunk *)data;
+
+        mem->memory = (char *)my_realloc(mem->memory, mem->size + realsize + 1);
+        if (mem->memory) {
+            memcpy(&(mem->memory[mem->size]), ptr, realsize);
+            mem->size += realsize;
+            mem->memory[mem->size] = 0;
+        }
+        return realsize;
+    }
+ 
+ }
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            
+            bool RESTServiceWrapper::initialized = false;
+            
+            RESTServiceWrapper::RESTServiceWrapper(Service* service) : ServiceWrapper(service)
+            {
+                if (!initialized)
+                {
+                    curl_global_init(CURL_GLOBAL_ALL);
+                    initialized = true;
+                 }
+            }
+            
+            RESTServiceWrapper::~RESTServiceWrapper()
+            {
+            }
+            
+            ///
+            /// This method will be called when a service call needs to be made.
+            ///
+            void RESTServiceWrapper::invoke(Operation& operation) 
+            {
+                logentry();
+            
+                const string& operationName = operation.getName();
+            
+                loginfo("Service: %s, operation: %s", getService()->getType()->getName().c_str() , operationName.c_str());
+            
+                for (unsigned int i=0; i<operation.getNParms(); i++)
+                {
+                    loginfo("Parameter: %p, type %u", operation.getParameterValue(i),(int) operation.getParameterType(i));
+                }
+
+                // Get the service, composite reference and composite
+                Service* service = getService();
+                CompositeReference* compositeReference = (CompositeReference*)service->getComponent();
+                Composite* composite = compositeReference->getComposite();
+                
+                XMLHelper* xmlHelper = composite->getXMLHelper();
+
+                // Get the REST binding
+                RESTServiceBinding* binding = (RESTServiceBinding *)service->getBinding();
+                
+                // Init the curl session
+                CURL *curl_handle = curl_easy_init();
+                Chunk chunk;
+                chunk.memory=NULL;
+                chunk.size = 0;
+                
+                // Some servers don't like requests that are made without a user-agent
+                curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
+
+                // HTTP GET
+                const string& opName = operation.getName();
+                if (opName == "get")
+                {
+                    // Build the request URL
+                    string uri = binding->getURI();
+                    ostringstream os;
+                    if (uri[uri.length()-1]=='?')
+                    {
+                        // Add the parameters to the end of the URL in the form
+                        // param=value&
+                        os << uri;
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            os << "param" << (i + 1) << "=";
+                            writeParameter(xmlHelper, os, operation.getParameter(i));
+                            if (i < operation.getNParms()-1)
+                                os << "&";
+                        }
+                    }
+                    else
+                    {
+                        // Add the parameters to the end of the URL in the
+                        // form value1 / value2 / value3 
+                        os << uri;
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            os << "/";
+                            writeParameter(xmlHelper, os, operation.getParameter(i));
+                        }
+                    }
+
+                    string url = os.str();                                        
+                    curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
+ 
+                    // Send all data to this function  */
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
+ 
+                    // Pass our 'chunk' struct to the callback function */
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
+ 
+                    // Perform the HTTP get
+                    CURLcode rc = curl_easy_perform(curl_handle);
+                    
+                    if (rc)
+                    {
+                        if (chunk.memory)
+                            free(chunk.memory);
+                        throwException(ServiceInvocationException, curl_easy_strerror(rc)); 
+                    }
+
+                    // Get the output data out of the returned document 
+                    if (chunk.memory)
+                    {
+                        string payload((const char*)chunk.memory, chunk.size);
+                        free(chunk.memory);
+
+                        // TODO This is a temp hack, clean this up
+                        // Wrap the returned document inside a part element 
+                        string part = 
+                        "<part xsi:type=\"sdo:OpenDataObject\" xmlns:sdo=\"commonj.sdo\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                        + payload
+                        + "</part>";
+                        setReturn(xmlHelper, part, operation);
+                    }
+                }
+                else if (opName == "post")
+                {
+                    // HTTP POST
+                    
+                    // Set the target URL
+                    string url = binding->getURI();  
+                    curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
+
+                    // If the request contains complex content then we'll use
+                    // a multipart form POST, otherwise we use a simpler
+                    // url-encoded POST
+                    bool complexContent = false; 
+                    for (int i=0; i<operation.getNParms(); i++)
+                    {
+                        if (operation.getParameter(i).getType() == Operation::DATAOBJECT)
+                        {
+                            complexContent = true;
+                            break;
+                        }
+                    }
+                    struct curl_httppost *formpost = NULL;
+                    if (complexContent)
+                    {
+                        // Build the input form
+                        struct curl_httppost *lastptr = NULL;
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            ostringstream pname;
+                            pname << "param" << (i+1);
+                            
+                            ostringstream pvalue;
+                            writeParameter(xmlHelper, pvalue, operation.getParameter(i));
+                            
+                            curl_formadd(&formpost,
+                                &lastptr,
+                                CURLFORM_COPYNAME, pname.str().c_str(),
+                                CURLFORM_COPYCONTENTS, pvalue.str().c_str(),
+                                CURLFORM_END);
+                        }
+                        
+                        // Set the form into the request
+                        curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost);
+                    }
+                    else
+                    {
+                        // Build the request string
+                        // Add the parameters in the form // param=value&
+                        ostringstream os;
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            os << "param" << (i + 1) << "=";
+                            writeParameter(xmlHelper, os, operation.getParameter(i));
+                            if (i < operation.getNParms()-1)
+                                os << "&";
+                        }
+                        curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, os.str().c_str());
+                    }                    
+                        
+                    // Send all data to this function
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
+ 
+                    // Pass our 'chunk' struct to the callback function
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
+ 
+                    // Perform the HTTP post
+                    CURLcode rc = curl_easy_perform(curl_handle);
+                    
+                    // Cleanup the form
+                    if (complexContent)
+                    {
+                        curl_formfree(formpost);
+                    }                    
+                    
+                    if (rc)
+                    {
+                        if (chunk.memory)
+                            free(chunk.memory);
+                        throwException(ServiceInvocationException, curl_easy_strerror(rc)); 
+                    }
+
+                    // Get the output data out of the returned document 
+                    if (chunk.memory)
+                    {
+                        string payload((const char*)chunk.memory, chunk.size);
+                        free(chunk.memory);
+
+                        // TODO This is a temp hack, clean this up
+                        // Wrap the returned document inside a part element 
+                        string part = 
+                        "<part xsi:type=\"sdo:OpenDataObject\" xmlns:sdo=\"commonj.sdo\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                        + payload
+                        + "</part>";
+                        setReturn(xmlHelper, part, operation);
+                    }
+                }
+                else if (opName == "put")
+                {
+                    // HTTP PUT
+                }
+                else if (opName == "delete")
+                {
+                    // HTTP DELETE
+                    
+                }
+                else
+                {
+                    // XML / HTTP RPC style
+                    
+                    // If the request contains complex content then we'll use
+                    // a multipart form POST, otherwise we use a GET
+                    bool complexContent = false; 
+                    for (int i=0; i<operation.getNParms(); i++)
+                    {
+                        if (operation.getParameter(i).getType() == Operation::DATAOBJECT)
+                        {
+                            complexContent = true;
+                            break;
+                        }
+                    }
+                    struct curl_httppost *formpost = NULL;
+                    if (complexContent)
+                    {
+                       // Set the target URL
+                        string url = binding->getURI();  
+                        curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
+
+                        // Build the input form
+                        struct curl_httppost *lastptr = NULL;
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            ostringstream pname;
+                            pname << "param" << (i+1);
+                            
+                            ostringstream pvalue;
+                            writeParameter(xmlHelper, pvalue, operation.getParameter(i));
+                            
+                            curl_formadd(&formpost,
+                                &lastptr,
+                                CURLFORM_COPYNAME, pname.str().c_str(),
+                                CURLFORM_COPYCONTENTS, pvalue.str().c_str(),
+                                CURLFORM_END);
+                        }
+                        
+                        // Set the form into the request
+                        curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost);
+                    }
+                    else
+                    {
+
+                        // Build the request URL, uri / opName ? params
+                        string uri = binding->getURI();
+                        ostringstream os;
+                        os << uri << "/" << opName;
+    
+                        // Add the parameters to the end of the URL in the form
+                        // param=value&
+                        for (int i=0; i<operation.getNParms(); i++)
+                        {
+                            if (i == 0)
+                                os << "?";
+                            os << "param" << (i + 1) << "=";
+                            writeParameter(xmlHelper, os, operation.getParameter(i));
+                            if (i < operation.getNParms()-1)
+                                os << "&";
+                        }
+    
+                        string url = os.str();                                        
+                        curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
+                    }
+                    
+                    // Send all data to this function
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
+ 
+                    // Pass our 'chunk' struct to the callback function
+                    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
+ 
+                    // Perform the HTTP request
+                    CURLcode rc = curl_easy_perform(curl_handle);
+
+                    // Cleanup the form
+                    if (complexContent)
+                    {
+                        curl_formfree(formpost);
+                    }                    
+                    
+                    if (rc)
+                    {
+                        if (chunk.memory)
+                            free(chunk.memory);
+                        throwException(ServiceInvocationException, curl_easy_strerror(rc)); 
+                    }
+ 
+                    if (chunk.memory)
+                    {
+                        string payload((const char*)chunk.memory, chunk.size);
+                        free(chunk.memory);
+                        
+                        setReturn(xmlHelper, payload, operation);
+                    }
+                }
+                
+                // Cleanup curl session
+                curl_easy_cleanup(curl_handle);
+            }
+            
+            void RESTServiceWrapper::writeParameter(XMLHelper* xmlHelper, ostringstream& os, const Operation::Parameter& parm)
+            {
+                logentry();
+
+                switch(parm.getType())
+                {
+                case Operation::BOOL: 
+                    {
+                        os << *(bool*)parm.getValue();
+                        break;
+                    }
+                case Operation::SHORT: 
+                    {
+                        os << *(short*)parm.getValue();
+                        break;
+                    }
+                case Operation::INT: 
+                    {
+                        os << *(long*)parm.getValue();
+                        break;
+                    }
+                case Operation::LONG: 
+                    {
+                        os << *(long*)parm.getValue();
+                        break;
+                    }
+                case Operation::USHORT: 
+                    {
+                        os << *(short*)parm.getValue();
+                        break;
+                    }
+                case Operation::UINT: 
+                    {
+                        os << *(long*)parm.getValue();
+                        break;
+                    }
+                case Operation::ULONG: 
+                    {
+                        os << *(long*)parm.getValue();
+                        break;
+                    }
+                case Operation::FLOAT: 
+                    {
+                        os << *(float*)parm.getValue();
+                        break;
+                    }
+                case Operation::DOUBLE: 
+                    {
+                        os << *(long double*)parm.getValue();
+                        break;
+                    }
+                case Operation::LONGDOUBLE: 
+                    {
+                        os << *(long double*)parm.getValue();
+                        break;
+                    }
+                case Operation::CHARS: 
+                    {
+                        os << *(char**)parm.getValue();
+                        break;
+                    }
+                case Operation::STRING: 
+                    {
+                        os << (*(string*)parm.getValue()).c_str();
+                        break;
+                    }
+                case Operation::DATAOBJECT: 
+                    {
+                        DataObjectPtr dob = *(DataObjectPtr*)parm.getValue(); 
+                        XMLDocumentPtr doc = xmlHelper->createDocument(dob, NULL, NULL);
+                        xmlHelper->save(doc, os);
+                        break;
+                    }
+                default:
+                    {
+                        throwException(ServiceDataException, "Unsupported parameter type");
+                    } 
+                }
+            }
+
+             void RESTServiceWrapper::setReturn(XMLHelper* xmlHelper, string& payload,
+                 Operation& operation)
+             {  
+                logentry();
+                
+                //TODO Remove this workaround once SDO supports loading of open top level content
+                // The workaround is to wrap the open content in a wrapper element of type OpenDataObject
+                string body = 
+                "<body xsi:type=\"sdo:OpenDataObject\" xmlns:sdo=\"commonj.sdo\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+                + payload
+                + "</body>";
+                
+                // Convert the body to an SDO DataObject
+                DataObjectPtr outputBodyDataObject = NULL;
+                XMLDocumentPtr theXMLDocument = xmlHelper->load(body.c_str(), NULL);
+                if (theXMLDocument != 0)
+                {
+                    outputBodyDataObject = theXMLDocument->getRootDataObject();
+                }
+                if(!outputBodyDataObject)
+                {
+                    logerror("Could not convert received document to SDO");
+                    /** TODO: return a fault here */
+                    return;
+                }                    
+
+                // Get the body part
+                DataObjectPtr outputDataObject = NULL; 
+                PropertyList bpl = outputBodyDataObject->getInstanceProperties();
+                if (bpl.size()!=0)
+                {
+                    if (bpl[0].isMany())
+                    {
+                        DataObjectList& parts = outputBodyDataObject->getList((unsigned int)0);
+                        outputDataObject = parts[0];
+                    }
+                    else
+                    {
+                        outputDataObject = outputBodyDataObject->getDataObject(bpl[0]);
+                    }
+                }
+                if (outputDataObject == NULL)
+                {
+                    logerror("Could not convert body part to SDO");
+                    return;
+                }
+                 
+                PropertyList pl = outputDataObject->getInstanceProperties();
+                unsigned int i = 0;
+                 
+                switch(pl[i].getTypeEnum())
+                {
+                case Type::BooleanType:
+                    {
+                        bool* boolData = new bool;
+                        *boolData = outputDataObject->getBoolean(pl[i]);
+                        operation.setReturnValue(boolData);
+                    }
+                    break;
+                case Type::ByteType:
+                    {
+                        char* byteData = new char;
+                        *byteData = outputDataObject->getByte(pl[i]);
+                        operation.setReturnValue(byteData);
+                    }
+                    break;
+                case Type::BytesType:
+                    {
+                        int len = outputDataObject->getLength(pl[i]);
+                        char* bytesData = new char[len+1];
+                        int bytesWritten = outputDataObject->getBytes(pl[i], bytesData, len);
+                        // Ensure the bytes end with the null char. Not sure if this is neccessary
+                        if(bytesWritten <= len)
+                        {
+                            bytesData[bytesWritten] = 0;
+                        }
+                        else
+                        {
+                            bytesData[len] = 0;
+                        }
+                        //printf("outputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
+                        operation.setReturnValue(&bytesData);
+                    }
+                    break;
+                case Type::CharacterType:
+                    {
+                        // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType
+                        wchar_t* charData = new wchar_t;
+                        *charData = outputDataObject->getCharacter(pl[i]);
+                        operation.setReturnValue(charData);
+                    }
+                    break;
+                case Type::DoubleType:
+                    {
+                        long double* doubleData = new long double;
+                        *doubleData = outputDataObject->getDouble(pl[i]);
+                        operation.setReturnValue(doubleData);
+                    }
+                    break;
+                case Type::FloatType:
+                    {
+                        float* floatData = new float;
+                        *floatData = outputDataObject->getFloat(pl[i]);
+                        operation.setReturnValue(floatData); 
+                    }
+                    break;
+                case Type::IntegerType:
+                    {
+                        long* intData = new long;
+                        *intData = outputDataObject->getInteger(pl[i]);
+                        operation.setReturnValue(intData);
+                    }
+                    break;
+                case Type::ShortType:
+                    {
+                        short* shortData = new short;
+                        *shortData = outputDataObject->getShort(pl[i]);
+                        operation.setReturnValue(shortData);
+                    }
+                    break;
+                case Type::StringType:
+                    {
+                        string* str = new string(outputDataObject->getCString(pl[i]));
+                        operation.setReturnValue(str);
+                    }
+                    break;
+                case Type::DataObjectType:
+                    {
+                        DataObjectPtr* dataObjectData = new DataObjectPtr;
+                        *dataObjectData = outputDataObject->getDataObject(pl[i]);
+                        if(!*dataObjectData)
+                        {
+                            loginfo("Null SDO DataObject return value");
+                        }
+                        operation.setReturnValue(dataObjectData);
+                    }
+                    break;
+                case Type::OpenDataObjectType:
+                    {         
+                        /*
+                         * This code deals with xsd:any element parameters
+                         * Get each element as a DataObject and add in to the parameter list
+                         */
+        
+                        DataObjectList& dataObjectList = outputDataObject->getList(pl[i]);
+                        
+                        for(int j=0; j<dataObjectList.size(); j++)
+                        {
+                            DataObjectPtr dob = dataObjectList[j];
+                            if(!dob)
+                            {
+                                DataObjectPtr* dataObjectData = new DataObjectPtr;
+                                *dataObjectData = NULL;
+                                operation.setReturnValue(dataObjectData);
+                                loginfo("Null OpenDataObject return value");
+                            }
+                            else 
+                            {
+                                
+                                SequencePtr sequence = dob->getSequence();
+                                if (sequence->size()!=0)
+                                {
+                                    // Return a text element        
+                                    if (sequence->isText(0))
+                                    {                                        
+                                        string* stringData = new string(sequence->getCStringValue(0));
+                                        operation.setReturnValue(stringData);
+                                    }
+                                    else
+                                    {
+                                        // Return a DataObject representing a complex element
+                                        DataObjectPtr* dataObjectData = new DataObjectPtr;
+                                        *dataObjectData = sequence->getDataObjectValue(0);
+                                        if(!*dataObjectData)
+                                        {
+                                            loginfo("Null DataObject return value");
+                                        }
+                                        operation.setReturnValue(dataObjectData);
+                                    }
+                                }
+                                else
+                                {
+                                    // Empty content, add an empty string
+                                    loginfo("Null OpenDataObject return value");
+                                    string *stringData = new string(""); 
+                                    operation.setReturnValue(stringData);
+                                }
+                            }
+                        }
+                    }
+                    break;
+                case Type::DateType:
+                    logwarning("SDO DateType return values are not yet supported");
+                    break;
+                case Type::LongType:
+                    logwarning("SDO LongType (int64_t) return values are not yet supported");
+                    break;
+                case Type::UriType:
+                    logwarning("SDO UriType return values are not yet supported");
+                    break;
+                case Type::BigDecimalType:
+                    logwarning("SDO BigDecimalType return values are not yet supported");
+                    break;
+                case Type::BigIntegerType:
+                    logwarning("SDO BigIntegerType return values are not yet supported");
+                    break;
+                default:
+                    logwarning("Unknown SDO type has been found in return value. Unknown types are not yet supported");
+                    break;
+                }         
+             }
+             
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h Mon Nov 20 00:50:08 2006
@@ -0,0 +1,86 @@
+/*
+ *
+ *  Copyright 2005 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_extension_rest_restservicewrapper_h
+#define tuscany_sca_extension_rest_restservicewrapper_h
+
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Service.h"
+#include "commonj/sdo/SDO.h"
+
+using namespace tuscany::sca::model;
+
+#include <sstream>
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        
+        namespace rest
+        {
+        
+            class RESTServiceWrapper : public ServiceWrapper
+            {
+            public:
+
+                /**
+                 * Constructor.
+                 * @param target The service wrapper represents a Web service.
+                 */
+                RESTServiceWrapper(Service* service);
+                
+                /**
+                 * Destructor
+                 */
+                virtual    ~RESTServiceWrapper();
+
+                /**
+                 * All business method calls on the target service are performed through
+                 * this invoke method.
+                 * @param operation The details of the method, paramaters and return value for the
+                 * business method to be called on the target service.
+                 */
+                virtual void invoke(Operation& operation);
+                
+            private:
+
+                /**
+                 * Used to track initialization of the CURL library
+                 */            
+                static bool initialized;
+                
+                /**
+                 * Write a parameter into a URL
+                 */
+                void writeParameter(commonj::sdo::XMLHelper* xmlHelper, std::ostringstream& os, const Operation::Parameter& parm);
+                
+                /**
+                 * Set the return value on the given operation
+                 */
+                void setReturn(commonj::sdo::XMLHelper* xmlHelper, string& payload, Operation& operation);
+                
+            };
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_rest_restservicewrapper_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp Mon Nov 20 00:50:08 2006
@@ -0,0 +1,51 @@
+/*
+ *
+ *  Copyright 2005 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/rest/model/RESTServiceBinding.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/rest/RESTServiceWrapper.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+
+            // Constructor
+            RESTServiceBinding::RESTServiceBinding(Service* service, const string& uri)
+                : ServiceBinding(service, uri)
+            {
+                serviceWrapper = new RESTServiceWrapper(service);
+            }
+
+            // Destructor
+            RESTServiceBinding::~RESTServiceBinding()
+            {
+            }
+            
+            ServiceWrapper* RESTServiceBinding::getServiceWrapper()
+            {
+                return serviceWrapper;
+            }
+                
+        } // End namespace rest
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h Mon Nov 20 00:50:08 2006
@@ -0,0 +1,77 @@
+/*
+ *
+ *  Copyright 2005 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_extension_rest_model_restservicebinding_h
+#define tuscany_sca_extension_rest_model_restservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/model/Service.h"
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace rest
+        {
+            /**
+             * Information about a REST binding for a service or a reference.
+             */
+            class RESTServiceBinding : public model::ServiceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 * @param uri The uri of the binding.
+                 */
+                RESTServiceBinding(model::Service* service, const string& uri);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~RESTServiceBinding();
+                            
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RESTBinding"; };
+                            
+                /**
+                 * 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 rest
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_rest_model_restservicebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/service/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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/rest/service/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am?view=auto&rev=477110
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am Mon Nov 20 00:50:08 2006
@@ -0,0 +1 @@
+SUBDIRS = httpd
\ No newline at end of file

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/service/Makefile.am
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/rest/service/httpd/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 20 00:50:08 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



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