tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajbor...@apache.org
Subject svn commit: r442975 - in /incubator/tuscany/cpp/sca/runtime/extensions/python: src/ src/osoa/sca/ src/tuscany/sca/python/ src/tuscany/sca/python/model/ xsd/
Date Wed, 13 Sep 2006 13:04:51 GMT
Author: ajborley
Date: Wed Sep 13 06:04:50 2006
New Revision: 442975

URL: http://svn.apache.org/viewvc?view=rev&rev=442975
Log:
Added support for references in Python components. Added a Python extension providing a locateService function to allow a Python client to locate an SCA service component

Added:
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAModule.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAProxy.py
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCASetup.py
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/export.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/xsd/sca-interface-python.xsd
Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/osoa/sca/ServiceRuntimeException.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am Wed Sep 13 06:04:50 2006
@@ -8,8 +8,12 @@
 libtuscany_sca_python_la_SOURCES = \
 tuscany/sca/python/PythonExtension.cpp \
 tuscany/sca/python/PythonImplementationExtension.cpp \
+tuscany/sca/python/PythonInterfaceExtension.cpp \
 tuscany/sca/python/PythonServiceWrapper.cpp \
+tuscany/sca/python/PythonServiceProxy.cpp \
 tuscany/sca/python/model/PythonImplementation.cpp \
+tuscany/sca/python/model/PythonInterface.cpp \
+tuscany/sca/python/model/PythonReferenceBinding.cpp \
 tuscany/sca/python/model/PythonServiceBinding.cpp
 
 libtuscany_sca_python_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/osoa/sca/ServiceRuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/osoa/sca/ServiceRuntimeException.h?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/osoa/sca/ServiceRuntimeException.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/osoa/sca/ServiceRuntimeException.h Wed Sep 13 06:04:50 2006
@@ -20,7 +20,7 @@
 #ifndef osoa_sca_serviceruntimeexception_h
 #define osoa_sca_serviceruntimeexception_h
 
-#include "tuscany/sca/export.h"
+#include "tuscany/sca/python/export.h"
 
 #include "tuscany/sca/util/Exceptions.h"
 using tuscany::sca::TuscanyRuntimeException;
@@ -32,7 +32,7 @@
          * Top level exception to represent all the exceptions that may be 
          * thrown by an SCA runtime implementation.
          */
