diff options
Diffstat (limited to 'tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core')
10 files changed, 0 insertions, 2646 deletions
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.cpp deleted file mode 100644 index a75da50c22..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * 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$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#else -#include "tuscany_sca_config.h" -#endif - -#include <sstream> -#if defined(WIN32) || defined (_WINDOWS) || defined (IS_DARWIN) -#else -#include <execinfo.h> -#endif - -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Logging.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - - // ======================================================================== - // Constructor - // ======================================================================== - TuscanyRuntimeException :: TuscanyRuntimeException(const char* name, - severity_level sev, - const char* msg_text) - { - 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); - -#if defined(WIN32) || defined (_WINDOWS) || defined (IS_DARWIN) -#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 - - // ======================================================================== - // Constructor - // ======================================================================== - TuscanyRuntimeException :: TuscanyRuntimeException(const TuscanyRuntimeException& c) - { - 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 < location_set; i++) - { - locations[i].file = new char[strlen(c.locations[i].file) + 1]; - strcpy(locations[i].file,c.locations[i].file); - locations[i].line = c.locations[i].line; - locations[i].function = new char[strlen(c.locations[i].function) + 1]; - strcpy(locations[i].function, c.locations[i].function); - } - -#if defined(WIN32) || defined (_WINDOWS) || defined (IS_DARWIN) -#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) || defined (IS_DARWIN) -#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); - } - - // ======================================================================== - // Destructor - // ======================================================================== - TuscanyRuntimeException :: ~TuscanyRuntimeException() - { - if (class_name) delete class_name; - if (message_text) delete message_text; - for (int i=0;i<location_set;i++) - { - if (locations[i].file) delete locations[i].file; - if (locations[i].function) delete locations[i].function; - } - -#if defined(WIN32) || defined (_WINDOWS) || defined (IS_DARWIN) -#else - free(stacktrace_symbols); -#endif - - } // end TuscanyRuntimeException destructor - - // ======================================================================== - // Return class name of this exception - // ======================================================================== - const char* TuscanyRuntimeException :: getEClassName() const - { - return class_name; - } // end getClassName() - - // ======================================================================== - // Return severity - // ======================================================================== - TuscanyRuntimeException::severity_level TuscanyRuntimeException :: getSeverity() const - { - return severity; - } // end getSeverity() - - // ======================================================================== - // Return message text associated with exception - // ======================================================================== - const char* TuscanyRuntimeException :: getMessageText() const - { - return message_text; - } // end getMessageText() - - // ======================================================================== - // Return file name where exception was raised - // ======================================================================== - const char* TuscanyRuntimeException :: getFileName() const - { - return locations[0].file; - } // end getFileName() - - // ======================================================================== - // Return line number where exception was raised - // ======================================================================== - unsigned long TuscanyRuntimeException :: getLineNumber() const - { - return locations[0].line; - } // end getLineNumber() - - // ======================================================================== - // Return function name where exception was raised - // ======================================================================== - const char* TuscanyRuntimeException :: getFunctionName() const - { - return locations[0].function; - } // end getFunctionName() - - - // ======================================================================== - // set severity of exception - // ======================================================================== - void TuscanyRuntimeException :: setSeverity(severity_level sev) - { - severity = sev; - } // end setSeverity(severity_level sev) const - - // ======================================================================== - // set message text associated with exception - // ======================================================================== - void TuscanyRuntimeException :: setMessageText(const char* msg_text) - { - if (message_text != 0) delete message_text; - message_text = new char[strlen(msg_text) + 1]; - strcpy(message_text,msg_text); - } // end setMessageText(const string &msg_text) const - - // ======================================================================== - // set location of most recent handling of the exception - // ======================================================================== - void TuscanyRuntimeException :: setLocation(const char* file, - unsigned long line, - const char* function) - { - if (location_set < num_locations) - { - locations[location_set].file = new char[strlen(file) + 1]; - strcpy(locations[location_set].file,file); - locations[location_set].line = line; - locations[location_set].function = new char[strlen(function) + 1]; - strcpy(locations[location_set].function,function); - - location_set++; - } - } // end setLocation() - - - // ======================================================================== - // print self - // ======================================================================== - ostream& TuscanyRuntimeException :: PrintSelf(ostream &os) const - { - - os << "Exception" << endl; - os << " Class: " << class_name << endl; - os << " Description: " << message_text << endl; - if (location_set != 0) - { - os << " Origin:" << endl; - os << " File: " << locations[0].file << endl; - char lineNumber[100]; - sprintf(lineNumber, "%lu",locations[0].line); - os << " Line: " << lineNumber << endl; - os << " Function: " << locations[0].function << endl; - - 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) || defined (IS_DARWIN) -#else - if (stacktrace_size != 0) - { - os << " Backtrace:" << endl; - for (int j = 0; j < stacktrace_size; j++) - { - os << " " << stacktrace_symbols[j] << endl; - } - } -#endif - return os; - } // end ostream operator << - - - // ======================================================================== - // ostream operator << - // ======================================================================== - SCA_API ostream& operator<< (ostream &os, const TuscanyRuntimeException &except) - { - return except.PrintSelf(os); - } // end ostream operator << - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.h deleted file mode 100644 index 3b5b048736..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Exceptions.h +++ /dev/null @@ -1,346 +0,0 @@ -/* - * 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_core_exceptions_h -#define tuscany_sca_core_exceptions_h - -#include <ostream> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/export.h" - - -namespace tuscany -{ - namespace sca - { - /** - * Top level exception to represent all the exceptions that may be - * thrown by an SCA runtime implementation. - */ - class SCA_API TuscanyRuntimeException - { - public: - /** - * Represents the possible severity levels for an exception. - */ - enum severity_level - { - Normal, - Warning, - Error, - Severe - }; - - /** - * Constructor. - * @param name Class name of the exception. - * @param sev Severity level. - * @param msg_text Detailed description of the exception. - */ - TuscanyRuntimeException( - const char *name = "TuscanyRuntimeException", - severity_level sev = Severe, - const char* msg_text = ""); - - TuscanyRuntimeException(const TuscanyRuntimeException& c); - TuscanyRuntimeException(const SDORuntimeException& c); - - // Destructor - virtual ~TuscanyRuntimeException(); - - /** - * Return class name of this exception. - */ - const char* getEClassName() const; - - /** - * Return severity. - */ - severity_level getSeverity() const; - - /** - * Return message text associated with exception. - */ - const char* getMessageText() const; - - /* - * Return file name where the exception was raised. - */ - const char* getFileName() const; - - /** - * Return line number where the exception was raised. - */ - unsigned long getLineNumber() const; - - /** - * Return function name where the exception was raised. - */ - const char* getFunctionName() const; - - /** - * Set the exception severity. - */ - void setSeverity(severity_level sev); - - /** - * Set the message text associated with exception. - */ - void setMessageText(const char* msg_text); - - /** - * Set the location where the exception was raised. - * @param file Name of the file. - * @param line Line number in the file. - * @param function Name of the function. - */ - void setLocation(const char* file, - unsigned long line, - const char* function=""); - - /** - * Append exception details to ostream. - */ - virtual std::ostream& PrintSelf(std::ostream &os) const; - - /** - * Operator to send exceptions details to a stream. - */ - SCA_API friend std::ostream& operator<< (std::ostream &os, const TuscanyRuntimeException &except); - - protected: - - private: - /** - * Class name of the exception. - */ - char* class_name; - - /** - * Severity level of the exception. - */ - severity_level severity; - - /** - * Description of the exception. - */ - char* message_text; // Description of exception - - /** - * Location where the exception was thrown or handled and thrown. - */ - class location - { - public: - char* file; // File name (from __FILE__) - unsigned long line; // Line number (from __LINE__) - char* function; // Function name - }; - - - enum {num_locations=5}; - /** - * Array of locations where the exception has been handled and thrown. - */ - location locations[num_locations]; - - /** - * The current location (index into TuscanyRuntimeException#location). - */ - 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 - - - /** - * Indicates a problem in the consistency of the SCA model provided to the - * Tuscany runtime. - */ - class SCA_API SystemConfigurationException: public TuscanyRuntimeException - { - public: - SystemConfigurationException(const char* msg) - : TuscanyRuntimeException("SystemConfigurationException", Severe, - 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_core_exceptions_h diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.cpp deleted file mode 100644 index 335ed5d369..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.cpp +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#include <stdarg.h> -#include <sstream> - -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace commonj::sdo; - - -namespace tuscany -{ - namespace sca - { - // =========== - // Constructor - // =========== - Operation::Operation(const char* operationName) - { - logentry(); - if (operationName != 0) - { - name = operationName; - } - } - - // ========== - // Destructor - // ========== - Operation::~Operation() - { - logentry(); - clean(); - } - - // ========== - // Copy Constructor - // ========== - Operation::Operation(const Operation& op) - { - logentry(); - copy(op); - } - - // ========== - // operator= - // ========== - Operation& Operation::operator=(const Operation& op) - { - logentry(); - if (&op != this) - { - copy(op); - } - return *this; - } - - // ========== - // Clean - // ========== - void Operation::clean() - { - logentry(); - for (unsigned int i = 0; i < getNParms(); i++) - { - const Parameter& parm = getParameter(i); - if (parm.getType() == DATAOBJECT) - { - delete (DataObjectPtr*)parm.getValue(); - } - } - - parameters.empty(); - - if (getReturnType() == DATAOBJECT) - { - delete (DataObjectPtr*)getReturnValue(); - } - } - - // ========== - // Copy - // ========== - void Operation::copy(const Operation& op) - { - logentry(); - clean(); - for (unsigned int i = 0; i < op.getNParms(); i++) - { - const Parameter& parm = op.getParameter(i); - if (parm.getType() == DATAOBJECT) - { - addParameter((const DataObject*)parm.getValue()); - } - else - { - parameters.insert(parameters.end(), parm); - } - } - - if (getReturnType() == DATAOBJECT) - { - setReturnValue((const DataObjectPtr*)op.getReturnValue()); - } - else - { - returnValue = op.returnValue; - } - } - - // ============================================== - // getParameter: return parameter at position pos - // ============================================== - void* Operation::getParameterValue(unsigned int pos) const - { - logentry(); - if (pos < parameters.size()) - { - return parameters[pos].getValue(); - } - - return 0; - } - - // ================================================== - // getParameter: return parameter value based on name - // ================================================== - void* Operation::getParameterValue(const string& name) const - { - logentry(); - try - { - return getParameter(name).getValue(); - } - catch(ServiceInvocationException) - {} - - return 0; - } - - // ====================================================== - // getParameter: return parameter based on index position - // ====================================================== - const Operation::Parameter& Operation::getParameter(unsigned int pos) const - { - logentry(); - if (pos < parameters.size()) - { - return parameters[pos]; - } - - throwException(ServiceInvocationException, "Index out of range"); - } - - // =============================================== - // getParameter: return of parameter based on name - // =============================================== - const Operation::Parameter& Operation::getParameter(const string& name) const - { - logentry(); - for(unsigned int pos=0; pos < parameters.size(); pos++) - { - if(parameters[pos].getName() == name) - { - return parameters[pos]; - } - } - - throwException(ServiceInvocationException, "Parameter name not found"); - } - - - // ============================================================ - // getParameterType: return type of parameter based on position - // ============================================================ - Operation::ParameterType Operation::getParameterType(unsigned int pos) const - { - logentry(); - if (pos < parameters.size()) - { - return parameters[pos].getType(); - } - - return VOID_TYPE; - } - - // ======================================================== - // getParameterType: return type of parameter based on name - // ======================================================== - Operation::ParameterType Operation::getParameterType(const string& name) const - { - logentry(); - try - { - return getParameter(name).getType(); - } - catch(ServiceInvocationException) - {} - - return VOID_TYPE; - } - - const string emptyString = string(); - - // ============================================== - // getParameterName: return name of parameter - // ============================================== - const string& Operation::getParameterName(unsigned int pos) const - { - logentry(); - if (pos < parameters.size()) - { - return parameters[pos].getName(); - } - - return emptyString; - } - - // =========================================== - // addParameter: set parameter at position pos - // =========================================== - void Operation::addParameter(const void *parm) - { - logentry(); - loginfo("Adding operation parameter, type: void, value: %p", parm); - parameters.insert(parameters.end(), Parameter((void*)parm, VOID_TYPE)); - } - - void Operation::addParameter(const bool *parm) - { - logentry(); - loginfo("Adding operation parameter, type: bool, value: %d", (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, BOOL)); - } - - void Operation::addParameter(const short *parm) - { - logentry(); - loginfo("Adding operation parameter, type: short, value: %hd", (short)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, SHORT)); - } - - void Operation::addParameter(const int *parm) - { - logentry(); - loginfo("Adding operation parameter, type: int, value: %d", (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, INT)); - } - - void Operation::addParameter(const long *parm) - { - logentry(); - loginfo("Adding operation parameter, type: long, value: %ld", (long)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, LONG)); - } - - void Operation::addParameter(const unsigned short *parm) - { - logentry(); - loginfo("Adding operation parameter, type: unsigned short, value: %hu", (unsigned short)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, USHORT)); - } - - void Operation::addParameter(const unsigned int *parm) - { - logentry(); - loginfo("Adding operation parameter, type: unsigned int, value: %u", (unsigned int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, UINT)); - } - - void Operation::addParameter(const unsigned long *parm) - { - logentry(); - loginfo("Adding operation parameter, type: unsigned long, value: %lu", (unsigned long)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, ULONG)); - } - - void Operation::addParameter(const float *parm) - { - logentry(); - loginfo("Adding operation parameter, type: float, value: %f", (float)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, FLOAT)); - } - - void Operation::addParameter(const double *parm) - { - logentry(); - loginfo("Adding operation parameter, type: double, value: %lf", (double)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, DOUBLE)); - } - - void Operation::addParameter(const long double *parm) - { - logentry(); - loginfo("Adding operation parameter, type: long double, value: %Lf", (long double)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, LONGDOUBLE)); - } - - void Operation::addParameter(const char* *parm) - { - logentry(); - loginfo("Adding operation parameter, type: char*, value: %s", (const char*)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, CHARS)); - } - - void Operation::addParameter(const char *parm) - { - logentry(); - loginfo("Adding operation parameter, type: char, value: %d", (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, CHAR)); - } - - void Operation::addParameter(const string *parm) - { - logentry(); - loginfo("Adding operation parameter, type: string, value: %s", (const char*)(*parm).c_str()); - parameters.insert(parameters.end(), Parameter((void*)parm, STRING)); - } - - void Operation::addParameter(const DataObjectPtr *parm) - { - logentry(); - ostringstream os; - os << *parm; - loginfo("Adding operation parameter, type: DataObject, value: %s", os.str().c_str()); - parameters.insert(parameters.end(), Parameter((void*)new DataObjectPtr(*parm), DATAOBJECT)); - } - - // ======================================================= - // addParameter: set parameter at position pos with a name - // ======================================================= - void Operation::addParameter(const string& name, const void *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: void, value: %p", name.c_str(), parm); - parameters.insert(parameters.end(), Parameter((void*)parm, VOID_TYPE, (string&) name)); - } - - void Operation::addParameter(const string& name, const bool *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: bool, value: %d", name.c_str(), (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, BOOL, (string&) name)); - } - - void Operation::addParameter(const string& name, const short *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: short, value: %hd", name.c_str(), (short)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, SHORT, (string&) name)); - } - - void Operation::addParameter(const string& name, const int *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: int, value: %d", name.c_str(), (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, INT, (string&) name)); - } - - void Operation::addParameter(const string& name, const long *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: long, value: %ld", name.c_str(), (long)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, LONG, (string&) name)); - } - - void Operation::addParameter(const string& name, const unsigned short *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: unsigned short, value: %hu", (unsigned short)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, USHORT, (string&) name)); - } - - void Operation::addParameter(const string& name, const unsigned int *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: unsigned int, value: %u", name.c_str(), (unsigned int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, UINT, (string&) name)); - } - - void Operation::addParameter(const string& name, const unsigned long *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: unsigned long, value: %lu", name.c_str(), (unsigned long)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, ULONG, (string&) name)); - } - - void Operation::addParameter(const string& name, const float *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: float, value: %f", name.c_str(), (float)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, FLOAT, (string&) name)); - } - - void Operation::addParameter(const string& name, const double *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: double, value: %lf", name.c_str(), (double)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, DOUBLE, (string&) name)); - } - - void Operation::addParameter(const string& name, const long double *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: long double, value: %Lf", name.c_str(), (long double)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, LONGDOUBLE, (string&) name)); - } - - void Operation::addParameter(const string& name, const char* *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: char*, value: %s", name.c_str(), (const char*)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, CHARS, (string&) name)); - } - - void Operation::addParameter(const string& name, const char *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: char, value: %d", name.c_str(), (int)*parm); - parameters.insert(parameters.end(), Parameter((void*)parm, CHAR, (string&) name)); - } - - void Operation::addParameter(const string& name, const string *parm) - { - logentry(); - loginfo("Adding operation parameter, name: %s, type: string, value: %s", name.c_str(), (const char*)(*parm).c_str()); - parameters.insert(parameters.end(), Parameter((void*)parm, STRING, (string&) name)); - } - - void Operation::addParameter(const string& name, const DataObjectPtr *parm) - { - logentry(); - ostringstream os; - os << *parm; - loginfo("Adding operation parameter, name: %s, type: DataObject, value: %s", name.c_str(), os.str().c_str()); - parameters.insert(parameters.end(), Parameter((void*)new DataObjectPtr(*parm), DATAOBJECT, (string&) name)); - } - - Operation::Parameter::Parameter(void* val, Operation::ParameterType typ, const string& nam) - : value(val), type(typ), name(nam) - { - } - - // =========================================== - // setReturnValue - // =========================================== - void Operation::setReturnValue(const void *parm) - { - logentry(); - loginfo("Setting operation return value, type: void, value: %p", parm); - returnValue = Parameter((void*)parm, VOID_TYPE); - } - - void Operation::setReturnValue(const bool *parm) - { - logentry(); - loginfo("Setting operation return value, type: bool, value: %d", (bool)*parm); - returnValue = Parameter((void*)parm, BOOL); - } - - void Operation::setReturnValue(const short *parm) - { - logentry(); - loginfo("Setting operation return value, type: short, value: %h", (short)*parm); - returnValue = Parameter((void*)parm, SHORT); - } - - void Operation::setReturnValue(const int *parm) - { - logentry(); - loginfo("Setting operation return value, type: int, value: %d", (int)*parm); - returnValue = Parameter((void*)parm, INT); - } - - void Operation::setReturnValue(const long *parm) - { - logentry(); - loginfo("Setting operation return value, type: long, value: %l", (long)*parm); - returnValue = Parameter((void*)parm, LONG); - } - - void Operation::setReturnValue(const unsigned short *parm) - { - logentry(); - loginfo("Setting operation return value, type: unsigned short, value: %hu", (unsigned short)*parm); - returnValue = Parameter((void*)parm, USHORT); - } - - void Operation::setReturnValue(const unsigned int *parm) - { - logentry(); - loginfo("Setting operation return value, type: unsigned short, value: %u", (unsigned int)*parm); - returnValue = Parameter((void*)parm, UINT); - } - - void Operation::setReturnValue(const unsigned long *parm) - { - logentry(); - loginfo("Setting operation return value, type: unsigned long, value: %lu", (unsigned long)*parm); - returnValue = Parameter((void*)parm, ULONG); - } - - void Operation::setReturnValue(const float *parm) - { - logentry(); - loginfo("Setting operation return value, type: float, value: %f", (float)*parm); - returnValue = Parameter((void*)parm, FLOAT); - } - - void Operation::setReturnValue(const double *parm) - { - logentry(); - loginfo("Setting operation return value, type: double, value: %lf", (double)*parm); - returnValue = Parameter((void*)parm, DOUBLE); - } - - void Operation::setReturnValue(const long double *parm) - { - logentry(); - loginfo("Setting operation return value, type: long double, value: %Lf", (long double)*parm); - returnValue = Parameter((void*)parm, LONGDOUBLE); - } - - void Operation::setReturnValue(const char *parm) - { - logentry(); - loginfo("Setting operation return value, type: char, value: %d", (char)*parm); - returnValue = Parameter((void*)parm, CHAR); - } - - void Operation::setReturnValue(const char* *parm) - { - logentry(); - loginfo("Setting operation return value, type: char*, value: %s", (char*)*parm); - returnValue = Parameter((void*)parm, CHARS); - } - - void Operation::setReturnValue(const string *parm) - { - logentry(); - loginfo("Setting operation return value, type: string, value: %s", (*parm).c_str()); - returnValue = Parameter((void*)parm, STRING); - } - - void Operation::setReturnValue(const DataObjectPtr *parm) - { - logentry(); - ostringstream os; - os << *parm; - loginfo("Setting operation return value, type: DataObject, value: %s", os.str().c_str()); - returnValue = Parameter((void*)new DataObjectPtr(*parm), DATAOBJECT); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.h deleted file mode 100644 index 89cf0b63b7..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/Operation.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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_core_operation_h -#define tuscany_sca_core_operation_h - -#include <string> -#include <vector> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/export.h" - - -namespace tuscany -{ - namespace sca - { - /** - * Holds the details of a single invocation of a business method. - * This class is used to pass the parameters and operation name from the - * client to a service. It will also hold the return value on the - * return from the business method. - */ - class Operation - { - public: - /** - * Create a new operation. - * @param operationName The method name of the business method to be invoked. - * @param numParameters The number of parameters to be passed. - */ - SCA_API Operation(const char* operationName = 0); - - /** - * Destructor. - */ - SCA_API virtual ~Operation(); - - /** - * Copy constructor. - */ - SCA_API Operation(const Operation& op); - - /** - * Assignment operator. - */ - SCA_API Operation& operator=(const Operation& op); - - /** - * Return the operation name. - * @return The name of the operation. - */ - SCA_API const std::string& getName() const {return name;} - - - enum ParameterType - { - UNSET = 0, - VOID_TYPE, - BOOL, - SHORT, - INT, - LONG, - USHORT, - UINT, - ULONG, - FLOAT, - DOUBLE, - LONGDOUBLE, - CHARS, - CHAR, - STRING, - DATAOBJECT - }; - - class Parameter - { - public: - SCA_API Parameter(void* value = NULL, ParameterType type = VOID_TYPE, const std::string& name = ""); - SCA_API void* getValue() const {return value;} - SCA_API ParameterType getType() const {return type;} - SCA_API const std::string& getName() const {return name;} - SCA_API bool hasName() const {return (name.length() > 0);} - - private: - std::string name; - void* value; - ParameterType type; - }; - - /** - * Set a return value for the operation. - * @param retVal Pointer to the return value. - */ - SCA_API void setReturnValue(const void *retVal); - SCA_API void setReturnValue(const bool *retVal); - SCA_API void setReturnValue(const short *retVal); - SCA_API void setReturnValue(const int *retVal); - SCA_API void setReturnValue(const long *retVal); - SCA_API void setReturnValue(const unsigned short *retVal); - SCA_API void setReturnValue(const unsigned int *retVal); - SCA_API void setReturnValue(const unsigned long *retVal); - SCA_API void setReturnValue(const float *retVal); - SCA_API void setReturnValue(const double *retVal); - SCA_API void setReturnValue(const long double *retVal); - SCA_API void setReturnValue(const char *retVal); - SCA_API void setReturnValue(const char* *retVal); - SCA_API void setReturnValue(const std::string *retVal); - SCA_API void setReturnValue(const commonj::sdo::DataObjectPtr *retVal); - - /** - * Set a parameter on the operation. - * @param parm Pointer to the parameter to be passed. - */ - SCA_API void addParameter(const void *parm); - SCA_API void addParameter(const bool *parm); - SCA_API void addParameter(const short *parm); - SCA_API void addParameter(const int *parm); - SCA_API void addParameter(const long *parm); - SCA_API void addParameter(const unsigned short *parm); - SCA_API void addParameter(const unsigned int *parm); - SCA_API void addParameter(const unsigned long *parm); - SCA_API void addParameter(const float *parm); - SCA_API void addParameter(const double *parm); - SCA_API void addParameter(const long double *parm); - SCA_API void addParameter(const char *parm); - SCA_API void addParameter(const char* *parm); - SCA_API void addParameter(const std::string *parm); - SCA_API void addParameter(const commonj::sdo::DataObjectPtr *parm); - - /** - * Set a parameter on the operation. - * @param name The name of the parameter in the parameter list. - * @param parm Pointer to the parameter to be passed. - */ - SCA_API void addParameter(const std::string& name, const void *parm); - SCA_API void addParameter(const std::string& name, const bool *parm); - SCA_API void addParameter(const std::string& name, const short *parm); - SCA_API void addParameter(const std::string& name, const int *parm); - SCA_API void addParameter(const std::string& name, const long *parm); - SCA_API void addParameter(const std::string& name, const unsigned short *parm); - SCA_API void addParameter(const std::string& name, const unsigned int *parm); - SCA_API void addParameter(const std::string& name, const unsigned long *parm); - SCA_API void addParameter(const std::string& name, const float *parm); - SCA_API void addParameter(const std::string& name, const double *parm); - SCA_API void addParameter(const std::string& name, const long double *parm); - SCA_API void addParameter(const std::string& name, const char *parm); - SCA_API void addParameter(const std::string& name, const char* *parm); - SCA_API void addParameter(const std::string& name, const std::string *parm); - SCA_API void addParameter(const std::string& name, const commonj::sdo::DataObjectPtr *parm); - - SCA_API unsigned int getNParms() const {return parameters.size();} - - /** - * Get a parameter from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Pointer to the paramter at the given postion. Should be - * cast to the appropriate type. - */ - SCA_API const Parameter& getParameter(unsigned int pos) const; - - /** - * Get a parameter from the operation. - * @param name The name of the parameter in the parameter list. - * @return Pointer to the paramter with the given name. Should be - * cast to the appropriate type. - */ - SCA_API const Parameter& getParameter(const std::string& name) const; - - /** - * Get a parameter type from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Type of the parameter at the given position. - */ - SCA_API ParameterType getParameterType(unsigned int pos) const; - - /** - * Get a parameter type from the operation. - * @param name The name of the parameter in the parameter list. - * @return Type of the parameter with the given name. - */ - SCA_API ParameterType getParameterType(const std::string& name) const; - - /** - * Get a parameter name from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Name of the parameter at the given position. - */ - SCA_API const std::string& getParameterName(unsigned int pos) const; - - /** - * Get the parameter value from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Pointer to the value of the parameter at the given postion. Should be - * cast to the appropriate type. - */ - SCA_API void* getParameterValue(unsigned int pos) const; - - /** - * Get the parameter value from the operation. - * @param name The name of the parameter in the parameter list. - * @return Pointer to the value of the parameter with the given name. Should be - * cast to the appropriate type. - */ - SCA_API void* getParameterValue(const std::string& name) const; - - SCA_API ParameterType getReturnType() const {return returnValue.getType();} - SCA_API void* getReturnValue() const {return returnValue.getValue();} - - private: - /** - * Operation name (method name). - */ - std::string name; - - /** - * Array of parameters. - */ - typedef std::vector<Parameter> PARAMETER_VECTOR; - - PARAMETER_VECTOR parameters; - - Parameter returnValue; - - void clean(); - void copy(const Operation& op); - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_operation_h diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.cpp deleted file mode 100644 index b518eff673..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.cpp +++ /dev/null @@ -1,619 +0,0 @@ -/* - * 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$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#include <windows.h> -#else -#include "tuscany_sca_config.h" -#endif - -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/ModelLoader.h" -#include "tuscany/sca/util/File.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Component.h" - -using namespace std; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - /** - * Environment variable names - */ - static const char* TUSCANY_SCACPP = "TUSCANY_SCACPP"; - static const char* TUSCANY_SCACPP_SYSTEM_ROOT = "TUSCANY_SCACPP_SYSTEM_ROOT"; - static const char* TUSCANY_SCACPP_DEFAULT_COMPONENT = "TUSCANY_SCACPP_DEFAULT_COMPONENT"; - - static const char* TUSCANY_SCACPP_ROOT = "TUSCANY_SCACPP_ROOT"; - static const char* TUSCANY_SCACPP_COMPONENT = "TUSCANY_SCACPP_COMPONENT"; - static const char* TUSCANY_SCACPP_PATH = "TUSCANY_SCACPP_PATH"; - static const char* TUSCANY_SCACPP_BASE_URI = "TUSCANY_SCACPP_BASE_URI"; - - // Initialize statics - SCARuntime* SCARuntime::sharedRuntime = NULL; - Mutex SCARuntime::sharedRuntimeLock; - ThreadLocal SCARuntime::current; - - - // =================================================================== - // Constructor for the SCARuntime class. This will - // hold all the information about the current runtime. - // =================================================================== - SCARuntime::SCARuntime(const string& insRoot, - const string& sysRoot, const string& sysPath, - const string& base, const string& defName) - : system(0), - installRoot(insRoot), systemRoot(sysRoot), systemPath(sysPath), - defaultBaseURI(base), defaultComponentName(defName) - { - logentry(); - - if (installRoot == "") - { - // Get install dir from environment variable TUSCANY_SCACPP - const char* root = getenv(TUSCANY_SCACPP); - if (root != NULL) - { - installRoot = root; - } - else - { - string msg = TUSCANY_SCACPP; - msg += " environment variable not set"; - throwException(SystemConfigurationException, msg.c_str()); - } - } - loginfo("SCA runtime install root: %s", installRoot.c_str()); - - if (systemRoot == "") - { - // Get root from environment variable TUSCANY_SCACPP_ROOT - char* systemRootEnv = getenv(TUSCANY_SCACPP_ROOT); - if (systemRootEnv == 0) - { - // Get root from environment variable TUSCANY_SCACPP_SYSTEM_ROOT - systemRootEnv = getenv(TUSCANY_SCACPP_SYSTEM_ROOT); - } - if (systemRootEnv == 0) - { - string msg = TUSCANY_SCACPP_ROOT; - msg += " environment variable not set"; - throwException(SystemConfigurationException, msg.c_str()); - } - - systemRoot = systemRootEnv; - } - else - { - loginfo("System root: %s", systemRoot.c_str()); - } - - if (systemPath == "") - { - - // Get system path from environment variable TUSCANY_SCACPP_PATH - char* systemPathEnv = getenv(TUSCANY_SCACPP_PATH); - if (systemPathEnv != 0) - { - systemPath = systemPathEnv; - } - } - else - { - loginfo("System path: %s", systemPath.c_str()); - } - - if (defaultBaseURI == "") - { - - // Get default base URI from environment variable TUSCANY_SCACPP_BASE_URI - char* baseURI = getenv(TUSCANY_SCACPP_BASE_URI); - if (baseURI != 0) - { - defaultBaseURI = baseURI; - } - } - else - { - loginfo("Default base URI: %s", defaultBaseURI.c_str()); - } - - if (defaultComponentName == "") - { - const char* defComp = getenv(TUSCANY_SCACPP_COMPONENT); - if (!defComp) - { - defComp = getenv(TUSCANY_SCACPP_DEFAULT_COMPONENT); - } - if (defComp) - { - defaultComponentName = defComp; - } - } - loginfo("Default component: %s", defaultComponentName.c_str()); - - SCARuntime* currentRuntime = (SCARuntime*)current.getValue(); - current.setValue(this); - try - { - - // Load the runtime extensions - loadExtensions(); - - // Load the system composite - loadSystem(); - } - catch (...) - { - current.setValue(currentRuntime); - throw; - } - current.setValue(currentRuntime); - - // Find the default component - if (defaultComponentName != "") - { - Component* comp = system->findComponent(defaultComponentName); - if (!comp) - { - string message = "Component \'" + defaultComponentName + "\' not found"; - throwException(SystemConfigurationException, message.c_str()); - } - defaultComponent.setValue(comp); - } - - } - - // =================================================================== - // Destructor for the SCARuntime class. - // =================================================================== - SCARuntime::~SCARuntime() - { - logentry(); - - if (system) - { - delete system; - } - } - - // ========================================================== - // Returns the system configuration root - // ========================================================== - const string& SCARuntime::getSystemRoot() - { - return systemRoot; - } - - // ========================================================== - // Returns the system path - // ========================================================== - const string& SCARuntime::getSystemPath() - { - return systemPath; - } - - // ========================================================== - // Returns the default component name - // ========================================================== - const string& SCARuntime::getDefaultComponentName() - { - return defaultComponentName ; - } - - // ========================================================== - // Returns the default base URI - // ========================================================== - const string& SCARuntime::getDefaultBaseURI() - { - return defaultBaseURI; - } - - // ========================================================== - // Returns the install root - // ========================================================== - const string& SCARuntime::getInstallRoot() - { - return installRoot; - } - - // ============================================================= - // Get the runtime associated with the current thread. - // ============================================================= - SCARuntime* SCARuntime::getCurrentRuntime() - { - logentry(); - - SCARuntime* runtime = (SCARuntime*)current.getValue(); - if (runtime == NULL) - { - runtime = getSharedRuntime(); - if (runtime != NULL) - { - setCurrentRuntime(runtime); - } - else - { - runtime = new SCARuntime(); - setCurrentRuntime(runtime); - } - } - loginfo("Runtime: %p", runtime); - return runtime; - } - - // ============================================================= - // Set the runtime associated with the current thread. - // ============================================================= - void SCARuntime::setCurrentRuntime(SCARuntime* runtime) - { - logentry(); - - loginfo("Runtime: %p", runtime); - current.setValue(runtime); - } - - // ============================================================= - // Get the runtime associated with the current process. - // ============================================================= - SCARuntime* SCARuntime::getSharedRuntime() - { - logentry(); - - sharedRuntimeLock.lock(); - SCARuntime* runtime = sharedRuntime; - sharedRuntimeLock.unlock(); - - return runtime; - } - - // ============================================================= - // Initialize the runtime associated with the current process. - // ============================================================= - SCARuntime* SCARuntime::initializeSharedRuntime(const string& installRoot, const string& systemRoot, - const string& systemPath, const string& baseURI, const string& defaultComponentName) - { - logentry(); - - SCARuntime* runtime; - - sharedRuntimeLock.lock(); - try - { - if (sharedRuntime == NULL) - { - sharedRuntime = new SCARuntime(installRoot, systemRoot, systemPath, baseURI, defaultComponentName); - } - else - { - if (installRoot.size() != 0 && sharedRuntime->getInstallRoot() != installRoot) - { - string msg = "Cannot reconfigure runtime installation directory: " + string(installRoot); - throwException(SystemConfigurationException, msg.c_str()); - } - if (systemRoot.size() != 0 && sharedRuntime->getSystemRoot() != systemRoot) - { - string msg = "Cannot reconfigure SCA system root: " + string(systemRoot); - throwException(SystemConfigurationException, msg.c_str()); - } - if (systemPath.size() != 0 && sharedRuntime->getSystemPath() != systemPath) - { - string msg = "Cannot reconfigure SCA system path: " + string(systemPath); - throwException(SystemConfigurationException, msg.c_str()); - } - if (baseURI.size() != 0 && sharedRuntime->getDefaultBaseURI() != baseURI) - { - string msg = "Cannot reconfigure SCA system URI: " + string(baseURI); - throwException(SystemConfigurationException, msg.c_str()); - } - if (defaultComponentName.size() != 0 && sharedRuntime->getDefaultComponentName() != defaultComponentName) - { - string msg = "Cannot reconfigure main SCA component: " + string(baseURI); - throwException(SystemConfigurationException, msg.c_str()); - } - } - - runtime = sharedRuntime; - } - catch (...) - { - sharedRuntimeLock.unlock(); - throw; - } - sharedRuntimeLock.unlock(); - - return runtime; - } - - // ====================================== - // Load the system composite - // ====================================== - void SCARuntime::loadSystem() - { - logentry(); - - system = new Composite("tuscany/sca/system", ""); - ModelLoader loader(this, system); - loader.load(systemRoot, systemPath); - } - - // ====================================== - // Load up extensions to the runtime - // ====================================== - void SCARuntime::loadExtensions() - { - logentry(); - - string extensionsRoot = installRoot + "/extensions"; - -#if defined(WIN32) || defined (_WINDOWS) - string libraryExtension = ".dll"; -#else -#if defined(IS_DARWIN) - string libraryExtension = ".dylib"; -#else - string libraryExtension = ".so"; -#endif -#endif - string pattern = "*" + libraryExtension; - - // Get list of all directories named "module" - Files extensionModules(extensionsRoot, "module", true, true); - for (unsigned int emI=0; emI < extensionModules.size(); emI++) - { - string extensionRoot = extensionModules[emI].getDirectory().c_str(); - extensionRoot += "/module"; - loginfo("Loading extension module: %s", extensionRoot.c_str() ); - - Files files(extensionRoot, pattern, true); - for (unsigned int i=0; i < files.size(); i++) - { - try - { - string filename = files[i].getFileName(); - Library lib = Library( files[i].getDirectory() + "/" + filename); - - // Determine the name of the initialize method - // 1) strip the .dll/.so/.dylib suffix - // 2) for non-Windows strip any lib prefix - string initializeMethod; - #if defined(WIN32) || defined (_WINDOWS) - #else - if (filename.substr(0,3) == "lib") - { - initializeMethod = filename.substr(3, filename.size()-libraryExtension.size() - 3); - } - else - #endif - { - initializeMethod = filename.substr(0, filename.size()-libraryExtension.size()); - } - initializeMethod += "_initialize"; - TUSCANY_IMPLEMENTATION_EXTENSION_INITIALIZE extension = - (TUSCANY_IMPLEMENTATION_EXTENSION_INITIALIZE)lib.getSymbol(initializeMethod); - if (extension) - { - extension(); - extensionsList.push_back(lib); - } - } - catch (TuscanyRuntimeException& ex) - { - logwarning("Failed to load extension library: %s: %s: %s", - files[i].getFileName().c_str(), ex.getEClassName(), ex.getMessageText()); - } - } - } - } - - - // ====================================== - // register an interfaceExtension - // ====================================== - void SCARuntime::registerInterfaceExtension(InterfaceExtension* extension) - { - logentry(); - if (extension) - { - loginfo("Registering interface: %s", extension->getExtensionTypeQName().c_str()); - interfaceExtensions[extension->getExtensionTypeQName()] = extension; - } - } - - // ====================================== - // find an InterfaceExtension - // ====================================== - InterfaceExtension* SCARuntime::getInterfaceExtension(const string& extensionTypeQName) - { - return interfaceExtensions[extensionTypeQName]; - } - - // ====================================== - // register an implementationExtension - // ====================================== - void SCARuntime::registerImplementationExtension(ImplementationExtension* extension) - { - logentry(); - if (extension) - { - loginfo("Registering implementation: %s", extension->getExtensionTypeQName().c_str()); - implementationExtensions[extension->getExtensionTypeQName()] = extension; - } - } - - // ====================================== - // find an implementationExtension - // ====================================== - ImplementationExtension* SCARuntime::getImplementationExtension(const string& extensionTypeQName) - { - return implementationExtensions[extensionTypeQName]; - } - - // ====================================== - // register a referenceBindingExtension - // ====================================== - void SCARuntime::registerReferenceBindingExtension(ReferenceBindingExtension* extension) - { - logentry(); - if (extension) - { - loginfo("Registering reference binding: %s", extension->getExtensionTypeQName().c_str()); - referenceBindingExtensions[extension->getExtensionTypeQName()] = extension; - } - } - - // ====================================== - // find a referenceBindingExtension - // ====================================== - ReferenceBindingExtension* SCARuntime::getReferenceBindingExtension(const string& extensionTypeQName) - { - return referenceBindingExtensions[extensionTypeQName]; - } - - // ====================================== - // register a serviceBindingExtension - // ====================================== - void SCARuntime::registerServiceBindingExtension(ServiceBindingExtension* extension) - { - logentry(); - if (extension) - { - loginfo("Registering service binding: %s", extension->getExtensionTypeQName().c_str()); - serviceBindingExtensions[extension->getExtensionTypeQName()] = extension; - } - } - - // ====================================== - // find a serviceBindingExtension - // ====================================== - ServiceBindingExtension* SCARuntime::getServiceBindingExtension(const string& extensionTypeQName) - { - return serviceBindingExtensions[extensionTypeQName]; - } - - - // =================================== - // Return the top of the runtime model - // =================================== - Composite* SCARuntime::getSystem() - { - logentry(); - - return system; - } - - - // =================================================== - // setCurrentComponent: push component for this thread - // =================================================== - void SCARuntime::setCurrentComponent(Component* component) - { - logentry(); - - COMPONENT_STACK* compStack = (COMPONENT_STACK*)componentStack.getValue(); - if (compStack == NULL) - { - compStack = new COMPONENT_STACK(); - componentStack.setValue(compStack); - } - compStack->push(component); - } - - // ==================================================== - // unsetCurrentComponent: pop component for this thread - // ==================================================== - Component* SCARuntime::unsetCurrentComponent() - { - logentry(); - - COMPONENT_STACK* compStack = (COMPONENT_STACK*)componentStack.getValue(); - if (compStack != NULL) - { - if (compStack->size() > 0) - { - Component* component = compStack->top(); - compStack->pop(); - return component; - } - } - - return NULL; - } - - // ============================================================= - // getCurrentComponent: return current component for this thread - // ============================================================= - Component* SCARuntime::getCurrentComponent() - { - logentry(); - - COMPONENT_STACK* compStack = (COMPONENT_STACK*)componentStack.getValue(); - if (compStack != NULL) - { - if (compStack->size() > 0) - { - return compStack->top(); - } - } - - return NULL; - } - - // =========================================== - // getDefaultComponent: return the default composite component - // =========================================== - Component* SCARuntime::getDefaultComponent() - { - logentry(); - - Component* comp = (Component*)defaultComponent.getValue(); - if (comp == NULL && defaultComponentName != "") - { - comp = system->findComponent(defaultComponentName); - if (!comp) - { - string message = "Component \'" + defaultComponentName + "\' not found"; - throwException(SystemConfigurationException, message.c_str()); - } - defaultComponent.setValue(comp); - } - return comp; - } - - // =========================================== - // Set the default composite component - // =========================================== - void SCARuntime::setDefaultComponent(Component* component) - { - logentry(); - - return defaultComponent.setValue(component); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.h deleted file mode 100644 index ff93bd5005..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/SCARuntime.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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_core_scaruntime_h -#define tuscany_sca_core_scaruntime_h - -#if defined(WIN32) || defined (_WINDOWS) -#include <windows.h> -#else -#include <pthread.h> -#endif - -#include <stack> -#include <string> -#include <map> -#include <list> - -#include "tuscany/sca/export.h" -#include "tuscany/sca/extension/InterfaceExtension.h" -#include "tuscany/sca/extension/ImplementationExtension.h" -#include "tuscany/sca/extension/ReferenceBindingExtension.h" -#include "tuscany/sca/extension/ServiceBindingExtension.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/util/ThreadLocal.h" -#include "tuscany/sca/util/Mutex.h" - - -namespace tuscany -{ - namespace sca - { - - /** - * Represents an executing SCA runtime. - */ - class SCARuntime { - public: - - /** - * Constructor - */ - SCA_API SCARuntime(const std::string& installRoot = "", - const std::string& systemRoot = "", const std::string& systemPath = "", - const std::string& baseURI = "", const std::string& defaultComponentName = ""); - - /** - * Destructor - */ - SCA_API virtual ~SCARuntime(); - - /** - * Get the runtime associated with the current thread. - * @return The runtime associated with the current thread. - */ - SCA_API static SCARuntime* getCurrentRuntime(); - - /** - * Get the runtime associated with the current thread. - * @return The runtime associated with the current thread. - */ - SCA_API static void setCurrentRuntime(SCARuntime* runtime); - - /** - * Get the runtime associated with the current process. - * @return The runtime associated with the current process. - */ - SCA_API static SCARuntime* getSharedRuntime(); - - /** - * Initialize the runtime associated with the current process. - * @return The runtime associated with the current process. - */ - SCA_API static SCARuntime* initializeSharedRuntime(const std::string& installRoot = "", - const std::string& systemRoot = "", const std::string& systemPath = "", - const std::string& baseURI = "", const std::string& defaultComponentName = ""); - - /** - * Returns the directory in which the Tuscany runtime has been installed. - */ - SCA_API const std::string& getInstallRoot(); - - /** - * Returns the system root - */ - SCA_API const std::string& getSystemRoot(); - - /** - * Returns the search path for composites. - */ - SCA_API const std::string& getSystemPath(); - - /** - * Returns the default component name. - */ - SCA_API const std::string& getDefaultComponentName(); - - /** - * Returns the default base URI for the system - */ - SCA_API const std::string& getDefaultBaseURI(); - - /** - * Set the current component for the current thread. - * @param component The current component. - */ - SCA_API void setCurrentComponent(tuscany::sca::model::Component* component); - - /** - * Remove the current component from this thread, and return - * to the previous component (if there was one). - * @return The previous component. - */ - SCA_API tuscany::sca::model::Component* unsetCurrentComponent(); - - /** - * Get a pointer to the configured SCA system which this - * SCA runtime represents. - * The rest of the SCA configuration can be navigated from - * the System. - * @return The configured SCA system. - */ - SCA_API tuscany::sca::model::Composite* getSystem(); - - /** - * Return the current component for this thread. - * @return The current component for this thread. - */ - SCA_API tuscany::sca::model::Component* getCurrentComponent(); - - /** - * Get the default component set for the current thread. - * @return The default composite. - */ - SCA_API tuscany::sca::model::Component* getDefaultComponent(); - - /** - * Set the default component for the current thread. - * @return The default component. - */ - SCA_API void setDefaultComponent(tuscany::sca::model::Component* component); - - /** - * Register an implementation extension - */ - SCA_API void registerImplementationExtension(ImplementationExtension* extension); - - /** - * Returns the implementation extension associated with - * the specified qname - */ - SCA_API ImplementationExtension* getImplementationExtension(const std::string& typeQname); - - /** - * Register a reference binding extension - */ - SCA_API void registerReferenceBindingExtension(ReferenceBindingExtension* extension); - - /** - * Returns the reference binding extension associated with - * the specified qname - */ - SCA_API ReferenceBindingExtension* getReferenceBindingExtension(const std::string& typeQname); - - /** - * Register a service binding extension - */ - SCA_API void registerServiceBindingExtension(ServiceBindingExtension* extension); - - /** - * Returns the service binding extension associated with - * the specified qname - */ - SCA_API ServiceBindingExtension* getServiceBindingExtension(const std::string& typeQname); - - /** - * Register an interface extension - */ - SCA_API void registerInterfaceExtension(InterfaceExtension* extension); - - /** - * Returns the interface extension associated with - * the specified qname - */ - SCA_API InterfaceExtension* getInterfaceExtension(const std::string& typeQname); - - private: - - /** - * The runtime associated with the current thread. - */ - static tuscany::sca::util::ThreadLocal current; - - /** - * The runtime shared by all threads of the current process. - */ - static tuscany::sca::util::Mutex sharedRuntimeLock; - static SCARuntime* sharedRuntime; - - /** - * Pointer to the top of the runtime model. - */ - tuscany::sca::model::Composite* system; - - /** - * The installed path of the Tuscany runtime. - */ - std::string installRoot; - - /** - * The path to the system configuration - */ - std::string systemRoot; - - /** - * The search path for composites. - */ - std::string systemPath; - - /** - * The default base URI. - */ - std::string defaultBaseURI; - - /** - * The default CompositeComponent name. - */ - std::string defaultComponentName; - - /** - * Load the SCA configuration from the scdl files (sca.composite, - * *.fragment, etc). - * This will create the runtime model from which the SCA runtime - * will operate. - */ - void loadSystem(); - - /** - * Component stack for the current thread. - */ - typedef std::stack<tuscany::sca::model::Component*> COMPONENT_STACK; - tuscany::sca::util::ThreadLocal componentStack; - - /** - * The default component for the current thread. - */ - tuscany::sca::util::ThreadLocal defaultComponent; - - /** - * Runtime Extensions - */ - typedef std::map<std::string, ImplementationExtension*> IMPLEMENTATION_EXTENSIONS_MAP; - IMPLEMENTATION_EXTENSIONS_MAP implementationExtensions; - - typedef std::map<std::string, ReferenceBindingExtension*> REFERENCE_BINDING_EXTENSIONS_MAP; - REFERENCE_BINDING_EXTENSIONS_MAP referenceBindingExtensions; - - typedef std::map<std::string, ServiceBindingExtension*> SERVICE_BINDING_EXTENSIONS_MAP; - SERVICE_BINDING_EXTENSIONS_MAP serviceBindingExtensions; - - typedef std::map<std::string, InterfaceExtension*> INTERFACE_EXTENSIONS_MAP; - INTERFACE_EXTENSIONS_MAP interfaceExtensions; - - void loadExtensions(); - - typedef std::list<tuscany::sca::util::Library> EXTENSIONS_LIST; - EXTENSIONS_LIST extensionsList; - - }; - - } // End namespace sca -} // End namespace tuscany - -typedef void (* TUSCANY_IMPLEMENTATION_EXTENSION_INITIALIZE) (); - -#endif // tuscany_sca_core_scaruntime_h diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp deleted file mode 100644 index c54d7648e3..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - // ============================ - // Constructor: Create a proxy - // ============================ - ServiceProxy::ServiceProxy(Reference* reference) - : reference(reference) - { - logentry(); - } - - // ========== - // Destructor - // ========== - ServiceProxy::~ServiceProxy() - { - logentry(); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.h deleted file mode 100644 index f1a0309be1..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceProxy.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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_core_serviceproxy_h -#define tuscany_sca_core_serviceproxy_h - -#include "tuscany/sca/export.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" - - -namespace tuscany -{ - namespace sca - { - - /** - * Holds a proxy for a given component and reference. - * The proxy which is held inside a ServiceProxy will be specific to the component - * and reference and will have been code generated and be contained in a dll - * created by a developer of an SCA application. - */ - class SCA_API ServiceProxy - { - public: - /** - * Create a new service proxy for a reference. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param reference The reference on the source component. - * @param target The wrapper of the service which is wired to this reference. - */ - ServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Destructor. - */ - virtual ~ServiceProxy(); - - /** - * Returns the reference represented by this proxy. - * @return The Reference represented by this proxy. - */ - tuscany::sca::model::Reference* getReference() const { return reference; }; - - private: - - /** - * The reference represented by this proxy. - */ - tuscany::sca::model::Reference* reference; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_serviceproxy_h diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp deleted file mode 100644 index 17666a5bb7..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/util/Logging.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - - // =========== - // Constructor - // =========== - ServiceWrapper::ServiceWrapper(Service* service) - : service(service) - { - logentry(); - } - - // ========== - // Destructor - // ========== - ServiceWrapper::~ServiceWrapper() - { - logentry(); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.h deleted file mode 100644 index 6a44c57675..0000000000 --- a/tags/native-sca-1.0.incubating-M3-RC4/runtime/core/src/tuscany/sca/core/ServiceWrapper.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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_core_servicewrapper_h -#define tuscany_sca_core_servicewrapper_h - -#include "tuscany/sca/export.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - - /** - * An abstract class that wraps a component implementation or an external - * service. - */ - class SCA_API ServiceWrapper - { - public: - /** - * Constructor. - * @param target The service wrapper wraps the target of a wire. - */ - ServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~ServiceWrapper(); - - /** - * Get the service represented by this wrapper. - * @return The service represented by this wrapper. - */ - tuscany::sca::model::Service* getService() const { return service; } - - /** - * All business method calls on the target service are performed through - * this invoke method. - * @param operation The details of the method, paramaters and return value for the - * business method to be called on the target service. - */ - virtual void invoke(Operation& operation) = 0; - - private: - /** - * The target represented by this wrapper. - */ - tuscany::sca::model::Service* service; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_servicewrapper_h |