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 [2/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/core/src/tuscany/sca/model/Reference.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Reference.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Reference.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Reference.cpp Sat Nov 11 20:39:42 2006
@@ -35,11 +35,13 @@
             Reference::Reference(Component* component, ReferenceType* referenceType)
                 : component(component), type(referenceType), binding(0)
             {
+                logentry(); 
             }
             
             // Destructor
             Reference::~Reference()
             {
+                logentry(); 
             }
             
             void Reference::setBinding(ReferenceBinding* binding)
@@ -54,13 +56,14 @@
             
             void Reference::addTarget(Service* target)
             {
+                logentry(); 
+
                 if (type->getMultiplicity() == ReferenceType::ONE_ONE || type->getMultiplicity() == ReferenceType::ZERO_ONE)
                 {
                     if (targets.size() > 0)
                     {
-                        // throw exception
                         string message = "Duplicate wire for reference: " + type->getName();
-                        throw SystemConfigurationException(message.c_str());
+                        throwException(SystemConfigurationException, message.c_str());
                     }
                 }
 

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceBinding.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceBinding.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceBinding.cpp Sat Nov 11 20:39:42 2006
@@ -35,11 +35,13 @@
             ReferenceBinding::ReferenceBinding(Reference *reference, const string& uri) :
                 Binding(uri), reference(reference)
             {
+                logentry(); 
             }
 
             // Destructor
             ReferenceBinding::~ReferenceBinding()
             {
+                logentry(); 
             }
 
         } // End namespace model

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceType.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceType.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceType.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ReferenceType.cpp Sat Nov 11 20:39:42 2006
@@ -37,14 +37,18 @@
                 : Contract(intface, callbackInterface),
                 componentType(componentType), name(name), multiplicity(multiplicity)
             {
+                logentry(); 
             }
             
             ReferenceType::~ReferenceType()
             {
+                logentry(); 
             }
             
             ReferenceType::Multiplicity ReferenceType::getMultiplicityFromString(const string& multip)
             {
+                logentry(); 
+
                 if (multip == "0..1")
                 {
                     return ReferenceType::ZERO_ONE;

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Service.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Service.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Service.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Service.cpp Sat Nov 11 20:39:42 2006
@@ -34,11 +34,13 @@
             Service::Service(Component* component, ServiceType* serviceType)
                 : component(component), type(serviceType), binding(0)
             {
+                logentry(); 
             }
             
             // Destructor
             Service::~Service()
             {
+                logentry(); 
             }
             
             void Service::setBinding(ServiceBinding* binding)

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.cpp Sat Nov 11 20:39:42 2006
@@ -35,11 +35,13 @@
             ServiceBinding::ServiceBinding(Service* service, const string& uri) :
                 Binding(uri), service(service)
             {
+                logentry(); 
             }
 
             // Destructor
             ServiceBinding::~ServiceBinding()
             {
+                logentry(); 
             }
 
         } // End namespace model

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp Sat Nov 11 20:39:42 2006
@@ -36,11 +36,13 @@
                 : Contract(intface, callbackInterface),
                 componentType(componentType), name(name)
             {
+                logentry(); 
             }
 
             // Destructor
             ServiceType::~ServiceType()
             {
+                logentry(); 
             }
 
             void ServiceType::setBinding(Binding* binding)

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp Sat Nov 11 20:39:42 2006
@@ -38,27 +38,30 @@
             
             
             // Constructor
-            WSDLDefinition::WSDLDefinition(DataObjectPtr wsdlModel) 
-                : wsdlModel(wsdlModel)
+            WSDLDefinition::WSDLDefinition(DataObjectPtr wsdlModel)
             {
-                LOGENTRY(1, "WSDLDefinition::constructor");
+                logentry(); 
 
-                // Trace
-                //Utils::printDO(wsdlModel);
-                
-                LOGEXIT(1, "WSDLDefinition::constructor");
+                wsdlModels.insert(wsdlModels.end(), wsdlModel);
             }
 
             WSDLDefinition::~WSDLDefinition()
             {
+                logentry(); 
             }
 
-
             /// 
             /// The namespace of the service and other definitions defined in this wsdl definition
             string WSDLDefinition::getNamespace()
             {
-                return wsdlModel->getCString("targetNamespace");
+                logentry(); 
+                return wsdlModels[0]->getCString("targetNamespace");
+            }
+
+            void WSDLDefinition::addWSDLModel(DataObjectPtr wsdlModel)
+            {
+                logentry(); 
+                wsdlModels.insert(wsdlModels.end(), wsdlModel);
             }
 
             ///
@@ -68,10 +71,12 @@
                                         const string& portName, 
                                         const string& operationName)
             {
+                logentry(); 
+
                 string message;
                 
                 string operationKey = serviceName+"#"+portName+"#"+operationName;
-                OperationMap::iterator iter = operationMap.find(operationKey);
+                OPERATION_MAP::iterator iter = operationMap.find(operationKey);
                 if (iter != operationMap.end())
                 {
                 	return iter->second;
@@ -85,7 +90,7 @@
                     message = "Unable to find service ";
                     message = message + serviceName;
                     message = message + " in the WSDL definition";
-                    throw SystemConfigurationException(message.c_str());
+                    throwException(SystemConfigurationException, message.c_str());
                 }
                 else
                 {
@@ -111,7 +116,7 @@
                                 message = "Unable to find binding ";
                                 message = message + wsBindingName;
                                 message = message + " in the WSDL definition";
-                                throw SystemConfigurationException(message.c_str());
+                                throwException(SystemConfigurationException, message.c_str());
                             }
                             
 
@@ -171,7 +176,7 @@
                                 message = "Unable to find PortType ";
                                 message = message + wsPortTypeName;
                                 message = message + " in the WSDL definition";
-                                throw SystemConfigurationException(message.c_str());
+                                throwException(SystemConfigurationException, message.c_str());
                             }
 
                             //Utils::printDO(wsPortType);
@@ -194,7 +199,7 @@
                                         message = "Unable to find message ";
                                         message = message + inputMessageType;
                                         message = message + " in the WSDL definition";
-                                        throw SystemConfigurationException(message.c_str());
+                                        throwException(SystemConfigurationException, message.c_str());
                                     }
 
                                     string requestType(wsMessageIn->getList("part")[0]->getCString("element"));
@@ -208,7 +213,7 @@
                                         message = "Unable to find message ";
                                         message = message + outputMessageType;
                                         message = message + " in the WSDL definition";
-                                        throw SystemConfigurationException(message.c_str());
+                                        throwException(SystemConfigurationException, message.c_str());
                                     }
 
                                     string responseType(wsMessageOut->getList("part")[0]->getCString("element"));
@@ -231,14 +236,14 @@
                             message = "Unable to find Operation ";
                             message = message + operationName;
                             message = message + " in the WSDL definition";
-                            throw SystemConfigurationException(message.c_str());                           
+                            throwException(SystemConfigurationException, message.c_str());                           
                         }
                     }
                     // cannot find the port
                     message = "Unable to find port ";
                     message = message + portName;
                     message = message + " in the WSDL definition";
-                    throw SystemConfigurationException(message.c_str());
+                    throwException(SystemConfigurationException, message.c_str());
                 }
                 
             }