-        class SCA_API ServiceRuntimeException : public TuscanyRuntimeException
+        class ServiceRuntimeException : public TuscanyRuntimeException
         {
         public:
             ServiceRuntimeException(
@@ -49,7 +49,7 @@
          * A remotable service is currently unavailable. It is possible that a retry
          * may resolve this exception.
          */
-        class SCA_API ServiceUnavailableException: public ServiceRuntimeException
+        class ServiceUnavailableException: public ServiceRuntimeException
         {
         public:
             ServiceUnavailableException(const char* serviceName)
@@ -65,7 +65,7 @@
          * The target of a wire cannot be found, or the reference has not been
          * configured.
          */
-        class SCA_API ServiceNotFoundException: public ServiceRuntimeException
+        class ServiceNotFoundException: public ServiceRuntimeException
         {
         public:
             ServiceNotFoundException(const char* msg)
@@ -81,7 +81,7 @@
          * There is no current component (for example, if a non-SCA component
          * tries to get the current ComponentContext).
          */
-        class SCA_API ComponentContextException: public ServiceRuntimeException
+        class ComponentContextException: public ServiceRuntimeException
         {
         public:
             ComponentContextException(const char* msg)
@@ -95,7 +95,7 @@
         /**
          * There is an error whilst trying to invoke a component.
          */
-        class SCA_API ComponentInvocationException: public ServiceRuntimeException
+        class ComponentInvocationException: public ServiceRuntimeException
         {
         public:
             ComponentInvocationException(const char* msg)

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp Wed Sep 13 06:04:50 2006
@@ -21,6 +21,7 @@
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/python/PythonImplementationExtension.h"
+#include "tuscany/sca/python/PythonInterfaceExtension.h"
 
 
 extern "C"
@@ -62,7 +63,7 @@
             { 
                 LOGENTRY(1, "PythonExtension::initialize");;           
                 SCARuntime::getInstance()->registerImplementationExtension(new PythonImplementationExtension());
-                //SCARuntime::getInstance()->registerInterfaceExtension(new PythonInterfaceExtension());
+                SCARuntime::getInstance()->registerInterfaceExtension(new PythonInterfaceExtension());
                 LOGEXIT(1, "PythonExtension::initialize");;           
             }
 

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp Wed Sep 13 06:04:50 2006
@@ -0,0 +1,120 @@
+/*
+ * 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/python/PythonInterfaceExtension.h"
+#include "tuscany/sca/python/model/PythonInterface.h"
+#include "tuscany/sca/util/Logging.h"
+
+//#include "commonj/sdo/SDO.h"
+//using commonj::sdo::DataObjectList; 
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            // ===================================================================
+            // Constructor for the PythonInterfaceExtension class. 
+            // ===================================================================
+            PythonInterfaceExtension::PythonInterfaceExtension()
+            { 
+                LOGENTRY(1, "PythonInterfaceExtension::constructor");     
+                LOGEXIT(1, "PythonInterfaceExtension::constructor");
+            }
+            
+            // ===================================================================
+            // Destructor for the PythonInterfaceExtension class.
+            // ===================================================================
+            PythonInterfaceExtension::~PythonInterfaceExtension()
+            { 
+                LOGENTRY(1, "PythonInterfaceExtension::destructor");;           
+                LOGEXIT(1, "PythonInterfaceExtension::destructor");
+            }
+
+            const string PythonInterfaceExtension::extensionName("python");
+            const string PythonInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PythonInterface");
+
+            // ===================================================================
+            // loadModelElement - load the info from interface.python 
+            // ===================================================================
+            tuscany::sca::model::Interface* PythonInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
+            {
+                // Determine the type
+                string ifType = scdlInterface->getType().getName();
+                if (ifType == "PythonInterface")
+                {
+                    bool remotable = scdlInterface->getBoolean("remotable");                    
+                    bool conversational = scdlInterface->getBoolean("conversational");                    
+
+                    return new PythonInterface(remotable, conversational);
+                    //DataObjectList& operationList = scdlInterface->getList("operation");
+
+                    //for(int i=0; i<operationList.size(); i++)
+                    //{
+                    //    string opName = operationList[i]->getCString("name");
+
+                    //    if(operationList[i]->hasProperty("returnType"))
+                    //    {
+                    //        string returnType = operationList[i]->getCString("returnType");
+
+                    //        if(returnType == "string")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::STRING);
+                    //        }
+                    //        else if(returnType == "int")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::INT);
+                    //        }
+                    //        else if(returnType == "long")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::LONG);
+                    //        }
+                    //        else if(returnType == "boolean")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::BOOLEAN);
+                    //        }
+                    //        else if(returnType == "float")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::FLOAT);
+                    //        }
+                    //        else if(returnType == "other")
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::OTHER);
+                    //        }
+                    //        else
+                    //        {
+                    //            pythonInterface->addOperation(opName, PythonInterface::NONE);
+                    //        }
+                    //    }
+                    //    else
+                    //    {
+                    //        // No return Type provided - set as NONE
+                    //        pythonInterface->addOperation(opName, PythonInterface::NONE);
+                    //    }
+                    //}
+                    //
+                    //return pythonInterface;
+                }
+                return 0;
+            }
+
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h Wed Sep 13 06:04:50 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_python_pythoninterfaceextension_h
+#define tuscany_sca_python_pythoninterfaceextension_h
+
+#include "tuscany/sca/extension/InterfaceExtension.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            
+            class PythonInterfaceExtension : public InterfaceExtension 
+            {
+            public:
+            /**
+            * Default constructor
+                */
+                PythonInterfaceExtension();            
+                
+                /**
+                * Destructor
+                */
+                virtual ~PythonInterfaceExtension();            
+                
+                /**
+                * 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#PythonInterface")
+                */
+                virtual const string& getExtensionTypeQName() {return typeQName;}
+ 
+                virtual tuscany::sca::model::Interface* getInterface(Composite* composite, DataObjectPtr scdlInterface);
+                 
+            private:
+                static const string extensionName;
+                static const string typeQName;
+                
+            };
+            
+            
+        } // End namespace python       
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_python_pythoninterfaceextension_h
+

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp Wed Sep 13 06:04:50 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.
+ */
+
+#include "tuscany/sca/python/PythonServiceProxy.h"
+#include "tuscany/sca/util/Logging.h"
+#include "osoa/sca/ServiceRuntimeException.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/python/model/PythonImplementation.h"
+#include "tuscany/sca/python/model/PythonReferenceBinding.h"
+#include "tuscany/sca/cpp/model/CPPInterface.h"
+
+using namespace osoa::sca;
+using namespace tuscany::sca::model;
+using tuscany::sca::cpp::CPPInterface;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            
+            // ============================================
+            // Constructor: Create a proxy from a reference
+            // ============================================
+            PythonServiceProxy::PythonServiceProxy(Reference* reference)
+                : ServiceProxy(reference)
+            {
+                LOGENTRY(1,"PythonServiceProxy::constructor(Reference)");
+ 
+                // Get the service wrapper
+                PythonReferenceBinding* referenceBinding = (PythonReferenceBinding*)reference->getBinding();                
+                serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
+    
+                LOGEXIT(1,"PythonServiceProxy::constructor(Reference)");
+            }
+
+            // ==========================================
+            // Constructor: Create a proxy from a service
+            // ==========================================
+            PythonServiceProxy::PythonServiceProxy(Service* service)
+                : ServiceProxy(NULL)
+            {
+                LOGENTRY(1,"PythonServiceProxy::constructor(Service)");
+ 
+                // Get the service wrapper
+                serviceWrapper = service->getBinding()->getServiceWrapper();                
+    
+                LOGEXIT(1,"PythonServiceProxy::constructor(Service)");
+            }
+
+            // ==========
+            // Destructor
+            // ==========
+            PythonServiceProxy::~PythonServiceProxy()
+            {
+                LOGENTRY(1,"PythonServiceProxy::destructor");
+                LOGEXIT(1,"PythonServiceProxy::destructor");
+            }
+
+            // =====================================================
+            // invokeService: invoke the service wired to this proxy
+            // =====================================================
+            void PythonServiceProxy::invokeService(Operation& operation)
+            {
+                LOGENTRY(1,"PythonServiceProxy::invokeService");
+
+                // Invoke the service
+                serviceWrapper->invoke(operation);
+
+                LOGEXIT(1,"PythonServiceProxy::invokeService");
+            }
+        } // End namespace python        
+    } // End namespace sca
+} // End namespace tuscany

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h Wed Sep 13 06:04:50 2006
@@ -0,0 +1,84 @@
+/*
+ * 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_python_pythonserviceproxy_h
+#define tuscany_sca_python_pythonserviceproxy_h
+
+#include "tuscany/sca/core/ServiceProxy.h" 
+#include "tuscany/sca/core/ServiceWrapper.h" 
+#include "tuscany/sca/util/Library.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/Service.h"
+
+#include "export.h" 
+
+using namespace tuscany::sca::model;
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            
+            /**
+             * Holds a proxy for a given reference from a component implemented in Python.
+             */
+            class PythonServiceProxy : 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.
+                 */
+                PythonServiceProxy(Reference* reference);
+       
+               /**
+                 * Create a new service proxy for a service. The proxy will contain a pointer to
+                 * the target ServiceWrapper.
+                 * @param service The service on the target component.
+                 */
+                SCA_PYTHON_API PythonServiceProxy(Service* service);
+       
+                /**
+                 * Destructor.
+                 */
+                virtual ~PythonServiceProxy();
+    
+                /**
+                 * Invoke the wired service.
+                 */
+                virtual void invokeService(Operation& operation);
+    
+            private:
+    
+                /**
+                 * The target service wrapper
+                 */
+                ServiceWrapper* serviceWrapper;    
+            };
+            
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_python_pythonserviceproxy_h

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp Wed Sep 13 06:04:50 2006
@@ -17,9 +17,9 @@
  * under the License.
  */
 
