You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by aj...@apache.org on 2006/10/12 13:07:46 UTC

svn commit: r463188 - in /incubator/tuscany/cpp/sca: projectsvc7/tuscany_sca/tuscany_sca_python/ runtime/extensions/python/src/tuscany/sca/python/

Author: ajborley
Date: Thu Oct 12 04:07:45 2006
New Revision: 463188

URL: http://svn.apache.org/viewvc?view=rev&rev=463188
Log:
Removed use of osoa::sca namespace for exceptions in python extension

Added:
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceRuntimeException.h   (with props)
Modified:
    incubator/tuscany/cpp/sca/projectsvc7/tuscany_sca/tuscany_sca_python/tuscany_sca_python.vcproj
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp

Modified: incubator/tuscany/cpp/sca/projectsvc7/tuscany_sca/tuscany_sca_python/tuscany_sca_python.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/projectsvc7/tuscany_sca/tuscany_sca_python/tuscany_sca_python.vcproj?view=diff&rev=463188&r1=463187&r2=463188
==============================================================================
--- incubator/tuscany/cpp/sca/projectsvc7/tuscany_sca/tuscany_sca_python/tuscany_sca_python.vcproj (original)
+++ incubator/tuscany/cpp/sca/projectsvc7/tuscany_sca/tuscany_sca_python/tuscany_sca_python.vcproj Thu Oct 12 04:07:45 2006
@@ -150,6 +150,9 @@
 				RelativePath="..\..\..\runtime\extensions\python\src\tuscany\sca\python\PythonServiceProxy.h">
 			</File>
 			<File
+				RelativePath="..\..\..\runtime\extensions\python\src\tuscany\sca\python\PythonServiceRuntimeException.h">
+			</File>
+			<File
 				RelativePath="..\..\..\runtime\extensions\python\src\tuscany\sca\python\PythonServiceWrapper.cpp">
 			</File>
 			<File
@@ -183,13 +186,6 @@
 					RelativePath="..\..\..\runtime\extensions\python\src\tuscany\sca\python\model\PythonServiceBinding.h">
 				</File>
 			</Filter>
-		</Filter>
-		<Filter
-			Name="osoa/sca"
-			Filter="">
-			<File
-				RelativePath="..\..\..\runtime\extensions\python\src\osoa\sca\ServiceRuntimeException.h">
-			</File>
 		</Filter>
 	</Files>
 	<Globals>

Modified: 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=diff&rev=463188&r1=463187&r2=463188
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp Thu Oct 12 04:07:45 2006
@@ -21,7 +21,7 @@
 
 #include "tuscany/sca/python/PythonServiceProxy.h"
 #include "tuscany/sca/util/Logging.h"
-#include "osoa/sca/ServiceRuntimeException.h"
+#include "tuscany/sca/python/PythonServiceRuntimeException.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/model/Reference.h"
 #include "tuscany/sca/model/ReferenceType.h"
@@ -35,7 +35,6 @@
 #include "tuscany/sca/python/model/PythonImplementation.h"
 #include "tuscany/sca/python/model/PythonReferenceBinding.h"
 
-using namespace osoa::sca;
 using namespace tuscany::sca::model;
 
 namespace tuscany

Added: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceRuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceRuntimeException.h?view=auto&rev=463188
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceRuntimeException.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceRuntimeException.h Thu Oct 12 04:07:45 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_python_pythonserviceruntimeexception_h
+#define tuscany_sca_python_pythonserviceruntimeexception_h
+
+#include "export.h"
+
+#include "tuscany/sca/util/Exceptions.h"
+using tuscany::sca::TuscanyRuntimeException;
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace python
+        {
+            /**
+            * Exception to represent a failure in a Python call.
+            */
+            class SCA_PYTHON_API PythonServiceRuntimeException : public TuscanyRuntimeException
+            {
+            public:
+                PythonServiceRuntimeException(
+                    const char *name="PythonServiceRuntimeException",
+                    severity_level sev=Severe,
+                    const char* msg_text="")
+                    : TuscanyRuntimeException(name, sev, msg_text)
+                {
+                }
+            }; // End PythonServiceRuntimeException class definition        
+        
+            /**
+            * The target of a wire cannot be found, or the reference has not been
+            * configured.
+            */
+            class SCA_PYTHON_API PythonServiceNotFoundException: public PythonServiceRuntimeException
+            {
+            public:
+                PythonServiceNotFoundException(const char* msg)
+                    : PythonServiceRuntimeException("PythonServiceNotFoundException", Error,
+                    msg)
+                {
+                }
+            private:
+            }; // End PythonServiceNotFoundException class definition
+
+
+            /**
+            * There is no current component (for example, if a non-SCA component
+            * tries to get the current ComponentContext).
+            */
+            class SCA_PYTHON_API PythonComponentContextException: public PythonServiceRuntimeException
+            {
+            public:
+                PythonComponentContextException(const char* msg)
+                    : PythonServiceRuntimeException("PythonComponentContextException", Error,
+                    msg)
+                {
+                }
+            private:
+            }; // End PythonComponentContextException class definition
+
+            /**
+            * There is no current component (for example, if a non-SCA component
+            * tries to get the current ComponentContext).
+            */
+            class SCA_PYTHON_API PythonComponentInvocationException: public PythonServiceRuntimeException
+            {
+            public:
+                PythonComponentInvocationException(const char* msg)
+                    : PythonServiceRuntimeException("ComponentInvocationException", Error,
+                    msg)
+                {
+                }
+            private:
+            }; // End PythonComponentInvocationException class definition
+
+        } // End namespace python
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_python_pythonserviceruntimeexception_h

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

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

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=463188&r1=463187&r2=463188
==============================================================================
--- 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 Thu Oct 12 04:07:45 2006
@@ -19,7 +19,7 @@
 
 /* $Rev$ $Date$ */
 