@@ -249,8 +254,10 @@
             const WSDLOperation& WSDLDefinition::findOperation(const string& portTypeName, 
                                         const string& operationName)
             {
+                logentry(); 
+
                 string operationKey = portTypeName+"#"+operationName;
-                OperationMap::iterator iter = operationMap.find(operationKey);
+                OPERATION_MAP::iterator iter = operationMap.find(operationKey);
                 if (iter != operationMap.end())
                 {
                     return iter->second;
@@ -269,11 +276,9 @@
                     string message = "Unable to find PortType ";
                     message = message + portTypeName;
                     message = message + " in the WSDL definition";
-                    throw SystemConfigurationException(message.c_str());
+                    throwException(SystemConfigurationException, message.c_str());
                 }
 
-                //Utils::printDO(wsPortType);
-                
                 // Found the portType, find the operation
                 DataObjectList& operationList = wsPortType->getList("operation");
                 for (int k=0; k< operationList.size(); k++)
@@ -292,7 +297,7 @@
                             string message = "Unable to find message ";
                             message = message + inputMessageType;
                             message = message + " in the WSDL definition";
-                            throw SystemConfigurationException(message.c_str());
+                            throwException(SystemConfigurationException, message.c_str());
                         }
 
                         string requestType(wsMessageIn->getList("part")[0]->getCString("element"));
@@ -306,7 +311,7 @@
                             string message = "Unable to find message ";
                             message = message + outputMessageType;
                             message = message + " in the WSDL definition";
-                            throw SystemConfigurationException(message.c_str());
+                            throwException(SystemConfigurationException, message.c_str());
                         }
 
                         string responseType(wsMessageOut->getList("part")[0]->getCString("element"));
@@ -328,7 +333,7 @@
                 string message = "Unable to find Operation ";
                 message = message + operationName;
                 message = message + " in the WSDL definition";
-                throw SystemConfigurationException(message.c_str());                           
+                throwException(SystemConfigurationException, message.c_str());
                 
             }
             
@@ -337,18 +342,22 @@
             ///
             DataObjectPtr WSDLDefinition::findService(const string& serviceName)
             {
+                logentry(); 
+
                 DataObjectPtr service = 0;
-        
 
                 // Find the binding
-                DataObjectList& serviceList = wsdlModel->getList("service");
-                for (int i=0; i<serviceList.size(); i++)
+                for (int m = 0; m < wsdlModels.size(); m++)
                 {
-                    string name(serviceList[i]->getCString("name"));
-
-                    if (name.compare(serviceName) == 0)
+                    DataObjectList& serviceList = wsdlModels[m]->getList("service");
+                    for (int i=0; i<serviceList.size(); i++)
                     {
-                        return serviceList[i];
+                        string name(serviceList[i]->getCString("name"));
+    
+                        if (name.compare(serviceName) == 0)
+                        {
+                            return serviceList[i];
+                        }
                     }
                 }
 
@@ -361,24 +370,26 @@
             ///
             DataObjectPtr WSDLDefinition::findBinding(const string& bindingName)
             {
+                logentry(); 
+
                 DataObjectPtr binding = 0;
                 string uri;
                 string name;
 
-
-                //Utils::tokeniseQName(bindingName, uri, name);
                 Utils::rTokeniseString(":", bindingName, uri, name);
 
-
                 // Find the binding
-                DataObjectList& bindingList = wsdlModel->getList("binding");
-                for (int i=0; i<bindingList.size(); i++)
+                for (int m = 0; m < wsdlModels.size(); m++)
                 {
-                    string nameBinding(bindingList[i]->getCString("name"));
-
-                    if (nameBinding.compare(name) == 0)
+                    DataObjectList& bindingList = wsdlModels[m]->getList("binding");
+                    for (int i=0; i<bindingList.size(); i++)
                     {
-                        return bindingList[i];
+                        string nameBinding(bindingList[i]->getCString("name"));
+    
+                        if (nameBinding.compare(name) == 0)
+                        {
+                            return bindingList[i];
+                        }
                     }
                 }
 
@@ -390,24 +401,26 @@
             ///
             DataObjectPtr WSDLDefinition::findPortType(const string& portTypeName)
             {
+                logentry(); 
+
                 DataObjectPtr portType = 0;
                 string uri;
                 string name;
 
-
-                // Utils::tokeniseQName(portTypeName, uri, name);
                 Utils::rTokeniseString(":", portTypeName, uri, name);
 
-
                 // Find the binding
-                DataObjectList& portTypeList = wsdlModel->getList("portType");
-                for (int i=0; i<portTypeList.size(); i++)
+                for (int m = 0; m < wsdlModels.size(); m++)
                 {
-                    string namePortType(portTypeList[i]->getCString("name"));
-
-                    if (namePortType.compare(name) == 0)
+                    DataObjectList& portTypeList = wsdlModels[m]->getList("portType");
+                    for (int i=0; i<portTypeList.size(); i++)
                     {
-                        return portTypeList[i];
+                        string namePortType(portTypeList[i]->getCString("name"));
+    
+                        if (namePortType.compare(name) == 0)
+                        {
+                            return portTypeList[i];
+                        }
                     }
                 }
 
@@ -419,24 +432,26 @@
             ///
             DataObjectPtr WSDLDefinition::findMessage(const string& messageName)
             {
+                logentry(); 
+
                 DataObjectPtr message = 0;
                 string uri;
                 string name;
 
-
-                // Utils::tokeniseQName(messageName, uri, name);
                 Utils::rTokeniseString(":", messageName, uri, name);
 
-
                 // Find the binding
-                DataObjectList& messageList = wsdlModel->getList("message");
-                for (int i=0; i<messageList.size(); i++)
+                for (int m = 0; m < wsdlModels.size(); m++)
                 {
-                    string nameMessage(messageList[i]->getCString("name"));
-
-                    if (nameMessage.compare(name) == 0)
+                    DataObjectList& messageList = wsdlModels[m]->getList("message");
+                    for (int i=0; i<messageList.size(); i++)
                     {
-                        return messageList[i];
+                        string nameMessage(messageList[i]->getCString("name"));
+    
+                        if (nameMessage.compare(name) == 0)
+                        {
+                            return messageList[i];
+                        }
                     }
                 }
 

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h Sat Nov 11 20:39:42 2006
@@ -33,6 +33,8 @@
 
 #include <map>
 using std::map;
+#include <vector>
+using std::vector;
 
 namespace tuscany
 {
@@ -61,7 +63,6 @@
                  */ 
                 SCA_API virtual ~WSDLDefinition();
 
-
                 /**
                  * Returns the target namespace of the WSDL definitions.
                  * @return The target namespace.
@@ -69,6 +70,11 @@
                 SCA_API string getNamespace(void);
 
                 /**
+                 * Add a WSDL model.
+                 */
+                SCA_API void addWSDLModel(DataObjectPtr wsdlModel);
+
+                /**
                  * Find an operation in the WSDL definitions.
                  * @param serviceName The name of the service on which this
                  * operation is defined.
@@ -129,10 +135,11 @@
                 /**
                  * The data object representation of the WSDL document.
                  */
-                DataObjectPtr wsdlModel;
+                typedef std::vector<DataObjectPtr> MODEL_VECTOR;
+                MODEL_VECTOR wsdlModels;
                 
-                typedef map<string, WSDLOperation> OperationMap;
-                OperationMap operationMap;
+                typedef map<string, WSDLOperation> OPERATION_MAP;
+                OPERATION_MAP operationMap;
             };
 
          } // End namespace model

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp Sat Nov 11 20:39:42 2006
@@ -38,11 +38,14 @@
                     const string& qname, bool remotable, bool conversational) 
                     : Interface(remotable, conversational)
             {
+                logentry(); 
                 parse(qname);
            }
            
             void WSDLInterface::parse(const string& qname)
             {
+                logentry(); 
+
                 // PortType is of the form: <wsdl-namepace-uri>#wsdl.interface(<portType-name>)
                 string::size_type hash = qname.find("#");
                 if (hash != string::npos)
@@ -95,6 +98,7 @@
            
             WSDLInterface::~WSDLInterface()
             {
+                logentry(); 
             }
 
         } // End namespace model

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp Sat Nov 11 20:39:42 2006
@@ -34,22 +34,24 @@
             // Constructor
             WSDLOperation::WSDLOperation() 
             {
-                LOGENTRY(1, "WSDLOperation::constructor");                
-                LOGEXIT(1, "WSDLOperation::constructor");
+                logentry(); 
             }
 
             WSDLOperation::~WSDLOperation()
             {
+                logentry(); 
             }
 
 
             void WSDLOperation::setInputType(const string& inputType)
             {
+                logentry(); 
             	Utils::tokeniseQName(inputType, inputTypeUri, inputTypeName); 
             }
 
             void WSDLOperation::setOutputType(const string& outputType)
             {
+                logentry(); 
             	Utils::tokeniseQName(outputType, outputTypeUri, outputTypeName); 
             }
 

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.cpp Sat Nov 11 20:39:42 2006
@@ -33,12 +33,15 @@
             // Constructor
             Wire::Wire(const std::string& source, const std::string& targ) 
             {
+                logentry(); 
+
                 Utils::tokeniseUri(source, sourceComponent, sourceReference);
                 target = targ;
            }
             
             Wire::~Wire()
             {
+                logentry(); 
             }
 
         } // End namespace model

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp Sat Nov 11 20:39:42 2006
@@ -23,6 +23,11 @@
 #include "tuscany/sca/util/Logging.h"
 using namespace std;
 
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+#include <execinfo.h>
+#endif
+
 namespace tuscany
 {
     namespace sca
@@ -34,13 +39,22 @@
         TuscanyRuntimeException :: TuscanyRuntimeException(const char* name,
             severity_level sev,
             const char* msg_text)
-            : severity(sev), location_set(0)
         {
+            severity = sev;
+            location_set = 0;
             class_name = new char[strlen(name) + 1];
             strcpy(class_name,name);
             message_text = new char[strlen(msg_text)+1];
             strcpy(message_text,msg_text);
-            LOGERROR_2(1, "%s raised: %s", class_name, message_text);
+            
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            void* array[25];
+            stacktrace_size = backtrace(array, 25);
+            stacktrace_symbols = backtrace_symbols(array, stacktrace_size);
+#endif
+            
+            logwarning("%s raised: %s", class_name, message_text);
             
         } // end TuscanyRuntimeException constuctor
         
@@ -48,15 +62,15 @@
         // Constructor
         // ========================================================================
         TuscanyRuntimeException ::  TuscanyRuntimeException(const TuscanyRuntimeException& c)
-            : 
-        severity(c.getSeverity()), location_set(c.location_set)
-            
         {
+            severity = c.getSeverity();
+            location_set = c.location_set;
             class_name = new char[strlen(c.getEClassName()) + 1];
             strcpy(class_name, c.getEClassName());
             message_text = new char[strlen(c.getMessageText())+1];
             strcpy(message_text,c.getMessageText());
-            for (int i=0;i<c.location_set;i++)
+
+            for (int i=0; i < location_set; i++)
             {
                 locations[i].file = new char[strlen(c.locations[i].file) + 1];
                 strcpy(locations[i].file,c.locations[i].file);
@@ -64,7 +78,59 @@
                 locations[i].function = new char[strlen(c.locations[i].function) + 1];
                 strcpy(locations[i].function, c.locations[i].function);
             }
-            LOGERROR_2(1, "%s raised: %s", class_name, message_text);
+
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            void* array[25];
+            stacktrace_size = backtrace(array, 25);
+            stacktrace_symbols = backtrace_symbols(array, stacktrace_size);
+#endif
+            
+            logwarning("%s raised: %s", class_name, message_text);
+        }
+        
+        // ========================================================================
+        // Constructor
+        // ========================================================================
+        TuscanyRuntimeException ::  TuscanyRuntimeException(const SDORuntimeException& c)
+        {
+            class_name = new char[strlen(c.getEClassName()) + 1];
+            strcpy(class_name, c.getEClassName());
+            message_text = new char[strlen(c.getMessageText())+1];
+            strcpy(message_text,c.getMessageText());
+            switch (c.getSeverity())
+            {
+                case SDORuntimeException::Normal:
+                    severity = Normal;
+                    break;
+                case SDORuntimeException::Warning:
+                    severity = Warning;
+                    break;
+                case SDORuntimeException::Error:
+                    severity = Error;
+                    break;
+                default:
+                    severity = Severe;
+                    break;
+            }
+
+            const char* file = c.getFileName();
+            unsigned long line = c.getLineNumber();
+            const char* function = c.getFunctionName();
+            location_set = 0;
+            if (file)
+            {
+                setLocation(file, line, function);
+            }
+            
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            void* array[25];
+            stacktrace_size = backtrace(array, 25);
+            stacktrace_symbols = backtrace_symbols(array, stacktrace_size);
+#endif
+            
+            logwarning("%s raised: %s", class_name, message_text);
         }
         
         // ========================================================================
@@ -80,6 +146,11 @@
                 if (locations[i].function) delete locations[i].function;
             }
             
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            free(stacktrace_symbols);
+#endif            
+            
         } // end TuscanyRuntimeException destructor
         
         // ========================================================================
