You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/12 05:39:45 UTC
svn commit: r473873 [3/5] - in /incubator/tuscany/cpp/sca:
runtime/core/src/tuscany/sca/core/ runtime/core/src/tuscany/sca/extension/
runtime/core/src/tuscany/sca/model/ runtime/core/src/tuscany/sca/util/
runtime/extensions/cpp/src/osoa/sca/ runtime/ex...
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp Sat Nov 11 20:39:42 2006
@@ -47,8 +47,7 @@
// ===================================================================
PHPExtension::PHPExtension()
{
- LOGENTRY(1, "PHPExtension::constructor");
- LOGEXIT(1, "PHPExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -56,16 +55,14 @@
// ===================================================================
PHPExtension::~PHPExtension()
{
- LOGENTRY(1, "PHPExtension::destructor");;
- LOGEXIT(1, "PHPExtension::destructor");
+ logentry();
}
void PHPExtension::initialize()
{
- LOGENTRY(1, "PHPExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerImplementationExtension(new PHPImplementationExtension());
//SCARuntime::getInstance()->registerInterfaceExtension(new PHPInterfaceExtension());
- LOGEXIT(1, "PHPExtension::initialize");;
}
} // End namespace php
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp Sat Nov 11 20:39:42 2006
@@ -36,8 +36,7 @@
// ===================================================================
PHPImplementationExtension::PHPImplementationExtension()
{
- LOGENTRY(1, "PHPImplementationExtension::constructor");
- LOGEXIT(1, "PHPImplementationExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -45,8 +44,7 @@
// ===================================================================
PHPImplementationExtension::~PHPImplementationExtension()
{
- LOGENTRY(1, "PHPImplementationExtension::destructor");;
- LOGEXIT(1, "PHPImplementationExtension::destructor");
+ logentry();
}
const string PHPImplementationExtension::extensionName("php");
@@ -57,6 +55,8 @@
// ===================================================================
ComponentType* PHPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
{
+ logentry();
+
string implType = scdlImplementation->getType().getName();
if (implType == "PHPImplementation")
{
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp Sat Nov 11 20:39:42 2006
@@ -26,8 +26,8 @@
#include "tuscany/sca/php/PHPServiceWrapper.h"
-#include "osoa/sca/ServiceRuntimeException.h"
#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
#include "tuscany/sca/util/Utils.h"
#include "tuscany/sca/model/Component.h"
#include "tuscany/sca/model/Composite.h"
@@ -38,8 +38,6 @@
#include <php_embed.h>
-using namespace osoa::sca;
-
namespace tuscany
{
namespace sca
@@ -59,14 +57,15 @@
// Callback for log messages
void php_log_message(char *message)
- {
- LOGINFO_1(5, "PHP Log (%s)", message);
+ {
+ loginfo("PHP log: %s", message);
}
// Callback for unbuffered writes (echo, print etc.)
int php_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
{
- LOGINFO_1(5, "PHP Write (%s)", str);
+ logentry();
+ loginfo("Write: %s", str);
scriptResponse = str;
return str_length;
}
@@ -77,19 +76,21 @@
const uint error_lineno,
const char *format, va_list args)
{
+ logentry();
+
char buffer[2048];
int len;
len = snprintf(buffer, 2048, "Error on line %d: ", error_lineno);
vsnprintf(buffer + len, (2048 - len), format, args);
- LOGINFO_1(5, "PHP Unformatted Error (%s)", buffer);
+ logwarning("PHP unformatted error: %s", buffer);
zend_bailout();
}
// Callback for flush (could be used to do something with the scriptResponse)
void php_flush(void *server_context)
{
- LOGINFO(5, "Flush");
+ logentry();
}
// ===========
@@ -98,7 +99,7 @@
PHPServiceWrapper::PHPServiceWrapper(Service* service)
: ServiceWrapper(service)
{
- LOGENTRY(1,"PHPServiceWrapper::constructor");
+ logentry();
component = service->getComponent();
interf = service->getType()->getInterface();
@@ -111,14 +112,11 @@
if (!impl)
{
string msg = "Component " + component->getName() + " has no implementation defined";
- throw ServiceNotFoundException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
- LOGINFO_1(3,"PHPServiceWrapper::getServiceWrapper module %s", impl->getModule().c_str());
- LOGINFO_1(3,"PHPServiceWrapper::getServiceWrapper class %s", impl->getClass().c_str());
-
- LOGEXIT(1,"PHPServiceWrapper::constructor");
-
+ loginfo("Module: %s", impl->getModule().c_str());
+ loginfo("Class: %s", impl->getClass().c_str());
}
// ==========
@@ -126,8 +124,7 @@
// ==========
PHPServiceWrapper::~PHPServiceWrapper()
{
- LOGENTRY(1,"PHPServiceWrapper::destructor");
- LOGEXIT(1,"PHPServiceWrapper::destructor");
+ logentry();
}
@@ -136,14 +133,14 @@
// ======================================================================
void PHPServiceWrapper::invoke(Operation& operation)
{
- LOGENTRY(1,"PHPServiceWrapper::invoke");
+ logentry();
SCARuntime* runtime = SCARuntime::getInstance();
runtime->setCurrentComponent(component);
try
{
- LOGINFO_1(4, "PHPServiceWrapper::invoke called with operation name: %s", operation.getName().c_str());
+ loginfo("Operation: %s", operation.getName().c_str());
// create a temporary script which
// - includes the named script
@@ -249,7 +246,7 @@
}
default:
{
- throw new ComponentInvocationException("Operation parameter type not supported");
+ throwException(ServiceDataException, "Operation parameter type not supported");
}
}
@@ -264,7 +261,7 @@
script += ");echo $response;return $response;";
// we now have the temporary script to make the call
- LOGINFO_1(5, "Executing PHP script \n%s", script.c_str());
+ loginfo("Script: %s", script.c_str());
// load the PHP logging and error callback methods
php_embed_module.log_message = php_log_message;
@@ -274,7 +271,7 @@
//PHP_EMBED_START_BLOCK(/* argc */ 0, /* argv */ NULL)
void ***tsrm_ls;
int status = php_embed_init(0, NULL PTSRMLS_CC);
- LOGINFO_1(5, "Engine startup status %d", status);
+ loginfo("Engine startup status: %d", status);
zend_first_try {
// set error handler
@@ -293,21 +290,21 @@
// This is a bit of a rubbish way of doing things so
// needs replacing when proper SAPI is used
//convert_to_string(&retval);
- //LOGINFO_1(5, "Script returned %s", Z_STRVAL(retval));
+ //loginfo("Script returned: %s", Z_STRVAL(retval));
//zval_dtor(&retval);
//PHP_EMBED_END_BLOCK()
} zend_catch {
int exit_status = EG(exit_status);
- LOGINFO_1(5, "In catch %d", exit_status);
+ loginfo("In catch: %d", exit_status);
} zend_end_try();
//clean up
php_embed_shutdown(TSRMLS_C);
- LOGINFO(5, "Engine shutdown");
+ loginfo("Engine shutdown");
// get the response values
- LOGINFO_1(5, "Script returned %s", scriptResponse.c_str());
+ loginfo("Script returned: %s", scriptResponse.c_str());
switch(operation.getReturnType())
{
@@ -369,12 +366,10 @@
}
catch (...)
{
- runtime->unsetCurrentComponent();
+ runtime->unsetCurrentComponent();
throw;
}
- runtime->unsetCurrentComponent();
- LOGEXIT(1,"PHPServiceWrapper::invoke");
-
+ runtime->unsetCurrentComponent();
}
// ======================================================================
@@ -382,7 +377,7 @@
// ======================================================================
PHPServiceWrapper* PHPServiceWrapper::getServiceWrapper(Service* service)
{
- LOGENTRY(1,"PHPServiceWrapper::getServiceWrapper");
+ logentry();
PHPServiceWrapper* serviceWrapper = 0;
// ---------------------------------
@@ -392,11 +387,9 @@
if (!serviceWrapper)
{
string msg = "Could not create new PHPServiceWrapper";
- LOGERROR(1, msg.c_str());
- throw ServiceNotFoundException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
- LOGEXIT(1,"PHPServiceWrapper::getServiceWrapper");
return serviceWrapper;
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h Sat Nov 11 20:39:42 2006
@@ -24,7 +24,7 @@
#define tuscany_sca_php_phpservicewrapper_h
-#include "osoa/sca/export.h"
+#include "tuscany/sca/php/export.h"
#include "tuscany/sca/core/ServiceWrapper.h"
#include "tuscany/sca/core/Operation.h"
#include "tuscany/sca/model/Component.h"
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h?view=auto&rev=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h Sat Nov 11 20:39:42 2006
@@ -0,0 +1,41 @@
+/*
+ * 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_php_export_h
+#define tuscany_sca_php_export_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+
+#ifdef TUSCANY_SCA_PHP_EXPORTS
+#define SCA_PHP_API __declspec(dllexport)
+#else
+#define SCA_PHP_API __declspec(dllimport)
+#endif
+
+#else
+#include <sys/time.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#define SCA_PHP_API
+#endif
+
+#endif // tuscany_sca_export_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/export.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp Sat Nov 11 20:39:42 2006
@@ -41,19 +41,17 @@
: ComponentType(composite, module),
module(module), className(className)
{
- LOGENTRY(1,"PHPImplementation::constructor");
- LOGEXIT(1,"PHPImplementation::constructor");
+ logentry();
}
PHPImplementation::~PHPImplementation()
{
- LOGENTRY(1,"PHPImplementation::destructor");
- LOGEXIT(1,"PHPImplementation::destructor");
+ logentry();
}
void PHPImplementation::initializeComponent(Component* component)
{
- LOGENTRY(1,"PHPImplementation::initializeComponent");
+ logentry();
ComponentType::initializeComponent(component);
// Create PHP bindings for all the services
@@ -79,7 +77,6 @@
// reference->setBinding(binding);
// refiter++;
//}
- LOGEXIT(1,"PHPImplementation::initializeComponent");
}
} // End namespace php
Modified: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp Sat Nov 11 20:39:42 2006
@@ -34,22 +34,19 @@
PHPServiceBinding::PHPServiceBinding(Service* service)
: ServiceBinding(service, "")
{
- LOGENTRY(1,"PHPServiceBinding::constructor");
+ logentry();
serviceWrapper = PHPServiceWrapper::getServiceWrapper(service);
- LOGEXIT(1,"PHPServiceBinding::constructor");
}
// Destructor
PHPServiceBinding::~PHPServiceBinding()
{
- LOGENTRY(1,"PHPServiceBinding::destructor");
- LOGEXIT(1,"PHPServiceBinding::destructor");
+ logentry();
}
ServiceWrapper* PHPServiceBinding::getServiceWrapper()
{
- LOGENTRY(1,"PHPServiceBinding::getServiceWrapper");
- LOGEXIT(1,"PHPServiceBinding::getServiceWrapper");
+ logentry();
return (ServiceWrapper*)serviceWrapper;
}
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=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/Makefile.am Sat Nov 11 20:39:42 2006
@@ -19,13 +19,7 @@
lib_LTLIBRARIES = libtuscany_sca_python.la
install-exec-hook:
- cd $(libdir); \
- for i in libtuscany_sca_python.so*; \
- do mv $$i $$i.disabled; \
- if ! [ "$$i" = "libtuscany_sca_python.so.0.0.0" ]; then \
- ln -s -f libtuscany_sca_python.so.0.0.0.disabled $$i.disabled; \
- fi; \
- done;
+ cd $(libdir); ln -s -f libtuscany_sca_python.so sca.so
pydir=$(prefix)/extensions/python/lib
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=473873&r1=473872&r2=473873
==============================================================================
--- 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 Sat Nov 11 20:39:42 2006
@@ -49,8 +49,7 @@
// ===================================================================
PythonExtension::PythonExtension()
{
- LOGENTRY(1, "PythonExtension::constructor");
- LOGEXIT(1, "PythonExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -58,16 +57,14 @@
// ===================================================================
PythonExtension::~PythonExtension()
{
- LOGENTRY(1, "PythonExtension::destructor");;
- LOGEXIT(1, "PythonExtension::destructor");
+ logentry();
}
void PythonExtension::initialize()
{
- LOGENTRY(1, "PythonExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerImplementationExtension(new PythonImplementationExtension());
SCARuntime::getInstance()->registerInterfaceExtension(new PythonInterfaceExtension());
- LOGEXIT(1, "PythonExtension::initialize");;
}
} // End namespace python
Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp Sat Nov 11 20:39:42 2006
@@ -37,8 +37,7 @@
// ===================================================================
PythonImplementationExtension::PythonImplementationExtension()
{
- LOGENTRY(1, "PythonImplementationExtension::constructor");
- LOGEXIT(1, "PythonImplementationExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -46,8 +45,7 @@
// ===================================================================
PythonImplementationExtension::~PythonImplementationExtension()
{
- LOGENTRY(1, "PythonImplementationExtension::destructor");;
- LOGEXIT(1, "PythonImplementationExtension::destructor");
+ logentry();
}
const string PythonImplementationExtension::extensionName("python");
@@ -58,6 +56,8 @@
// ===================================================================
ComponentType* PythonImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
{
+ logentry();
+
string implType = scdlImplementation->getType().getName();
if (implType == "PythonImplementation")
{
Modified: 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=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp Sat Nov 11 20:39:42 2006
@@ -37,8 +37,7 @@
// ===================================================================
PythonInterfaceExtension::PythonInterfaceExtension()
{
- LOGENTRY(1, "PythonInterfaceExtension::constructor");
- LOGEXIT(1, "PythonInterfaceExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -46,8 +45,7 @@
// ===================================================================
PythonInterfaceExtension::~PythonInterfaceExtension()
{
- LOGENTRY(1, "PythonInterfaceExtension::destructor");;
- LOGEXIT(1, "PythonInterfaceExtension::destructor");
+ logentry();
}
const string PythonInterfaceExtension::extensionName("python");
@@ -58,6 +56,8 @@
// ===================================================================
tuscany::sca::model::Interface* PythonInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
{
+ logentry();
+
// Determine the type
string ifType = scdlInterface->getType().getName();
if (ifType == "PythonInterface")
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=473873&r1=473872&r2=473873
==============================================================================
--- 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 Sat Nov 11 20:39:42 2006
@@ -21,7 +21,7 @@
#include "tuscany/sca/python/PythonServiceProxy.h"
#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/python/PythonServiceRuntimeException.h"
+#include "tuscany/sca/util/Exceptions.h"
#include "tuscany/sca/core/SCARuntime.h"
#include "tuscany/sca/model/Reference.h"
#include "tuscany/sca/model/ReferenceType.h"
@@ -50,13 +50,11 @@
PythonServiceProxy::PythonServiceProxy(Reference* reference)
: ServiceProxy(reference)
{
- LOGENTRY(1,"PythonServiceProxy::constructor(Reference)");
+ logentry();
// Get the service wrapper
PythonReferenceBinding* referenceBinding = (PythonReferenceBinding*)reference->getBinding();
serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
-
- LOGEXIT(1,"PythonServiceProxy::constructor(Reference)");
}
// ==========================================
@@ -65,12 +63,10 @@
PythonServiceProxy::PythonServiceProxy(Service* service)
: ServiceProxy(NULL)
{
- LOGENTRY(1,"PythonServiceProxy::constructor(Service)");
+ logentry();
// Get the service wrapper
serviceWrapper = service->getBinding()->getServiceWrapper();
-
- LOGEXIT(1,"PythonServiceProxy::constructor(Service)");
}
// ==========
@@ -78,8 +74,7 @@
// ==========
PythonServiceProxy::~PythonServiceProxy()
{
- LOGENTRY(1,"PythonServiceProxy::destructor");
- LOGEXIT(1,"PythonServiceProxy::destructor");
+ logentry();
}
// =====================================================
@@ -87,12 +82,10 @@
// =====================================================
void PythonServiceProxy::invokeService(Operation& operation)
{
- LOGENTRY(1,"PythonServiceProxy::invokeService");
+ logentry();
// Invoke the service
serviceWrapper->invoke(operation);
-
- LOGEXIT(1,"PythonServiceProxy::invokeService");
}
} // End namespace python
} // End namespace sca
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=473873&r1=473872&r2=473873
==============================================================================
--- 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 Sat Nov 11 20:39:42 2006
@@ -19,10 +19,10 @@
/* $Rev$ $Date$ */
-#include "tuscany/sca/python/PythonServiceRuntimeException.h"
#include "tuscany/sca/python/PythonServiceWrapper.h"
#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
#include "tuscany/sca/util/Utils.h"
#include "tuscany/sca/model/Component.h"
#include "tuscany/sca/model/Composite.h"
@@ -48,12 +48,12 @@
void printPyObject(char * name, PyObject *pObj)
{
PyObject* pObjRepr = PyObject_Repr(pObj);
- LOGINFO_2(5, "PythonServiceWrapper::printPyObject %s: %s", name, PyString_AsString(pObjRepr));
+ loginfo("PyObject %s: %s", name, PyString_AsString(pObjRepr));
Py_DECREF(pObjRepr);
PyObject* pObjDir = PyObject_Dir(pObj);
PyObject* pObjDirRepr = PyObject_Repr(pObjDir);
- LOGINFO_2(5, "PythonServiceWrapper::printPyObject dir(%s): %s", name, PyString_AsString(pObjDirRepr));
+ loginfo("PyObject dir(%s): %s", name, PyString_AsString(pObjDirRepr));
Py_DECREF(pObjDirRepr);
Py_DECREF(pObjDir);
}
@@ -64,7 +64,7 @@
PythonServiceWrapper::PythonServiceWrapper(Service* service)
: ServiceWrapper(service)
{
- LOGENTRY(1,"PythonServiceWrapper::constructor");
+ logentry();
component = service->getComponent();
implementation = (PythonImplementation*)component->getType();
@@ -79,12 +79,12 @@
if (!impl)
{
string msg = "Component " + component->getName() + " has no implementation defined";
- throw PythonServiceNotFoundException(msg.c_str());
+ throwException(SystemConfigurationException, msg.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());
+ loginfo("Module: %s", impl->getModule().c_str());
+ loginfo("Path: %s", impl->getModulePath().c_str());
+ loginfo("Class: %s", impl->getClass().c_str());
// Initialize the Python environment
Py_Initialize();
@@ -128,8 +128,7 @@
PyErr_Print();
}
string msg = "Failed to load module named " + impl->getModule();
- LOGERROR(0, msg.c_str());
- throw PythonComponentContextException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
//else
//{
@@ -138,9 +137,6 @@
//}
printPyObject("pythonModule",pythonModule);
-
- LOGEXIT(1,"PythonServiceWrapper::constructor");
-
}
// ==========
@@ -148,11 +144,11 @@
// ==========
PythonServiceWrapper::~PythonServiceWrapper()
{
- LOGENTRY(1,"PythonServiceWrapper::destructor");
+ logentry();
+
Py_XDECREF(pythonClassInstance);
Py_XDECREF(pythonModule);
Py_Finalize();
- LOGEXIT(1,"PythonServiceWrapper::destructor");
}
// ======================================================================
@@ -160,7 +156,8 @@
// ======================================================================
PyObject* PythonServiceWrapper::newInstance()
{
- LOGENTRY(1,"PythonServiceWrapper::newInstance");
+ logentry();
+
PythonImplementation* impl = (PythonImplementation*)component->getType();
string className = impl->getClass();
@@ -179,8 +176,7 @@
PyErr_Print();
}
string msg = "Cannot find class named " + className + " in Python module";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
pClassInstance = PyInstance_New(pClass, NULL, NULL);
@@ -192,13 +188,11 @@
PyErr_Print();
}
string msg = "Could not create new instance of class named " + className + " in Python module";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(ServiceInvocationException, msg.c_str());
}
Py_XDECREF(pClass);
}
}
- LOGEXIT(1,"PythonServiceWrapper::newInstance");
return pClassInstance;
}
@@ -207,7 +201,7 @@
// ======================================================================
PyObject* PythonServiceWrapper::getInstance()
{
- LOGENTRY(1,"PythonServiceWrapper::getInstance");
+ logentry();
PythonImplementation::Scope scope = implementation->getScope();
if (scope == PythonImplementation::COMPOSITE)
@@ -222,7 +216,6 @@
{
return newInstance();
}
- LOGEXIT(1,"PythonServiceWrapper::getInstance");
}
// ======================================================================
@@ -230,7 +223,7 @@
// ======================================================================
void PythonServiceWrapper::releaseInstance()
{
- LOGENTRY(1,"PythonServiceWrapper::releaseInstance");
+ logentry();
PythonImplementation::Scope scope = implementation->getScope();
if(scope == PythonImplementation::STATELESS)
@@ -252,7 +245,6 @@
pythonModule = reloadedPythonModule;
}
}
- LOGEXIT(1,"PythonServiceWrapper::releaseInstance");
}
// ======================================================================
@@ -260,7 +252,7 @@
// ======================================================================
void PythonServiceWrapper::invoke(Operation& operation)
{
- LOGENTRY(1,"PythonServiceWrapper::invoke");
+ logentry();
SCARuntime* runtime = SCARuntime::getInstance();
runtime->setCurrentComponent(component);
@@ -272,7 +264,7 @@
try
{
- LOGINFO_1(4, "PythonServiceWrapper::invoke called with operation name: %s", operation.getName().c_str());
+ loginfo("Operation: %s", operation.getName().c_str());
PyObject* pFunc = NULL;
pythonClassInstance = getInstance();
@@ -289,10 +281,9 @@
}
if(pFunc == NULL)
{
- // Can't get the function from the class or module - throw exception
+ // Can't get the function from the class or module
string msg = "Python module or class instance has not been created";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(ServiceInvocationException, msg.c_str());
}
if (pFunc && PyCallable_Check(pFunc))
@@ -373,7 +364,8 @@
pValue = PyString_FromString((*(string*)parm.getValue()).c_str());
break;
}
- default: throw new PythonComponentInvocationException("Operation parameter type not supported");
+ default:
+ throwException(ServiceDataException, "Operation parameter type not supported");
}
if (!pValue)
@@ -386,8 +378,7 @@
}
string msg = "Error converting parameter into Python type";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(ServiceDataException, msg.c_str());
}
//printPyObject("Param value", pValue);
@@ -408,12 +399,12 @@
long* data = new long;
if(PyInt_Check(pValue))
{
- LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is int type: %d", PyInt_AsLong(pValue));
+ loginfo("Int return value: %d", PyInt_AsLong(pValue));
*data = PyInt_AsLong(pValue);
}
else
{
- LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is long type: %l", PyLong_AsLong(pValue));
+ loginfo("Long return value: %l", PyLong_AsLong(pValue));
*data = PyLong_AsLong(pValue);
}
@@ -491,7 +482,7 @@
}
else if(PyBool_Check(pValue))
{
- LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is bool type: %d", (pValue == Py_True));
+ loginfo("Bool return value: %d", (pValue == Py_True));
bool* data = new bool;
*data = (pValue == Py_True);
@@ -581,7 +572,7 @@
}
else if(PyFloat_Check(pValue))
{
- LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is float type: %f", PyFloat_AsDouble(pValue));
+ loginfo("Float return value: %f", PyFloat_AsDouble(pValue));
double* data = new double;
*data = PyFloat_AsDouble(pValue);
@@ -660,7 +651,7 @@
}
else if(PyString_Check(pValue))
{
- LOGINFO_1(3, "PythonServiceWrapper::invoke Return value is string type: %s", PyString_AsString(pValue));
+ loginfo("String return value: %s", PyString_AsString(pValue));
const char** data = new const char*;
*data = PyString_AsString(pValue);
@@ -747,7 +738,7 @@
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));
+ loginfo("Return value of unknown type (%s) has repr: %s", PyString_AsString(valueTypeRepr), PyString_AsString(valueRepr));
Py_DECREF(valueTypeRepr);
Py_DECREF(valueType);
Py_DECREF(valueRepr);
@@ -763,8 +754,7 @@
PyErr_Print();
}
string msg = "Error whilst calling Python module";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(ServiceInvocationException, msg.c_str());
}
}
else
@@ -774,8 +764,7 @@
PyErr_Print();
}
string msg = "Cannot find the operation named " + operation.getName() + " in the Python module";
- LOGERROR(0, msg.c_str());
- throw new PythonComponentInvocationException(msg.c_str());
+ throwException(ServiceInvocationException, msg.c_str());
}
Py_XDECREF(pFunc);
@@ -788,8 +777,6 @@
}
releaseInstance();
runtime->unsetCurrentComponent();
- LOGEXIT(1,"PythonServiceWrapper::invoke");
-
}
@@ -798,6 +785,8 @@
// ==========================================================================
void PythonServiceWrapper::addProperties(PyObject* module)
{
+ logentry();
+
// Set all the configured properties
DataObjectPtr properties = component->getProperties();
PropertyList pl = properties->getInstanceProperties();
@@ -875,11 +864,11 @@
if(success == 0)
{
- LOGINFO_3(3, "Successfully added property named %s with type %s and value %s to python module", propName.c_str(), pl[i].getType().getName(), propValue.c_str());
+ loginfo("Added property named %s with type %s and value %s to python module", propName.c_str(), pl[i].getType().getName(), propValue.c_str());
}
else
{
- LOGERROR_1(1, "Failed to add property named %s to python module", propName.c_str());
+ logwarning("Failed to add property named %s to python module", propName.c_str());
}
}
}
@@ -892,6 +881,7 @@
// ======================================================================
void PythonServiceWrapper::addReferences(PyObject* module)
{
+ logentry();
// Import the TuscanySCA python-extension module
PyObject* pModuleName = PyString_FromString("sca_proxy");
@@ -905,7 +895,7 @@
PyErr_Print();
}
string msg = "Failed to load the sca_proxy Python module - has it been successfully installed?\nReferences from Python components will not be supported";
- LOGERROR(0, msg.c_str());
+ logwarning(0, msg.c_str());
}
else
{
@@ -935,11 +925,11 @@
if(success == 0)
{
- LOGINFO_1(3, "Successfully added sca_proxy_class instance as %s to pythonModule", referenceName.c_str());
+ loginfo("Successfully added sca_proxy_class instance as %s to pythonModule", referenceName.c_str());
}
else
{
- LOGERROR_1(1, "Failed to add sca_proxy_class instance as %s to pythonModule", referenceName.c_str());
+ logwarning("Failed to add sca_proxy_class instance as %s to pythonModule", referenceName.c_str());
}
}
Py_DECREF(sca_proxy_module);
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=473873&r1=473872&r2=473873
==============================================================================
--- 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 Sat Nov 11 20:39:42 2006
@@ -42,19 +42,17 @@
: ComponentType(composite, modulePath + "/" + module),
module(module), modulePath(modulePath), className(className), scope(scope)
{
- LOGENTRY(1,"PythonImplementation::constructor");
- LOGEXIT(1,"PythonImplementation::constructor");
+ logentry();
}
PythonImplementation::~PythonImplementation()
{
- LOGENTRY(1,"PythonImplementation::destructor");
- LOGEXIT(1,"PythonImplementation::destructor");
+ logentry();
}
void PythonImplementation::initializeComponent(Component* component)
{
- LOGENTRY(1,"PythonImplementation::initializeComponent");
+ logentry();
ComponentType::initializeComponent(component);
// Create Python bindings for all the services
@@ -78,8 +76,6 @@
reference->setBinding(binding);
refiter++;
}
-
- LOGEXIT(1,"PythonImplementation::initializeComponent");
}
} // End namespace python
Modified: 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=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp Sat Nov 11 20:39:42 2006
@@ -39,12 +39,12 @@
bool conversational)
: Interface(remotable, conversational)
{
- LOGENTRY(1, "PythonInterface::constructor");
- LOGEXIT(1, "PythonInterface::constructor");
+ logentry();
}
PythonInterface::~PythonInterface()
{
+ logentry();
}
} // End namespace python
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=473873&r1=473872&r2=473873
==============================================================================
--- 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 Sat Nov 11 20:39:42 2006
@@ -34,22 +34,19 @@
PythonServiceBinding::PythonServiceBinding(Service* service)
: ServiceBinding(service, "")
{
- LOGENTRY(1,"PythonServiceBinding::constructor");
+ logentry();
serviceWrapper = new PythonServiceWrapper(service);
- LOGEXIT(1,"PythonServiceBinding::constructor");
}
// Destructor
PythonServiceBinding::~PythonServiceBinding()
{
- LOGENTRY(1,"PythonServiceBinding::destructor");
- LOGEXIT(1,"PythonServiceBinding::destructor");
+ logentry();
}
ServiceWrapper* PythonServiceBinding::getServiceWrapper()
{
- LOGENTRY(1,"PythonServiceBinding::getServiceWrapper");
- LOGEXIT(1,"PythonServiceBinding::getServiceWrapper");
+ logentry();
return (ServiceWrapper*)serviceWrapper;
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp Sat Nov 11 20:39:42 2006
@@ -48,24 +48,24 @@
*/
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));
+ loginfo("%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));
+ loginfo("%s printPyObject dir(%s): %s", prefix, name, PyString_AsString(pObjDirRepr));
Py_DECREF(pObjDirRepr);
Py_DECREF(pObjDir);
}
- LOGINFO(4, "Returning from printPyObject");
}
static PyObject* sca_locateservice(PyObject *self, PyObject *args)
{
+ logentry();
+
// Get the service name
PyObject* pServiceName = PyTuple_GetItem(args, 0);
@@ -81,7 +81,7 @@
PyErr_Print();
}
string msg = "Failed to load the sca_proxy Python module - has it been successfully installed?\nReferences from Python components will not be supported";
- LOGERROR(0, msg.c_str());
+ logerror(msg.c_str());
}
else
{
@@ -107,7 +107,7 @@
static PythonServiceProxy* getServiceProxy(PyObject *args)
{
- LOGENTRY(1, "sca_module getPythonServiceProxy");
+ logentry();
PythonServiceProxy* serviceProxy = NULL;
SCARuntime* runtime = SCARuntime::getInstance();
@@ -121,12 +121,12 @@
}
if(name.size() > 0)
{
- LOGINFO_1(3, "sca_invoke Service/Reference name is %s", name.c_str());
+ loginfo("Service/Reference name is %s", name.c_str());
}
else
{
- string msg = "sca_invoke Service/Reference name has not been set";
- LOGERROR(1, msg.c_str());
+ string msg = "Service/Reference name has not been set";
+ logwarning(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
return NULL;
}
@@ -141,8 +141,8 @@
Reference* ref = component->findReference(name);
if(!ref)
{
- string msg = "sca_invoke Could not find the reference named "+name;
- LOGERROR(1, msg.c_str());
+ string msg = "Could not find the reference: "+name;
+ logwarning(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
return NULL;
@@ -159,8 +159,8 @@
if(!service)
{
- string msg = "sca_invoke Could not find the service named "+name;
- LOGERROR(1, msg.c_str());
+ string msg = "Could not find service: "+name;
+ logwarning(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
return NULL;
}
@@ -174,7 +174,7 @@
static PyObject* sca_invoke(PyObject *self, PyObject *args)
{
- LOGENTRY(1, "sca_invoke");
+ logentry();
PythonServiceProxy* pythonServiceProxy = getServiceProxy(args);
if(!pythonServiceProxy)
@@ -192,12 +192,12 @@
if(operationName.size() > 0)
{
- LOGINFO_1(3, "sca_invoke Operation name is %s", operationName.c_str());
+ loginfo("Operation: %s", operationName.c_str());
}
else
{
- string msg = "sca_invoke Operation name has not been set";
- LOGERROR(1, msg.c_str());
+ string msg = "Operation name has not been set";
+ logwarning(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
return NULL;
}
@@ -215,35 +215,35 @@
if(PyInt_Check(param))
{
- LOGINFO_2(3, "sca_invoke Param %d is int type: %d", i, PyInt_AsLong(param));
+ loginfo("Int param %d: %d", i, PyInt_AsLong(param));
long* intData = new long;
*intData = PyInt_AsLong(param);
operation.addParameter(intData);
}
else if(PyBool_Check(param))
{
- LOGINFO_2(3, "sca_invoke Param %d is bool type: %d", i, (param == Py_True));
+ loginfo("Bool param %d: %d", i, (param == Py_True));
bool* boolData = new bool;
*boolData = (param == Py_True);
operation.addParameter(boolData);
}
else if(PyLong_Check(param))
{
- LOGINFO_2(3, "sca_invoke Param %d is long type: %l", i, PyLong_AsLong(param));
+ loginfo("Long param %d: %l", i, PyLong_AsLong(param));
long* longData = new long;
*longData = PyLong_AsLong(param);
operation.addParameter(longData);
}
else if(PyFloat_Check(param))
{
- LOGINFO_2(3, "sca_invoke Param %d is float type: %f", i, PyFloat_AsDouble(param));
+ loginfo("Float param %d: %f", i, PyFloat_AsDouble(param));
double* doubleData = new double;
*doubleData = PyFloat_AsDouble(param);
operation.addParameter(doubleData);
}
else if(PyString_Check(param))
{
- LOGINFO_2(3, "sca_invoke %d is string type: %s", i, PyString_AsString(param));
+ loginfo("String param %d: %s", i, PyString_AsString(param));
const char** stringData = new const char*;
*stringData = PyString_AsString(param);
operation.addParameter(stringData);
@@ -261,7 +261,7 @@
msg += ") and has repr: ";
msg += PyString_AsString(paramRepr);
- LOGERROR(1, msg.c_str());
+ logerror(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
Py_DECREF(paramTypeRepr);
@@ -281,8 +281,8 @@
}
catch(...)
{
- string msg = "sca_invoke Exception thrown whilst invoking the service";
- LOGERROR(1, msg.c_str());
+ string msg = "Exception whilst invoking the service";
+ logwarning(msg.c_str());
PyErr_SetString(scaError, msg.c_str());
return NULL;
}
@@ -355,7 +355,6 @@
}
- LOGEXIT(1, "sca_invoke");
return returnValue;
}
static PyMethodDef ModuleMethods[] =
@@ -367,7 +366,7 @@
PyMODINIT_FUNC initsca(void)
{
- LOGENTRY(1, "initsca");
+ logentry();
// Create a new module
PyObject* module = Py_InitModule("sca", ModuleMethods);
@@ -375,6 +374,4 @@
scaError = PyErr_NewException("sca.error", NULL, NULL);
Py_INCREF(scaError);
PyModule_AddObject(module, "error", scaError);
-
- LOGEXIT(1, "initsca");
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/Makefile.am Sat Nov 11 20:39:42 2006
@@ -19,13 +19,8 @@
lib_LTLIBRARIES = libtuscany_sca_ruby.la
install-exec-hook:
- cd $(libdir); \
- for i in libtuscany_sca_ruby.so*; \
- do mv $$i $$i.disabled; \
- if ! [ "$$i" = "libtuscany_sca_ruby.so.0.0.0" ]; then \
- ln -s -f libtuscany_sca_ruby.so.0.0.0.disabled $$i.disabled; \
- fi; \
- done;
+ cd $(libdir); ln -s -f libtuscany_sca_ruby.so tuscany_sca_ruby.so
+
rootdir=$(prefix)/extensions/ruby
root_SCRIPTS = deploy.sh
@@ -55,4 +50,4 @@
-I${RUBY_INCLUDE}
AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
-
\ No newline at end of file
+
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp Sat Nov 11 20:39:42 2006
@@ -47,8 +47,7 @@
// ===================================================================
RubyExtension::RubyExtension()
{
- LOGENTRY(1, "RubyExtension::constructor");
- LOGEXIT(1, "RubyExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -56,15 +55,13 @@
// ===================================================================
RubyExtension::~RubyExtension()
{
- LOGENTRY(1, "RubyExtension::destructor");;
- LOGEXIT(1, "RubyExtension::destructor");
+ logentry();
}
void RubyExtension::initialize()
{
- LOGENTRY(1, "RubyExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerImplementationExtension(new RubyImplementationExtension());
- LOGEXIT(1, "RubyExtension::initialize");;
}
} // End namespace ruby
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp Sat Nov 11 20:39:42 2006
@@ -36,8 +36,7 @@
// ===================================================================
RubyImplementationExtension::RubyImplementationExtension()
{
- LOGENTRY(1, "RubyImplementationExtension::constructor");
- LOGEXIT(1, "RubyImplementationExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -45,8 +44,7 @@
// ===================================================================
RubyImplementationExtension::~RubyImplementationExtension()
{
- LOGENTRY(1, "RubyImplementationExtension::destructor");;
- LOGEXIT(1, "RubyImplementationExtension::destructor");
+ logentry();
}
const string RubyImplementationExtension::extensionName("ruby");
@@ -57,6 +55,8 @@
// ===================================================================
ComponentType* RubyImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
{
+ logentry();
+
string implType = scdlImplementation->getType().getName();
if (implType == "RubyImplementation")
{
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp Sat Nov 11 20:39:42 2006
@@ -78,7 +78,7 @@
RubyServiceProxy::RubyServiceProxy(Reference* reference)
: ServiceProxy(reference)
{
- LOGENTRY(1,"RubyServiceProxy::constructor");
+ logentry();
// ----------------------
// Get the component
@@ -93,8 +93,6 @@
// Create the Ruby proxy
createProxy();
-
- LOGEXIT(1,"RubyServiceProxy::constructor");
}
// ============================
@@ -103,7 +101,7 @@
RubyServiceProxy::RubyServiceProxy(Service* service)
: ServiceProxy(0)
{
- LOGENTRY(1,"RubyServiceProxy::constructor");
+ logentry();
// ----------------------
// Get the component
@@ -116,8 +114,6 @@
// Create the Ruby proxy
createProxy();
-
- LOGEXIT(1,"RubyServiceProxy::constructor");
}
// ==========
@@ -125,12 +121,13 @@
// ==========
RubyServiceProxy::~RubyServiceProxy()
{
- LOGENTRY(1,"RubyServiceProxy::destructor");
- LOGEXIT(1,"RubyServiceProxy::destructor");
+ logentry();
}
void RubyServiceProxy::createProxy()
{
+ logentry();
+
// Create the Ruby proxy class
if (RubyServiceProxy::proxyClass == Qnil)
{
@@ -152,6 +149,8 @@
VALUE RubyServiceProxy::invoke(int argc, VALUE* argv)
{
+ logentry();
+
// Get the method name
char* methodName = rb_id2name(SYM2ID(argv[0]));
@@ -346,7 +345,6 @@
}
default:
{
- //throw new ComponentInvocationException("Operation parameter type not supported");
string msg = "Operation parameter type not supported" + resultType;
rb_raise(rb_eRuntimeError, msg.c_str());
return Qnil;
@@ -356,7 +354,7 @@
return value;
}
- catch(TuscanyRuntimeException &ex)
+ catch(TuscanyRuntimeException& ex)
{
string msg = "Exception while invoking a service: ";
msg += ex.getEClassName();
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp Sat Nov 11 20:39:42 2006
@@ -23,6 +23,7 @@
#include "tuscany/sca/ruby/RubyServiceWrapper.h"
#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
#include "tuscany/sca/util/Utils.h"
#include "tuscany/sca/util/Library.h"
#include "tuscany/sca/model/Component.h"
@@ -52,14 +53,11 @@
RubyServiceWrapper::RubyServiceWrapper(Service* service)
: ServiceWrapper(service)
{
- LOGENTRY(1,"RubyServiceWrapper::constructor");
+ logentry();
component = service->getComponent();
implementation = (RubyImplementation*)component->getType();
interf = service->getType()->getInterface();
-
- LOGEXIT(1,"RubyServiceWrapper::constructor");
-
}
// ==========
@@ -67,8 +65,7 @@
// ==========
RubyServiceWrapper::~RubyServiceWrapper()
{
- LOGENTRY(1,"RubyServiceWrapper::destructor");
- LOGEXIT(1,"RubyServiceWrapper::destructor");
+ logentry();
}
// ======================================================================
@@ -76,7 +73,7 @@
// ======================================================================
void RubyServiceWrapper::invoke(Operation& operation)
{
- LOGENTRY(1,"RubyServiceWrapper::invoke");
+ logentry();
SCARuntime* runtime = SCARuntime::getInstance();
runtime->setCurrentComponent(component);
@@ -227,9 +224,8 @@
}
default:
{
- //throw new ComponentInvocationException("Operation parameter type not supported");
string msg = "Operation parameter type not supported" + parmType;
- throw msg.c_str();
+ throwException(ServiceDataException, msg.c_str());
}
}
@@ -679,32 +675,36 @@
commonj::sdo::XMLHelper* xmlHelper = composite->getXMLHelper();
commonj::sdo::XMLDocumentPtr xmlDoc = xmlHelper->load(str.c_str());
- DataObjectPtr dob;
+ DataObjectPtr* dataObjectData = new DataObjectPtr;
if (xmlDoc != NULL)
{
- dob = xmlDoc->getRootDataObject();
+ *dataObjectData = xmlDoc->getRootDataObject();
}
- if (dob != NULL)
+ else
{
- operation.setReturnValue(&dob);
+ *dataObjectData = NULL;
+ }
+ if (*dataObjectData != NULL)
+ {
+ operation.setReturnValue(dataObjectData);
}
else
{
string msg = "Document could not be converted to a DataObject";
- throw msg.c_str();
+ throwException(ServiceDataException, msg.c_str());
}
}
else
{
string msg = "Ruby type not supported: " + resultType;
- throw msg.c_str();
+ throwException(ServiceDataException, msg.c_str());
}
break;
}
default:
{
string msg = "Ruby type not supported: " + resultType;
- throw msg.c_str();
+ throwException(ServiceDataException, msg.c_str());
}
}
@@ -714,9 +714,8 @@
runtime->unsetCurrentComponent();
throw;
}
- runtime->unsetCurrentComponent();
- LOGEXIT(1,"RubyServiceWrapper::invoke");
+ runtime->unsetCurrentComponent();
}
} // End namespace ruby
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp Sat Nov 11 20:39:42 2006
@@ -61,7 +61,7 @@
{
ruby_init();
ruby_init_loadpath();
-
+
// Load the Rexml module. Rexml is used to handle XML documents.
//rb_require("rexml/document");
// Use rb_eval_string for now as it provides better error reporting
@@ -76,7 +76,6 @@
if (script != "")
{
// Convert any windows slashes \ in the root path to unix slashes /
- // otherwise the ruby interpreter throws an error
string rootpath = getComposite()->getRoot();
int pos = 0;
while((pos = rootpath.find('\\', pos)) != string::npos)
Modified: incubator/tuscany/cpp/sca/runtime/extensions/sca/reference/axis2c/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/sca/reference/axis2c/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/sca/reference/axis2c/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/sca/reference/axis2c/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp Sat Nov 11 20:39:42 2006
@@ -48,8 +48,7 @@
// ===================================================================
SCAServiceBindingExtension::SCAServiceBindingExtension()
{
- LOGENTRY(1, "SCAServiceBindingExtension::constructor");
- LOGEXIT(1, "SCAServiceBindingExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -57,8 +56,7 @@
// ===================================================================
SCAServiceBindingExtension::~SCAServiceBindingExtension()
{
- LOGENTRY(1, "SCAServiceBindingExtension::destructor");;
- LOGEXIT(1, "SCAServiceBindingExtension::destructor");
+ logentry();
}
const string SCAServiceBindingExtension::extensionName("sca");
@@ -70,6 +68,8 @@
// ===================================================================
ServiceBinding* SCAServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding)
{
+ logentry();
+
string bindingType = scdlBinding->getType().getName();
if (bindingType == "SCABinding")
{
@@ -87,9 +87,8 @@
void SCAServiceBindingExtension::initialize()
{
- LOGENTRY(1, "SCAServiceBindingExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerServiceBindingExtension(new SCAServiceBindingExtension());
- LOGEXIT(1, "SCAServiceBindingExtension::initialize");;
}
} // End namespace ws
Modified: incubator/tuscany/cpp/sca/runtime/extensions/sca/service/axis2c/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/sca/service/axis2c/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/sca/service/axis2c/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/sca/service/axis2c/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp Sat Nov 11 20:39:42 2006
@@ -49,8 +49,7 @@
// ===================================================================
SCAReferenceBindingExtension::SCAReferenceBindingExtension()
{
- LOGENTRY(1, "SCAReferenceBindingExtension::constructor");
- LOGEXIT(1, "SCAReferenceBindingExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -58,8 +57,7 @@
// ===================================================================
SCAReferenceBindingExtension::~SCAReferenceBindingExtension()
{
- LOGENTRY(1, "SCAReferenceBindingExtension::destructor");;
- LOGEXIT(1, "SCAReferenceBindingExtension::destructor");
+ logentry();
}
const string SCAReferenceBindingExtension::extensionName("sca");
@@ -70,6 +68,8 @@
// ===================================================================
ReferenceBinding* SCAReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding)
{
+ logentry();
+
string bindingType = scdlBinding->getType().getName();
if (bindingType == "SCABinding")
{
@@ -87,9 +87,8 @@
void SCAReferenceBindingExtension::initialize()
{
- LOGENTRY(1, "SCAReferenceBindingExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerReferenceBindingExtension(new SCAReferenceBindingExtension());
- LOGEXIT(1, "SCAReferenceBindingExtension::initialize");;
}
} // End namespace binding
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org