+#include "osoa/sca/ServiceRuntimeException.h"
 #include "tuscany/sca/python/PythonServiceWrapper.h"
 
-#include "osoa/sca/ServiceRuntimeException.h"
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/util/Utils.h"
 #include "tuscany/sca/model/Component.h"
@@ -64,7 +64,6 @@
                 LOGENTRY(1,"PythonServiceWrapper::constructor");
     
                 component = service->getComponent();
-                interf = service->getType()->getInterface();
                 implementation = (PythonImplementation*)component->getType();              
 
                 pythonModule = NULL;
@@ -80,9 +79,9 @@
                     throw ServiceNotFoundException(msg.c_str());
                 }
 
-                LOGINFO_1(3,"PythonServiceWrapper::getServiceWrapper module %s", impl->getModule().c_str());
-                LOGINFO_1(3,"PythonServiceWrapper::getServiceWrapper path %s", impl->getModulePath().c_str());
-                LOGINFO_1(3,"PythonServiceWrapper::getServiceWrapper class %s", impl->getClass().c_str());
+                LOGINFO_1(3,"PythonServiceWrapper::constructor module %s", impl->getModule().c_str());
+                LOGINFO_1(3,"PythonServiceWrapper::constructor path %s", impl->getModulePath().c_str());
+                LOGINFO_1(3,"PythonServiceWrapper::constructor class %s", impl->getClass().c_str());
 
                 // Initialize the Python environment
                 Py_Initialize();
@@ -103,7 +102,6 @@
                         PyObject* pPath = PyString_FromString(path.c_str());
                         PyList_Append(pSysPath, pPath);
                         
-                        //printPyObject("sys.path", pSysPath);
                         
                         Py_DECREF(pPath);
                         Py_DECREF(pSysPath);
@@ -128,9 +126,14 @@
                     }
                     string msg = "Failed to load module named " + impl->getModule();
                     LOGERROR(0, msg.c_str());
-                    throw new ComponentInvocationException(msg.c_str());
+                    throw ComponentContextException(msg.c_str());
+                }
+                else
+                {
+                    addReferences(pythonModule);
                 }
 
+                printPyObject("pythonModule",pythonModule);
 
                 LOGEXIT(1,"PythonServiceWrapper::constructor");
                 
@@ -243,6 +246,9 @@
                         // Get rid of old pythonModule and replace with the reloaded one
                         Py_DECREF(pythonModule);
                         pythonModule = reloadedPythonModule;
+
+                        // Reload the references into the module
+                        addReferences(pythonModule);
                     }
                 }
                 LOGEXIT(1,"PythonServiceWrapper::releaseInstance");
@@ -380,63 +386,52 @@
                         Py_DECREF(pArgs);
                         if (pValue != NULL) 
                         {
-                            switch(operation.getReturnType())
+                            if(PyInt_Check(pValue))
                             {
-                            case Operation::BOOL: 
-                                {
-                                    if(PyBool_Check(pValue))
-                                    {
-                                        *(bool*)operation.getReturnValue() = (pValue == Py_True);
-                                    }
-                                    break;
-                                }
-                            case Operation::SHORT: 
-                                {
-                                    *(short*)operation.getReturnValue() = (short) PyInt_AsLong(pValue);
-                                    break;
-                                }
-                            case Operation::LONG: 
-                                {
-                                    *(long*)operation.getReturnValue() =  (long) PyLong_AsLong(pValue);
-                                    break;
-                                }
-                            case Operation::USHORT: 
-                                {
-                                    *(unsigned short*)operation.getReturnValue() = (unsigned short) PyInt_AsLong(pValue);
-                                    break;
-                                }
-                            case Operation::ULONG: 
-                                {
-                                    *(unsigned long*)operation.getReturnValue() = (unsigned long) PyLong_AsUnsignedLong(pValue);
-                                    break;
-                                }
-                            case Operation::FLOAT: 
-                                {
-                                    *(float*)operation.getReturnValue() = (float) PyFloat_AsDouble(pValue);
-                                    break;
-                                }
-                            case Operation::DOUBLE: 
-                                {
-                                    *(double*)operation.getReturnValue() = (double) PyFloat_AsDouble(pValue);
-                                    break;
-                                }
-                            case Operation::LONGDOUBLE: 
-                                {
-                                    *(long double*)operation.getReturnValue() = (long double) PyFloat_AsDouble(pValue);
-                                    break;
-                                }
-                            case Operation::CHARS: 
-                                {
-                                    *(char**)operation.getReturnValue() = strdup(PyString_AsString(pValue));
-                                    break;
-                                }
-                            case Operation::STRING: 
-                                {
-                                    *(string*)operation.getReturnValue() = PyString_AsString(pValue);
-                                    break;
-                                }
-                            default:;
+                                LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is int type: %d", PyInt_AsLong(pValue));
+                                long* intData = new long;
+                                *intData = PyInt_AsLong(pValue);
+                                operation.setReturnValue(intData);
+                            }
+                            else if(PyBool_Check(pValue))
+                            {
+                                LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is bool type: %d", (pValue == Py_True));
+                                bool* boolData = new bool;
+                                *boolData = (pValue == Py_True);
+                                operation.setReturnValue(boolData);
+                            }
+                            else if(PyLong_Check(pValue))
+                            {
+                                LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is long type: %l", PyLong_AsLong(pValue));
+                                long* longData = new long;
+                                *longData = PyLong_AsLong(pValue);
+                                operation.setReturnValue(longData);
+                            }
+                            else if(PyFloat_Check(pValue))
+                            {
+                                LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is float type: %f", PyFloat_AsDouble(pValue));
+                                double* doubleData = new double;
+                                *doubleData = PyFloat_AsDouble(pValue);
+                                operation.setReturnValue(doubleData);
+                            }
+                            else if(PyString_Check(pValue))
+                            {
+                                LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is string type: %s", PyString_AsString(pValue));
+                                const char** stringData = new const char*; 
+                                *stringData = PyString_AsString(pValue);
+                                operation.setReturnValue(stringData);
+                            }
+                            else
+                            {
+                                PyObject* valueRepr = PyObject_Repr(pValue); 
+                                PyObject* valueType = PyObject_Type(pValue);             
+                                PyObject* valueTypeRepr = PyObject_Repr(valueType);    
+                                LOGINFO_2(3, "PythonServiceWrapper::invoke Return value is of unknown type (%s) and has repr: %s", PyString_AsString(valueTypeRepr), PyString_AsString(valueRepr));
+                                Py_DECREF(valueTypeRepr);
+                                Py_DECREF(valueType);
+                                Py_DECREF(valueRepr);
                             }
+
                             Py_DECREF(pValue);
                         }
                         else 