@@ -150,7 +221,7 @@
         } // end setMessageText(const string &msg_text) const
         
         // ========================================================================
-        // set location of most recent throw/handling of the exception
+        // set location of most recent handling of the exception
         // ========================================================================
         void TuscanyRuntimeException :: setLocation(const char* file,    
             unsigned long line,       
@@ -175,28 +246,42 @@
         ostream& TuscanyRuntimeException :: PrintSelf(ostream &os) const
         { 
             
-            os << "Exception object :" << endl;
-            os << " class:           " << class_name << endl;
-            os << " description:     " << message_text << endl;
+            os << "Exception" << endl;
+            os << " Class:           " << class_name << endl;
+            os << " Description:     " << message_text << endl;
             if (location_set != 0)
             {
-                os << " file name:       " << locations[0].file << endl;
+                os << " Origin:" << endl;
+                os << "   File:            " << locations[0].file << endl;
                 char lineNumber[100];
                 sprintf(lineNumber, "%lu",locations[0].line);
-                os << " line number:     " << lineNumber << endl;
-                os << " function:        " << locations[0].function << endl;
-                os << " location history:" << endl;
+                os << "   Line:            " << lineNumber << endl;
+                os << "   Function:        " << locations[0].function << endl;
                 
-                int i=1;
-                while (i < location_set)
+                if (location_set >1)
+                {
+                    os << " Path:" << endl;
+                    int i=1;
+                    while (i < location_set)
+                    {
+                        os << "   File:          " << locations[i].file << endl;
+                        os << "   Line:          " << locations[i].line << endl;
+                        os << "   Function:      " << locations[i].function << endl;
+                        i++;
+                    }
+                }
+            }
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            if (stacktrace_size != 0)
+            {
+                os << " Backtrace:" << endl;
+                for (int j = 0; j < stacktrace_size; j++)
                 {
-                    os << "  " <<  i << ")" << endl;
-                    os << "   file:          " << locations[i].file << endl;
-                    os << "   line:          " << locations[i].line << endl;
-                    os << "   function:      " << locations[i].function << endl;
-                    i++;
+                    os << "   " << stacktrace_symbols[j] << endl;
                 }
             }
+#endif            
             return os;
         } // end ostream operator <<
         

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h Sat Nov 11 20:39:42 2006
@@ -26,6 +26,7 @@
 #include "tuscany/sca/export.h"
 
 #include <ostream>
+#include "commonj/sdo/SDO.h"
 
 
 namespace tuscany
@@ -57,11 +58,12 @@
              * @param msg_text Detailed description of the exception.
              */
             TuscanyRuntimeException(
-                const char *name="TuscanyRuntimeException",
-                severity_level sev=Severe,
-                const char* msg_text="");
+                const char *name = "TuscanyRuntimeException",
+                severity_level sev = Severe,
+                const char* msg_text = "");
             
             TuscanyRuntimeException(const TuscanyRuntimeException& c);
