diff options
Diffstat (limited to 'tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core')
10 files changed, 0 insertions, 1788 deletions
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.cpp deleted file mode 100644 index aa030a1ce7..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.cpp +++ /dev/null @@ -1,372 +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/Operation.h" -#include <stdarg.h> - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" - - -namespace tuscany -{ - namespace sca - { - // =========== - // Constructor - // =========== - Operation::Operation(const char* operationName) - { - LOGENTRY(1,"Operation::constructor"); - - if (operationName != 0) - { - name = operationName; - } - - LOGEXIT(1,"Operation::constructor"); - } - - // ========== - // Destructor - // ========== - Operation::~Operation() - { - LOGENTRY(1,"Operation::destructor"); - clean(); - LOGEXIT(1,"Operation::destructor"); - } - - // ========== - // Copy Constructor - // ========== - Operation::Operation(const Operation& op) - { - LOGENTRY(1,"Operation::copy contructor"); - copy(op); - LOGEXIT(1,"Operation::copy contructor"); - } - - // ========== - // operator= - // ========== - Operation& Operation::operator=(const Operation& op) - { - LOGENTRY(1,"Operation::operator="); - if (&op != this) - { - copy(op); - } - LOGEXIT(1,"Operation::operator="); - return *this; - } - - // ========== - // Clean - // ========== - void Operation::clean() - { - LOGENTRY(1,"Operation::clean"); - 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(); - } - - LOGEXIT(1,"Operation::clean"); - } - - // ========== - // Copy - // ========== - void Operation::copy(const Operation& op) - { - LOGENTRY(1,"Operation::copy"); - 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; - } - - LOGEXIT(1,"Operation::copy"); - } - - // ============================================== - // getParameter: return parameter at position pos - // ============================================== - void* Operation::getParameterValue(unsigned int pos) const - { - if (pos < parameters.size()) - { - return parameters[pos].getValue(); - } - - return 0; - } - - // ============================================== - // getParameter: return of parameter - // ============================================== - const Operation::Parameter& Operation::getParameter(unsigned int pos) const - { - if (pos < parameters.size()) - { - return parameters[pos]; - } - - throw "index out of range"; - } - - - // ============================================== - // getParameterType: return type of parameter - // ============================================== - Operation::ParameterType Operation::getParameterType(unsigned int pos) const - { - if (pos < parameters.size()) - { - return parameters[pos].getType(); - } - - return VOID_TYPE; - } - - // =========================================== - // addParameter: set parameter at position pos - // =========================================== - void Operation::addParameter(const void *parm) - { - LOGINFO(4, "Operation::addParameter(void*)"); - parameters.insert(parameters.end(), Parameter((void*)parm, VOID_TYPE)); - } - - void Operation::addParameter(const bool *parm) - { - LOGINFO(4, "Operation::addParameter(bool)"); - parameters.insert(parameters.end(), Parameter((void*)parm, BOOL)); - } - - void Operation::addParameter(const short *parm) - { - LOGINFO(4, "Operation::addParameter(short)"); - parameters.insert(parameters.end(), Parameter((void*)parm, SHORT)); - } - - void Operation::addParameter(const int *parm) - { - LOGINFO(4, "Operation::addParameter(int)"); - parameters.insert(parameters.end(), Parameter((void*)parm, INT)); - } - - void Operation::addParameter(const long *parm) - { - LOGINFO(4, "Operation::addParameter(long)"); - parameters.insert(parameters.end(), Parameter((void*)parm, LONG)); - } - - void Operation::addParameter(const unsigned short *parm) - { - LOGINFO(4, "Operation::addParameter(unsigned short)"); - parameters.insert(parameters.end(), Parameter((void*)parm, USHORT)); - } - - void Operation::addParameter(const unsigned int *parm) - { - LOGINFO(4, "Operation::addParameter(unsigned int)"); - parameters.insert(parameters.end(), Parameter((void*)parm, UINT)); - } - - void Operation::addParameter(const unsigned long *parm) - { - LOGINFO(4, "Operation::addParameter(unsigned long)"); - parameters.insert(parameters.end(), Parameter((void*)parm, ULONG)); - } - - void Operation::addParameter(const float *parm) - { - LOGINFO(4, "Operation::addParameter(float)"); - parameters.insert(parameters.end(), Parameter((void*)parm, FLOAT)); - } - - void Operation::addParameter(const double *parm) - { - LOGINFO(4, "Operation::addParameter(double)"); - parameters.insert(parameters.end(), Parameter((void*)parm, DOUBLE)); - } - - void Operation::addParameter(const long double *parm) - { - LOGINFO(4, "Operation::addParameter(long double)"); - parameters.insert(parameters.end(), Parameter((void*)parm, LONGDOUBLE)); - } - - void Operation::addParameter(const char* *parm) - { - LOGINFO(4, "Operation::addParameter(char*)"); - parameters.insert(parameters.end(), Parameter((void*)parm, CHARS)); - } - - void Operation::addParameter(const char *parm) - { - LOGINFO(4, "Operation::addParameter(char)"); - parameters.insert(parameters.end(), Parameter((void*)parm, CHAR)); - } - - void Operation::addParameter(const string *parm) - { - LOGINFO(4, "Operation::addParameter(string)"); - parameters.insert(parameters.end(), Parameter((void*)parm, STRING)); - } - - void Operation::addParameter(const DataObjectPtr *parm) - { - LOGINFO(4, "Operation::addParameter(DataObjectPtr)"); - parameters.insert(parameters.end(), Parameter((void*)new DataObjectPtr(*parm), DATAOBJECT)); - } - - Operation::Parameter::Parameter(void* val, Operation::ParameterType typ) - : value(val), type(typ) - { - } - - // =========================================== - // setReturnValue - // =========================================== - void Operation::setReturnValue(const void *parm) - { - LOGINFO(4, "Operation::setReturnValue(void*)"); - returnValue = Parameter((void*)parm, VOID_TYPE); - } - - void Operation::setReturnValue(const bool *parm) - { - LOGINFO(4, "Operation::setReturnValue(bool*)"); - returnValue = Parameter((void*)parm, BOOL); - } - - void Operation::setReturnValue(const short *parm) - { - LOGINFO(4, "Operation::setReturnValue(short*)"); - returnValue = Parameter((void*)parm, SHORT); - } - - void Operation::setReturnValue(const int *parm) - { - LOGINFO(4, "Operation::setReturnValue(int)"); - returnValue = Parameter((void*)parm, INT); - } - - void Operation::setReturnValue(const long *parm) - { - LOGINFO(4, "Operation::setReturnValue(long*)"); - returnValue = Parameter((void*)parm, LONG); - } - - void Operation::setReturnValue(const unsigned short *parm) - { - LOGINFO(4, "Operation::setReturnValue(unsigned short*)"); - returnValue = Parameter((void*)parm, USHORT); - } - - void Operation::setReturnValue(const unsigned int *parm) - { - LOGINFO(4, "Operation::setReturnValue(unsigned int)"); - returnValue = Parameter((void*)parm, UINT); - } - - void Operation::setReturnValue(const unsigned long *parm) - { - LOGINFO(4, "Operation::setReturnValue(unsigned long*)"); - returnValue = Parameter((void*)parm, ULONG); - } - - void Operation::setReturnValue(const float *parm) - { - LOGINFO(4, "Operation::setReturnValue(float*)"); - returnValue = Parameter((void*)parm, FLOAT); - } - - void Operation::setReturnValue(const double *parm) - { - LOGINFO(4, "Operation::setReturnValue(double*)"); - returnValue = Parameter((void*)parm, DOUBLE); - } - - void Operation::setReturnValue(const long double *parm) - { - LOGINFO(4, "Operation::setReturnValue(long double*)"); - returnValue = Parameter((void*)parm, LONGDOUBLE); - } - - void Operation::setReturnValue(const char *parm) - { - LOGINFO(4, "Operation::setReturnValue(char)"); - returnValue = Parameter((void*)parm, CHAR); - } - - void Operation::setReturnValue(const char* *parm) - { - LOGINFO(4, "Operation::setReturnValue(char*)"); - returnValue = Parameter((void*)parm, CHARS); - } - - void Operation::setReturnValue(const string *parm) - { - LOGINFO(4, "Operation::setReturnValue(string*)"); - returnValue = Parameter((void*)parm, STRING); - } - - void Operation::setReturnValue(const DataObjectPtr *parm) - { - LOGINFO(4, "Operation::setReturnValue(DataObjectPtr*)"); - returnValue = Parameter((void*)new DataObjectPtr(*parm), DATAOBJECT); - } - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.h deleted file mode 100644 index 84338ae9e8..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/Operation.h +++ /dev/null @@ -1,198 +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 "tuscany/sca/export.h" -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; -#include <string> -using std::string; -#include <vector> -using std::vector; - -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 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); - SCA_API void* getValue() const {return value;} - SCA_API ParameterType getType() const {return type;} - - private: - 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 string *retVal); - SCA_API void setReturnValue(const DataObjectPtr *retVal); - - /** - * Set a parameter on the operation. - * @param pos The position of the parameter in the parameter list. - * @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 string *parm); - SCA_API void addParameter(const 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 type 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 ParameterType getParameterType(unsigned int pos) const; - - /** - * 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 void* getParameterValue(unsigned int pos) const; - - SCA_API ParameterType getReturnType() const {return returnValue.getType();} - SCA_API void* getReturnValue() const {return returnValue.getValue();} - - private: - /** - * Operation name (method name). - */ - 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/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp deleted file mode 100644 index 49ec646bb1..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp +++ /dev/null @@ -1,487 +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/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/util/Exceptions.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Component.h" - -#if defined(WIN32) || defined (_WINDOWS) -#include <windows.h> -#endif - -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"; - - // ========================================================== - // Initialize static class member to not pointing at anything - // ========================================================== - SCARuntime* SCARuntime::instance = 0; - string SCARuntime::systemRoot = ""; - string SCARuntime::systemPath = ""; - string SCARuntime::defaultComponentName = ""; - - - // ========================================================== - // Set the system configuration root - // ========================================================== - void SCARuntime::setSystemRoot(const string& root) - { - LOGENTRY(1, "SCARuntime::setSystemRoot"); - systemRoot = root; - LOGINFO_1(3, "SCARuntime::setSystemRoot - set to %s", root.c_str()); - LOGEXIT(1, "SCARuntime::setSystemRoot"); - } - - // ========================================================== - // Set the system configuration root - // ========================================================== - void SCARuntime::setSystemPath(const string& path) - { - LOGENTRY(1, "SCARuntime::setSystemPath"); - systemPath = path; - LOGINFO_1(3, "SCARuntime::setSystemPath - set to %s", path.c_str()); - LOGEXIT(1, "SCARuntime::setSystemPath"); - } - - // ========================================================== - // Set the default component name - // ========================================================== - void SCARuntime::setDefaultComponentName(const string& componentName) - { - LOGENTRY(1, "SCARuntime::setDefaultComponentName"); - defaultComponentName = componentName; - LOGINFO_1(3, "SCARuntime::setDefaultComponentName - set to %s", componentName.c_str()); - LOGEXIT(1, "SCARuntime::setDefaultComponentName"); - } - - // =================================================================== - // Constructor for the SCARuntime class. This will be a singleton that - // holds all the information about the current runtime. - // =================================================================== - SCARuntime::SCARuntime() : system(0), defaultComponent(0) - { - LOGENTRY(1, "SCARuntime::constructor"); - - // Locate the SCA install root - char* root = 0; - root = getenv(TUSCANY_SCACPP); - if (root == 0) - { - string msg = TUSCANY_SCACPP; - msg += " environment variable not set"; - throw SystemConfigurationException(msg.c_str()); - } - else - { - SCARoot = root; - } - - LOGEXIT(1, "SCARuntime::constructor"); - } - - // =================================================================== - // Destructor for the SCARuntime class. - // =================================================================== - SCARuntime::~SCARuntime() - { - LOGENTRY(1, "SCARuntime::destructor"); - - if (system) - { - delete system; - } - - LOGEXIT(1, "SCARuntime::destructor"); - } - - // ============================================================= - // Get the instance of the runtime, creates it if does not exist - // static method - // ============================================================= - SCARuntime* SCARuntime::getInstance() - { - LOGENTRY(1, "SCARuntime::getInstance"); - - if (instance == NULL) - { - instance = new SCARuntime(); - - // load extensions - instance->loadExtensions(); - - 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"; - throw SystemConfigurationException(msg.c_str()); - } - - systemRoot = systemRootEnv; - } - if (systemPath == "") - { - - // Get system path from environment variable TUSCANY_SCACPP_PATH - char* systemPathEnv = getenv(TUSCANY_SCACPP_PATH); - if (systemPathEnv == 0) - { - // Make the path optional for now -// string msg = TUSCANY_SCACPP_PATH; -// msg += " environment variable not set"; -// throw SystemConfigurationException(msg.c_str()); - } - else - { - systemPath = systemPathEnv; - } - } - } - - LOGEXIT(1, "SCARuntime::getInstance"); - - return instance; - - } - - - // ============================================================= - // Release the instance of the runtime. - // ============================================================= - void SCARuntime::releaseInstance() - { - LOGENTRY(1, "SCARuntime::releaseInstance"); - - if (instance) - { - delete instance; - instance = 0; - systemRoot = ""; - systemPath = ""; - defaultComponentName = ""; - } - - LOGEXIT(1, "SCARuntime::releaseInstance"); - } - - // ====================================== - // Load up all the details of the runtime - // ====================================== - void SCARuntime::load() - { - LOGENTRY(1, "SCARuntime::load"); - - LOGINFO_1(2,"configuration root: %s", systemRoot.c_str()); - LOGINFO_1(2,"configuration path: %s", systemPath.c_str()); - - // Load the system composite - ModelLoader loader(system); - loader.load(systemRoot, systemPath); - - LOGEXIT(1, "SCARuntime::load"); - } - - - // ====================================== - // Load up extensions to the runtime - // ====================================== - void SCARuntime::loadExtensions() - { - LOGENTRY(1, "SCARuntime::loadExtensions"); - - string extensionsRoot = SCARoot + "/extensions"; - -#if defined(WIN32) || defined (_WINDOWS) - string pattern = "*.dll"; -#else - string pattern = "*.so"; -#endif - - Files files(extensionsRoot, pattern, true); - for (unsigned int i=0; i < files.size(); i++) - { - try - { - Library lib = Library( files[i].getDirectory() + "/" + files[i].getFileName()); - extensionsList.push_back(lib); - TUSCANY_IMPLEMENTATION_EXTENSION_INITIALIZE extension = - (TUSCANY_IMPLEMENTATION_EXTENSION_INITIALIZE)lib.getSymbol("tuscany_sca_extension_initialize"); - if (extension) - { - extension(); - } - } - catch (TuscanyRuntimeException& ex) - { - LOGERROR_3(0, "SCARuntime::loadExtensions failed to load extension library: %s: %s: %s", - files[i].getFileName().c_str(), ex.getEClassName(), ex.getMessageText()); - } - } - - LOGEXIT(1, "SCARuntime::loadExtensions"); - } - - - // ====================================== - // register an interfaceExtension - // ====================================== - void SCARuntime::registerInterfaceExtension(InterfaceExtension* extension) - { - LOGENTRY(1, "SCARuntime::registerInterfaceExtension"); - if (extension) - { - interfaceExtensions[extension->getExtensionTypeQName()] = extension; - } - LOGEXIT(1, "SCARuntime::registerInterfaceExtension"); - } - - // ====================================== - // find an InterfaceExtension - // ====================================== - InterfaceExtension* SCARuntime::getInterfaceExtension(const string& extensionTypeQName) - { - return interfaceExtensions[extensionTypeQName]; - } - - // ====================================== - // register an implementationExtension - // ====================================== - void SCARuntime::registerImplementationExtension(ImplementationExtension* extension) - { - LOGENTRY(1, "SCARuntime::registerImplementationExtension"); - if (extension) - { - implementationExtensions[extension->getExtensionTypeQName()] = extension; - } - LOGEXIT(1, "SCARuntime::registerImplementationExtension"); - } - - // ====================================== - // find an implementationExtension - // ====================================== - ImplementationExtension* SCARuntime::getImplementationExtension(const string& extensionTypeQName) - { - return implementationExtensions[extensionTypeQName]; - } - - // ====================================== - // register a referenceBindingExtension - // ====================================== - void SCARuntime::registerReferenceBindingExtension(ReferenceBindingExtension* extension) - { - LOGENTRY(1, "SCARuntime::registerReferenceBindingExtension"); - if (extension) - { - referenceBindingExtensions[extension->getExtensionTypeQName()] = extension; - } - LOGEXIT(1, "SCARuntime::registerReferenceBindingExtension"); - } - - // ====================================== - // find a referenceBindingExtension - // ====================================== - ReferenceBindingExtension* SCARuntime::getReferenceBindingExtension(const string& extensionTypeQName) - { - return referenceBindingExtensions[extensionTypeQName]; - } - - // ====================================== - // register a serviceBindingExtension - // ====================================== - void SCARuntime::registerServiceBindingExtension(ServiceBindingExtension* extension) - { - LOGENTRY(1, "SCARuntime::registerServiceBindingExtension"); - if (extension) - { - serviceBindingExtensions[extension->getExtensionTypeQName()] = extension; - } - LOGEXIT(1, "SCARuntime::registerServiceBindingExtension"); - } - - // ====================================== - // find a serviceBindingExtension - // ====================================== - ServiceBindingExtension* SCARuntime::getServiceBindingExtension(const string& extensionTypeQName) - { - return serviceBindingExtensions[extensionTypeQName]; - } - - - // =================================== - // Return the top of the runtime model - // =================================== - Composite* SCARuntime::getSystem() - { - if (!system) - { - system = new Composite("tuscany/sca/system", ""); - load(); - } - return system; - } - - - // =================================================== - // setCurrentComponent: push component for this thread - // =================================================== - void SCARuntime::setCurrentComponent(Component* component) - { - -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter == components.end()) - { - components[currentThreadId] = COMPONENT_STACK(); - iter = components.find(currentThreadId); - } - - COMPONENT_STACK& compStack = iter->second; - compStack.push(component); - } - - - // ==================================================== - // unsetCurrentComponent: pop component for this thread - // ==================================================== - Component* SCARuntime::unsetCurrentComponent() - { -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter != components.end()) - { - COMPONENT_STACK& compStack = iter->second; - if (compStack.size() > 0) - { - Component* component = compStack.top(); - compStack.pop(); - return component; - } - } - - return 0; - } - - // ============================================================= - // getCurrentComponent: return current component for this thread - // ============================================================= - Component* SCARuntime::getCurrentComponent() - { -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter == components.end()) - { - components[currentThreadId] = COMPONENT_STACK(); - iter = components.find(currentThreadId); - } - - COMPONENT_STACK& compStack = iter->second; - if (compStack.size() > 0) - { - return compStack.top(); - } - else - { - return 0; - } - - } - - // =========================================== - // getCurrentCompositeComponent: return the current composite component - // =========================================== - Component* SCARuntime::getDefaultComponent() - { - - // ---------------------- - // Get the default Component - // ---------------------- - if (!defaultComponent) - { - // ------------------------------------------- - // Get the default component name from the environment - // ------------------------------------------- - if (defaultComponentName == "") - { - const char* defComp = getenv(TUSCANY_SCACPP_COMPONENT); - if (!defComp) - { - defComp = getenv(TUSCANY_SCACPP_DEFAULT_COMPONENT); - } - if (!defComp) - { - string message = TUSCANY_SCACPP_COMPONENT; - message += " environment variable not set"; - throw SystemConfigurationException(message.c_str()); - } - defaultComponentName = defComp; - } - - defaultComponent = getSystem()->findComponent(defaultComponentName); - if (!defaultComponent) - { - string message = "Component \'" + defaultComponentName + "\' not found"; - throw SystemConfigurationException(message.c_str()); - } - } - return defaultComponent; - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h deleted file mode 100644 index ef78296480..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h +++ /dev/null @@ -1,262 +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 - -#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" - -#if defined(WIN32) || defined (_WINDOWS) -#include <windows.h> -#else -#include <pthread.h> -#endif - -#include <stack> -#include <string> -#include <map> -#include <list> -using namespace std; - -using namespace tuscany::sca::model; - - -namespace tuscany -{ - namespace sca - { - - /** - * A singleton which represents the executing SCA runtime. - */ - class SCARuntime { - public: - - /** - * Get the single instance. - * @return The single instance of the runtime. - */ - SCA_API static SCARuntime* getInstance(); - - /** - * Release the single instance. - */ - SCA_API static void releaseInstance(); - - /** - * 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. - */ - SCA_API void load(); - - /** - * Set the system root - * @param root The path to the system configuration. - */ - static void setSystemRoot(const string& root); - - /** - * Set the search path for composites. - * @param path The search path for composites. - */ - static void setSystemPath(const string& path); - - /** - * Set the default Component for the system - * @param componentName The name of the default component. - */ - static void setDefaultComponentName(const string& componentName); - - /** - * Set the current component for the current thread. - * @param component The current component. - */ - SCA_API void setCurrentComponent(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 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 Composite* getSystem(); - - /** - * The directory in which the Tuscany runtime has been installed. - */ - SCA_API const string& getInstallRoot() {return SCARoot;} - - /** - * Return the current component for this thread. - * @return The current component for this thread. - */ - SCA_API Component* getCurrentComponent(); - - /** - * Get the default component set for this runtime. - * @return The default composite. - */ - SCA_API Component* getDefaultComponent(); - - /** - * Register an implementation extension - */ - SCA_API void registerImplementationExtension(ImplementationExtension* extension); - - /** - * Returns the implementation extension associated with - * the specified qname - */ - SCA_API ImplementationExtension* getImplementationExtension(const 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 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 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 string& typeQname); - - private: - /** - * Default constructor is private to prevent more than one instance. - */ - SCARuntime(); - - virtual ~SCARuntime(); - - /** - * The single instance of this class. - */ - static SCARuntime* instance; - - /** - * Pointer to the top of the runtime model. - */ - Composite* system; - - /** - * The installed path of the Tuscany runtime. - */ - string SCARoot; - - /** - * The path to the system configuration - */ - static string systemRoot; - - /** - * The search path for composites. - */ - static string systemPath; - - /** - * The default CompositeComponent. - */ - static string defaultComponentName; - - /** - * The default component set for this runtime. - */ - Component* defaultComponent; - - - typedef stack<Component*> COMPONENT_STACK; -#if defined(WIN32) || defined (_WINDOWS) - typedef map<DWORD, COMPONENT_STACK> COMPONENTS_MAP; -#else - typedef map<pthread_t, COMPONENT_STACK> COMPONENTS_MAP; -#endif - - /** - * A map of threads to components. - */ - COMPONENTS_MAP components; - - typedef map<string, ImplementationExtension*> IMPLEMENTATION_EXTENSIONS_MAP; - IMPLEMENTATION_EXTENSIONS_MAP implementationExtensions; - - typedef map<string, ReferenceBindingExtension*> REFERENCE_BINDING_EXTENSIONS_MAP; - REFERENCE_BINDING_EXTENSIONS_MAP referenceBindingExtensions; - - typedef map<string, ServiceBindingExtension*> SERVICE_BINDING_EXTENSIONS_MAP; - SERVICE_BINDING_EXTENSIONS_MAP serviceBindingExtensions; - - typedef map<string, InterfaceExtension*> INTERFACE_EXTENSIONS_MAP; - INTERFACE_EXTENSIONS_MAP interfaceExtensions; - - // Runtime Extensions - void loadExtensions(); - - typedef list<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/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp deleted file mode 100644 index f835b53267..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp +++ /dev/null @@ -1,51 +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/util/Exceptions.h" - -namespace tuscany -{ - namespace sca - { - // ============================ - // Constructor: Create a proxy - // ============================ - ServiceProxy::ServiceProxy(Reference* reference) - : reference(reference) - { - LOGENTRY(1,"ServiceProxy::constructor"); - LOGEXIT(1,"ServiceProxy::constructor"); - - } - - // ========== - // Destructor - // ========== - ServiceProxy::~ServiceProxy() - { - LOGENTRY(1,"ServiceProxy::destructor"); - LOGEXIT(1,"ServiceProxy::destructor"); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h deleted file mode 100644 index 69af373062..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h +++ /dev/null @@ -1,81 +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" -#include "tuscany/sca/core/ServiceWrapper.h" - -#include <vector> -using std::vector; - -using namespace tuscany::sca::model; - - -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(Reference* reference); - - /** - * Destructor. - */ - virtual ~ServiceProxy(); - - /** - * Returns the reference represented by this proxy. - * @return The Reference represented by this proxy. - */ - Reference* getReference() const { return reference; }; - - private: - - /** - * The reference represented by this proxy. - */ - Reference* reference; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_serviceproxy_h diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp deleted file mode 100644 index 51ee4f02b7..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp +++ /dev/null @@ -1,52 +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" - -namespace tuscany -{ - namespace sca - { - - // =========== - // Constructor - // =========== - ServiceWrapper::ServiceWrapper(Service* service) - : service(service) - { - LOGENTRY(1,"ServiceWrapper::constructor"); - - LOGEXIT(1,"ServiceWrapper::constructor"); - - } - - // ========== - // Destructor - // ========== - ServiceWrapper::~ServiceWrapper() - { - LOGENTRY(1,"ServiceWrapper::destructor"); - LOGEXIT(1,"ServiceWrapper::destructor"); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h deleted file mode 100644 index 816e1d06f4..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h +++ /dev/null @@ -1,79 +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" - -using namespace tuscany::sca::model; - - -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(Service* service); - - /** - * Destructor. - */ - virtual ~ServiceWrapper(); - - /** - * Get the service represented by this wrapper. - * @return The service represented by this wrapper. - */ - 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. - */ - Service* service; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_servicewrapper_h diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp deleted file mode 100644 index 5e6cd4a197..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp +++ /dev/null @@ -1,111 +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/TuscanyRuntime.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" - -namespace tuscany -{ - namespace sca - { - - // ========================================================== - // Set the system configuration root path - // ========================================================== - void TuscanyRuntime::setSystemRoot(const string& root) - { - LOGENTRY(1, "TuscanyRuntime::setSystemRoot"); - systemRoot = root; - LOGINFO_1(3, "TuscanyRuntime::setSystemRoot - set to %s", root.c_str()); - LOGEXIT(1, "TuscanyRuntime::setSystemRoot"); - } - - // ========================================================== - // Set the search path for composites - // ========================================================== - void TuscanyRuntime::setSystemPath(const string& path) - { - LOGENTRY(1, "TuscanyRuntime::setSystemPath"); - systemPath = path; - LOGINFO_1(3, "TuscanyRuntime::setSystemPath - set to %s", path.c_str()); - LOGEXIT(1, "TuscanyRuntime::setSystemPath"); - } - - // ========================================================== - // Set the default component name - // ========================================================== - void TuscanyRuntime::setDefaultComponentName(const string& componentName) - { - LOGENTRY(1, "TuscanyRuntime::setDefaultComponentName"); - defaultComponentName = componentName; - LOGINFO_1(3, "TuscanyRuntime::setDefaultComponentName - set to %s", componentName.c_str()); - LOGEXIT(1, "TuscanyRuntime::setDefaultComponentName"); - } - - // =================================================================== - // Constructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::TuscanyRuntime(const string& componentName, const string& root, const string& path) - { - LOGENTRY(1, "TuscanyRuntime::constructor"); - setSystemRoot(root); - setSystemPath(path); - setDefaultComponentName(componentName); - LOGEXIT(1, "TuscanyRuntime::constructor"); - } - - // =================================================================== - // Destructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::~TuscanyRuntime() - { - LOGENTRY(1, "TuscanyRuntime::destructor");; - LOGEXIT(1, "TuscanyRuntime::destructor"); - } - - // =================================================================== - // Start the runtime. - // =================================================================== - void TuscanyRuntime::start() - { - LOGENTRY(1, "TuscanyRuntime::start"); - SCARuntime::setSystemRoot(systemRoot); - SCARuntime::setSystemPath(systemPath); - SCARuntime::setDefaultComponentName(defaultComponentName); - SCARuntime::getInstance(); - LOGEXIT(1, "TuscanyRuntime::start"); - } - - // =================================================================== - // Stop the runtime. - // =================================================================== - void TuscanyRuntime::stop() - { - LOGENTRY(1, "TuscanyRuntime::stop"); - SCARuntime::releaseInstance(); - LOGEXIT(1, "TuscanyRuntime::stop"); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h deleted file mode 100644 index f1ac59f357..0000000000 --- a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h +++ /dev/null @@ -1,95 +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_tuscanyruntime_h -#define tuscany_sca_core_tuscanyruntime_h - -#include "tuscany/sca/export.h" -#include <string> -using std::string; - -namespace tuscany -{ - namespace sca - { - - /** - * A singleton which represents the executing SCA runtime. - */ - class SCA_API TuscanyRuntime - { - public: - /** - * Default constructor - */ - TuscanyRuntime(const string& defaultComponentName = "", - const string& root = "", const string& path = ""); - - /** - * Destructor - */ - virtual ~TuscanyRuntime(); - - - /** - * Set the system root configuration path - * @param root The path to the system configuration. - */ - void setSystemRoot(const string& root); - - /** - * Set the system composite search path - * @param root The search path for composites. - */ - void setSystemPath(const string& path); - - /** - * Set the default component for the system - * @param componentName The name of the default component. - */ - void setDefaultComponentName(const string& componentName); - - /** - * start the runtime - */ - void start(); - - /** - * stop the runtime - */ - void stop(); - - - private: - string systemRoot; - string systemPath; - string defaultComponentName; - }; - - - } // End namespace sca -} // End namespace tuscany - - - - -#endif // tuscany_sca_core_tuscanyruntime_h - |