@@ -475,30 +470,65 @@
                 LOGEXIT(1,"PythonServiceWrapper::invoke");
                 
             }
-            
+ 
             // ======================================================================
-            // getServiceWrapper: create a wrapper for the target ComponentService
+            // Add any references into the loaded implementation module as class instances that look like
+            // the classes defined in the interface.python xml
             // ======================================================================
-            PythonServiceWrapper* PythonServiceWrapper::getServiceWrapper(Service* service)
-            {            
-                LOGENTRY(1,"PythonServiceWrapper::getServiceWrapper");
-                PythonServiceWrapper* serviceWrapper = 0;
-                
-                // ---------------------------------
-                // Create an instance of the wrapper
-                // ---------------------------------                
-                serviceWrapper = new PythonServiceWrapper(service);
-                if (!serviceWrapper)
+            void PythonServiceWrapper::addReferences(PyObject* module)
+            {
+
+                // Import the TuscanySCA python-extension module
+                PyObject* pModuleName = PyString_FromString("TuscanySCAProxy");
+                PyObject* tuscanySCAProxyModule = PyImport_Import(pModuleName);
+                Py_DECREF(pModuleName);
+
+                if(!tuscanySCAProxyModule)
                 {
-                    string msg = "Could not create new PythonServiceWrapper";
-                    LOGERROR(1, msg.c_str());
-                    throw ServiceNotFoundException(msg.c_str());
-                }                
-                
-                LOGEXIT(1,"PythonServiceWrapper::getServiceWrapper");
-                return serviceWrapper;
-            }    
+                    if(PyErr_Occurred())
+                    {
+                        PyErr_Print();
+                    }
+                    string msg = "Failed to load the TuscanySCAProxy Python module - has it been successfully installed?\nReferences from Python components will not be supported";
+                    LOGERROR(0, msg.c_str());
+                }
+                else
+                {
+                    // Get the TuscanySCAProxy class
+                    PyObject* tuscanySCAProxyClass = PyObject_GetAttrString(tuscanySCAProxyModule, "TuscanySCAProxyClass");
+
+                    // Iterate through the references of the current component, adding
+                    // each reference to the module
+                    Component::REFERENCE_MAP references = component->getReferences();
+                    Component::REFERENCE_MAP::iterator pos;
+                    for( pos = references.begin(); pos != references.end(); ++pos)
+                    {
+                        ReferenceType* referenceType = ((Reference*) pos->second)->getType();
+
+                        PyObject* tuscanySCAArgs = PyTuple_New(2);
+                        PyObject* refName = PyString_FromString(referenceType->getName().c_str());
+                        PyTuple_SetItem(tuscanySCAArgs, 0, refName);
+                        Py_INCREF(Py_True);
+                        PyTuple_SetItem(tuscanySCAArgs, 1, Py_True);
 
+                        // Create the instance of the TuscanySCAReference class
+                        PyObject* tuscanySCAProxyClassInstance = PyInstance_New(tuscanySCAProxyClass, tuscanySCAArgs, NULL);
+                        Py_DECREF(tuscanySCAArgs);
+
+                        int success = PyModule_AddObject(module, (char*)referenceType->getName().c_str(), tuscanySCAProxyClassInstance);
+
+                        if(success == 0)
+                        {
+                            LOGINFO_1(3, "Successfully added TuscanySCAReferenceClassInstance as %s to pythonModule", referenceType->getName().c_str());
+                        }
+                        else
+                        {
+                            LOGERROR_1(1, "Failed to add TuscanySCAReferenceClassInstance as %s to pythonModule", referenceType->getName().c_str());
+                        }
+                    }                       
+                    Py_DECREF(tuscanySCAProxyModule);
+                }
+            }
         } // End namespace python        
     } // End namespace sca
 } // End namespace tuscany

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h Wed Sep 13 06:04:50 2006
@@ -20,7 +20,7 @@
 #ifndef tuscany_sca_python_pythonservicewrapper_h
 #define tuscany_sca_python_pythonservicewrapper_h
 
-
+#include "tuscany/sca/python/export.h"
 #include "tuscany/sca/core/ServiceWrapper.h"
 #include "tuscany/sca/core/Operation.h"
 #include "tuscany/sca/model/Component.h"
@@ -47,19 +47,10 @@
              * An instance of this class wraps the actual component implementation which 
              * has been written by a developer of an SCA application.
              */