-#include "osoa/sca/ServiceRuntimeException.h"
+#include "tuscany/sca/python/PythonServiceRuntimeException.h"
 #include "tuscany/sca/python/PythonServiceWrapper.h"
 
 #include "tuscany/sca/util/Logging.h"
@@ -31,8 +31,6 @@
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/python/model/PythonImplementation.h"
 
-using namespace osoa::sca;
-
 #include "commonj/sdo/SDO.h"
 using namespace commonj::sdo;
 
@@ -81,7 +79,7 @@
                 if (!impl)
                 {
                     string msg = "Component " + component->getName() + " has no implementation defined";
-                    throw ServiceNotFoundException(msg.c_str());
+                    throw PythonServiceNotFoundException(msg.c_str());
                 }
 
                 LOGINFO_1(3,"PythonServiceWrapper::constructor module %s", impl->getModule().c_str());
@@ -131,7 +129,7 @@
                     }
                     string msg = "Failed to load module named " + impl->getModule();
                     LOGERROR(0, msg.c_str());
-                    throw ComponentContextException(msg.c_str());
+                    throw PythonComponentContextException(msg.c_str());
                 }
                 //else
                 //{
@@ -182,7 +180,7 @@
                             }
                             string msg = "Cannot find class named " + className + " in Python module";
                             LOGERROR(0, msg.c_str());
-                            throw new ComponentInvocationException(msg.c_str());
+                            throw new PythonComponentInvocationException(msg.c_str());
                         }
 
                         pClassInstance = PyInstance_New(pClass, NULL, NULL);
@@ -195,7 +193,7 @@
                             }
                             string msg = "Could not create new instance of class named " + className + " in Python module";
                             LOGERROR(0, msg.c_str());
-                            throw new ComponentInvocationException(msg.c_str());
+                            throw new PythonComponentInvocationException(msg.c_str());
                         }
                         Py_XDECREF(pClass);
                     }
@@ -294,7 +292,7 @@
                         // Can't get the function from the class or module - throw exception
                         string msg = "Python module or class instance has not been created";
                         LOGERROR(0, msg.c_str());
-                        throw new ComponentInvocationException(msg.c_str());
+                        throw new PythonComponentInvocationException(msg.c_str());
                     }
 
                     if (pFunc && PyCallable_Check(pFunc)) 
@@ -375,7 +373,7 @@
                                     pValue = PyString_FromString((*(string*)parm.getValue()).c_str());
     				                break;
     			                }
-                                default: throw new ComponentInvocationException("Operation parameter type not supported");
+                                default: throw new PythonComponentInvocationException("Operation parameter type not supported");
     		                }
 
                             if (!pValue) 
@@ -389,7 +387,7 @@
 
                                 string msg = "Error converting parameter into Python type";
                                 LOGERROR(0, msg.c_str());
-                                throw new ComponentInvocationException(msg.c_str());
+                                throw new PythonComponentInvocationException(msg.c_str());
                                 
                             }
                             //printPyObject("Param value", pValue);
@@ -766,7 +764,7 @@
                             }
                             string msg = "Error whilst calling Python module";
                             LOGERROR(0, msg.c_str());
-                            throw new ComponentInvocationException(msg.c_str());
+                            throw new PythonComponentInvocationException(msg.c_str());
                         }
                     }
                     else 
@@ -777,7 +775,7 @@
                         }
                         string msg = "Cannot find the operation named " + operation.getName() + " in the Python module";
                         LOGERROR(0, msg.c_str());
-                        throw new ComponentInvocationException(msg.c_str());
+                        throw new PythonComponentInvocationException(msg.c_str());
                     }
                     Py_XDECREF(pFunc);
  



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