summaryrefslogtreecommitdiffstats
path: root/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core
diff options
context:
space:
mode:
Diffstat (limited to 'tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core')
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp202
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h156
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp102
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h81
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.cpp88
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.h115
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp215
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h126
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp288
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h166
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp121
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h89
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp55
-rw-r--r--tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h73
14 files changed, 0 insertions, 1877 deletions
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp
deleted file mode 100644
index 9db068a2ff..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/ComponentServiceWrapper.h"
-
-#include "tuscany/sca/util/Exceptions.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/model/CPPImplementation.h"
-using namespace osoa::sca;
-
-namespace tuscany
-{
- namespace sca
- {
- // ===================
- // Static data members
- // ===================
- void* ComponentServiceWrapper::staticImpl = 0;
-
- // ===========
- // Constructor
- // ===========
- ComponentServiceWrapper::ComponentServiceWrapper(Service* target)
- : ServiceWrapper(target), service(target)
- {
- LOGENTRY(1,"ComponentServiceWrapper::constructor");
- if (target->getServiceType() != WireTarget::ComponentServiceType)
- {
- throw ServiceRuntimeException("ComponentServiceWrapper: target is not a component service");
- }
-
- component = target->getComponent();
- interf = (CPPInterface*)target->getInterface();
-
- remotable = interf->getRemotable();
-
-
- LOGEXIT(1,"ComponentServiceWrapper::constructor");
-
- }
-
- // ==========
- // Destructor
- // ==========
- ComponentServiceWrapper::~ComponentServiceWrapper()
- {
- LOGENTRY(1,"ComponentServiceWrapper::destructor");
- LOGEXIT(1,"ComponentServiceWrapper::destructor");
- }
-
-
- // ======================================================================
- // getImplementation: get an implementation for this scope
- // ======================================================================
- void* ComponentServiceWrapper::getImplementation()
- {
- CPPInterface::SCOPE scope = interf->getScope();
- if (scope == CPPInterface::MODULE)
- {
- if (!staticImpl)
- {
- staticImpl = newImplementation();
- }
- return staticImpl;
- }
- else // (scope == CPPInterface::STATELESS)
- {
- return newImplementation();
- }
- }
-
- // ======================================================================
- // releaseImplementation: release the implementation for this scope
- // ======================================================================
- void ComponentServiceWrapper::releaseImplementation()
- {
- CPPInterface::SCOPE scope = interf->getScope();
- if (scope == CPPInterface::STATELESS)
- {
- deleteImplementation();
- }
- }
-
- // ======================================================================
- // invoke: wrapper call to service with setting the component context
- // ======================================================================
- void ComponentServiceWrapper::invoke(Operation& operation)
- {
-
- SCARuntime* runtime = SCARuntime::getInstance();
- runtime->setCurrentComponent(component);
-
- try
- {
- invokeService(operation);
- }
- catch (...)
- {
- runtime->unsetCurrentComponent();
- throw;
- }
- runtime->unsetCurrentComponent();
-
- }
-
- void ComponentServiceWrapper::setLibrary(Library* lib)
- {
- wrapperLibrary = lib;
- }
-
- // ======================================================================
- // createServiceWrapper: create a wrapper for the target ComponentService
- // ======================================================================
- ComponentServiceWrapper* ComponentServiceWrapper::createServiceWrapper(Service* service)
- {
- string msg;
- ComponentServiceWrapper* serviceWrapper = 0;
-
- // -----------------------------------------------
- // Get the implementation for the target component
- // -----------------------------------------------
- Component* targetComponent = service->getComponent();
- Implementation* impl = targetComponent->getImplementation();
- if (!impl)
- {
- msg = "Component " + targetComponent->getName() + " has no implementation defined";
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // TODO: This only handle CPP implementation for now
- if (impl->getImplementationType() == Implementation::CPP)
- {
- // ----------------------------------------------------
- // Get implementation dll name and wrapper factory name
- // ----------------------------------------------------
- string dllName = ((CPPImplementation*)impl)->getDll();
- string wrapperFactoryName = ((CPPImplementation*)impl)->getHeaderStub()
- + "_" + service->getName() + "_Wrapper_Factory";
-
- // ------------
- // Load the dll
- // ------------
- string fullDllName = targetComponent->getModule()->getRoot() + "/" + dllName;
- typedef ComponentServiceWrapper* (* WRAPPERFACTORY) (Service*);
- Library* wrapperLib = new Library(fullDllName);
-
- // -------------------------
- // Locate the factory method
- // -------------------------
- WRAPPERFACTORY wrapperFactory = (WRAPPERFACTORY)wrapperLib->getSymbol(wrapperFactoryName);
- if (!wrapperFactory)
- {
- LOGERROR_2(1, "ComponentServiceWrapper::createServiceWrapper: Unable to locate %s in library %s",
- wrapperFactoryName.c_str(), fullDllName.c_str());
- msg = "Unable to locate " + wrapperFactoryName + " in library " + fullDllName;
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // -------------------------------------
- // Now create an instance of the wrapper
- // -------------------------------------
- serviceWrapper = wrapperFactory(service);
- if (!serviceWrapper)
- {
- LOGERROR_2(1, "ComponentServiceWrapper::createServiceWrapper: Factory method %s in library %s returned null",
- wrapperFactoryName.c_str(), fullDllName.c_str());
- msg = "Factory method " + wrapperFactoryName + " in library " + fullDllName + " returned null";
- throw ServiceNotFoundException(msg.c_str());
- }
- serviceWrapper->setLibrary(wrapperLib);
- }
- else
- {
- // ----------------------
- // Non CPP Implementation
- // ----------------------
- msg = "Unsupported implementation type for service: " + service->getName();
- throw ServiceNotFoundException(msg.c_str());
- }
-
- return serviceWrapper;
- }
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h
deleted file mode 100644
index 3a5e990bf0..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_componentservicewrapper_h
-#define tuscany_sca_core_componentservicewrapper_h
-
-#include "osoa/sca/export.h"
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/model/Component.h"
-#include "tuscany/sca/core/Operation.h"
-#include "tuscany/sca/model/CPPInterface.h"
-#include "tuscany/sca/util/Library.h"
-
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- /**
- * Wraps the service on a component implementation.
- * This abstract class is extended by generated code which provides
- * the implementation of some of the methods.
- * An instance of this class wraps the actual component implementation which
- * has been written by a developer of an SCA application.
- */
- class ComponentServiceWrapper : public ServiceWrapper
- {
- public:
- /**
- * Factory method to create a new ComponentServiceWrapper for a given target
- * service. This method will provide all the loading of dlls required to
- * create the target component.
- * @param target The service on the component for which this wrapper is to be
- * created.
- * @return A wrapper that references the given target.
- */
- static SCA_API ComponentServiceWrapper* createServiceWrapper(Service* target);
-
- /**
- * Constructor.
- * @param target The component service to which this wrapper refers.
- */
- SCA_API ComponentServiceWrapper(Service* target);
-
- /**
- * Destructor.
- */
- SCA_API virtual ~ComponentServiceWrapper();
-
- /**
- * All business method calls to the target component go through the invoke method.
- * @param operation The details of the method, paramaters and return value for the
- * business method to be called on the target component.
- */
- SCA_API virtual void invoke(Operation& operation);
-
- /**
- * Return the loaded shared library for the target component.
- */
- Library* getLibrary() {return wrapperLibrary;}
- protected:
- /**
- * Delegated method to invoke the correct method on the target component.
- * Implemented by the subtype.
- */
- SCA_API virtual void invokeService(Operation& operation) = 0;
-
- /**
- * Delegated method to create a new component implementation.
- * Implemented by the subtype.
- * @return A pointer to an instance of the component implementation class.
- */
- SCA_API virtual void* newImplementation() = 0;
-
- /**
- * Delegated method to delete the current instance of the component
- * implementation.
- * Implemented by the subtype.
- */
- SCA_API virtual void deleteImplementation() = 0;
-
- /**
- * Return the current instance of the component implementation.
- * @return A pointer to an instance of the component implementation class.
- */
- SCA_API virtual void* getImplementation();
-
- /**
- * Indicates that the current instance of the component implementation
- * has been finished with.
- * Will call ComponentServiceWrapper#deleteImplementation if the
- * implementation is stateless (so that a new instance is returned
- * for each call).
- */
- SCA_API virtual void releaseImplementation();
-
- private:
- /**
- * Holds an implementation instance if the scope is set to module.
- */
- static void* staticImpl;
-
- /**
- * The component to which this wrapper refers.
- */
- Component* component;
-
- /**
- * The service on the component to which this wrapper refers.
- */
- Service* service;
-
- /**
- * A pointer to the interface which the service exposes.
- */
- CPPInterface* interf;
-
- /**
- * Set to true if the service is remotable.
- */
- bool remotable;
-
- /**
- * Pointer to the loaded library which contains the component
- * implementation.
- */
- Library* wrapperLibrary;
-
- /**
- * Set the loaded library which contains the component
- * implementation.
- * @param lib The library.
- */
- void setLibrary(Library* lib);
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_componentservicewrapper_h
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp
deleted file mode 100644
index 2838bbe4d4..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/ExternalServiceWrapper.h"
-#include <stdarg.h>
-
-#include "tuscany/sca/util/Exceptions.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/SCARuntime.h"
-
-#include "tuscany/sca/ws/WSServiceWrapper.h"
-using tuscany::sca::ws::WSServiceWrapper;
-
-using namespace osoa::sca;
-
-
-namespace tuscany
-{
- namespace sca
- {
-
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
-
- ExternalServiceWrapper::ExternalServiceWrapper(tuscany::sca::model::WireTarget* target)
- : ServiceWrapper(target)
- {
- LOGENTRY(1,"ExternalServiceWrapper::constructor");
- if (target->getServiceType() != WireTarget::ExternalServiceType)
- {
- throw ServiceRuntimeException("ExternalServiceWrapper: target is not an ExternalService");
- }
-
- LOGEXIT(1,"ExternalServiceWrapper::constructor");
-
- }
-
- ExternalServiceWrapper::~ExternalServiceWrapper()
- {
- LOGENTRY(1,"ExternalServiceWrapper::destructor");
- LOGEXIT(1,"ExternalServiceWrapper::destructor");
- }
-
- // ======================================================================
- // createServiceWrapper: create a wrapper for the target ExternalService
- // ======================================================================
- ExternalServiceWrapper* ExternalServiceWrapper::createServiceWrapper(ExternalService* service)
- {
- string msg;
- ExternalServiceWrapper* serviceWrapper = 0;
-
- // -----------------------------------------------
- // Get the binding for the target component
- // -----------------------------------------------
- Binding* targetBinding = service->getBinding();
- if (!targetBinding)
- {
- msg = "External service " + service->getName() + " has no binding defined";
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // TODO: This only handles ws implementation for now
- if (targetBinding->getBindingType() == Binding::WS)
- {
- // -------------------------------------
- // Create an instance of the wrapper
- // -------------------------------------
- serviceWrapper = new WSServiceWrapper(service);
-
- }
- else
- {
- // ----------------------
- // Non WS Binding
- // ----------------------
- msg = "Unsupported binding type for externalService: " + service->getName();
- throw ServiceNotFoundException(msg.c_str());
- }
-
- return serviceWrapper;
- }
-
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h
deleted file mode 100644
index b2dcfb3a6b..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_externalservicewrapper_h
-#define tuscany_sca_core_externalservicewrapper_h
-
-#include "osoa/sca/export.h"
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/core/Operation.h"
-#include "tuscany/sca/model/ExternalService.h"
-using tuscany::sca::model::ExternalService;
-
-namespace tuscany
-{
- namespace sca
- {
-
- /**
- * Wraps an SCA external service so that it can be called by a
- * proxy.
- * This abstract class will be extended by a class which supports
- * a specific external service binding (for example, the web services binding).
- */
- class SCA_API ExternalServiceWrapper : public ServiceWrapper
- {
- public:
- /**
- * Factory method to create a new ExternaServiceWrapper for a given
- * external service described in the SCA module.
- */
- static ExternalServiceWrapper* createServiceWrapper(ExternalService* service);
-
- /**
- * Constructor.
- * @param target The target external service for which this wrapper is to be
- * created.
- * @return A wrapper that references the given target.
- */
- ExternalServiceWrapper(tuscany::sca::model::WireTarget* target);
-
- /**
- * Destructor.
- */
- virtual ~ExternalServiceWrapper();
-
- /**
- * Return the external service (in the runtime model) that is wrapped by
- * the instance of this class.
- */
- virtual ExternalService* getExternalService() {return (ExternalService*)getTarget();};
-
- /**
- * All business method calls to the external service go through the invoke method.
- * This is a delegated method which will be implemented by the subclass.
- * @param operation The details of the method, paramaters and return value for the
- * business method to be called on the external service.
- */
- virtual void invoke(Operation& operation) = 0;
- private:
-
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_externalservicewrapper_h
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.cpp
deleted file mode 100644
index ea9dfdb15a..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#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, unsigned int numParameters)
- : name(operationName), nparms(numParameters)
- {
- LOGENTRY(1,"Operation::constructor");
-
- parameters = new void*[nparms];
-
- LOGEXIT(1,"Operation::constructor");
- }
-
- // ==========
- // Destructor
- // ==========
- Operation::~Operation()
- {
- LOGENTRY(1,"Operation::destructor");
- LOGEXIT(1,"Operation::destructor");
- }
-
-
- // ==============================================
- // getParameter: return parameter at position pos
- // ==============================================
- void* Operation::getParameter(unsigned int pos)
- {
- if (pos < nparms)
- {
- return parameters[pos];
- }
-
- return 0;
- }
-
- // ===========================================
- // setParameter: set parameter at position pos
- // ===========================================
- void Operation::setParameter(unsigned int pos, void* parm)
- {
- if (pos < nparms)
- {
- parameters[pos] = parm;
- }
- }
-
- // ====================================
- // setReturnValue: set the return value
- // ====================================
- void Operation::setReturnValue(void* val)
- {
- returnType = val;
- }
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.h
deleted file mode 100644
index 9e080363aa..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/Operation.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_operation_h
-#define tuscany_sca_core_operation_h
-#include "osoa/sca/export.h"
-
-#include <string>
-using std::string;
-
-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, unsigned int numParameters);
-
- /**
- * Destructor.
- */
- SCA_API virtual ~Operation();
-
- /**
- * Return the operation name.
- * @return The name of the operation.
- */
- SCA_API const char* getName() {return name;}
-
- /**
- * 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 setParameter(unsigned int pos, void* parm);
-
- /**
- * 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* getParameter(unsigned int pos);
-
- /**
- * Get the return value on the operation.
- * Normally the client
- * would set the return value and the service will get this
- * return value pointer and set the return value.
- * @return Pointer to the return type.
- */
- SCA_API void* getReturnValue() {return returnType;}
-
- /**
- * Set the return value on the operation.
- * Normally the client
- * would set the return value pointer so that the service can
- * return a value
- * @param valPtr Pointer to the return type.
- */
- SCA_API void setReturnValue(void* valPtr);
-
- private:
- /**
- * Operation name (method name).
- */
- const char* name;
-
- /**
- * Number of paramaters passed for this operation.
- */
- unsigned int nparms;
-
- /**
- * Pointer to the array of parameters.
- */
- void** parameters;
-
- /**
- * The return value.
- */
- void* returnType;
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_operation_h
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp
deleted file mode 100644
index a505ba9636..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/SCAEntryPoint.h"
-
-#include "tuscany/sca/util/Exceptions.h"
-#include "tuscany/sca/util/Utils.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/core/ComponentServiceWrapper.h"
-#include "tuscany/sca/core/ExternalServiceWrapper.h"
-using namespace osoa::sca;
-
-namespace tuscany
-{
- namespace sca
- {
- // ===========
- // Constructor
- // ===========
- SCAEntryPoint::SCAEntryPoint(const char* epName)
- : subsystem(0), entrypoint(0), module(0)
- {
- LOGENTRY(1,"SCAEntryPoint::constructor");
- string message;
-
- // initialize the system if necessary
- System* system = SCARuntime::getInstance()->getSystem();
-
- string subsystemName;
- string entrypointName;
-
- Utils::tokeniseUri(epName, subsystemName, entrypointName);
-
- // --------------------
- // locate the Subsystem
- // --------------------
- subsystem = system->findSubsystem(subsystemName);
- if (!subsystem)
- {
- throw EntryPointNotFoundException(epName);
- }
-
- // ---------------------
- // locate the EntryPoint
- // ---------------------
- entrypoint = subsystem->findEntryPoint(entrypointName);
- if (entrypoint)
- {
- // found Subsystem EntryPoint
- throw EntryPointNotFoundException("Subsystem EntryPoint not yet supported");
- }
- else
- {
- // -----------------------------------
- // locate the EntryPoint in the Module
- // -----------------------------------
- string moduleComponentName;
- Utils::tokeniseUri(entrypointName, moduleComponentName, entrypointName);
- module = subsystem->findModuleByComponentName(moduleComponentName);
- if (module)
- {
- dataFactory = module->getDataFactory();
- entrypoint = module->findEntryPoint(entrypointName);
- }
- }
-
- if (!entrypoint)
- {
- throw EntryPointNotFoundException(epName);
- }
-
- // ---------------------------------
- // Get Wrappers for each wire target
- // ---------------------------------
-
- // Get the target services from the EntryPoint
- const EntryPoint::TARGETS& targets = entrypoint->getTargets();
-
- // --------------------
- // Validate the request
- // --------------------
- switch (entrypoint->getMultiplicity())
- {
- case EntryPoint::ONE_MANY:
- case EntryPoint::ONE_ONE:
- {
- if (targets.size() == 0)
- {
- message = "EntryPoint " + entrypoint->getName() + " not wired";
- throw ServiceNotFoundException(message.c_str());
- }
- }
- default:
- {
- }
- } // end switch
-
- for (EntryPoint::TARGETS::const_iterator iter = targets.begin();
- iter!=targets.end();
- iter++)
- {
- ServiceWrapper* service = getServiceWrapper(*iter);
- if (service)
- {
- services.push_back(service);
- }
- }
-
- LOGEXIT(1,"SCAEntryPoint::constructor");
- }
-
- // ==========
- // Destructor
- // ==========
- SCAEntryPoint::~SCAEntryPoint()
- {
- LOGENTRY(1,"SCAEntryPoint::destructor");
-
- // Delete any ServiceWrappers
- for (SERVICES::iterator iter = services.begin(); iter < services.end(); iter++)
- {
- delete (*iter);
- }
- LOGEXIT(1,"SCAEntryPoint::destructor");
- }
-
-
- // ======================================================================
- // invoke:
- // ======================================================================
- SCA_API DataObjectPtr SCAEntryPoint::invoke(const char* operationName, DataObjectPtr inDataObject)
- {
- string message;
-
- // --------------------
- // Validate the request
- // --------------------
- if (services.size() == 0)
- {
- message = "EntryPoint " + entrypoint->getName() + " not wired";
- throw ServiceNotFoundException(message.c_str());
- }
-
- // -------------------
- // Invoke each target
- // -------------------
- Operation operation(operationName, 1);
- operation.setParameter(0, &inDataObject);
- DataObjectPtr ret;
- operation.setReturnValue((void *)&ret);
-
- for (SERVICES::iterator iter = services.begin(); iter < services.end(); iter++)
- {
- (*iter)->invoke(operation);
- }
-
- return ret;
- }
-
-
- // ======================================================================
- // getServiceWrapper: Create and return an instance of the ServiceWrapper
- // ======================================================================
- ServiceWrapper* SCAEntryPoint::getServiceWrapper(WireTarget* target)
- {
- // -------------------------
- // Determine type of Service
- // -------------------------
- switch (target->getServiceType())
- {
- case WireTarget::ExternalServiceType:
- {
- // ----------------
- // External Service
- // ----------------
- return ExternalServiceWrapper::createServiceWrapper((ExternalService*)target);
- }
-
- case WireTarget::ComponentServiceType:
- {
- // -----------------
- // Component Service
- // -----------------
- return ComponentServiceWrapper::createServiceWrapper((Service*)target);
- }
-
- default:
- {
- string message = "Undefined wire target type for : ";
- message = message + target->getName();
- throw ServiceNotFoundException(message.c_str());
- }
- } // end switch
- }
-
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h
deleted file mode 100644
index 34c9f3e0d8..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_scaentrypoint_h
-#define tuscany_sca_core_scaentrypoint_h
-
-#include "osoa/sca/export.h"
-
-#include <vector>
-using std::vector;
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/model/WireTarget.h"
-#include "tuscany/sca/model/Subsystem.h"
-#include "tuscany/sca/model/EntryPoint.h"
-#include "tuscany/sca/model/Module.h"
-using namespace tuscany::sca::model;
-#include "commonj/sdo/SDO.h"
-using commonj::sdo::DataObjectPtr;
-using commonj::sdo::DataFactoryPtr;
-
-namespace tuscany
-{
- namespace sca
- {
- /**
- * A runtime class which is used by external bindings to provide the entry
- * point into the SCA runtime. An entry point will be defined in an SCA
- * module, and a binding class will be provided to service the
- * communication between the external binding (e.g. for web services the
- * SOAP/HTTP communication) and the SCA runtime. The binding class will
- * use SCAEntryPoint to call into the SCA runtime.
- */
- class SCAEntryPoint
- {
- public:
- /**
- * Constructor to create a new instance which will be associated with
- * a given entry point in an SCA module.
- * @param entryPointName The qualified name of the entry point in an
- * SCA module. It is of the form
- * "subsystem name"/"module component name"/"entry point name".
- */
- SCA_API SCAEntryPoint(const char* entryPointName);
-
- /**
- * Destructor.
- */
- SCA_API virtual ~SCAEntryPoint();
-
- /**
- * Invokes an operation on the component to which the SCA entry point
- * is wired in the SCA module.
- * Note that the operation must take a single data object as a parameter, and
- * the return is a single data object.
- * @param operationName Name of the operation.
- * @param inDataObject The parameter for the operation.
- * @return The data object which holds the result of the operation.
- */
- SCA_API virtual DataObjectPtr invoke(const char* operationName, DataObjectPtr inDataObject);
-
- /**
- * Returns a SDO data factory from which all the types associated with the entry point
- * and module can be created.
- */
- SCA_API DataFactoryPtr getDataFactory() {return dataFactory;}
-
- protected:
-
- private:
- /**
- * The subsystem in which this entry point is found.
- */
- Subsystem* subsystem;
-
- /**
- * The entry point in the module.
- */
- EntryPoint* entrypoint;
-
- /**
- * The module component in the subsystem.
- */
- Module* module;
-
- /**
- * Cached data factory which has all the types defined for the module in which
- * this entry point is found.
- */
- DataFactoryPtr dataFactory;
-
- typedef vector<ServiceWrapper*> SERVICES;
- /**
- * Vector of all the service wrappers created for this entry point.
- * Used to destroy the wrappers when this class is destroyed.
- */
- SERVICES services;
-
- /**
- * Creates and returns the service wrapper for a given target.
- * @param target The target of the wire for which a service wrapper is
- * to be created.
- * @return A service wrapper to be used for invoking the target implementation.
- */
- ServiceWrapper* getServiceWrapper(WireTarget* target);
-
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_scaentrypoint_h
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp
deleted file mode 100644
index deca72c378..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/core/ComponentServiceWrapper.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/util/Utils.h"
-#include "tuscany/sca/util/Exceptions.h"
-
-#include "tuscany/sca/model/System.h"
-#include "tuscany/sca/model/Subsystem.h"
-#include "tuscany/sca/model/ModelLoader.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_MODULE = "TUSCANY_SCACPP_DEFAULT_MODULE";
-
-
- // ==========================================================
- // Initialize static class member to not pointing at anything
- // ==========================================================
- SCARuntime* SCARuntime::instance = 0;
-
-
- // ===================================================================
- // Constructor for the SCARuntime class. This will be a singleton that
- // holds all the information about the current runtime.
- // ===================================================================
- SCARuntime::SCARuntime() : system(new System()), defaultModule(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");
- }
-
- // =============================================================
- // 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 the runtime
- // Get root from environment variable TUSCANY_SCACPP_SYSTEM_ROOT
- char* systemRoot = getenv(TUSCANY_SCACPP_SYSTEM_ROOT);
- if (systemRoot == 0)
- {
- string msg = TUSCANY_SCACPP_SYSTEM_ROOT;
- msg += " environment variable not set";
- throw SystemConfigurationException(msg.c_str());
- }
- instance->load(systemRoot);
- }
-
- LOGEXIT(1, "SCARuntime::getInstance");
-
- return instance;
-
- }
-
- // ======================================
- // Load up all the details of the runtime
- // ======================================
- void SCARuntime::load(const char *configurationRoot)
- {
- LOGENTRY(1, "SCARuntime::load");
- std::string root = configurationRoot;
-
- LOGINFO_1(2,"configuration root: %s", configurationRoot);
-
- ModelLoader loader(system);
- // Load details of the module
- loader.load(configurationRoot);
-
- LOGEXIT(1, "SCARuntime::load");
- }
-
-
- // ===================================
- // Return the top of the runtime model
- // ===================================
- System* SCARuntime::getSystem()
- {
- 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;
- }
-
- }
-
-
- // ===========================================
- // getCurrentModule: return the current module
- // ===========================================
- Module* SCARuntime::getCurrentModule()
- {
- // ---------------------------------------------
- // Get module from current component if possible
- // ---------------------------------------------
- Component* comp = getCurrentComponent();
- if (comp != 0)
- {
- return comp->getModule();
- }
-
- // ----------------------
- // Get the default Module
- // ----------------------
- string message;
- if (!defaultModule)
- {
- // -------------------------------------------
- // Get the default module from the environment
- // -------------------------------------------
- const char* defMod = getenv(TUSCANY_SCACPP_DEFAULT_MODULE);
- if (!defMod)
- {
- message = TUSCANY_SCACPP_DEFAULT_MODULE;
- message += " environment variable not set";
- throw SystemConfigurationException(message.c_str());
- }
-
- string subsystemName, moduleName;
- Utils::tokeniseUri(defMod, subsystemName, moduleName);
-
- // ---------------------------
- // Subsystem must be specified
- // ---------------------------
- Subsystem* subsystem = system->findSubsystem(subsystemName);
- if (!subsystem)
- {
- message = "Default subsystem \'" + subsystemName + "\' not found";
- throw SystemConfigurationException(message.c_str());
- }
-
- // --------------------------------------------------------------------------
- // If module is not specified then get the default module for this subsystem.
- // This will be the ONLY module for this subsystem
- // --------------------------------------------------------------------------
- if (moduleName == "")
- {
- defaultModule = subsystem->getDefaultModule();
- if (!defaultModule)
- {
- message = "Default module not found for subsystem \'" + subsystemName + "\'";
- throw SystemConfigurationException(message.c_str());
- }
- }
- else
- {
- // -----------------------------
- // get the named ModuleComponent
- // -----------------------------
- defaultModule = subsystem->findModuleByComponentName(moduleName);
- if (!defaultModule)
- {
- message = "Default module \'" + moduleName + "\' not found in subsystem \'" + subsystemName +"\'";
- throw SystemConfigurationException(message.c_str());
- }
- }
- }
- return defaultModule;
- }
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h
deleted file mode 100644
index 42deb85751..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_scaruntime_h
-#define tuscany_sca_core_scaruntime_h
-
-#include "osoa/sca/export.h"
-
-#include "osoa/sca/ComponentContext.h"
-using osoa::sca::ComponentContext;
-
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/model/System.h"
-using namespace tuscany::sca::model;
-
-#if defined(WIN32) || defined (_WINDOWS)
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-
-#include <stack>
-#include <string>
-#include <map>
-using namespace std;
-
-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();
-
- /**
- * 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.
- */
- System* getSystem();
-
- /**
- * The directory in which the Tuscany runtime has been installed.
- */
- const string& getInstallRoot() {return SCARoot;}
-
- /**
- * Return the current component for this thread.
- * @return The current component for this thread.
- */
- Component* getCurrentComponent();
-
- /**
- * Get the current module. The current module will either
- * be the module in which the current component for this thread
- * is defined, or it will be the default module if there is no current
- * component. There will not be a current component if a client of
- * the SCA runtime is making a call into the SCA runtime.
- */
- Module* getCurrentModule();
-
- private:
- /**
- * Default constructor is private to prevent more than one instance.
- */
- SCARuntime();
-
- /**
- * Load the SCA configuration from the scdl files (sca.module,
- * *.fragment, etc).
- * This will create the runtime model from which the SCA runtime
- * will operate.
- * @param configurationRoot The path to the configuration of the
- * SCA runtime. Under this root will be the subsystems and modules
- * directories.
- */
- void load(const char* configurationRoot);
-
- /**
- * The single instance of this class.
- */
- static SCARuntime* instance;
-
- /**
- * Pointer to the top of the runtime model.
- */
- System* system;
-
- /**
- * The installed path of the Tuscany runtime.
- */
- string SCARoot;
-
- /**
- * Get the default module set for this runtime.
- * @return The default module.
- */
- Module* getDefaultModule() {return defaultModule;}
-
- /**
- * The default module set for this runtime.
- */
- Module* defaultModule;
-
-
- 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;
- };
-
-
- } // End namespace sca
-} // End namespace tuscany
-
-
-
-
-#endif // tuscany_sca_core_scaruntime_h
-
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp
deleted file mode 100644
index ef2f2744eb..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/ServiceProxy.h"
-
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/util/Exceptions.h"
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/model/CPPImplementation.h"
-
-using namespace osoa::sca;
-
-namespace tuscany
-{
- namespace sca
- {
- // ============================
- // Constructor: Create a proxy
- // ============================
- ServiceProxy::ServiceProxy(Component* component, const string& name, ServiceWrapper* target)
- {
- LOGENTRY(1,"ServiceProxy::constructor");
- string msg;
-
- // ----------------------
- // Get the implementation
- // ----------------------
- Implementation* impl = component->getImplementation();
- if (!impl)
- {
- msg = "Component " + component->getName() + " has no implementation defined";
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // TODO: This only handle CPP implementation for now
- if (impl->getImplementationType() == Implementation::CPP)
- {
- // ----------------------------------------------------
- // Get implementation dll name and service factory name
- // ----------------------------------------------------
- string dllName = ((CPPImplementation*)impl)->getDll();
- string headerStub = ((CPPImplementation*)impl)->getHeaderStub();
-
- string fullDllName = component->getModule()->getRoot() + "/" + dllName;
- string proxyFactoryName = headerStub + "_" + name + "_Proxy_Factory";
- string proxyDestructorName = headerStub + "_" + name + "_Proxy_Destructor";
- typedef void* (* PROXYFACTORY) (ServiceWrapper*);
-
- // ------------
- // Load the dll
- // ------------
- proxyLibrary = Library(fullDllName);
-
- // -------------------------
- // Locate the factory method
- // -------------------------
- PROXYFACTORY proxyFactory = (PROXYFACTORY)proxyLibrary.getSymbol(proxyFactoryName);
- if (!proxyFactory)
- {
- LOGERROR_2(1, "ComponentContextImpl::getServiceProxy: Unable to locate %s in library %s",
- proxyFactoryName.c_str(), fullDllName.c_str());
- msg = "Unable to locate " + proxyFactoryName + " in library " + fullDllName;
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // -----------------------------------
- // Now create an instance of the proxy
- // -----------------------------------
- proxy = proxyFactory(target);
- if (!proxy)
- {
- LOGERROR_2(1, "ComponentContextImpl::getServiceProxy: Factory method %s in library %s returned null",
- proxyFactoryName.c_str(), fullDllName.c_str());
- msg = "Factory method " + proxyFactoryName + " in library " + fullDllName + " returned null";
- throw ServiceNotFoundException(msg.c_str());
- }
-
- // -------------------------
- // Get the destructor method
- // -------------------------
- destructor = (PROXYDESTRUCTOR)proxyLibrary.getSymbol(proxyDestructorName);
- }
-
- LOGEXIT(1,"ServiceProxy::constructor");
-
- }
-
- // ==========
- // Destructor
- // ==========
- ServiceProxy::~ServiceProxy()
- {
- LOGENTRY(1,"ServiceProxy::destructor");
-
- // Delete the proxy
- if (destructor)
- {
- destructor(proxy);
- }
- LOGEXIT(1,"ServiceProxy::destructor");
- }
-
-
- } // End namespace sca
-} // End namespace tuscany
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h
deleted file mode 100644
index 073b379cd7..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_serviceproxy_h
-#define tuscany_sca_core_serviceproxy_h
-
-#include "osoa/sca/export.h"
-
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/model/Component.h"
-#include "tuscany/sca/util/Library.h"
-
-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 ServiceProxy
- {
- public:
- /**
- * Create a new service proxy for a given component and reference name. The
- * create proxy will contain a pointer to the target ServiceWrapper.
- * @param component The component for which this proxy will be created (the
- * source component).
- * @param name The name of the reference on the component.
- * @param target The wrapper of the component which is wired to this component and
- * reference.
- */
- ServiceProxy(Component* component, const string& name, ServiceWrapper* target);
-
- /**
- * Destructor.
- */
- virtual ~ServiceProxy();
-
- /**
- * Return an instance of the proxy created for this particular component and reference.
- * @return The proxy.
- */
- void* getProxy() {return proxy;}
-
-
- private:
- /**
- * Holds the instance of the code generated proxy.
- */
- void* proxy;
-
- typedef void (* PROXYDESTRUCTOR) (void*);
-
- /**
- * A function pointer to the destructor of the proxy.
- */
- PROXYDESTRUCTOR destructor;
-
- /**
- * The library which contains the code for the proxy.
- */
- Library proxyLibrary;
-
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_serviceproxy_h
diff --git a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp
deleted file mode 100644
index 5936f526f1..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include <stdarg.h>
-
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/SCARuntime.h"
-
-
-
-namespace tuscany
-{
- namespace sca
- {
-
- // ===========
- // Constructor
- // ===========
- ServiceWrapper::ServiceWrapper(WireTarget* targ)
- : target(targ)
- {
- 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-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h b/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h
deleted file mode 100644
index 21c162d77f..0000000000
--- a/tags/cpp-stable-20060304/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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: 2005/12/22 11:33:21 $ */
-
-#ifndef tuscany_sca_core_servicewrapper_h
-#define tuscany_sca_core_servicewrapper_h
-
-#include "osoa/sca/export.h"
-
-#include "tuscany/sca/core/Operation.h"
-#include "tuscany/sca/model/WireTarget.h"
-using tuscany::sca::model::WireTarget;
-
-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(WireTarget* target);
-
- /**
- * Destructor.
- */
- virtual ~ServiceWrapper();
-
- /**
- * Get the target represented by this wrapper.
- * @return The target represented by this wrapper.
- */
- virtual WireTarget* getTarget() {return target;}
-
- /**
- * 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.
- */
- WireTarget* target;
- };
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_core_servicewrapper_h