-            class SCA_API PythonServiceWrapper : public ServiceWrapper
+            class PythonServiceWrapper : public ServiceWrapper
             {
             public:
-                /**
-                 * Factory method to create a new PythonServiceWrapper for a given target
-                 * service. This method will provide all the loading of dlls required to 
-                 * create the target component.
-                 * @param target The service on the component for which this wrapper is to be
-                 * created.
-                 * @return A wrapper that references the given target.
-                 */
-                static PythonServiceWrapper* getServiceWrapper(Service* service);
-    
+
                 /**
                  * Constructor.
                  * @param target The component service to which this wrapper refers.
@@ -99,6 +90,7 @@
                  */
                 virtual void releaseInstance();
     
+
             private:
                 /**
                  * Holds a class instance if a classname is provided. 
@@ -110,21 +102,21 @@
                  * Holds the module 
                  */
                 PyObject* pythonModule;
+                                
+                /**
+                 * Adds references to the provided implementation module or class instance 
+                 */
+                void addReferences(PyObject* module);
 
                 /**
                  * The component to which this wrapper refers.
                  */
                 Component* component;
-    
-                /**
-                 * A pointer to the interface which the service exposes.
-                 */
-                Interface* interf;
 
                 /**
                  * The component implementation
                  */
-                 PythonImplementation* implementation;
+                PythonImplementation* implementation;
                 
             };
             

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAModule.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAModule.cpp?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAModule.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAModule.cpp Wed Sep 13 06:04:50 2006
@@ -0,0 +1,377 @@
+/*
+* 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 <Python.h>
+
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/core/Operation.h"
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+
+#include "PythonServiceProxy.h"
+using namespace tuscany::sca::python;
+
+#include "tuscany/sca/util/Logging.h"
+
+#include <string>
+#include <iostream>
+using namespace std;
+
+static PyObject* tuscanySCAError;
+
+/**
+* Prints out PyObject and dir(PyObject)
+* for debugging purposes
+*/
+static void printPyObject(char* prefix, char* name, PyObject* pObj)
+{
+    LOGINFO(4, "Entering printPyObject");
+    PyObject* pObjRepr = PyObject_Repr(pObj);    
+    LOGINFO_3(4, "%s printPyObject %s: %s", prefix, name, PyString_AsString(pObjRepr));
+    Py_XDECREF(pObjRepr);
+
+    if(pObj != NULL)
+    {
+        PyObject* pObjDir = PyObject_Dir(pObj);    
+        PyObject* pObjDirRepr = PyObject_Repr(pObjDir);
+        LOGINFO_3(4, "%s printPyObject dir(%s): %s", prefix, name, PyString_AsString(pObjDirRepr));
+        Py_DECREF(pObjDirRepr);
+        Py_DECREF(pObjDir);
+    }
+    LOGINFO(4, "Returning from printPyObject");
+}
+
+static PyObject* TuscanySCA_locateService(PyObject *self, PyObject *args)
+{
+    // Get the service name
+    PyObject* pServiceName = PyTuple_GetItem(args, 0);
+
+    // Import the TuscanySCA python-extension module
+    PyObject* pModuleName = PyString_FromString("TuscanySCAProxy");
+    PyObject* tuscanySCAProxyModule = PyImport_Import(pModuleName);
+    Py_DECREF(pModuleName);
+
+    if(!tuscanySCAProxyModule)
+    {
+        if(PyErr_Occurred())
+        {
+            PyErr_Print();
+        }
+        string msg = "Failed to load the TuscanySCAProxy Python module - has it been successfully installed?\nReferences from Python components will not be supported";
+        LOGERROR(0, msg.c_str());
+    }
+    else
+    {
+        // Get the TuscanySCAProxy class
+        PyObject* tuscanySCAProxyClass = PyObject_GetAttrString(tuscanySCAProxyModule, "TuscanySCAProxyClass");
+
+        PyObject* tuscanySCAArgs = PyTuple_New(2);
+        PyTuple_SetItem(tuscanySCAArgs, 0, pServiceName);
+        Py_INCREF(Py_True);
+        PyTuple_SetItem(tuscanySCAArgs, 1, Py_False);
+
+        // Create the instance of the TuscanySCAReference class
+        PyObject* tuscanySCAProxyClassInstance = PyInstance_New(tuscanySCAProxyClass, tuscanySCAArgs, NULL);
+        Py_DECREF(tuscanySCAArgs);
+
+        return tuscanySCAProxyClassInstance;
+    }
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+
+static PythonServiceProxy* getServiceProxy(PyObject *args)
+{
+    LOGENTRY(1, "TuscanySCAModule getPythonServiceProxy");
+
+    PythonServiceProxy* serviceProxy = NULL;
+    SCARuntime* runtime = SCARuntime::getInstance();
+
+    // The first argument holds the name
+    string name;
+    PyObject* pName = PyTuple_GetItem(args, 0);
+    if(pName && PyString_Check(pName))
+    {
+        name = PyString_AsString(pName);
+    }
+    if(name.size() > 0)
+    {
+        LOGINFO_1(3, "TuscanySCA_invoke Service/Reference name is %s", name.c_str());
+    }
+    else
+    {
+        string msg = "TuscanySCA_invoke Service/Reference name has not been set";
+        LOGERROR(1, msg.c_str());
+        PyErr_SetString(tuscanySCAError, msg.c_str());
+        return NULL;
+    }
+
+    // The second argument is a boolean
+    PyObject* isReference = PyTuple_GetItem(args, 1);
+
+    // Get the serviceProxy from the reference or service name provided
+    if(PyObject_IsTrue(isReference))
+    {
+        Component* component = runtime->getCurrentComponent();    
+        Reference* ref = component->findReference(name);
+        if(!ref)
+        {
+            string msg = "TuscanySCA_invoke Could not find the reference named "+name;
+            LOGERROR(1, msg.c_str());
+            PyErr_SetString(tuscanySCAError, msg.c_str());
+
+            return NULL;
+        }
+
+        ReferenceBinding* refBinding = ref->getBinding();
+        serviceProxy = (PythonServiceProxy*) refBinding->getServiceProxy();
+    }
+    else
+    {
+        Component* component = runtime->getDefaultComponent();    
+        Composite* composite = (Composite*)component->getType();
+        Service* service = composite->findComponentService(name);
+
+        if(!service)
+        {
+            string msg = "TuscanySCA_invoke Could not find the service named "+name;
+            LOGERROR(1, msg.c_str());
+            PyErr_SetString(tuscanySCAError, msg.c_str());
+            return NULL;
+        }
+
+        serviceProxy = new PythonServiceProxy(service);
+    }
+
+    return serviceProxy;
+}
+
+
+static PyObject* TuscanySCA_invoke(PyObject *self, PyObject *args)
+{
+    LOGENTRY(1, "TuscanySCA_invoke");
+
+    PythonServiceProxy* pythonServiceProxy = getServiceProxy(args);
+    if(!pythonServiceProxy)
+    {
+        return NULL;
+    }
+
+    // Get the name of the operation to invoke
+    string operationName;
+    PyObject* opName = PyTuple_GetItem(args, 2);
+    if(opName && PyString_Check(opName))
+    {
+        operationName = PyString_AsString(opName);
+    }
+
+    if(operationName.size() > 0)
+    {
+        LOGINFO_1(3, "TuscanySCA_invoke Operation name is %s", operationName.c_str());
+    }
+    else
+    {
+        string msg = "TuscanySCA_invoke Operation name has not been set";
+        LOGERROR(1, msg.c_str());
+        PyErr_SetString(tuscanySCAError, msg.c_str());
+        return NULL;
+    }
+
+    // Create the Operation object
+    Operation operation(operationName.c_str());
+
+    // Parameters are the fourth argument
+    PyObject* paramTuple = PyTuple_GetItem(args, 3);
+
+    // Go through the supplied parameters
+    for(int i=0; i < PyTuple_Size(paramTuple); i++)
+    {
+        PyObject* param = PyTuple_GetItem(paramTuple, i);
+
+        if(PyInt_Check(param))
+        {
+            LOGINFO_2(3, "TuscanySCA_invoke Param %d is int type: %d", i, PyInt_AsLong(param));
+            long* intData = new long;
+            *intData = PyInt_AsLong(param);
+            operation.addParameter(intData);
+        }
+        else if(PyBool_Check(param))
+        {
+            LOGINFO_2(3, "TuscanySCA_invoke Param %d is bool type: %d", i, (param == Py_True));
+            bool* boolData = new bool;
+            *boolData = (param == Py_True);
+            operation.addParameter(boolData);
+        }
+        else if(PyLong_Check(param))
+        {
+            LOGINFO_2(3, "TuscanySCA_invoke Param %d is long type: %l", i, PyLong_AsLong(param));
+            long* longData = new long;
+            *longData = PyLong_AsLong(param);
+            operation.addParameter(longData);
+        }
+        else if(PyFloat_Check(param))
+        {
+            LOGINFO_2(3, "TuscanySCA_invoke Param %d is float type: %f", i, PyFloat_AsDouble(param));
+            double* doubleData = new double;
+            *doubleData = PyFloat_AsDouble(param);
+            operation.addParameter(doubleData);
+        }
+        else if(PyString_Check(param))
+        {
+            LOGINFO_2(3, "TuscanySCA_invoke %d is string type: %s", i, PyString_AsString(param));
+            const char** stringData = new const char*; 
+            *stringData = PyString_AsString(param);
+            operation.addParameter(stringData);
+        }
+        else
+        {
+            PyObject* paramRepr = PyObject_Repr(param); 
+            PyObject* paramType = PyObject_Type(param);             
+            PyObject* paramTypeRepr = PyObject_Repr(paramType);    
+            
+            string msg = "TuscanySCA_invoke Param ";
+            msg += i;
+            msg += "is of unknown type (";
+            msg += PyString_AsString(paramTypeRepr);
+            msg += ") and has repr: ";
+            msg += PyString_AsString(paramRepr);
+
+            LOGERROR(1, msg.c_str());
+            PyErr_SetString(tuscanySCAError, msg.c_str());
+            
+            Py_DECREF(paramTypeRepr);
+            Py_DECREF(paramType);
+            Py_DECREF(paramRepr);
+
+            return NULL;
+        }
+    }
+   
+    PyObject* returnValue = NULL;
+
+    try
+    {
+        // Invoke the wired service
+        pythonServiceProxy->invokeService(operation);
+    }
+    catch(...)
+    {
+        string msg = "TuscanySCA_invoke Exception thrown whilst invoking the service";
+        LOGERROR(1, msg.c_str());
+        PyErr_SetString(tuscanySCAError, msg.c_str());
+        return NULL;
+    }
+
+
+    switch(operation.getReturnType())
+    {
+        case Operation::BOOL: 
+            {
+                if(*(bool*)operation.getReturnValue())
+                {
+                    returnValue = Py_True;
+                }
+                else
+                {
+                    returnValue = Py_False;
+                }
+                break;
+            }
+        case Operation::SHORT: 
+            {
+                returnValue = PyInt_FromLong(*(short*)operation.getReturnValue());
+                break;
+            }
+        case Operation::LONG: 
+            {
+                returnValue = PyLong_FromLong(*(long*)operation.getReturnValue());
+                break;
+            }
+        case Operation::USHORT: 
+            {
+                returnValue = PyInt_FromLong(*(unsigned short*)operation.getReturnValue());
+                break;
+            }
+        case Operation::ULONG: 
+            {
+                returnValue = PyLong_FromLong(*(unsigned long*)operation.getReturnValue());
+                break;
+            }
+        case Operation::FLOAT: 
+            {
+                returnValue = PyFloat_FromDouble(*(float*)operation.getReturnValue());
+                break;
+            }
+        case Operation::DOUBLE: 
+            {
+                returnValue = PyFloat_FromDouble(*(double*)operation.getReturnValue());
+                break;
+            }
+        case Operation::LONGDOUBLE: 
+            {
+                returnValue = PyFloat_FromDouble(*(long double*)operation.getReturnValue());
+                break;
+            }
+        case Operation::CHARS: 
+            {
+                returnValue = PyString_FromString(*(char**)operation.getReturnValue());
+                break;
+            }
+        case Operation::STRING: 
+            {
+                returnValue = PyString_FromString((*(string*)operation.getReturnValue()).c_str());
+                break;
+            }
+        default:
+            {
+                Py_INCREF(Py_None);
+                returnValue = Py_None;
+            }
+
+    }
+
+    LOGEXIT(1, "TuscanySCA_invoke");
+    return returnValue;
+}
+static PyMethodDef ModuleMethods[] = 
+{
+    {"locateService", TuscanySCA_locateService, METH_VARARGS, "Locates a TuscanySCA service & returns a TuscanySCAReference instance"},
+    {"invoke", TuscanySCA_invoke, METH_VARARGS, "Invoke an operation on a Tuscany service or reference"},
+    {NULL, NULL, 0, NULL}        /* Sentinel */
+};
+
+PyMODINIT_FUNC initTuscanySCA(void)
+{
+    LOGENTRY(1, "initTuscanySCA");
+
+    // Create a new module 
+    PyObject* module = Py_InitModule("TuscanySCA", ModuleMethods);
+    
+    tuscanySCAError = PyErr_NewException("TuscanySCA.error", NULL, NULL);
+    Py_INCREF(tuscanySCAError);
+    PyModule_AddObject(module, "error", tuscanySCAError);
+
+    LOGEXIT(1, "initTuscanySCA");
+}

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAProxy.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAProxy.py?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAProxy.py (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCAProxy.py Wed Sep 13 06:04:50 2006
@@ -0,0 +1,56 @@
+# 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.
+#
+#
+# 
+# 
+# This Python code is used in the TuscanySCA package and
+# provides the proxy objects to a Python SCA component or SCA 
+# client.  
+# 
+# This is done by overloading the __getattr__ method which makes 
+# calls to myProxy.anyMethod go to __getattr__ which will return
+# the invokeFunction defined inside the invoke method
+
+import TuscanySCA
+
+class TuscanySCAProxyClass:
+
+    TuscanySCAProxyName = ''
+    TuscanySCAProxyIsReference = 1
+
+    def __init__(self, name, isReference):
+        self.TuscanySCAProxyName = name 
+        self.TuscanySCAProxyIsReference = isReference
+        return
+
+    def invoke(self, operationName):
+        
+        def invokeFunction(*args,**kwargs):
+            return TuscanySCA.invoke(self.TuscanySCAProxyName, self.TuscanySCAProxyIsReference, operationName, args)
+
+        return invokeFunction
+
+    def __getattr__(self, operationName):
+        return self.invoke(operationName)
+
+    def __str__(self):
+        return  '<TuscanySCAProxy.TuscanySCAProxyClass instance for ' + self.TuscanySCAProxyName + '>'
+
+    def __repr__(self):
+        return  '<TuscanySCAProxy.TuscanySCAProxyClass instance for ' + self.TuscanySCAProxyName + '>'
+

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCASetup.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCASetup.py?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCASetup.py (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/TuscanySCASetup.py Wed Sep 13 06:04:50 2006
@@ -0,0 +1,60 @@
+# 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.
+#
+#
+# 
+# 
+# This Python code builds and/or installs the TuscanySCA and 
+# TuscanySCAProxy extension modules
+# 
+# Build/install with the following comands:
+# python TuscanySCASetup.py build
+# python TuscanySCASetup.py install
+# 
+# 
+
+from distutils.core import setup, Extension, os
+
+TUSCANY_SCACPP = os.environ.get("TUSCANY_SCACPP")
+print 'Using TUSCANY_SCACPP at ' + TUSCANY_SCACPP
+
+TUSCANY_SDOCPP = os.environ.get("TUSCANY_SDOCPP")
+print 'Using TUSCANY_SDOCPP at ' + TUSCANY_SDOCPP
+
+macros = []
+if os.name == 'nt':
+    macros = [ ('WIN32',None) ]
+
+module1 = Extension('TuscanySCA',
+                    define_macros = macros,
+                    sources = ['TuscanySCAModule.cpp'],
+                    include_dirs = [ TUSCANY_SCACPP + '/include',
+                                     TUSCANY_SCACPP + '/extensions/python/include',
+                                     TUSCANY_SDOCPP + '/include'],
+                    libraries = ['tuscany_sca',
+                                 'tuscany_sdo',
+                                 'tuscany_sca_python'],
+                    library_dirs = [ TUSCANY_SCACPP + '/lib',
+                                     TUSCANY_SCACPP + '/extensions/python/lib',
+                                     TUSCANY_SDOCPP + '/lib'])
+
+setup (name = 'TuscanySCA',
+       version = '1.0',
+       description = 'The TuscanySCA package',
+       url='http://incubator.apache.org/tuscany/',
+       ext_modules = [module1],
+       py_modules = ['TuscanySCAProxy'])

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/export.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/export.h?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/export.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/export.h Wed Sep 13 06:04:50 2006
@@ -0,0 +1,39 @@
+/*
+ * 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_python_export_h
+#define tuscany_sca_python_export_h
+
+#if defined(WIN32)  || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+
+#ifdef TUSCANY_SCA_PYTHON_EXPORTS
+#define SCA_PYTHON_API __declspec(dllexport)
+#else
+#define SCA_PYTHON_API __declspec(dllimport)
+#endif
+
+#else
+#include <sys/time.h>
+#include <inttypes.h> 
+#include <stdlib.h>
+#define SCA_PYTHON_API 
+#endif
+
+#endif // tuscany_sca_export_h

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp Wed Sep 13 06:04:50 2006
@@ -20,7 +20,7 @@
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/python/model/PythonImplementation.h"
 #include "tuscany/sca/python/model/PythonServiceBinding.h"
-//#include "tuscany/sca/python/model/PythonReferenceBinding.h"
+#include "tuscany/sca/python/model/PythonReferenceBinding.h"
 #include "tuscany/sca/model/Component.h"
 #include "tuscany/sca/model/Service.h"
 #include "tuscany/sca/model/Reference.h"
@@ -66,18 +66,17 @@
                     iter++;
                 }
                 
-                // References not yet supported..
+                // Create Python 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;
+                    PythonReferenceBinding* binding = new PythonReferenceBinding(reference);
+                    reference->setBinding(binding);
+                    refiter++;
+                }
 
-                //// Create Python 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;
-                //    PythonReferenceBinding* binding = new PythonReferenceBinding(reference);
-                //    reference->setBinding(binding);
-                //    refiter++;
-                //}
                 LOGEXIT(1,"PythonImplementation::initializeComponent");
             }
             

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp Wed Sep 13 06:04:50 2006
@@ -0,0 +1,49 @@
+/*
+ * 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/python/export.h"
+#include "tuscany/sca/python/model/PythonInterface.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            const string PythonInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#PythonInterface");
+
+            // Constructor
+            PythonInterface::PythonInterface(
+                    bool remotable,
+                    bool conversational)  
+                    : Interface(remotable, conversational)
+            {
+                LOGENTRY(1, "PythonInterface::constructor");
+                LOGEXIT(1, "PythonInterface::constructor");
+            }
+
+            PythonInterface::~PythonInterface()
+            {
+            }
+
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h Wed Sep 13 06:04:50 2006
@@ -0,0 +1,81 @@
+/*
+ * 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_python_model_pythoninterface_h
+#define tuscany_sca_python_model_pythoninterface_h
+
+#include "tuscany/sca/python/export.h"
+#include "tuscany/sca/model/Interface.h"
+
+#include <map>
+using std::map;
+#include <vector>
+using std::vector;
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            /**
+             * Holds information about an interface described using a C++
+             * header file.
+             */
+            class PythonInterface : public Interface
+            {
+                
+            public:    
+                /**
+                 * Constuctor.
+                 * @param scope The scope of the interface (stateless or composite).
+                 * @param remotable True if the interface is remotable.
+                 */
+                PythonInterface(
+                    bool remotable,
+                    bool conversational);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~PythonInterface();
+                               
+                /**
+                 * return the QName of the schema type for this interface type
+                 * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
+                 */
+                const string& getInterfaceTypeQName() { return typeQName; };
+    
+                /**
+                 * The QName of the schema type for this interface type.
+                 */               
+                SCA_PYTHON_API static const string typeQName;
+           
+            };
+            
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_python_model_pythoninterface_h
+

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp Wed Sep 13 06:04:50 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/python/model/PythonReferenceBinding.h"
+#include "tuscany/sca/python/PythonServiceProxy.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+
+            // Constructor
+            PythonReferenceBinding::PythonReferenceBinding(Reference* reference)
+                : ReferenceBinding(reference, ""), serviceProxy(NULL)
+            {
+            }
+            
+            // Destructor
+            PythonReferenceBinding::~PythonReferenceBinding()
+            {
+            }
+            
+            ServiceProxy* PythonReferenceBinding::getServiceProxy()
+            {
+                return serviceProxy;
+            }
+            
+            void PythonReferenceBinding::configure(ServiceBinding* binding)
+            {
+                targetServiceBinding = binding;
+                
+                serviceProxy = new PythonServiceProxy(getReference());
+            }
+                
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h Wed Sep 13 06:04:50 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_python_model_pythonreferencebinding_h
+#define tuscany_sca_python_model_pythonreferencebinding_h
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            /**
+             * Information about a Python service binding for service or a reference.
+             */
+            class PythonReferenceBinding : public ReferenceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 */
+                PythonReferenceBinding(Reference* reference);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~PythonReferenceBinding();
+                            
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PythonImplementationBinding"; };
+                            
+                /**
+                 * 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 python
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_python_model_pythonreferencebinding_h

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp?view=diff&rev=442975&r1=442974&r2=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp Wed Sep 13 06:04:50 2006
@@ -33,7 +33,7 @@
                 : ServiceBinding(service, "")
             {
                 LOGENTRY(1,"PythonServiceBinding::constructor");
-                serviceWrapper = PythonServiceWrapper::getServiceWrapper(service);
+                serviceWrapper = new PythonServiceWrapper(service);
                 LOGEXIT(1,"PythonServiceBinding::constructor");
             }
 

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/xsd/sca-interface-python.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/xsd/sca-interface-python.xsd?view=auto&rev=442975
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/xsd/sca-interface-python.xsd (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/xsd/sca-interface-python.xsd Wed Sep 13 06:04:50 2006
@@ -0,0 +1,58 @@
+<?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="interface.python" type="sca:PythonInterface" substitutionGroup="sca:interface"/>
+    <complexType name="PythonInterface">
+        <complexContent>
+            <extension base="sca:Interface">
+                <sequence>
+                    <element name="operation" type="sca:PythonOperation" minOccurs="0" maxOccurs="unbounded" />
+                    <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+                </sequence>
+                <attribute name="remotable" type="boolean" use="optional" />
+                <attribute name="conversational" type="boolean" use="optional" />
+                <anyAttribute namespace="##any" processContents="lax" />
+            </extension>
+        </complexContent>
+    </complexType>
+    
+    <complexType name="PythonOperation">
+        <complexContent>
+            <sequence>
+                <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+            </sequence>
+            <attribute name="name" type="string" use="required" />
+            <attribute name="returnType" type="sca:PythonReturnTypes" use="optional" />
+            <anyAttribute namespace="##any" processContents="lax" />
+        </complexContent>
+    </complexType>
+
+    <simpleType name="PythonReturnTypes">
+        <restriction base="string">
+            <enumeration value="string" />
+            <enumeration value="int" />
+            <enumeration value="long" />
+            <enumeration value="boolean" />
+            <enumeration value="float" />
+            <enumeration value="other" />
+        </restriction>
+    </simpleType>
+</schema>



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