+            TuscanyRuntimeException(const SDORuntimeException& c);
             
             // Destructor
             virtual  ~TuscanyRuntimeException();
@@ -125,6 +127,7 @@
              * Operator to send exceptions details to a stream.
              */
             SCA_API friend std::ostream& operator<< (std::ostream &os, const TuscanyRuntimeException &except);
+
         protected:
             
         private:
@@ -166,6 +169,14 @@
              */
             int              location_set;
             
+            /**
+             * A snapshot of the stack when the exception was constructed
+             */
+#if defined(WIN32)  || defined (_WINDOWS)
+#else
+            int stacktrace_size;
+            char** stacktrace_symbols;
+#endif
             
         }; // End TuscanyRuntimeException class definition
         
@@ -182,9 +193,154 @@
                 msg)
             {
             }
+
+            SystemConfigurationException(
+                const char *name,
+                severity_level sev,
+                const char* msg_text)
+                : TuscanyRuntimeException(name, sev, msg_text)
+            {
+            }
+            
+            SystemConfigurationException(const SDORuntimeException& c)
+                : TuscanyRuntimeException(c)
+            {
+            }
+        private:
+        };
+        
+        /**
+         * Indicates a problem while invoking a service.
+         */
+        class SCA_API ServiceInvocationException: public TuscanyRuntimeException
+        {
+        public:
+            ServiceInvocationException(const char* msg)
+                : TuscanyRuntimeException("ServiceInvocationException", Severe, msg)
+            {
+            }
+
+            ServiceInvocationException(
+                const char *name,
+                severity_level sev,
+                const char* msg_text)
+                : TuscanyRuntimeException(name, sev, msg_text)
+            {
+            }
+            
+            ServiceInvocationException(const SDORuntimeException& c)
+                : TuscanyRuntimeException(c)
+            {
+            }
+
+        private:
+        };
+        
+        /**
+         * Indicates a problem while working with service data.
+         */
+        class SCA_API ServiceDataException: public TuscanyRuntimeException
+        {
+        public:
+            ServiceDataException(const char* msg)
+                : TuscanyRuntimeException("ServiceDataException", Severe,
+                msg)
+            {
+            }
+
+            ServiceDataException(
+                const char *name,
+                severity_level sev,
+                const char* msg_text)
+                : TuscanyRuntimeException(name, sev, msg_text)
+            {
+            }
+            
+            ServiceDataException(const SDORuntimeException& c)
+                : TuscanyRuntimeException(c)
+            {
+            }
         private:
         };
         
     } // End namespace sca
 } // End namespace tuscany
+
+
+/**
+  * =========================================================================
+  * Macro  - throwException
+  *
+  * adds the current file name, line number and function name to the exception.
+  * then throws the exception.
+  * The parameter 'function_name' should be the name of the function throwing
+  * this exception.
+  * The parameter 'type' is the class of exception to throw and must be a
+  * SDORuntimeException or a class derived from SDORuntimeException.
+  * The parameter 'parameter' is the construction parameter for the exception
+  * =========================================================================
+*/
+
+#if defined(WIN32)  || defined (_WINDOWS)
+#define throwException(type, parameter)  \
+{\
+ type __TuscanyThrownException__(parameter); \
+ __TuscanyThrownException__.setLocation(__FILE__,__LINE__,__FUNCTION__); \
+ throw __TuscanyThrownException__;\
+}
+#else
+#define throwException(type, parameter)  \
+{\
+ type __TuscanyThrownException__(parameter); \
+ __TuscanyThrownException__.setLocation(__FILE__,__LINE__,__PRETTY_FUNCTION__); \
+ throw __TuscanyThrownException__;\
+}
+#endif
+
+/** 
+    =========================================================================
+  * Macro  - rethrowException
+  *
+  * adds the current file name, line number and function name to the exception.
+  * then re-throws the exception.
+  * The parameter 'function_name' should be the name of the function throwing
+  * this exception.
+  * =========================================================================
+*/
+#if defined(WIN32)  || defined (_WINDOWS)
+#define rethrowException(exception)  \
+{\
+ (exception).setLocation(__FILE__,__LINE__,__FUNCTION__); \
+ throw (exception);\
+}
+#else
+#define rethrowException(exception)  \
+{\
+ (exception).setLocation(__FILE__,__LINE__,__PRETTY_FUNCTION__); \
+ throw (exception);\
+}
+#endif
+
+/**
+  * =========================================================================
+  * Macro  - handleException
+  *
+  * adds the current file name, line number and function name to the exception.
+  * Writes an exception trace entry then continues.
+  * The parameter 'function_name' should be the name of the function handling
+  * this exception.
+  * =========================================================================
+*/
+#if defined(WIN32)  || defined (_WINDOWS)
+#define handleException(__PRETTY_FUNCTION__, exception)  \
+{\
+ (exception).setLocation(__FILE__,__LINE__,__FUNCTION__); \
+}
+#else
+#define handleException(__PRETTY_FUNCTION__, exception)  \
+{\
+ (exception).setLocation(__FILE__,__LINE__,__PRETTY_FUNCTION__); \
+}
+#endif
+
 #endif // tuscany_sca_util_exceptions_h

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp Sat Nov 11 20:39:42 2006
@@ -26,6 +26,7 @@
 #include "tuscany/sca/util/File.h"
 #include "tuscany/sca/util/Utils.h"
 #include "tuscany/sca/util/Exceptions.h"
+#include "tuscany/sca/util/Logging.h"
 #include <iostream>
 
 #include <string>
@@ -72,7 +73,7 @@
         {
             if (size() <= index)
             {
-                throw SystemConfigurationException("Files::operator[] index out of bounds");
+                throwException(SystemConfigurationException, "Index of of bounds");
             }
             
             FILES::iterator iter = files.begin();
@@ -165,7 +166,7 @@
             DIR* root = opendir(rootDir.c_str());
             if (!root)
             {
-                cout << "Unable to open directory: " << rootDir.c_str() << endl;
+                logwarning("Unable to open directory: %s", rootDir.c_str());
                 return;
             }
             
@@ -186,7 +187,7 @@
                     continue;
                 if (stat(entryName.c_str(), &statbuf)  != 0)
                 {
-                    perror("stat");
+                    logwarning("Unable to stat entry: %s", entryName.c_str());
                 }
                 else
                 {

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp Sat Nov 11 20:39:42 2006
@@ -40,14 +40,14 @@
         Library::Library(const string& libraryName)
             : name(libraryName), hDLL(NULL)
         {
-            LOGINFO_1(3, "Library::construcor : %s", name.c_str()); 
+            logentry();
             load();
         }
 
         Library::Library(const Library& lib)
             : name(lib.name), hDLL(NULL)
         {
-            LOGINFO_1(3, "Library::copy constructor : %s", name.c_str()); 
+            logentry();
             if (lib.hDLL)
             {
                 load();
@@ -56,7 +56,7 @@
         
         Library& Library::operator=(const Library& lib)
         {
-            LOGINFO_1(3, "Library::operator= : %s", name.c_str()); 
+            logentry();
             if (&lib != this)
             {
                 unload();
@@ -68,14 +68,16 @@
         
         Library::~Library()
         {
-            LOGINFO_1(3, "Library::destructor: %s", name.c_str()); 
+            logentry();
             unload();
         }
         
         
         void Library::load()
         {
-            LOGINFO_1(3, "Library::load : %s", name.c_str()); 
+            logentry();
+            loginfo("Library: %s", name.c_str()); 
+
             string msg;
 #if defined(WIN32)  || defined (_WINDOWS)
             int l = name.length();
@@ -121,16 +123,17 @@
 #endif
             if (hDLL == NULL)
             {
-                LOGERROR(1, msg.c_str());
-                throw SystemConfigurationException(msg.c_str());
+                throwException(SystemConfigurationException, msg.c_str());
             }    
         }
         
         void Library::unload()
         {
+            logentry();
+            loginfo("Library: %s", name.c_str()); 
+            
             if (hDLL != NULL)
             {
-            LOGINFO_1(3, "Library::unload : %s", name.c_str()); 
 #if defined(WIN32)  || defined (_WINDOWS)
                 FreeLibrary(hDLL);
 #else
@@ -142,7 +145,8 @@
     
         void* Library::getSymbol(const string& symbol)
         {
-            LOGINFO_1(3, "Library::getSymbol : %s", symbol.c_str()); 
+            logentry();
+            loginfo("Symbol: %s", symbol.c_str()); 
             if (!hDLL)
             {
                 return 0;

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h Sat Nov 11 20:39:42 2006
@@ -86,6 +86,31 @@
             static int setLogging();
         };
         
+        class LogEntry
+        {
+        };
+        
+        class EnabledLogEntry : public LogEntry
+        {
+        public:
+        
+            EnabledLogEntry(const char* func)
+                : funcName(func)
+            {
+                Logger::logArgs(2, ">> %s", funcName);
+            }
+            
+            ~EnabledLogEntry()
+            {
+                tuscany::sca::Logger::logArgs(2, "<< %s", funcName);
+            }
+            
+        private:
+            const char *funcName;
+        
+        };
+        
     } // End namespace sca
 } // End namespace tuscany
+
 #endif // tuscany_sca_util_logger_h

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h Sat Nov 11 20:39:42 2006
@@ -24,44 +24,24 @@
 
 #include "tuscany/sca/util/Logger.h"
 
-#define LOGENTRY(level, methodName) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::log(level, "Entering: " methodName);
-
-#define LOGEXIT(level, methodName) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::log(level, "Exiting: " methodName);
-
-#define LOGINFO(level, message) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::log(level, message);
-
-#define LOGINFO_1(level, message, arg1) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1);
-
-#define LOGINFO_2(level, message, arg1, arg2) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1, arg2);
-
-#define LOGINFO_3(level, message, arg1, arg2, arg3) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1, arg2, arg3);
-
-#define LOGERROR(level, message) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::log(level, message);
-
-#define LOGERROR_1(level, message, arg1) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1);
-
-#define LOGERROR_2(level, message, arg1, arg2) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1, arg2);
-
-#define LOGERROR_3(level, message, arg1, arg2, arg3) \
-if (tuscany::sca::Logger::loggingLevel >= level) \
-tuscany::sca::Logger::logArgs(level, message, arg1, arg2, arg3);
+#if defined(WIN32)  || defined (_WINDOWS)
+#define logentry() \
+const LogEntry& __LOGENTRY__ = tuscany::sca::Logger::loggingLevel >= 2 ? tuscany::sca::EnabledLogEntry(__FUNCTION__) :  tuscany::sca::LogEntry()
+#else
+#define logentry() \
+const LogEntry& __LOGENTRY__ = tuscany::sca::Logger::loggingLevel >= 2 ? tuscany::sca::EnabledLogEntry(__PRETTY_FUNCTION__) :  tuscany::sca::LogEntry()
+#endif 
+
+#define loginfo(...) \
+if (tuscany::sca::Logger::loggingLevel >= 2) \
+tuscany::sca::Logger::logArgs(2, __VA_ARGS__);
+
+#define logwarning(...) \
+if (tuscany::sca::Logger::loggingLevel >= 1) \
+tuscany::sca::Logger::logArgs(1, __VA_ARGS__);
+
+#define logerror(...) \
+if (tuscany::sca::Logger::loggingLevel >= 0) \
+tuscany::sca::Logger::logArgs(0, __VA_ARGS__);
 
 #endif // tuscany_sca_util_logging_h

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp Sat Nov 11 20:39:42 2006
@@ -40,15 +40,25 @@
         // =======================================================
         ComponentContext ComponentContext::getCurrent()
         {
-            LOGENTRY(1, "ComponentContext::getCurrent");
-            Component* component = tuscany::sca::SCARuntime::getInstance()->getCurrentComponent();
-            if (!component)
+            logentry();
+            try
             {
-                throw ComponentContextException("No current component");
+                Component* component = tuscany::sca::SCARuntime::getInstance()->getCurrentComponent();
+                if (!component)
+                {
+                    throwException(ComponentContextException, "No current component");
+                }
+                ComponentContext* cci = new ComponentContextImpl(component);
+                return ComponentContext(cci);
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
             }
-            ComponentContext* cci = new ComponentContextImpl(component);
-            LOGEXIT(1, "ComponentContext::constructor");
-            return ComponentContext(cci);
         }
         
         // ===========
@@ -57,8 +67,7 @@
         ComponentContext::ComponentContext(ComponentContext* implementation)
             : impl(implementation)
         {
-            LOGENTRY(1, "ComponentContext::constructor");
-            LOGEXIT(1, "ComponentContext::constructor");
+            logentry();
         }
         
         // ==========
@@ -66,9 +75,8 @@
         // ==========
         ComponentContext::~ComponentContext()
         {
-            LOGENTRY(1, "ComponentContext::destructor");
+            logentry();
             delete impl;
-            LOGEXIT(1, "ComponentContext::destructor");
         }
 
         // ===================================
@@ -76,6 +84,7 @@
         // ===================================
         ComponentContext::ComponentContext(const ComponentContext& ctx)
         {
+            logentry();
             Component* component = ((ComponentContextImpl*)impl)->getComponent();
             impl = new ComponentContextImpl(component);
         }
@@ -85,6 +94,7 @@
         // =============================
         ComponentContext& ComponentContext::operator=(const ComponentContext& ctx)
         {
+            logentry();
             if (this != &ctx)
             {
                 Component* component = ((ComponentContextImpl*)impl)->getComponent();
@@ -98,9 +108,8 @@
         // ==========
         void* ComponentContext::getService(const std::string& referenceName)
         {
-            LOGENTRY(1, "ComponentContext::getService");
+            logentry();
             void* service = impl->getService(referenceName);
-            LOGEXIT(1, "ComponentContext::getService");
             return service;
         }
         
@@ -109,6 +118,7 @@
         // ===========
         std::list<void*> ComponentContext::getServices(const std::string& referenceName)
         {
+            logentry();
             return impl->getServices(referenceName);
         }
         
@@ -117,9 +127,8 @@
         // =============
         DataObjectPtr ComponentContext::getProperties()
         {
-            LOGENTRY(1, "ComponentContext::getProperties");
+            logentry();
             DataObjectPtr properties = impl->getProperties();
-            LOGEXIT(1, "ComponentContext::getProperties");
             return properties;
         }
 
@@ -128,9 +137,8 @@
         // =============
         DataFactoryPtr ComponentContext::getDataFactory()
         {
-            LOGENTRY(1, "ComponentContext::getDataFactory");
+            logentry();
             DataFactoryPtr dataFactory = impl->getDataFactory();
-            LOGEXIT(1, "ComponentContext::getDataFactory");
             return dataFactory;
         }
 

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp Sat Nov 11 20:39:42 2006
@@ -20,6 +20,7 @@
 /* $Rev$ $Date$ */
 
 #include "osoa/sca/CompositeContext.h"
+#include "osoa/sca/ServiceRuntimeException.h"
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/cpp/CompositeContextImpl.h"
 #include "tuscany/sca/core/SCARuntime.h"
@@ -40,6 +41,7 @@
         CompositeContext::CompositeContext(CompositeContext* implementation)
             : impl(implementation)
         {
+            logentry();
         }
 
         // ===================================
@@ -47,6 +49,7 @@
         // ===================================
         CompositeContext::CompositeContext(const CompositeContext& ctx)
         {
+            logentry();
             impl = new CompositeContextImpl(
                 tuscany::sca::SCARuntime::getInstance()->getDefaultComponent());
         }
@@ -56,6 +59,7 @@
         // =============================
         CompositeContext& CompositeContext::operator=(const CompositeContext& ctx)
         {
+            logentry();
             if (this != &ctx)
             {
                 impl = new CompositeContextImpl(
@@ -69,9 +73,8 @@
         // ==========
         CompositeContext::~CompositeContext()
         {
-            LOGENTRY(1, "CompositeContext::destructor");
+            logentry();
             delete impl;
-            LOGEXIT(1, "CompositeContext::destructor");
         }
         
         // ====================================================
@@ -79,11 +82,22 @@
         // ====================================================
         CompositeContext CompositeContext::getCurrent()
         {
-            LOGENTRY(1, "CompositeContext::getCurrent");
-            CompositeContext* cci = new CompositeContextImpl(
-                tuscany::sca::SCARuntime::getInstance()->getDefaultComponent());
-            LOGEXIT(1, "CompositeContext::getCurrent");
-            return CompositeContext(cci);
+            logentry();
+            try
+            {
+                CompositeContext* cci = new CompositeContextImpl(
+                    tuscany::sca::SCARuntime::getInstance()->getDefaultComponent());
+                    
+                return CompositeContext(cci);
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
+            }
         }
 
         // =============
@@ -91,9 +105,8 @@
         // =============
         void* CompositeContext::locateService(const std::string& serviceName)
         {
-            LOGENTRY(1, "CompositeContext::locateService");
+            logentry();
             void* sp = impl->locateService(serviceName);
-            LOGEXIT(1, "CompositeContext::locateService");
             return sp;
         }
 
@@ -102,9 +115,8 @@
         // =============
         DataFactoryPtr CompositeContext::getDataFactory()
         {
-            LOGENTRY(1, "CompositeContext::getDataFactory");
+            logentry();
             DataFactoryPtr df = impl->getDataFactory();
-            LOGEXIT(1, "CompositeContext::getDataFactory");
             return df;
         }
 

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h Sat Nov 11 20:39:42 2006
@@ -25,7 +25,9 @@
 #include "osoa/sca/export.h"
 
 #include "tuscany/sca/util/Exceptions.h"
+
 using tuscany::sca::TuscanyRuntimeException;
+
 namespace osoa
 {
     namespace sca
@@ -44,8 +46,12 @@
                 : TuscanyRuntimeException(name, sev, msg_text)
             {
             }
+
+            ServiceRuntimeException(const TuscanyRuntimeException& e)
+                : TuscanyRuntimeException(e)
+            {
+            }
         }; // End ServiceRuntimeException class definition
-        
 
         /**
          * A remotable service is currently unavailable. It is possible that a retry

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp Sat Nov 11 20:39:42 2006
@@ -48,8 +48,7 @@
             // ===================================================================
             CPPExtension::CPPExtension()
             { 
-                LOGENTRY(1, "CPPExtension::constructor");     
-                LOGEXIT(1, "CPPExtension::constructor");
+                logentry();
             }
             
             // ===================================================================
@@ -57,16 +56,14 @@
             // ===================================================================
             CPPExtension::~CPPExtension()
             { 
-                LOGENTRY(1, "CPPExtension::destructor");;           
-                LOGEXIT(1, "CPPExtension::destructor");
+                logentry();
             }
 
             void CPPExtension::initialize()
             { 
-                LOGENTRY(1, "CPPExtension::initialize");;           
+                logentry();
                 SCARuntime::getInstance()->registerImplementationExtension(new CPPImplementationExtension());
                 SCARuntime::getInstance()->registerInterfaceExtension(new CPPInterfaceExtension());
-                LOGEXIT(1, "CPPExtension::initialize");;           
             }
 
         } // End namespace cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp Sat Nov 11 20:39:42 2006
@@ -36,8 +36,7 @@
             // ===================================================================
             CPPImplementationExtension::CPPImplementationExtension()
             { 
-                LOGENTRY(1, "CPPImplementationExtension::constructor");     
-                LOGEXIT(1, "CPPImplementationExtension::constructor");
+                logentry();
             }
             
             // ===================================================================
@@ -45,8 +44,7 @@
             // ===================================================================
             CPPImplementationExtension::~CPPImplementationExtension()
             { 
-                LOGENTRY(1, "CPPImplementationExtension::destructor");;           
-                LOGEXIT(1, "CPPImplementationExtension::destructor");
+                logentry();
             }
 
             const string CPPImplementationExtension::extensionName("cpp");
@@ -57,6 +55,7 @@
             // ===================================================================
             ComponentType* CPPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
             {
+                logentry();
                 string implType = scdlImplementation->getType().getName();
                 if (implType == "CPPImplementation")
                 {

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp Sat Nov 11 20:39:42 2006
@@ -35,8 +35,7 @@
             // ===================================================================
             CPPInterfaceExtension::CPPInterfaceExtension()
             { 
-                LOGENTRY(1, "CPPInterfaceExtension::constructor");     
-                LOGEXIT(1, "CPPInterfaceExtension::constructor");
+                logentry();
             }
             
             // ===================================================================
@@ -44,8 +43,7 @@
             // ===================================================================
             CPPInterfaceExtension::~CPPInterfaceExtension()
             { 
-                LOGENTRY(1, "CPPInterfaceExtension::destructor");;           
-                LOGEXIT(1, "CPPInterfaceExtension::destructor");
+                logentry();
             }
 
             const string CPPInterfaceExtension::extensionName("cpp");
@@ -56,6 +54,8 @@
             // ===================================================================
             tuscany::sca::model::Interface* CPPInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
             {
+                logentry();
+
                 // Determine the type
                 string ifType = scdlInterface->getType().getName();
                 if (ifType == "CPPInterface")

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp Sat Nov 11 20:39:42 2006
@@ -50,7 +50,7 @@
             CPPServiceProxy::CPPServiceProxy(Reference* reference)
                 : ServiceProxy(reference)
             {
-                LOGENTRY(1,"CPPServiceProxy::constructor");
+                logentry();
     
                 // ----------------------
                 // Get the component
@@ -64,8 +64,6 @@
                 ServiceWrapper* serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
     
                 createProxy(component, name, serviceWrapper);
-    
-                LOGEXIT(1,"CPPServiceProxy::constructor");
             }
             
             // ============================
@@ -74,7 +72,7 @@
             CPPServiceProxy::CPPServiceProxy(Service* service)
                 : ServiceProxy(0)
             {
-                LOGENTRY(1,"CPPServiceProxy::constructor");
+                logentry();
                 
                 // ----------------------
                 // Get the component
@@ -86,19 +84,17 @@
                 ServiceWrapper* serviceWrapper = service->getBinding()->getServiceWrapper();
     
                 createProxy(component, name, serviceWrapper);
-    
-                LOGEXIT(1,"CPPServiceProxy::constructor");
             }
             
             void CPPServiceProxy::createProxy(Component* component, const string& name, ServiceWrapper* serviceWrapper)
             {
-                LOGENTRY(1,"CPPServiceProxy::createProxy");
+                logentry();
                 
                 ComponentType* componentType = component->getType();
                 if (!componentType)
                 {
                     string msg = "Component " + component->getName() + " has no implementation defined";
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }
                 
                 // If we got here we have a CPP implementation
@@ -126,10 +122,10 @@
                 PROXYFACTORY proxyFactory = (PROXYFACTORY)proxyLibrary.getSymbol(proxyFactoryName);        
                 if (!proxyFactory)
                 {
-                    LOGERROR_2(1, "CPPServiceProxy::createProxy: Unable to locate %s in library %s",
+                    logerror("Unable to locate %s in library %s",
                         proxyFactoryName.c_str(), fullLibraryName.c_str());
                     string msg = "Unable to locate " + proxyFactoryName + " in library " + fullLibraryName;
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }
                 
                 // -----------------------------------
@@ -138,10 +134,10 @@
                 void* proxy = proxyFactory(serviceWrapper); 
                 if (!proxy)
                 {
-                    LOGERROR_2(1, "CPPServiceProxy::createProxy: Factory method %s in library %s returned null",
+                    logerror("Factory method %s in library %s returned null",
                         proxyFactoryName.c_str(), fullLibraryName.c_str());
                     string msg = "Factory method " + proxyFactoryName + " in library " + fullLibraryName + " returned null";
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }
                 else
                 {
@@ -152,8 +148,6 @@
                 // Get the destructor method
                 // -------------------------
                 destructor  = (PROXYDESTRUCTOR)proxyLibrary.getSymbol(proxyDestructorName);        
-                
-                LOGEXIT(1,"CPPServiceProxy::createProxy");
             }
     
             // ==========
@@ -161,14 +155,13 @@
             // ==========
             CPPServiceProxy::~CPPServiceProxy()
             {
-                LOGENTRY(1,"CPPServiceProxy::destructor");
+                logentry();
     
                 // Delete the proxies
                 if (destructor != NULL && proxies.size() != 0)
                 {
                     destructor(*proxies.begin());
                 }
-                LOGEXIT(1,"CPPServiceProxy::destructor");
             }
             
             CPPServiceProxy::PROXIES CPPServiceProxy::getProxies()
@@ -178,6 +171,8 @@
             
             void* CPPServiceProxy::getProxy()
             {
+                logentry();
+
                 if (proxies.size() != 0)
                 {
                     return *proxies.begin();

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp Sat Nov 11 20:39:42 2006
@@ -54,14 +54,11 @@
             CPPServiceWrapper::CPPServiceWrapper(Service* service)
                 : ServiceWrapper(service)
             {
-                LOGENTRY(1,"CPPServiceWrapper::constructor");
+                logentry();
     
                 component = service->getComponent();
                 interf = service->getType()->getInterface();
                 implementation = (CPPImplementation*)component->getType();
-                
-                LOGEXIT(1,"CPPServiceWrapper::constructor");
-                
             }
             
             // ==========
@@ -69,8 +66,7 @@
             // ==========
             CPPServiceWrapper::~CPPServiceWrapper()
             {
-                LOGENTRY(1,"CPPServiceWrapper::destructor");
-                LOGEXIT(1,"CPPServiceWrapper::destructor");
+                logentry();
             }
             
             
@@ -79,6 +75,7 @@
             // ======================================================================
             void* CPPServiceWrapper::getImplementation()
             {
+                logentry();
                 if (implementation->getScope() == CPPImplementation::COMPOSITE)
                 {
                     if (!staticImpl)
@@ -98,6 +95,7 @@
             // ======================================================================
             void CPPServiceWrapper::releaseImplementation()
             {
+                logentry();
                 if (implementation->getScope() == CPPImplementation::STATELESS)
                 {
                     deleteImplementation();
@@ -109,7 +107,7 @@
             // ======================================================================
             void CPPServiceWrapper::invoke(Operation& operation)
             {
-                LOGENTRY(1,"CPPServiceWrapper::invoke");
+                logentry();
     
                 SCARuntime* runtime = SCARuntime::getInstance();
                 runtime->setCurrentComponent(component);
@@ -124,8 +122,6 @@
                     throw;
                 }
                 runtime->unsetCurrentComponent();
-                LOGEXIT(1,"CPPServiceWrapper::invoke");
-                
             }
             
             void CPPServiceWrapper::setLibrary(Library* lib)
@@ -138,6 +134,8 @@
             // ======================================================================
             CPPServiceWrapper* CPPServiceWrapper::getServiceWrapper(Service* service)
             {            
+                logentry();
+
                 CPPServiceWrapper* serviceWrapper = 0;
                 
                 // -----------------------------------------------
@@ -148,7 +146,7 @@
                 if (!impl)
                 {
                     string msg = "Component " + component->getName() + " has no implementation defined";
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }
                 
                 // ----------------------------------------------------
@@ -171,10 +169,10 @@
                 WRAPPERFACTORY wrapperFactory = (WRAPPERFACTORY)wrapperLib->getSymbol(wrapperFactoryName);
                 if (!wrapperFactory)
                 {
-                    LOGERROR_2(1, "CPPServiceWrapper::getServiceWrapper: Unable to locate %s in library %s",
+                    logerror("Unable to locate %s in library %s",
                         wrapperFactoryName.c_str(), fullLibraryName.c_str());
                     string msg = "Unable to locate " + wrapperFactoryName + " in library " + fullLibraryName;
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }
                 
                 // -------------------------------------
@@ -183,10 +181,10 @@
                 serviceWrapper = wrapperFactory(service);
                 if (!serviceWrapper)
                 {
-                    LOGERROR_2(1, "CPPServiceWrapper::getServiceWrapper: Factory method %s in library %s returned null",
+                    logerror("Factory method %s in library %s returned null",
                         wrapperFactoryName.c_str(), fullLibraryName.c_str());
                     string msg = "Factory method " + wrapperFactoryName + " in library " + fullLibraryName + " returned null";
-                    throw ServiceNotFoundException(msg.c_str());
+                    throwException(ServiceNotFoundException, msg.c_str());
                 }                
                 serviceWrapper->setLibrary(wrapperLib);
                 

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp Sat Nov 11 20:39:42 2006
@@ -40,8 +40,7 @@
         ComponentContextImpl::ComponentContextImpl(Component* comp)
             : ComponentContext(0),  component(comp)
         {
-            LOGENTRY(1, "ComponentContextImpl::constructor");
-            LOGEXIT(1, "ComponentContextImpl::constructor");
+            logentry();
         }
         
         // ==========
@@ -49,6 +48,7 @@
         // ==========
         ComponentContextImpl::~ComponentContextImpl()
         {
+            logentry();
         }
         
         
@@ -57,29 +57,39 @@
         // ==========================================================================
         std::list<void*> ComponentContextImpl::getServices(const std::string& referenceName)
         {
-            LOGENTRY(1, "ComponentContextImpl::getServices");
-            
-            // --------------------------------------------------------------
-            // locate reference in the current component and determine target
-            // --------------------------------------------------------------
-            Reference* reference = component->findReference(referenceName);
-            if (!reference)
-            {
-                string message = "Reference not defined: ";
-                message = message + referenceName;
-                throw ServiceNotFoundException(message.c_str());
+            logentry();
+            try
+            {
+                // --------------------------------------------------------------
+                // locate reference in the current component and determine target
+                // --------------------------------------------------------------
+                Reference* reference = component->findReference(referenceName);
+                if (!reference)
+                {
+                    string message = "Reference not defined: ";
+                    message = message + referenceName;
+                    throwException(ServiceNotFoundException, message.c_str());
+                }
+    
+                // Get a service proxy from the binding configured on the reference
+                CPPServiceProxy* serviceProxy =  (CPPServiceProxy*)reference->getBinding()->getServiceProxy();
+                if (serviceProxy == NULL)
+                {
+                    string message = "Reference ";
+                    message = message + referenceName + " not wired";
+                    throwException(ServiceNotFoundException, message.c_str());
+                }
+                
+                return serviceProxy->getProxies();
             }
-
-            // Get a service proxy from the binding configured on the reference
-            CPPServiceProxy* serviceProxy =  (CPPServiceProxy*)reference->getBinding()->getServiceProxy();
-            if (serviceProxy == NULL)
-            {
-                string message = "Reference ";
-                message = message + referenceName + " not wired";
-                throw ServiceNotFoundException(message.c_str());
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
             }
-            
-            return serviceProxy->getProxies();
             
         } // End getServices()
         
@@ -89,47 +99,58 @@
         // ===================================================================
         void* ComponentContextImpl::getService(const std::string& referenceName)
         {
-            LOGENTRY(1, "ComponentContextImpl::getService");
-            
-            // --------------------------------------------------------------
-            // locate reference in the current component and determine target
-            // --------------------------------------------------------------
-            Reference* reference = component->findReference(referenceName);
-            if (!reference)
-            {
-                string message = "Reference not defined: ";
-                message = message + referenceName;
-                throw ServiceNotFoundException(message.c_str());
-            }
-            
-            // --------------------
-            // Validate the request
-            // --------------------
-            switch (reference->getType()->getMultiplicity())
-            {
-            case ReferenceType::ZERO_MANY:
-            case ReferenceType::ONE_MANY:
+            logentry();
+            try
+            {            
+                // --------------------------------------------------------------
+                // locate reference in the current component and determine target
+                // --------------------------------------------------------------
+                Reference* reference = component->findReference(referenceName);
+                if (!reference)
                 {
-                    string message = "getService() called for reference with multiplicity >1 :";
+                    string message = "Reference not defined: ";
                     message = message + referenceName;
-                    throw ServiceNotFoundException(message.c_str());                    
+                    throwException(ServiceNotFoundException, message.c_str());
                 }
-            default:
+                
+                // --------------------
+                // Validate the request
+                // --------------------
+                switch (reference->getType()->getMultiplicity())
+                {
+                case ReferenceType::ZERO_MANY:
+                case ReferenceType::ONE_MANY:
+                    {
+                        string message = "getService() called for reference with multiplicity >1 :";
+                        message = message + referenceName;
+                        throwException(ServiceNotFoundException, message.c_str());
+                    }
+                default:
+                    {
+                    }
+                } // end switch
+    
+                // Get a service proxy from the binding configured on the reference
+                CPPServiceProxy* serviceProxy =  (CPPServiceProxy*)reference->getBinding()->getServiceProxy();
+                if (serviceProxy == NULL)
                 {
+                    string message = "Reference ";
+                    message = message + referenceName + " not wired";
+                    throwException(ServiceNotFoundException, message.c_str());
                 }
-            } // end switch
-
-            // Get a service proxy from the binding configured on the reference
-            CPPServiceProxy* serviceProxy =  (CPPServiceProxy*)reference->getBinding()->getServiceProxy();
-            if (serviceProxy == NULL)
-            {
-                string message = "Reference ";
-                message = message + referenceName + " not wired";
-                throw ServiceNotFoundException(message.c_str());
+                
+                void* service = serviceProxy->getProxy();
+                
+                return service;
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
             }
-            
-            void* service = serviceProxy->getProxy();
-            return service;
             
         } // End getService()
         
@@ -138,11 +159,20 @@
         // ==============================================
         DataObjectPtr ComponentContextImpl::getProperties()
         {
-            LOGENTRY(1, "ComponentContextImpl::getProperties");
-            DataObjectPtr properties = component->getProperties();
-            
-            LOGEXIT(1, "ComponentContextImpl::getProperties");
-            return properties;
+            logentry();
+            try
+            {
+                DataObjectPtr properties = component->getProperties();
+                return properties;
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
+            }
         }
 
         // ==============================================
@@ -151,11 +181,20 @@
         // ==============================================
         commonj::sdo::DataFactoryPtr ComponentContextImpl::getDataFactory()
         {
-            LOGENTRY(1, "ComponentContextImpl::getProperties");
-            commonj::sdo::DataFactoryPtr dataFactory = component->getComposite()->getDataFactory();
-            
-            LOGEXIT(1, "ComponentContextImpl::getDataFactory");
-            return dataFactory;
+            logentry();
+            try
+            {
+                commonj::sdo::DataFactoryPtr dataFactory = component->getComposite()->getDataFactory();
+                return dataFactory;
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
+            }
         }
         
        } // End namespace cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp Sat Nov 11 20:39:42 2006
@@ -49,6 +49,7 @@
         CompositeContextImpl::CompositeContextImpl(Component* component)
             : CompositeContext(0), component(component),  composite((Composite*)component->getType())
         {
+            logentry();
         }
 
         // ==========
@@ -56,6 +57,7 @@
         // ==========
         CompositeContextImpl::~CompositeContextImpl()
         {
+            logentry();
         }
 
         // ===========================================================================
@@ -63,30 +65,38 @@
         // ===========================================================================
         void* CompositeContextImpl::locateService(const std::string& serviceName)
         {
-            LOGENTRY(1, "CompositeContextImpl::locateService");
-
-            // ----------------------------
-            // Locate the component service
-            // ----------------------------
-            Service* service = composite->findComponentService(serviceName);
-            string msg;
-            if (!service)
-            {
-                msg = "Service not found: ";
-                msg = msg + serviceName;
-                throw ServiceNotFoundException(msg.c_str());
+            logentry();
+            try
+            {
+                // ----------------------------
+                // Locate the component service
+                // ----------------------------
+                Service* service = composite->findComponentService(serviceName);
+                string msg;
+                if (!service)
+                {
+                    msg = "Service not found: ";
+                    msg = msg + serviceName;
+                    throwException(ServiceNotFoundException, msg.c_str());
+                }
+    
+                // ----------------------------
+                // Get a Proxy for this service
+                // ----------------------------
+    
+                // The locate service API is used from CPP clients so we are using
+                // our default service proxy here
+                CPPServiceProxy* serviceProxy =  new CPPServiceProxy(service);
+                return serviceProxy->getProxy();
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
             }
-
-            // ----------------------------
-            // Get a Proxy for this service
-            // ----------------------------
-
-            // The locate service API is used from CPP clients so we are using
-            // our default service proxy here
-            CPPServiceProxy* serviceProxy =  new CPPServiceProxy(service);
-            LOGEXIT(1, "CompositeContextImpl::locateService");
-            return serviceProxy->getProxy();
-
         }
         
         // ==============================================
@@ -94,11 +104,20 @@
         // ==============================================
         DataFactoryPtr CompositeContextImpl::getDataFactory()
         {
-            LOGENTRY(1, "CompositeContextImpl::getDataFactory");
-            DataFactoryPtr dataFactory = composite->getDataFactory();
-            
-            LOGEXIT(1, "CompositeContextImpl::getDataFactory");
-            return dataFactory;
+            logentry();
+            try
+            {
+                DataFactoryPtr dataFactory = composite->getDataFactory();
+                return dataFactory;
+            }
+            catch (ServiceRuntimeException&)
+            {
+                throw;
+            }
+            catch (TuscanyRuntimeException& e)
+            {
+                throwException(ServiceRuntimeException, e);
+            }
         }
 
        } // End namespace cpp



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