diff options
Diffstat (limited to 'sca-cpp/trunk/contrib/runtime/extensions')
409 files changed, 0 insertions, 41187 deletions
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/Makefile.am deleted file mode 100644 index 1cc28fe80e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/Makefile.am +++ /dev/null @@ -1,45 +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. - -if WANT_ALL - CPP_EXTENSION = cpp - PYTHON_EXTENSION = python - RUBY_EXTENSION = ruby - WSBINDING_EXTENSION = ws - SCABINDING_EXTENSION = sca - RESTBINDING_EXTENSION = rest -endif -if WANT_CPP - CPP_EXTENSION = cpp -endif -if WANT_PYTHON - PYTHON_EXTENSION = python -endif -if WANT_RUBY - RUBY_EXTENSION = ruby -endif - -if WANT_WSBINDING - WSBINDING_EXTENSION = ws -endif -if WANT_SCABINDING - SCABINDING_EXTENSION = sca -endif -if WANT_RESTBINDING - RESTBINDING_EXTENSION = rest -endif -SUBDIRS = ${CPP_EXTENSION} ${WSBINDING_EXTENSION} ${SCABINDING_EXTENSION} ${RESTBINDING_EXTENSION} ${PYTHON_EXTENSION} ${RUBY_EXTENSION} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am deleted file mode 100644 index 3ef2b728b3..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am +++ /dev/null @@ -1,24 +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. - -SUBDIRS = src tools - -datadir=$(prefix)/extensions/cpp - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/Makefile.am deleted file mode 100644 index f234261f5b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/Makefile.am +++ /dev/null @@ -1,55 +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. - -libdir=$(prefix)/extensions/cpp/lib - -lib_LTLIBRARIES = libtuscany_sca_cpp.la -includedir=$(prefix)/extensions/cpp/include -nobase_include_HEADERS = \ -osoa/sca/*.h \ -tuscany/sca/cpp/*.h \ -tuscany/sca/cpp/model/*.h - -libtuscany_sca_cpp_la_SOURCES = \ -osoa/sca/ComponentContext.cpp \ -osoa/sca/CompositeContext.cpp \ -tuscany/sca/cpp/ComponentContextImpl.cpp \ -tuscany/sca/cpp/CompositeContextImpl.cpp \ -tuscany/sca/cpp/CPPExtension.cpp \ -tuscany/sca/cpp/CPPImplementationExtension.cpp \ -tuscany/sca/cpp/CPPInterfaceExtension.cpp \ -tuscany/sca/cpp/CPPServiceProxy.cpp \ -tuscany/sca/cpp/CPPServiceWrapper.cpp \ -tuscany/sca/cpp/TuscanyRuntime.cpp \ -tuscany/sca/cpp/model/CPPImplementation.cpp \ -tuscany/sca/cpp/model/CPPInterface.cpp \ -tuscany/sca/cpp/model/CPPReferenceBinding.cpp \ -tuscany/sca/cpp/model/CPPServiceBinding.cpp - -libtuscany_sca_cpp_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca - -INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include - -moduledir=$(prefix)/extensions/cpp/module -extension = libtuscany_sca_cpp$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp deleted file mode 100644 index d686c4c09f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp +++ /dev/null @@ -1,150 +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 "commonj/sdo/SDO.h" - -#include "osoa/sca/ComponentContext.h" -#include "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/cpp/ComponentContextImpl.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::cpp; -using namespace tuscany::sca::model; - -namespace osoa -{ - namespace sca - { - - // ======================================================= - // getCurrent: create a context from the current component - // ======================================================= - ComponentContext ComponentContext::getCurrent() - { - logentry(); - try - { - Component* component = tuscany::sca::SCARuntime::getCurrentRuntime()->getCurrentComponent(); - if (!component) - { - throwException(ComponentContextException, "No current component"); - } - ComponentContext* cci = new ComponentContextImpl(component); - return ComponentContext(cci); - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - // =========== - // Constructor - // =========== - ComponentContext::ComponentContext(ComponentContext* implementation) - : impl(implementation) - { - logentry(); - } - - // ========== - // Destructor - // ========== - ComponentContext::~ComponentContext() - { - logentry(); - delete impl; - } - - // =================================== - // Copy constructor: create a new impl - // =================================== - ComponentContext::ComponentContext(const ComponentContext& ctx) - { - logentry(); - Component* component = ((ComponentContextImpl*)impl)->getComponent(); - impl = new ComponentContextImpl(component); - } - - // ============================= - // operator= : create a new impl - // ============================= - ComponentContext& ComponentContext::operator=(const ComponentContext& ctx) - { - logentry(); - if (this != &ctx) - { - Component* component = ((ComponentContextImpl*)impl)->getComponent(); - impl = new ComponentContextImpl(component); - } - return *this; - } - - // ========== - // getService - // ========== - void* ComponentContext::getService(const std::string& referenceName) - { - logentry(); - void* service = impl->getService(referenceName); - return service; - } - - // =========== - // getServices - // =========== - std::list<void*> ComponentContext::getServices(const std::string& referenceName) - { - logentry(); - return impl->getServices(referenceName); - } - - // ============ - // getProperties - // ============= - DataObjectPtr ComponentContext::getProperties() - { - logentry(); - DataObjectPtr properties = impl->getProperties(); - return properties; - } - - // ============ - // getDataFactory - // ============= - DataFactoryPtr ComponentContext::getDataFactory() - { - logentry(); - DataFactoryPtr dataFactory = impl->getDataFactory(); - return dataFactory; - } - - - } // End namespace sca -} // End namespace osoa diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.h deleted file mode 100644 index 2c305c5161..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.h +++ /dev/null @@ -1,117 +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 osoa_sca_componentcontext_h -#define osoa_sca_componentcontext_h - -#include <string> -#include <list> - -#include "commonj/sdo/SDO.h" - -#include "osoa/sca/export.h" - -namespace osoa -{ - namespace sca - { - - /** - * An SCA component implementation uses the ComponentContext class to - * retrieve information about the configured SCA component. - */ - class SCA_CPP_API ComponentContext - { - - public: - /** - * Return a new ComponentContext for the current Component. - */ - static ComponentContext getCurrent(); - - /** - * Resolve a reference name into a single configured service. - * If the component's reference is wired to more than one service - * then theis method will return an exception. - * @param referenceName The reference to be resolved. This must match - * the name of a reference configured in the component type file for - * this component. - */ - virtual void* getService(const std::string& referenceName); - - /** - * Resolve a reference name into a list of configured services. - * @param referenceName The reference to be resolved. This must match - * the name of a reference configured in the component type file for - * this component. - */ - virtual std::list<void*> getServices(const std::string& referenceName); - - /** - * Get the configured properties for the component. - * @return A data object representing all the properties that - * are configured for this component. - */ - virtual commonj::sdo::DataObjectPtr getProperties(); - - /** - * Get an SDO data factory which will allow the component to - * create data objects for all the types configured for this - * component. - * @return A data factory to be used by the component to create - * new data objects. - */ - virtual commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Destructor - */ - virtual ~ComponentContext(); - - /** - * Constructor - */ - ComponentContext(const ComponentContext&); - - /** - * Copy operator - */ - ComponentContext& operator=(const ComponentContext&); - - /** - * Constructor to create an interface class from the contained - * implementation. - * @param implementation the actual implementation class - */ - ComponentContext(ComponentContext* implementation); - - private: - - /** - * Pointer to the class which provides the actual implementation. - */ - ComponentContext* impl; - - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_componentcontext_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp deleted file mode 100644 index d3f06e1b12..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp +++ /dev/null @@ -1,127 +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 "commonj/sdo/SDO.h" - -#include "osoa/sca/CompositeContext.h" -#include "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/cpp/CompositeContextImpl.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::cpp; - - -namespace osoa -{ - namespace sca - { - // =========== - // Constructor - // =========== - CompositeContext::CompositeContext(CompositeContext* implementation) - : impl(implementation) - { - logentry(); - } - - // =================================== - // Copy constructor: create a new impl - // =================================== - CompositeContext::CompositeContext(const CompositeContext& ctx) - { - logentry(); - impl = new CompositeContextImpl( - tuscany::sca::SCARuntime::getCurrentRuntime()->getDefaultComponent()); - } - - // ============================= - // operator= : create a new impl - // ============================= - CompositeContext& CompositeContext::operator=(const CompositeContext& ctx) - { - logentry(); - if (this != &ctx) - { - impl = new CompositeContextImpl( - tuscany::sca::SCARuntime::getCurrentRuntime()->getDefaultComponent()); - } - return *this; - } - - // ========== - // Destructor - // ========== - CompositeContext::~CompositeContext() - { - logentry(); - delete impl; - } - - // ==================================================== - // getCurrent: create a context from the current composite - // ==================================================== - CompositeContext CompositeContext::getCurrent() - { - logentry(); - try - { - CompositeContext* cci = new CompositeContextImpl( - tuscany::sca::SCARuntime::getCurrentRuntime()->getDefaultComponent()); - - return CompositeContext(cci); - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - // ============= - // locateService - // ============= - void* CompositeContext::locateService(const std::string& serviceName) - { - logentry(); - void* sp = impl->locateService(serviceName); - return sp; - } - - // ============= - // getDataFactory - // ============= - DataFactoryPtr CompositeContext::getDataFactory() - { - logentry(); - DataFactoryPtr df = impl->getDataFactory(); - return df; - } - - - } // End namespace sca -} // End namespace osoa diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.h deleted file mode 100644 index a047f82e46..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.h +++ /dev/null @@ -1,99 +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 osoa_sca_compositecontext_h -#define osoa_sca_compositecontext_h - -#include "commonj/sdo/SDO.h" - -#include "osoa/sca/export.h" - -namespace osoa -{ - namespace sca - { - /** - * An SCA component implementation, or a non-SCA client, uses the - * CompositeContext class to retrieve information about the configured - * SCA composite. - */ - class SCA_CPP_API CompositeContext - { - - public: - /** - * Return a new CompositeContext for the current Component. - */ - static CompositeContext getCurrent(); - - /** - * Resolve a service name into a single component service. - * @param serviceName The name of the service in the form - * "component name"/"service name". The service name is - * optional in the component has one service. - * @return A pointer to an object which can be cast to the - * business interface of the target service. - */ - virtual void* locateService(const std::string& serviceName); - - /** - * Get an SDO data factory which will allow the component to - * create data objects for all the types configured for this - * component. - * @return A data factory to be used by the component to create - * new data objects. - */ - virtual commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Destructor. - */ - virtual ~CompositeContext(); - - /** - * Constructor - */ - CompositeContext(const CompositeContext&); - - /** - * Copy operator - */ - CompositeContext& operator=(const CompositeContext&); - - /** - * Constructor to create an interface class from the contained - * implementation. - * @param implementation The actual implementation class. - */ - CompositeContext(CompositeContext* implementation); - - private: - - /** - * Pointer to the class which provides the actual implementation. - */ - CompositeContext* impl; - - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_compositecontext_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h deleted file mode 100644 index 6d64a32dd6..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h +++ /dev/null @@ -1,105 +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 osoa_sca_serviceruntimeexception_h -#define osoa_sca_serviceruntimeexception_h - -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/Exceptions.h" - -namespace osoa -{ - namespace sca - { - /** - * Top level exception to represent all the exceptions that may be - * thrown by an SCA runtime implementation. - */ - class SCA_CPP_API ServiceRuntimeException : public tuscany::sca::TuscanyRuntimeException - { - public: - ServiceRuntimeException( - const char *name="ServiceRuntimeException", - severity_level sev=Severe, - const char* msg_text="") - : tuscany::sca::TuscanyRuntimeException(name, sev, msg_text) - { - } - - ServiceRuntimeException(const tuscany::sca::TuscanyRuntimeException& e) - : tuscany::sca::TuscanyRuntimeException(e) - { - } - }; // End ServiceRuntimeException class definition - - /** - * A remotable service is currently unavailable. It is possible that a retry - * may resolve this exception. - */ - class SCA_CPP_API ServiceUnavailableException: public ServiceRuntimeException - { - public: - ServiceUnavailableException(const char* serviceName) - : ServiceRuntimeException("ServiceUnavailableException", Warning, - serviceName) - { - } - private: - }; // End ServiceUnavailableException class definition - - - /** - * The target of a wire cannot be found, or the reference has not been - * configured. - */ - class SCA_CPP_API ServiceNotFoundException: public ServiceRuntimeException - { - public: - ServiceNotFoundException(const char* msg) - : ServiceRuntimeException("ServiceNotFoundException", Error, - msg) - { - } - private: - }; // End ServiceNotFoundException class definition - - - /** - * There is no current component (for example, if a non-SCA component - * tries to get the current ComponentContext). - */ - class SCA_CPP_API ComponentContextException: public ServiceRuntimeException - { - public: - ComponentContextException(const char* msg) - : ServiceRuntimeException("ComponentContextException", Error, - msg) - { - } - private: - }; // End ComponentContextException class definition - - - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_serviceruntimeexception_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/export.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/export.h deleted file mode 100644 index 8a69913be4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/export.h +++ /dev/null @@ -1,42 +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 osoa_sca_export_h -#define osoa_sca_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_CPP_EXPORTS -#define SCA_CPP_API __declspec(dllexport) -#else -#define SCA_CPP_API __declspec(dllimport) -#endif - -#else -#include <sys/time.h> -#include <inttypes.h> -#include <stdlib.h> -#define SCA_CPP_API -#endif - -#endif // osoa_sca_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/sca.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/sca.h deleted file mode 100644 index 6cce9453d7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/sca.h +++ /dev/null @@ -1,31 +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 osoa_sca_sca_h -#define osoa_sca_sca_h - -#include "osoa/sca/export.h" -#include "osoa/sca/CompositeContext.h" -#include "osoa/sca/ComponentContext.h" -#include "osoa/sca/ServiceRuntimeException.h" - -#endif // osoa_sca_sca_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp deleted file mode 100644 index 74a30fb772..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp +++ /dev/null @@ -1,72 +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/cpp/CPPExtension.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/cpp/CPPImplementationExtension.h" -#include "tuscany/sca/cpp/CPPInterfaceExtension.h" - - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_cpp_initialize() - { - tuscany::sca::cpp::CPPExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - // =================================================================== - // Constructor for the CPPExtension class. - // =================================================================== - CPPExtension::CPPExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the CPPExtension class. - // =================================================================== - CPPExtension::~CPPExtension() - { - logentry(); - } - - void CPPExtension::initialize() - { - logentry(); - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->registerImplementationExtension(new CPPImplementationExtension()); - runtime->registerInterfaceExtension(new CPPInterfaceExtension()); - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.h deleted file mode 100644 index d6c872629d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.h +++ /dev/null @@ -1,57 +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_cpp_cppextension_h -#define tuscany_sca_cpp_cppextension_h - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - class CPPExtension - { - public: - /** - * Default constructor - */ - CPPExtension(); - - /** - * Destructor - */ - virtual ~CPPExtension(); - - static void initialize(); - - private: - - }; - - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_cppextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp deleted file mode 100644 index b5312ab243..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp +++ /dev/null @@ -1,101 +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/cpp/CPPImplementationExtension.h" -#include "tuscany/sca/cpp/model/CPPImplementation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::util; -using namespace tuscany::sca::model; - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - // =================================================================== - // Constructor for the CPPImplementationExtension class. - // =================================================================== - CPPImplementationExtension::CPPImplementationExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the CPPImplementationExtension class. - // =================================================================== - CPPImplementationExtension::~CPPImplementationExtension() - { - logentry(); - } - - const string CPPImplementationExtension::extensionName("cpp"); - const string CPPImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#CPPImplementation"); - - // =================================================================== - // loadModelElement - load the info from implementation.cpp - // =================================================================== - ComponentType* CPPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation) - { - logentry(); - string library = scdlImplementation->getCString("library"); - string header = scdlImplementation->getCString("header"); - string className = scdlImplementation->getCString("class"); - string scopeName = scdlImplementation->getCString("scope"); - - CPPImplementation::Scope scope; - if (scopeName == "composite") - { - scope = CPPImplementation::COMPOSITE; - } - else - { - scope = CPPImplementation::STATELESS; - } - - string headerPath; - string headerStub; - - // Separate any path element - Utils::rTokeniseString("/", header, headerPath, headerStub); - if (headerPath != "") - { - headerPath += "/"; - } - - // Determine the header stub name - string tmp; - Utils::rTokeniseString(".h", headerStub, headerStub, tmp); - - CPPImplementation* cppImpl = new CPPImplementation( - composite, library, header, headerPath, headerStub, className, scope); - - return cppImpl; - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h deleted file mode 100644 index 8eb7b88691..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h +++ /dev/null @@ -1,74 +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_cpp_cppimplementationextension_h -#define tuscany_sca_cpp_cppimplementationextension_h - -#include "tuscany/sca/extension/ImplementationExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - class CPPImplementationExtension : public ImplementationExtension - { - public: - /** - * Default constructor - */ - CPPImplementationExtension(); - - /** - * Destructor - */ - virtual ~CPPImplementationExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema type for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.cpp") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ComponentType* getImplementation( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlImplementation); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_cppimplementationextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp deleted file mode 100644 index 7bb84a7673..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp +++ /dev/null @@ -1,71 +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/cpp/CPPInterfaceExtension.h" -#include "tuscany/sca/cpp/model/CPPInterface.h" -#include "tuscany/sca/util/Logging.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - // =================================================================== - // Constructor for the CPPInterfaceExtension class. - // =================================================================== - CPPInterfaceExtension::CPPInterfaceExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the CPPInterfaceExtension class. - // =================================================================== - CPPInterfaceExtension::~CPPInterfaceExtension() - { - logentry(); - } - - const string CPPInterfaceExtension::extensionName("cpp"); - const string CPPInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#CPPInterface"); - - // =================================================================== - // loadModelElement - load the info from interface.cpp - // =================================================================== - tuscany::sca::model::Interface* CPPInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface) - { - logentry(); - - string header = scdlInterface->getCString("header"); - string className = scdlInterface->getCString("class"); - bool remotable = scdlInterface->getBoolean("remotable"); - - return new CPPInterface(header, className, remotable, false); - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h deleted file mode 100644 index 04ac9f6970..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h +++ /dev/null @@ -1,74 +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_cpp_cppinterfaceextension_h -#define tuscany_sca_cpp_cppinterfaceextension_h - -#include "tuscany/sca/extension/InterfaceExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - class CPPInterfaceExtension : public InterfaceExtension - { - public: - /** - * Default constructor - */ - CPPInterfaceExtension(); - - /** - * Destructor - */ - virtual ~CPPInterfaceExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema type for this interface extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::Interface* getInterface( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlInterface); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_cppinterfaceextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp deleted file mode 100644 index cc45ea9fb8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp +++ /dev/null @@ -1,192 +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 "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/cpp/CPPServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ComponentType.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/cpp/model/CPPImplementation.h" -#include "tuscany/sca/cpp/model/CPPReferenceBinding.h" - -using namespace std; -using namespace osoa::sca; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // ============================ - // Constructor: Create a proxy - // ============================ - CPPServiceProxy::CPPServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // ---------------------- - // Get the component - // ---------------------- - Component* component = reference->getComponent(); - string name = reference->getType()->getName(); - - // Get the service wrapper - CPPReferenceBinding* referenceBinding = (CPPReferenceBinding*)reference->getBinding(); - - ServiceWrapper* serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - - createProxy(component, name, serviceWrapper); - } - - // ============================ - // Constructor: Create a proxy - // ============================ - CPPServiceProxy::CPPServiceProxy(Service* service) - : ServiceProxy(0) - { - logentry(); - - // ---------------------- - // Get the component - // ---------------------- - Component* component = service->getComponent(); - string name = service->getType()->getName(); - - // Get the service wrapper - ServiceWrapper* serviceWrapper = service->getBinding()->getServiceWrapper(); - - createProxy(component, name, serviceWrapper); - } - - void CPPServiceProxy::createProxy(Component* component, const string& name, ServiceWrapper* serviceWrapper) - { - logentry(); - - ComponentType* componentType = component->getType(); - if (!componentType) - { - string msg = "Component " + component->getName() + " has no implementation defined"; - throwException(ServiceNotFoundException, msg.c_str()); - } - - // If we got here we have a CPP implementation - CPPImplementation* impl = (CPPImplementation *)componentType; - - // ---------------------------------------------------- - // Get implementation dll name and service factory name - // ---------------------------------------------------- - string library = impl->getLibrary(); - string headerStub = impl->getHeaderStub(); - - string fullLibraryName = component->getComposite()->getRoot() + "/" + library; - string proxyFactoryName = headerStub + "_" + name + "_Proxy_Factory"; - string proxyDestructorName = headerStub + "_" + name + "_Proxy_Destructor"; - typedef void* (* PROXYFACTORY) (ServiceWrapper*); - - // ------------ - // Load the dll - // ------------ - proxyLibrary = Library(fullLibraryName); - - // ------------------------- - // Locate the factory method - // ------------------------- - PROXYFACTORY proxyFactory = (PROXYFACTORY)proxyLibrary.getSymbol(proxyFactoryName); - if (!proxyFactory) - { - logerror("Unable to locate %s in library %s", - proxyFactoryName.c_str(), fullLibraryName.c_str()); - string msg = "Unable to locate " + proxyFactoryName + " in library " + fullLibraryName; - throwException(ServiceNotFoundException, msg.c_str()); - } - - // ----------------------------------- - // Now create an instance of the proxy - // ----------------------------------- - void* proxy = proxyFactory(serviceWrapper); - if (!proxy) - { - logerror("Factory method %s in library %s returned null", - proxyFactoryName.c_str(), fullLibraryName.c_str()); - string msg = "Factory method " + proxyFactoryName + " in library " + fullLibraryName + " returned null"; - throwException(ServiceNotFoundException, msg.c_str()); - } - else - { - proxies.push_back(proxy); - } - - // ------------------------- - // Get the destructor method - // ------------------------- - destructor = (PROXYDESTRUCTOR)proxyLibrary.getSymbol(proxyDestructorName); - } - - // ========== - // Destructor - // ========== - CPPServiceProxy::~CPPServiceProxy() - { - logentry(); - - // Delete the proxies - if (destructor != NULL && proxies.size() != 0) - { - destructor(*proxies.begin()); - } - } - - CPPServiceProxy::PROXIES CPPServiceProxy::getProxies() - { - return proxies; - } - - void* CPPServiceProxy::getProxy() - { - logentry(); - - if (proxies.size() != 0) - { - return *proxies.begin(); - } - else - { - return NULL; - } - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.h deleted file mode 100644 index 8406e9bc44..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.h +++ /dev/null @@ -1,117 +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_cpp_cppserviceproxy_h -#define tuscany_sca_cpp_cppserviceproxy_h - -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - /** - * 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 CPPServiceProxy : public 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. - */ - CPPServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param reference The service on the target component. - * @param target The wrapper of the target service. - */ - CPPServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~CPPServiceProxy(); - - /** - * Return an instance of the proxy created for this particular component and reference. - * @return The proxy. - */ - virtual void* getProxy(); - - /** - * Return the proxies created for this particular component and reference. - * @return The proxies. - */ - typedef std::list<void*> PROXIES; - virtual PROXIES getProxies(); - - private: - - /** - * Create the proxy - */ - void createProxy(tuscany::sca::model::Component* component, - const std::string& name, - ServiceWrapper* serviceWrapper); - - /** - * Holds the instances of the code generated proxies. - */ - PROXIES proxies; - - /** - * A function pointer to the destructor of the proxy. - */ - typedef void (* PROXYDESTRUCTOR) (void*); - PROXYDESTRUCTOR destructor; - - /** - * The library which contains the code for the proxy. - */ - tuscany::sca::util::Library proxyLibrary; - - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_cppserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp deleted file mode 100644 index 1304ab92a0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp +++ /dev/null @@ -1,194 +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 "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/cpp/CPPServiceWrapper.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/cpp/model/CPPImplementation.h" -#include "tuscany/sca/model/Interface.h" - -using namespace std; -using namespace osoa::sca; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // =========== - // Constructor - // =========== - CPPServiceWrapper::CPPServiceWrapper(Service* service) - : ServiceWrapper(service) - { - logentry(); - - component = service->getComponent(); - interf = service->getType()->getInterface(); - implementation = (CPPImplementation*)component->getType(); - } - - // ========== - // Destructor - // ========== - CPPServiceWrapper::~CPPServiceWrapper() - { - logentry(); - } - - - // ====================================================================== - // getImplementation: get an implementation for this scope - // ====================================================================== - void* CPPServiceWrapper::getImplementation() - { - logentry(); - if (implementation->getScope() == CPPImplementation::COMPOSITE) - { - // fill the cache if needed - if ( !implementation->getStaticImplementation() ) - { - implementation->setStaticImplementation(newImplementation()); - } - return implementation->getStaticImplementation(); - } - else // (scope == CPPInterface::STATELESS) - { - return newImplementation(); - } - } - - // ====================================================================== - // releaseImplementation: release the implementation for this scope - // ====================================================================== - void CPPServiceWrapper::releaseImplementation() - { - logentry(); - if (implementation->getScope() == CPPImplementation::STATELESS) - { - deleteImplementation(); - } - } - - // ====================================================================== - // invoke: wrapper call to service with setting the component context - // ====================================================================== - void CPPServiceWrapper::invoke(Operation& operation) - { - logentry(); - - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->setCurrentComponent(component); - - try - { - invokeService(operation); - } - catch (...) - { - runtime->unsetCurrentComponent(); - throw; - } - runtime->unsetCurrentComponent(); - } - - void CPPServiceWrapper::setLibrary(Library* lib) - { - wrapperLibrary = lib; - } - - // ====================================================================== - // getServiceWrapper: create a wrapper for the target ComponentService - // ====================================================================== - CPPServiceWrapper* CPPServiceWrapper::getServiceWrapper(Service* service) - { - logentry(); - - CPPServiceWrapper* serviceWrapper = 0; - - // ----------------------------------------------- - // Get the implementation for the target component - // ----------------------------------------------- - Component* component = service->getComponent(); - CPPImplementation* impl = (CPPImplementation*)component->getType(); - if (!impl) - { - string msg = "Component " + component->getName() + " has no implementation defined"; - throwException(ServiceNotFoundException, msg.c_str()); - } - - // ---------------------------------------------------- - // Get implementation dll name and wrapper factory name - // ---------------------------------------------------- - string libraryName = impl->getLibrary(); - string wrapperFactoryName = impl->getHeaderStub() - + "_" + service->getType()->getName() + "_Wrapper_Factory"; - - // ------------ - // Load the dll - // ------------ - string fullLibraryName = component->getComposite()->getRoot() + "/" + libraryName; - typedef CPPServiceWrapper* (* WRAPPERFACTORY) (Service*); - Library* wrapperLib = new Library(fullLibraryName); - - // ------------------------- - // Locate the factory method - // ------------------------- - WRAPPERFACTORY wrapperFactory = (WRAPPERFACTORY)wrapperLib->getSymbol(wrapperFactoryName); - if (!wrapperFactory) - { - logerror("Unable to locate %s in library %s", - wrapperFactoryName.c_str(), fullLibraryName.c_str()); - string msg = "Unable to locate " + wrapperFactoryName + " in library " + fullLibraryName; - throwException(ServiceNotFoundException, msg.c_str()); - } - - // ------------------------------------- - // Now create an instance of the wrapper - // ------------------------------------- - serviceWrapper = wrapperFactory(service); - if (!serviceWrapper) - { - logerror("Factory method %s in library %s returned null", - wrapperFactoryName.c_str(), fullLibraryName.c_str()); - string msg = "Factory method " + wrapperFactoryName + " in library " + fullLibraryName + " returned null"; - throwException(ServiceNotFoundException, msg.c_str()); - } - serviceWrapper->setLibrary(wrapperLib); - - return serviceWrapper; - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h deleted file mode 100644 index 899deca07a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h +++ /dev/null @@ -1,155 +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_cpp_cppservicewrapper_h -#define tuscany_sca_cpp_cppservicewrapper_h - -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/cpp/model/CPPImplementation.h" -#include "tuscany/sca/util/Library.h" - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - /** - * 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 SCA_CPP_API CPPServiceWrapper : public ServiceWrapper - { - public: - /** - * Factory method to create a new CPPServiceWrapper 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 CPPServiceWrapper* getServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Constructor. - * @param target The component service to which this wrapper refers. - */ - CPPServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~CPPServiceWrapper(); - - /** - * 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. - */ - virtual void invoke(Operation& operation); - - /** - * Return the loaded shared library for the target component. - */ - tuscany::sca::util::Library* getLibrary() const { return wrapperLibrary; } - - protected: - - /** - * Delegated method to invoke the correct method on the target component. - * Implemented by the subtype. - */ - 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. - */ - virtual void* newImplementation() = 0; - - /** - * Delegated method to delete the current instance of the component - * implementation. - * Implemented by the subtype. - */ - virtual void deleteImplementation() = 0; - - /** - * Return the current instance of the component implementation. - * @return A pointer to an instance of the component implementation class. - */ - virtual void* getImplementation(); - - /** - * Indicates that the current instance of the component implementation - * has been finished with. - * Will call CPPServiceWrapper#deleteImplementation if the - * implementation is stateless (so that a new instance is returned - * for each call). - */ - virtual void releaseImplementation(); - - private: - /** - * The component to which this wrapper refers. - */ - tuscany::sca::model::Component* component; - - /** - * A pointer to the interface which the service exposes. - */ - tuscany::sca::model::Interface* interf; - - /** - * The component implementation - */ - CPPImplementation* implementation; - - /** - * Pointer to the loaded library which contains the component - * implementation. - */ - tuscany::sca::util::Library* wrapperLibrary; - - /** - * Set the loaded library which contains the component - * implementation. - * @param lib The library. - */ - void setLibrary(tuscany::sca::util::Library* lib); - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_cppservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp deleted file mode 100644 index 3de0cb968c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp +++ /dev/null @@ -1,208 +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 "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/cpp/ComponentContextImpl.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ReferenceBinding.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/ServiceBinding.h" - -using namespace std; -using namespace osoa::sca; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // =========== - // Constructor - // =========== - ComponentContextImpl::ComponentContextImpl(Component* comp) - : ComponentContext(0), component(comp) - { - logentry(); - } - - // ========== - // Destructor - // ========== - ComponentContextImpl::~ComponentContextImpl() - { - logentry(); - } - - - // ========================================================================== - // getServices: return a list of Proxies for services wired to this reference - // ========================================================================== - std::list<void*> ComponentContextImpl::getServices(const std::string& referenceName) - { - logentry(); - try - { - // -------------------------------------------------------------- - // locate reference in the current component and determine target - // -------------------------------------------------------------- - Reference* reference = component->findReference(referenceName); - if (!reference) - { - string message = "Reference not defined: "; - message = message + referenceName; - throwException(ServiceNotFoundException, message.c_str()); - } - - // Get a service proxy from the binding configured on the reference - CPPServiceProxy* serviceProxy = (CPPServiceProxy*)reference->getBinding()->getServiceProxy(); - if (serviceProxy == NULL) - { - string message = "Reference "; - message = message + referenceName + " not wired"; - throwException(ServiceNotFoundException, message.c_str()); - } - - return serviceProxy->getProxies(); - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - - } // End getServices() - - - // =================================================================== - // getService: return a Proxy for the services wired to this reference - // =================================================================== - void* ComponentContextImpl::getService(const std::string& referenceName) - { - logentry(); - try - { - // -------------------------------------------------------------- - // locate reference in the current component and determine target - // -------------------------------------------------------------- - Reference* reference = component->findReference(referenceName); - if (!reference) - { - string message = "Reference not defined: "; - message = message + referenceName; - throwException(ServiceNotFoundException, message.c_str()); - } - - // -------------------- - // Validate the request - // -------------------- - switch (reference->getType()->getMultiplicity()) - { - case ReferenceType::ZERO_MANY: - case ReferenceType::ONE_MANY: - { - string message = "getService() called for reference with multiplicity >1 :"; - message = message + referenceName; - throwException(ServiceNotFoundException, message.c_str()); - } - default: - { - } - } // end switch - - // Get a service proxy from the binding configured on the reference - CPPServiceProxy* serviceProxy = (CPPServiceProxy*)reference->getBinding()->getServiceProxy(); - if (serviceProxy == NULL) - { - string message = "Reference "; - message = message + referenceName + " not wired"; - throwException(ServiceNotFoundException, message.c_str()); - } - - void* service = serviceProxy->getProxy(); - - return service; - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - - } // End getService() - - // ============================================== - // getProperties: return the component properties - // ============================================== - DataObjectPtr ComponentContextImpl::getProperties() - { - logentry(); - try - { - DataObjectPtr properties = component->getProperties(); - return properties; - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - // ============================================== - // getDataFactory: return the data factory for the composite in which - // this component resides - // ============================================== - commonj::sdo::DataFactoryPtr ComponentContextImpl::getDataFactory() - { - logentry(); - try - { - commonj::sdo::DataFactoryPtr dataFactory = component->getComposite()->getDataFactory(); - return dataFactory; - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.h deleted file mode 100644 index 412c276d8c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.h +++ /dev/null @@ -1,119 +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_cpp_componentcontextimpl_h -#define tuscany_sca_cpp_componentcontextimpl_h - -#include "osoa/sca/ComponentContext.h" - -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/cpp/CPPServiceProxy.h" - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - /** - * Contains the actual implementation of a ComponentContext interface. - */ - class ComponentContextImpl : public osoa::sca::ComponentContext - { - - public: - /** - * Constructor that takes a Component which represents the runtime - * model for this context. - */ - ComponentContextImpl(tuscany::sca::model::Component* component); - - /** - * Default constructor. - */ - virtual ~ComponentContextImpl(); - - /** - * See ComponentContext. - */ - virtual void* getService(const std::string& referenceName); - - /** - * See ComponentContext. - */ - virtual std::list<void*> getServices(const std::string& referenceName); - - /** - * See ComponentContext. - */ - virtual commonj::sdo::DataObjectPtr getProperties(); - - /** - * See ComponentContext. - */ - virtual commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Returns the contained Component. - * @return The Component to which this context refers. - */ - virtual tuscany::sca::model::Component* getComponent() {return component;} - - private: - ComponentContextImpl(const ComponentContextImpl&); - ComponentContextImpl& operator=(const ComponentContextImpl&); - - /** - * Pointer to the runtime model Component to which this - * context refers. - */ - tuscany::sca::model::Component* component; - - /** - * Helper method to return a proxy to a service. - * @param serviceReference The source reference. - * @param target The target to which this source reference is wired. - * @return A pointer to an object which can be cast to the business - * class representing the target. - */ - void* getServiceProxy( - tuscany::sca::model::Reference* serviceReference, - tuscany::sca::model::Service* target); - - /** - * Helper method to return a wrapper for a target service. - * @param target The target for which this wrapper is to be created. - * @return The service wrapper. - */ - ServiceWrapper* getServiceWrapper(tuscany::sca::model::Service* target); - - }; - - } // End namespaca cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_componentcontextimpl_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp deleted file mode 100644 index ae8183231e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp +++ /dev/null @@ -1,128 +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 "commonj/sdo/SDO.h" - -#include "osoa/sca/ServiceRuntimeException.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/cpp/CompositeContextImpl.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/cpp/CPPServiceProxy.h" - -using namespace std; -using namespace commonj::sdo; -using namespace osoa::sca; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // =========== - // Constructor - // =========== - CompositeContextImpl::CompositeContextImpl(Component* component) - : CompositeContext(0), component(component), composite((Composite*)component->getType()) - { - logentry(); - } - - // ========== - // Destructor - // ========== - CompositeContextImpl::~CompositeContextImpl() - { - logentry(); - } - - // =========================================================================== - // locateService: return a proxy connected to a wrapper for the target service - // =========================================================================== - void* CompositeContextImpl::locateService(const std::string& serviceName) - { - logentry(); - try - { - // ---------------------------- - // Locate the component service - // ---------------------------- - Service* service = composite->findComponentService(serviceName); - string msg; - if (!service) - { - msg = "Service not found: "; - msg = msg + serviceName; - throwException(ServiceNotFoundException, msg.c_str()); - } - - // ---------------------------- - // Get a Proxy for this service - // ---------------------------- - - // The locate service API is used from CPP clients so we are using - // our default service proxy here - CPPServiceProxy* serviceProxy = new CPPServiceProxy(service); - return serviceProxy->getProxy(); - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - // ============================================== - // getDataFactory: return the data factory for the current composite - // ============================================== - DataFactoryPtr CompositeContextImpl::getDataFactory() - { - logentry(); - try - { - DataFactoryPtr dataFactory = composite->getDataFactory(); - return dataFactory; - } - catch (ServiceRuntimeException&) - { - throw; - } - catch (TuscanyRuntimeException& e) - { - throwException(ServiceRuntimeException, e); - } - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h deleted file mode 100644 index ed0bb8b51c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h +++ /dev/null @@ -1,89 +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_cpp_compositecontextimpl_h -#define tuscany_sca_cpp_compositecontextimpl_h - -#include "osoa/sca/CompositeContext.h" - -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/cpp/CPPServiceProxy.h" - -namespace tuscany -{ - namespace sca - { - - namespace cpp - { - - /** - * Contains the actual implementation of a CompositeContext interface. - */ - class CompositeContextImpl : public osoa::sca::CompositeContext - { - - public: - /** - * Constructor that takes a Composite which represents the runtime - * model for this context. - */ - CompositeContextImpl(tuscany::sca::model::Component* component); - - /** - * See CompositeContext#locateService. - */ - virtual void* locateService(const std::string& serviceName); - - /** - * See CompositeContext. - */ - virtual commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Destructor. - */ - virtual ~CompositeContextImpl(); - - private: - CompositeContextImpl(const CompositeContextImpl&); - CompositeContextImpl& operator=(const CompositeContextImpl&); - - /** - * Pointer to the runtime model Composite object to which this - * context refers. - */ - tuscany::sca::model::Composite* composite; - - /** - * Pointer to the runtime model Component object to which this - * context refers. - */ - tuscany::sca::model::Component* component; - - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_compositecontextimpl_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.cpp deleted file mode 100644 index f8aad90f7a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.cpp +++ /dev/null @@ -1,83 +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/cpp/TuscanyRuntime.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // =================================================================== - // Constructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::TuscanyRuntime(const string& componentName, const string& root, const string& path) - { - logentry(); - loginfo("System root: %s", root.c_str()); - systemRoot = root; - loginfo("System path: %s", path.c_str()); - systemPath = path; - loginfo("Default component name: %s", componentName.c_str()); - defaultComponentName = componentName; - - runtime = new SCARuntime("", systemRoot, systemPath, "", defaultComponentName); - } - - // =================================================================== - // Destructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::~TuscanyRuntime() - { - logentry(); - - delete (SCARuntime*)runtime; - } - - // =================================================================== - // Start the runtime. - // =================================================================== - void TuscanyRuntime::start() - { - logentry(); - SCARuntime::setCurrentRuntime((SCARuntime*)runtime); - } - - // =================================================================== - // Stop the runtime. - // =================================================================== - void TuscanyRuntime::stop() - { - logentry(); - SCARuntime::setCurrentRuntime(NULL); - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.h deleted file mode 100644 index b4cf31220a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#ifndef tuscany_sca_cpp_tuscanyruntime_h -#define tuscany_sca_cpp_tuscanyruntime_h - -#include <string> - -#include "osoa/sca/export.h" - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - /** - * A singleton which represents the executing SCA runtime. - */ - class SCA_CPP_API TuscanyRuntime - { - public: - /** - * Default constructor - */ - TuscanyRuntime(const std::string& defaultComponentName = "", - const std::string& root = "", const std::string& path = ""); - - /** - * Destructor - */ - virtual ~TuscanyRuntime(); - - /** - * start the runtime - */ - void start(); - - /** - * stop the runtime - */ - void stop(); - - - private: - std::string systemRoot; - std::string systemPath; - std::string defaultComponentName; - - void* defaultComponent; - void* runtime; - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_tuscanyruntime_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp deleted file mode 100644 index 56098ced93..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp +++ /dev/null @@ -1,90 +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/util/Logging.h" -#include "tuscany/sca/cpp/model/CPPImplementation.h" -#include "tuscany/sca/cpp/model/CPPServiceBinding.h" -#include "tuscany/sca/cpp/model/CPPReferenceBinding.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - - namespace cpp - { - - // Constructor - CPPImplementation::CPPImplementation(Composite* composite, const string& library, const string& header, - const string&headerPath, const string& headerStub, const string& className, Scope scope) - : ComponentType(composite, headerPath + headerStub), - library(library), header(header), headerPath(headerPath), - headerStub(headerStub), className(className), scope(scope), staticImpl(0) - { - } - - CPPImplementation::~CPPImplementation() - { - } - - void CPPImplementation::initializeComponent(Component* component) - { - ComponentType::initializeComponent(component); - - // Create CPP bindings for all the services - const Component::SERVICE_MAP& services = component->getServices(); - Component::SERVICE_MAP::const_iterator iter = services.begin(); - for (unsigned int i=0; i< services.size(); i++) - { - Service *service = iter->second; - CPPServiceBinding* binding = new CPPServiceBinding(service); - service->setBinding(binding); - iter++; - } - - // Create CPP bindings for all the references - const Component::REFERENCE_MAP& references = component->getReferences(); - Component::REFERENCE_MAP::const_iterator refiter = references.begin(); - for (unsigned int ri=0; ri< references.size(); ri++) - { - Reference *reference = refiter->second; - CPPReferenceBinding* binding = new CPPReferenceBinding(reference); - reference->setBinding(binding); - refiter++; - } - } - - void CPPImplementation::setStaticImplementation(void* staticImpl) - { - this->staticImpl = staticImpl; - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h deleted file mode 100644 index 2dfdac616e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h +++ /dev/null @@ -1,163 +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_cpp_model_cppimplementation_h -#define tuscany_sca_cpp_model_cppimplementation_h - -#include <map> -#include <string> - -#include "tuscany/sca/model/ComponentType.h" - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - /** - * Holds information about an SCA implementation written in C++ - */ - class CPPImplementation : public tuscany::sca::model::ComponentType - { - - public: - /** - * Scope of the component implementation. - */ - enum Scope - { - COMPOSITE, - STATELESS - }; - - /** - * Constructor. - * @param dllName Name of the shared library. - * @param header Name of the header file that contains the class declaring the - * implementation class. - * @param className Name of the class in the header file (could be a blank string - * if this is not specified). - */ - CPPImplementation(tuscany::sca::model::Composite* composite, - const std::string& library, const std::string& header, const std::string&headerPath, - const std::string& headerStub, const std::string& className, Scope scope); - - /** - * Destructor - */ - virtual ~CPPImplementation(); - - /** - * Initialize a component of this type. - * @param component The component to initialize. - */ - virtual void initializeComponent(tuscany::sca::model::Component* component); - - /** - * Returns the name of the shared library. - * @return The name of the shared library. - */ - const std::string& getLibrary() const { return library; } - - /** - * Get the name of the header file. - * @return Name of the header file. - */ - const std::string& getHeader() const { return header; } - - /** - * Get the header file name without the extension. - * @return The name of the header file without any extension. - */ - const std::string& getHeaderStub() const { return headerStub; } - - /** - * Get the header path. - * @return The pathe element of the header. - */ - const std::string& getHeaderPath() const { return headerPath; } - - /** - * Get the name of the class. - * @return The class name if specified. - */ - const std::string& getClass() const { return className; } - - /** - * Returns the implementation scope - */ - Scope getScope() { return scope; } - - /** - * Returns the implementation instance (to be used if the scope is set to composite) - */ - void* getStaticImplementation() { return staticImpl; } - - /** - * Sets the implementation instance (to be used if the scope is set to composite) - */ - void setStaticImplementation(void* staticImpl); - - private: - - /** - * Name of the shared library. - */ - std::string library; - - /** - * Name of the header file describing the interface. - */ - std::string header; - - /** - * Name of the header file without the extension. - */ - std::string headerStub; - - /** - * Path element of the header. - */ - std::string headerPath; - - /** - * Name of the class in the header file declaring the implementation. - * May be an empty string if not set in the SCDL file. - */ - std::string className; - - /** - * Scope of the implementation - */ - Scope scope; - - /** - * Holds the implementation instance if the scope is set to composite. - */ - void* staticImpl; - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_model_cppimplementation_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp deleted file mode 100644 index 2322d1bdf5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp +++ /dev/null @@ -1,63 +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/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/cpp/model/CPPInterface.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - const string CPPInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#CPPInterface"); - - // Constructor - CPPInterface::CPPInterface( - const string& header, - const string& className, - bool remotable, - bool conversational) - : Interface(remotable, conversational), header(header), className(className) - { - string::size_type dot = header.rfind(".h"); // this will also find .hpp - if (dot != string::npos) - { - headerStub = header.substr(0, dot); - } - else - { - headerStub = header; - } - - } - - CPPInterface::~CPPInterface() - { - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h deleted file mode 100644 index fdbf314d3d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h +++ /dev/null @@ -1,117 +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_cpp_model_cppinterface_h -#define tuscany_sca_cpp_model_cppinterface_h - -#include <string> - -#include "tuscany/sca/model/Interface.h" - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - /** - * Holds information about an interface described using a C++ - * header file. - */ - class CPPInterface : public tuscany::sca::model::Interface - { - - public: - /** - * Constuctor. - * @param header Name of the header file containing the class that - * describes the interface. - * @param className Name of the class in the header file that - * describes the interface. - * @param scope The scope of the interface (stateless or composite). - * @param remotable True if the interface is remotable. - */ - CPPInterface( - const std::string& header, - const std::string& className, - bool remotable, - bool conversational); - - /** - * Destructor. - */ - virtual ~CPPInterface(); - - /** - * Get the name of the header file. - * @return The name of the header file containing the definition of the - * interface. - */ - const std::string& getHeader() { return header; } - - /** - * Return the name of the header file without the extension. - * @return Header file name without any extension. - */ - const std::string& getHeaderStub() { return headerStub; } - - /** - * Get the name of the class. - * @return The name of the class defining the interface. - */ - const std::string& getClass() { return className; } - - /** - * return the QName of the schema type for this interface type - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp") - */ - virtual const std::string& getInterfaceTypeQName() { return typeQName; }; - - private: - - /** - * Name of the header file containing the definition of the interface. - */ - std::string header; - - /** - * Name of the header file without the extension. - */ - std::string headerStub; - - /** - * Name of the class in the header file. - */ - std::string className; - - /** - * The QName of the schema type for this interface type. - */ - static const std::string typeQName; - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_model_cppinterface_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp deleted file mode 100644 index 0c12b7af43..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp +++ /dev/null @@ -1,61 +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/util/Logging.h" -#include "tuscany/sca/cpp/model/CPPReferenceBinding.h" -#include "tuscany/sca/cpp/CPPServiceProxy.h" - -using namespace tuscany::sca::model; - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // Constructor - CPPReferenceBinding::CPPReferenceBinding(Reference* reference) - : ReferenceBinding(reference, ""), serviceProxy(NULL) - { - } - - // Destructor - CPPReferenceBinding::~CPPReferenceBinding() - { - } - - ServiceProxy* CPPReferenceBinding::getServiceProxy() - { - return serviceProxy; - } - - void CPPReferenceBinding::configure(ServiceBinding* binding) - { - setTargetServiceBinding(binding); - - serviceProxy = new CPPServiceProxy(getReference()); - } - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h deleted file mode 100644 index 9860f14765..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h +++ /dev/null @@ -1,87 +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_cpp_model_cppreferencebinding_h -#define tuscany_sca_cpp_model_cppreferencebinding_h - -#include <string> - -#include "tuscany/sca/model/ReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - /** - * Information about a CPP service binding for service or a reference. - */ - class CPPReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param port The definition of the port to which the entrypoint - * or external service is to be bound. This is of the form - * "namespace"#endpoint("service"/"port") - */ - CPPReferenceBinding(tuscany::sca::model::Reference* reference); - - /** - * Destructor. - */ - virtual ~CPPReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#CPPImplementationBinding"; }; - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual ServiceProxy* getServiceProxy(); - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - private: - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_model_cppreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp deleted file mode 100644 index 45afea8375..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp +++ /dev/null @@ -1,54 +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/util/Logging.h" -#include "tuscany/sca/cpp/model/CPPServiceBinding.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - - // Constructor - CPPServiceBinding::CPPServiceBinding(Service* service) - : ServiceBinding(service, "") - { - serviceWrapper = CPPServiceWrapper::getServiceWrapper(service); - } - - // Destructor - CPPServiceBinding::~CPPServiceBinding() - { - } - - ServiceWrapper* CPPServiceBinding::getServiceWrapper() - { - return (ServiceWrapper*)serviceWrapper; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h deleted file mode 100644 index 13b88a84dd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.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_cpp_model_cppservicebinding_h -#define tuscany_sca_cpp_model_cppservicebinding_h - -#include <string> - -#include "tuscany/sca/model/ServiceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace cpp - { - /** - * Information about a CPP service binding for service or a reference. - */ - class CPPServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param port The definition of the port to which the entrypoint - * or external service is to be bound. This is of the form - * "namespace"#endpoint("service"/"port") - */ - CPPServiceBinding(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~CPPServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#CPPImplementationBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - virtual ServiceWrapper* getServiceWrapper(); - - private: - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace cpp - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_cpp_model_cppservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/Makefile.am deleted file mode 100644 index 3a97f02513..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/Makefile.am +++ /dev/null @@ -1,25 +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. - -if WANT_ALL - CPP_TOOLS = scagen -endif -if WANT_CPP - CPP_TOOLS = scagen -endif - -SUBDIRS = ${CPP_TOOLS}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/LICENSE b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/LICENSE deleted file mode 100644 index f433b1a53f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/NOTICE b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/NOTICE deleted file mode 100644 index 44befbee63..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Tuscany SCA Native -Copyright 2005, 2007 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/)
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/README b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/README deleted file mode 100644 index 2831dadd94..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/README +++ /dev/null @@ -1,19 +0,0 @@ -Apache Tuscany C++ M1 build (July, 2006) -=================================== - -http://incubator.apache.org/tuscany - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services PMC. - -Incubation is required of all newly accepted projects until a further review -indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness or -stability of the code, it does indicate that the project has yet to be fully -endorsed by the ASF. - -Thank you for using Tuscany! - -The Tuscany Team. diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/Makefile.am deleted file mode 100644 index 59b4d2095f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/Makefile.am +++ /dev/null @@ -1,35 +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. - -SUBDIRS = - -BUILT_SOURCES = scagen_build -EXTRA_DIST = build.xml scagen.sh src META-INF -bin_SCRIPTS = scagen.sh - -scagen_build: - ant - touch scagen_build - -clean: - rm -rf build - rm -rf docs - rm -f scagen_build - -install-exec-hook: - cp build/scagen.jar $(bindir) - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/build.xml b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/build.xml deleted file mode 100644 index 23e825a1b4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/build.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - - -<project name="org.apache.tuscany.sca.cpp.tools" default="all" basedir="."> - - <target name="init"> - <property name="build.result.folder" value="${basedir}/build" /> - <property name="temp.folder" value="${basedir}/tmp" /> - <property name="junit.jar.folder" value="${basedir}/lib" /> - <property name="tool.name" value="scagen" /> - <property name="bin.dir" value="${basedir}/../../deploy/bin" /> - </target> - - <!-- Add "test" to the depends list below to add auto-testing to the build --> - <!-- a junit.jar is needed at ${junit.jar.folder}/junit.jar though --> - <target name="all" depends="init,jars,scripts,zip.all"> - </target> - - <target name="test" depends="init,jars,test.jar"> - <java classname="org.apache.tuscany.sca.cpp.tools.junit.TestAllCompositesTest"> - <classpath> - <pathelement location="${build.result.folder}/test.jar" /> - <pathelement location="${junit.jar.folder}/junit.jar" /> - <pathelement location="${build.result.folder}/scagen.jar" /> - <pathelement path="${java.class.path}" /> - </classpath> - </java> - </target> - - - - <target name="doc"> - <javadoc packagenames="org.apache.tuscany.sca.cpp.tools.*" sourcepath="src" defaultexcludes="yes" destdir="docs/api" author="true" version="true" use="true" windowtitle="SCA for C++ Tools"> - <doctitle> - <![CDATA[<h1>SCA for C++ Tools</h1>]]> - </doctitle> - <bottom> - <![CDATA[<i>Copyright 2005 The Apache Software Foundation or its licensors, as applicable.</i>]]></bottom> - <group title="C++ Parser" packages="org.apache.tuscany.sca.cpp.tools.common" /> - <group title="SCA Services Generator" packages="org.apache.tuscany.sca.cpp.tools.services" /> - <link offline="true" href="http://java.sun.com/products/jdk/1.2/docs/api/" packagelistLoc="C:\tmp" /> -</javadoc> -</target> - -<target name="jars" depends="init, scagen.jar, src.jar"> -</target> - -<target name="scripts" depends="init"> -<mkdir dir="${build.result.folder}" /> -</target> - - - -<target name="src.jar" depends="init"> -<delete dir="${temp.folder}/src.jar.bin" /> -<mkdir dir="${temp.folder}/src.jar.bin" /> -<!-- Copy necessary resources i.e XSL stylesheets, test input etc - for the src jar too - --> -<copy todir="${temp.folder}/src.jar.bin" failonerror="true"> - <fileset dir="src/" /> -</copy> -<mkdir dir="${build.result.folder}" /> -<jar jarfile="${build.result.folder}/src.jar" basedir="${temp.folder}/src.jar.bin" /> -<delete dir="${temp.folder}/test.jar.bin" /> -</target> - -<target name="test.jar" depends="init, scagen.jar" unless="test.jar" description="Create jar for unit tests: test.jar."> -<delete dir="${temp.folder}/test.jar.bin" /> -<mkdir dir="${temp.folder}/test.jar.bin" /> -<!-- compile the source code --> -<javac srcdir="junit" destdir="${temp.folder}/test.jar.bin" failonerror="true" includeAntRuntime="no"> - <src path="junit/" /> - <classpath> - <pathelement path="${junit.jar.folder}/junit.jar" /> - <pathelement path="${build.result.folder}/scagen.jar" /> - </classpath> -</javac> -<!-- Copy necessary resources i.e XSL stylesheets, test input etc --> -<copy todir="${temp.folder}/test.jar.bin" failonerror="true"> - <fileset dir="junit/" excludes="testoutput/**" /> -</copy> -<mkdir dir="${build.result.folder}" /> -<jar jarfile="${build.result.folder}/test.jar" basedir="${temp.folder}/test.jar.bin" /> -<delete dir="${temp.folder}/test.jar.bin" /> -</target> - -<target name="scagen.jar" depends="init" unless="scagen.jar" description="Create main jar: scagen.jar"> -<delete dir="${temp.folder}/scagen.jar.bin" /> -<mkdir dir="${temp.folder}/scagen.jar.bin" /> -<!-- compile the source code --> -<javac srcdir="src" destdir="${temp.folder}/scagen.jar.bin" failonerror="true" includeAntRuntime="no"> - <src path="src/" /> -</javac> -<!-- Copy necessary resources i.e XSL stylesheets, test input etc --> -<copy todir="${temp.folder}/scagen.jar.bin" failonerror="true"> - <fileset dir="src/" excludes="**/*.java" /> -</copy> - -<copy todir="${temp.folder}/scagen.jar.bin/META-INF" failonerror="true"> - <fileset dir="META-INF/"/> -</copy> - -<mkdir dir="${build.result.folder}" /> -<jar jarfile="${build.result.folder}/scagen.jar" basedir="${temp.folder}/scagen.jar.bin"> - <manifest> - <attribute name="Main-Class" value="org.apache.tuscany.sca.cpp.tools.services.Scagen" /> - </manifest> -</jar> -<delete dir="${temp.folder}/scagen.jar.bin" /> -</target> - -<target name="tobin" depends="jars, scripts" description="move the desired stuff to bin"> - <move file="${build.result.folder}/scagen.jar" todir="${bin.dir}" /> -</target> - - - -<target name="clean" depends="init" description="Clean of all the files created."> -<delete file="${build.result.folder}/test.jar" /> -<delete file="${build.result.folder}/src.jar" /> -<delete file="${build.result.folder}/scagen.jar" /> -<delete file="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" /> -<delete dir="${temp.folder}" /> -</target> - -<target name="zip.all" depends="jars" description="Create a zip containing everything"> -<delete file="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" /> -<zip zipfile="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" excludes="bin/**,tmp/**,lib/**,junit/testoutput/**" basedir="." filesonly="true" whenempty="skip" update="false" /> -<delete dir="${temp.folder}" /> -</target> - -</project> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/CalculatorTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/CalculatorTest.java deleted file mode 100644 index 13c1273983..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/CalculatorTest.java +++ /dev/null @@ -1,33 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -import org.apache.tuscany.sca.cpp.tools.junit.TuscanyTestCase; - -/** - * This test case tests a simple Calculator service tools generation - */ -public class CalculatorTest extends TuscanyTestCase { - - public void testCalculatorCompositeAndComponent() { - testComposite("CalculatorCompositeAndComponent", check_results); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/EnvHandlerTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/EnvHandlerTest.java deleted file mode 100644 index 48d415dd8e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/EnvHandlerTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class EnvHandlerTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public EnvHandlerTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceComposite", check_results); - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceButNotInClassAttrTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceButNotInClassAttrTest.java deleted file mode 100644 index ca7d50ae48..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceButNotInClassAttrTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr SCA composite as - * input data. - */ -public class ImplClassWithNameSpaceButNotInClassAttrTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public ImplClassWithNameSpaceButNotInClassAttrTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr", check_results); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceTest.java deleted file mode 100644 index e019873489..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class ImplClassWithNameSpaceTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public ImplClassWithNameSpaceTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceCompositeImplClassWithNamespace", check_results); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceButNotInClassAttrTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceButNotInClassAttrTest.java deleted file mode 100644 index 11cab070b2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceButNotInClassAttrTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class IntfClassWithNameSpaceButNotInClassAttrTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public IntfClassWithNameSpaceButNotInClassAttrTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr", check_results); - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceTest.java deleted file mode 100644 index a26321d2a3..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class IntfClassWithNameSpaceTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public IntfClassWithNameSpaceTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceCompositeIntfClassWithNamespace", check_results); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/MissingCompositeAndFragmentTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/MissingCompositeAndFragmentTest.java deleted file mode 100644 index e529af0dd0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/MissingCompositeAndFragmentTest.java +++ /dev/null @@ -1,48 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class MissingCompositeAndFragmentTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public MissingCompositeAndFragmentTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - testComposite("MyValueServiceCompositeMissingScaComposite",false); - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/SimplePublicPrivateProtectedTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/SimplePublicPrivateProtectedTest.java deleted file mode 100644 index 3743a1f1f9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/SimplePublicPrivateProtectedTest.java +++ /dev/null @@ -1,49 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -/** - * This is a "run this first" testcase that just tests some simple operations of - * the scagen tools it uses the - * Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite SCA composite as - * input data. - */ -public class SimplePublicPrivateProtectedTest extends TuscanyTestCase { - - /** - * Constructor for CustomerInfoTestOLD. - * - * @param arg0 - */ - public SimplePublicPrivateProtectedTest(String arg0) { - super(arg0); - } - - /** - * Test the Hydra.sca.core\test\testSCASystem\composites\MyValueServiceComposite - * proxy and wrapper generation. - */ - public void testEnvHandler() { - - testComposite("SimplePublicPrivateProtectedTest", check_results); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestAllCompositesTest.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestAllCompositesTest.java deleted file mode 100644 index 1f1d2108e5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestAllCompositesTest.java +++ /dev/null @@ -1,89 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; - -import org.apache.tuscany.sca.cpp.tools.junit.TuscanyTestCase; - -/** - * This test case will test all the composites placed in the "composites" directory - * against the results in their repectice "expected_results" folders. - */ -public class TestAllCompositesTest extends TuscanyTestCase { - - String testsDir = TuscanyTestCase.junit_composites; - - Set excludes = new HashSet(); - - public TestAllCompositesTest(String arg0) { - super(arg0); - excludes.add("MyValueServiceCompositeMissingScaComposite"); - excludes.add("CVS"); - excludes.add(".svn"); - } - - - /* main exists to allow running from the java ant task */ - public static void main(String[] args) { - TestAllCompositesTest test = new TestAllCompositesTest(""); - test.testAllCompositesRegression(); - } - - public void testAllCompositesRegression() { - File dir = new File(testsDir); - - if (dir.isDirectory()) { - System.out.println("Testing all composites under " - + dir.getAbsolutePath()); - String[] test_composites = dir.list(); - - for (int i = 0; i < test_composites.length; i++) { - File test_composite = new File(testsDir, test_composites[i]); - - String composite_name = null; - if (test_composite.isDirectory()) { - composite_name = test_composite.getName(); - if (!excludes.contains(composite_name.intern())) { - testComposite(composite_name, check_results); - System.out.println("Test of composite \"" + composite_name - + "\" passed."); - continue; - } else { - System.out - .println("Ignoring excluded composite subdirectory \"" - + composite_name + "\""); - } - } - } - - } else { - - fail("Test directory is not a directory! \r The variable org.apache.tuscany.sca.cpp.tools.junit.TuscanyTestCase.root sets the location of the junit input data,\r it is currently set as " - + TuscanyTestCase.root + "\rand we expect to find a testinput\\composites directory under there."); - } - - System.out.println("testAllComposites test passed."); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestDeployAssistTool.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestDeployAssistTool.java deleted file mode 100644 index 0d845e1b1e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestDeployAssistTool.java +++ /dev/null @@ -1,97 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; - -/** - * This test case will test all the composites placed in the "composites" directory - * against the results in their repectice "expected_results" folders. - */ -public class TestDeployAssistTool extends TuscanyTestCase { - - String testsDir = TuscanyTestCase.junit_composites; - - Set excludes = new HashSet(); - - public TestDeployAssistTool(String arg0) { - super(arg0); - excludes.add("MyValueServiceCompositeMissingScaComposite"); - excludes.add("CVS"); - } - - /* main exists to allow running from the test script which will - * wrap this test case and pipe the satandard output to somewhere - * for checking. - */ - - public static void main(String[] args) { - TestDeployAssistTool test = new TestDeployAssistTool(""); - test.testDeployToolNullParms(); - } - - public void testDeployTool() { - //Utils.setReportArtefacts(true); - TestAllCompositesTest t = new TestAllCompositesTest(""); - File dir = new File(testsDir); - - if (dir.isDirectory()) { - String[] test_composites = dir.list(); - - for (int i = 0; i < test_composites.length; i++) { - File test_composite = new File(testsDir, test_composites[i]); - String composite_name = null; - if (test_composite.isDirectory()) { - composite_name = test_composite.getName(); - if (!excludes.contains(composite_name.intern())) { - t.testCompositeDeploy(composite_name, create_results, "c:\\colin", "cp"); - } - } - System.out.println(""); - } - } - } - - public void testDeployToolNullParms() { - //Utils.setReportArtefacts(true); - TestAllCompositesTest t = new TestAllCompositesTest(""); - File dir = new File(testsDir); - - if (dir.isDirectory()) { - String[] test_composites = dir.list(); - - for (int i = 0; i < test_composites.length; i++) { - File test_composite = new File(testsDir, test_composites[i]); - String composite_name = null; - if (test_composite.isDirectory()) { - composite_name = test_composite.getName(); - if (!excludes.contains(composite_name.intern())) { - t.testCompositeDeploy(composite_name, create_results, null, null); - } - } - System.out.println(""); - } - } - } -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TuscanyTestCase.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TuscanyTestCase.java deleted file mode 100644 index 5d1fa568d1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TuscanyTestCase.java +++ /dev/null @@ -1,341 +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. - */ - -package org.apache.tuscany.sca.cpp.tools.junit; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.cpp.tools.common.Options; -import org.apache.tuscany.sca.cpp.tools.services.Scagen; - -/** - * A superclass for testcases that can be used to store common functions. - */ -public abstract class TuscanyTestCase extends TestCase { - - public static String root = "d:\\tuscany\\cpp\\sca\\tools\\scagen\\junit\\"; - - public static String junit_composites = root + "testinput\\composites\\"; - - public static String junit_output = root + "testoutput\\"; - - private String testcase = "TESTCASE NOT SET BY SUBCLASS"; - - String input = null; - - String output = null; - - /** - * Check the resulting files with the contents of the expected_results - * folder in the testComposite method - */ - public final static boolean check_results = true; - - /** - * Create test output but do not check it (useful for setting up new - * expected test output - */ - public final static boolean create_results = false; - - /** - * - */ - public TuscanyTestCase() { - super(); - } - - /** - * @param arg0 - */ - public TuscanyTestCase(String arg0) { - super(arg0); - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Tests to see if two files are the same - this is just a scratch method at - * the moment that flags up testcase output files not matching expected - * results rather than needing to be a fully robust implementation and needs - * a little further work. - * - * @param file1 - * the first file to compare - * @param file2 - * the second file to compare - * - */ - protected boolean areFilesEqual(String file1, String file2) { - - try { - FileInputStream fis1 = new java.io.FileInputStream(file1); - FileInputStream fis2 = new java.io.FileInputStream(file2); - - BufferedReader br1 = new BufferedReader(new InputStreamReader(fis1)); - BufferedReader br2 = new BufferedReader(new InputStreamReader(fis2)); - - String line1 = br1.readLine(); - String line2 = br2.readLine(); - boolean moretodo = (line1 != null) && (line2 != null); - - for (int line = 1; moretodo; line++) { - - if (line1.equals(line2)) { - - line1 = br1.readLine(); - line2 = br2.readLine(); - - } else { - - int l1i, l2i; - - if ((l1i = line1.lastIndexOf("$Id")) > 0) { - //allow CVS strings - line1 = br1.readLine(); - } - - if ((l2i = line2.lastIndexOf("$Id")) > 0) { - //allow CVS strings - line2 = br2.readLine(); - } - - if (l1i == -1 && l2i == -1) { - - // they don't match - System.out.println("file " + file1 + " and file " - + file2); - System.out.println(" don't match at line " + line); - System.out.println("1 is :" + line1); - System.out.println("2 is :" + line2); - - return false; - } - } - - moretodo = (line1 != null) && (line2 != null); - } - - System.out.println("MATCH FOR: file " + file1 + " and file " - + file2); - return true; - - } catch (Throwable t) { - t.printStackTrace(); - return true; - } - - } - - /** - * @param outputDir - */ - protected void clearDirButNotExpectedOutputSubDir(String outputDir) { - File dir = new File(outputDir); - if (dir.isDirectory()) { - String[] files = dir.list(); - for (int i = 0; i < files.length; i++) { - File child = new File(dir, files[i]); - if (child.isDirectory()) { - if (!(child.getName().equals("expected_output") || child.getName().equals(".svn"))) { - clearDirButNotExpectedOutputSubDir(dir - .getAbsolutePath() - + File.separator + files[i]); - } - } - else - { - if( !child.delete() ) - { - System.out.println("File "+outputDir+"/"+child.getName()+" could not be deleted"); - } - } - } - } - - } - - public void testComposite(String composite, boolean check) { - - Options.reset(); - setTestcase(composite); - clearDirButNotExpectedOutputSubDir(output); - - String[] commandLine = new String[] { "-dir", input, "-output", output }; - try { - Scagen.main(commandLine); - } catch (Exception e) { - fail(e.getMessage()); - } - - if (check) { - checkDirWithExpected(output); - } - } - - public void testCompositeDeploy(String composite, boolean check, - String deployDir, String command) { - - Options.reset(); - setTestcase(composite); - clearDirButNotExpectedOutputSubDir(output); - - String[] commandLine; - if (null == deployDir) { - commandLine = new String[] { "-dir", input, "-output", - output, "-deploy"}; - } else { - commandLine = new String[] { "-dir", input, "-output", - output, "-deploy", deployDir, "-command", command }; - } - try { - Scagen.main(commandLine); - } catch (Exception e) { - fail(e.getMessage()); - } - - if (check) { - checkDirWithExpected(output); - } - } - - /** - * @param outputDirName - */ - private void checkDirWithExpected(String outputDirName) { - - File actualDir = new File(outputDirName); - if (actualDir == null || !actualDir.isDirectory()) { - fail("result directory does not exist"); - } - - File expectedDir = new File(outputDirName + File.separator - + "expected_output"); - if (expectedDir == null || !actualDir.isDirectory()) { - fail("can't check results as expected directory does not exist"); - } - - //Check every file in the expected output directory is present - //in the actual directory - - String[] expectedFiles = expectedDir.list(); - - if (expectedFiles == null) { - fail("no expected results for " + expectedDir.getPath()); - } - for (int i = 0; expectedFiles != null && i < expectedFiles.length; i++) { - File expectedFile = new File(expectedDir, expectedFiles[i]); - if (expectedFile.isDirectory()) { - // we can't check subdirectories yet - // and it conveniently skips over "CVS" - } else { - File actualFile = checkFileExistsFailIfNot(actualDir, - expectedFile.getName()); - checkFileHasNoTabsAndEndsInNewline(actualDir, expectedFile - .getName()); - if (!areFilesEqual(expectedFile.getAbsolutePath(), actualFile - .getAbsolutePath())) { - fail("odd output for " + expectedFile.getPath()); - } - - } - - } - - } - - /** - * @param actualDir - * @param name - */ - private File checkFileExistsFailIfNot(File dir, String name) { - - File f = new File(dir, name); - if (f == null || !f.exists() || !f.isFile()) { - fail("Expected result file " + f + " does not exist"); - } - return f; - - } - - /** - * @param actualDir - * @param name - */ - private void checkFileHasNoTabsAndEndsInNewline(File dir, String name) { - - try { - File f = new File(dir, name); - FileInputStream fis = new FileInputStream(f); - InputStreamReader isr = new InputStreamReader(fis); - Reader br = new BufferedReader(isr); - int ch, charBeforeMinusOne = -1; - while ((ch = br.read()) > -1) { - if (ch == '\t') { - fail("found tab in output " + f.getPath()); - } - charBeforeMinusOne = ch; - } - //The last char must be newline; - if (charBeforeMinusOne != '\n') { - fail("last char in file is not a newline in " + "(char is:" - + ch + " " + dir.getName() + File.separator + name); - } - - br.close(); - } catch (IOException e) { - e.printStackTrace(); - fail("io exception in tab/newline checker for " + dir.getName() - + File.separator + name); - return; - } - - } - - /** - * @param testcase - * The testcase to set. - */ - void setTestcase(String testcase) { - this.testcase = testcase; - input = TuscanyTestCase.junit_composites + testcase; - output = TuscanyTestCase.junit_output + testcase; - } - - /** - * @return Returns the testcase. - */ - String getTestcase() { - return testcase; - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/Calculator.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/Calculator.h deleted file mode 100644 index 99c4158d1a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/Calculator.h +++ /dev/null @@ -1,36 +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 CALCULATOR_H -#define CALCULATOR_H - - -class Calculator { - -private: - virtual long add(long a, long b) = 0; -public: - - virtual long subtract(long a, long b) = 0; -}; - - -#endif // CALCULATOR_H diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.componentType deleted file mode 100644 index a1accb0fda..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.componentType +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
- <service name="CalculatorService">
- <interface.cpp header="Calculator.h"/> <!-- Header is relative to the composite root -->
- </service>
-</componentType>
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.h deleted file mode 100644 index 3f97eacef2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.h +++ /dev/null @@ -1,37 +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 CALCULATORIMPL_H -#define CALCULATORIMPL_H - -#include "Calculator.h" - -class CalculatorImpl : public Calculator -{ -public: - CalculatorImpl(); - virtual ~CalculatorImpl(); - virtual long add(long a, long b); - virtual long subtract(long a, long b); - -}; - -#endif // diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/sca.composite deleted file mode 100644 index f2a8e56c58..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/sca.composite +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9" name="Calculator">
-
- <component name="Calculator">
- <implementation.cpp dll="debug/Calculator.dll" header="CalculatorImpl.h"/>
- </component>
-
-</composite>
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorBack.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorBack.h deleted file mode 100644 index bc14167841..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorBack.h +++ /dev/null @@ -1,36 +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 CALCULATOR_H -#define CALCULATOR_H - - -class CalculatorBack { - - - -public: - virtual long subtractBack(long a, long b) = 0; - virtual long addBack(long a, long b) = 0; -}; - - -#endif // CALCULATOR_H diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorForward.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorForward.h deleted file mode 100644 index af140f9575..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorForward.h +++ /dev/null @@ -1,35 +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 CALCULATOR_H -#define CALCULATOR_H - - -class CalculatorForward { - -public: - - virtual long subtractForward(long a, long b) = 0; - virtual long addForward(long a, long b) = 0; -}; - - -#endif // CALCULATOR_H diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/sca.composite deleted file mode 100644 index b3c5778b36..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/sca.composite +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9" name="Calculator">
-
- <component name="CalculatorForward">
- <implementation.cpp header="subFolder/CalculatorForwardImpl.h"/>
- </component>
-
- <component name="CalculatorBack">
- <implementation.cpp header="subFolder\CalculatorBackImpl.h"/>
- </component>
-
-</composite>
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.componentType deleted file mode 100644 index 715a4dfc6c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.componentType +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
- <service name="CalculatorService">
- <interface.cpp header="otherSubFolder\CalculatorBack.h"/> <!-- Header is relative to the composite root -->
- </service>
-</componentType>
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.h deleted file mode 100644 index d10bfb4b1a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.h +++ /dev/null @@ -1,37 +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 CALCULATORIMPL_H -#define CALCULATORIMPL_H - -#include "Calculator.h" - -class CalculatorBackImpl : public Calculator -{ -public: - CalculatorImpl(); - virtual ~CalculatorImpl(); - virtual long addBack(long a, long b); - virtual long subtractBack(long a, long b); - -}; - -#endif // diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.componentType deleted file mode 100644 index 0000086167..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.componentType +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
- <service name="CalculatorService">
- <interface.cpp header="otherSubFolder/CalculatorForward.h"/> <!-- Header is relative to the composite root -->
- </service>
-</componentType>
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.h deleted file mode 100644 index 182d9d89f2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.h +++ /dev/null @@ -1,37 +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 CALCULATORIMPL_H -#define CALCULATORIMPL_H - -#include "Calculator.h" - -class CalculatorForwardImpl : public Calculator -{ -public: - CalculatorImpl(); - virtual ~CalculatorImpl(); - virtual long addForward(long a, long b); - virtual long subtractForward(long a, long b); - -}; - -#endif // diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.fragment deleted file mode 100644 index 733b4700e7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.fragment +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo.dll" class="CustomerInfoImpl" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.h deleted file mode 100644 index d1a634999c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.h +++ /dev/null @@ -1,98 +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 CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: -//char (simple extra type) - virtual const char* getCustomerInformationChar(char * p1, const char* customerID ) = 0; - virtual const char* getCustomerInfoAChar(char * p1,const char*) = 0; - virtual const char* getCustomerInfoBChar(char * p1, char* customerID ) = 0; - virtual const char* getCustomerInfoCChar(char * p1, char customerID ) = 0; - virtual const char* getCustomerInfoDChar(char * p1,char) = 0; - virtual const char* getCustomerInfoEChar(char * p1 , char *) = 0; - virtual const char* getCustomerInfoFChar(char * p1, char * p1, char *customerID ) = 0; - virtual const char* getCustomerInfoGChar(char * p1, char *, char * p1,signed char *customerID ) = 0; - virtual const char* getCustomerInfoHChar(unsigned char *customerID, const char, ) = 0; - virtual const char* getCustomerInfoHChar(unsigned char *customerID, const char*) = 0; - -//long (duplicate the types) - virtual const long* getCustomerInformationLong(const long* customerID, const long* customerID ) = 0; - virtual const long* getCustomerInfoALong(const long*,const long*) = 0; - virtual const long* getCustomerInfoBLong(long* customerID, long* customerID2 ) = 0; - virtual const long* getCustomerInfoCLong(long customerID , long customerID2 ) = 0; - virtual const long* getCustomerInfoDLong(long,long) = 0; - virtual const long* getCustomerInfoELong(long *, long*) = 0; - virtual const long* getCustomerInfoFLong(long *customerID, long* customerID2 ) = 0; - virtual const long* getCustomerInfoGLong(signed long *customerID, signed long *customerID2 ) = 0; - virtual const long* getCustomerInfoHLong(signed long *customerID, signed long *customerID2 ) = 0; - -//int - virtual const int* getCustomerInformationInt(char*, const int* customerID ) = 0; - virtual const int* getCustomerInfoAInt(char*,const int*) = 0; - virtual const int* getCustomerInfoBInt(char*,int* customerID ) = 0; - virtual const int* getCustomerInfoCInt(char*,int customerID ) = 0; - virtual const int* getCustomerInfoDInt(char*,int) = 0; - virtual const int* getCustomerInfoEInt(char*,int *) = 0; - virtual const int* getCustomerInfoFInt(char*,int *customerID ) = 0; - virtual const int* getCustomerInfoGInt(char*,signed int *customerID ) = 0; - virtual const int* getCustomerInfoHInt(char*,unsigned int *customerID ) = 0; - - -//__int64 - virtual const __int64* getCustomerInformationint64(Diamond&,const __int64* customerID ) = 0; - virtual const __int64* getCustomerInfoAint64(Diamond&, const __int64*) = 0; - virtual const __int64* getCustomerInfoBint64( Diamond&, __int64* customerID ) = 0; - virtual const __int64* getCustomerInfoCint64(Diamond&,__int64 customerID ) = 0; - virtual const __int64* getCustomerInfoDint64(Diamond& myDiamond,__int64) = 0; - virtual const __int64* getCustomerInfoEint64(Diamond& myDiamond, __int64 *) = 0; - virtual const __int64* getCustomerInfoFint64(Diamond& myDiamond, __int64 *customerID ) = 0; - virtual const __int64* getCustomerInfoGint64(Diamond& myDiamond, signed __int64 *customerID ) = 0; - virtual const __int64* getCustomerInfoHint64(const Diamond& myDiamond, unsigned int64 *customerID ) = 0; - -//void - virtual const void* getCustomerInformationVoid(float& f, const __int64* customerID ) = 0; - virtual void getCustomerInfoAVoid(const float& f, const __int64*) = 0; - virtual void getCustomerInfoBVoid( ) = 0; - virtual void getCustomerInfoCVoid() = 0; - virtual void getCustomerInfoDVoid(void) = 0; - virtual char getCustomerInfoEVoid(void) = 0; - virtual char getCustomerInfoFVoid() = 0; - virtual char getCustomerInfoGVoid( void ) = 0; - -//inline - virtual inline const char * getCustomerInfoAInline(int,int,int,int, char* customer id) = 0; - inline int getCustomerInfoBInline(int*,int* f, int* g, char* customer id) = 0; - virtual inline friend const unsigned int * getCustomerInfoCInline(char* customer id) = 0; - -//tricky examples - int getCustomerInfoTrickyA(const char, const char) = 0; - int getCustomerInfoTrickyB(int myInt, int myInt) = 0; - - - - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.h deleted file mode 100644 index c325a90b1e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.h +++ /dev/null @@ -1,38 +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 CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - - -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.fragment deleted file mode 100644 index cb63dd1f06..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.fragment +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" class="CustomerInfoImpl" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.h deleted file mode 100644 index 85fac59da8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.h +++ /dev/null @@ -1,94 +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 CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: -//char - virtual const char* getCustomerInformationChar(const char* customerID ) = 0; - virtual const char* getCustomerInfoAChar(const char*) = 0; - virtual const char* getCustomerInfoBChar(char* customerID ) = 0; - virtual const char* getCustomerInfoCChar(char customerID ) = 0; - virtual const char* getCustomerInfoDChar(char) = 0; - virtual const char* getCustomerInfoEChar(char *) = 0; - virtual const char* getCustomerInfoFChar(char *customerID ) = 0; - virtual const char* getCustomerInfoGChar(signed char *customerID ) = 0; - virtual const char* getCustomerInfoHChar(unsigned char *customerID ) = 0; - -//long - virtual const long* getCustomerInformationLong(const long* customerID ) = 0; - virtual const long* getCustomerInfoALong(const long*) = 0; - virtual const long* getCustomerInfoBLong(long* customerID ) = 0; - virtual const long* getCustomerInfoCLong(long customerID ) = 0; - virtual const long* getCustomerInfoDLong(long) = 0; - virtual const long* getCustomerInfoELong(long *) = 0; - virtual const long* getCustomerInfoFLong(long *customerID ) = 0; - virtual const long* getCustomerInfoGLong(signed long *customerID ) = 0; - virtual const long* getCustomerInfoHLong(unsigned long *customerID ) = 0; - -//int - virtual const int* getCustomerInformationInt(const int* customerID ) = 0; - virtual const int* getCustomerInfoAInt(const int*) = 0; - virtual const int* getCustomerInfoBInt(int* customerID ) = 0; - virtual const int* getCustomerInfoCInt(int customerID ) = 0; - virtual const int* getCustomerInfoDInt(int) = 0; - virtual const int* getCustomerInfoEInt(int *) = 0; - virtual const int* getCustomerInfoFInt(int *customerID ) = 0; - virtual const int* getCustomerInfoGInt(signed int *customerID ) = 0; - virtual const int* getCustomerInfoHInt(unsigned int *customerID ) = 0; - - -//__int64 - virtual const __int64* getCustomerInformationint64(const __int64* customerID ) = 0; - virtual const __int64* getCustomerInfoAint64(const __int64*) = 0; - virtual const __int64* getCustomerInfoBint64(__int64* customerID ) = 0; - virtual const __int64* getCustomerInfoCint64(__int64 customerID ) = 0; - virtual const __int64* getCustomerInfoDint64(__int64) = 0; - virtual const __int64* getCustomerInfoEint64(__int64 *) = 0; - virtual const __int64* getCustomerInfoFint64(__int64 *customerID ) = 0; - virtual const __int64* getCustomerInfoGint64(signed __int64 *customerID ) = 0; - virtual const __int64* getCustomerInfoHint64(unsigned int64 *customerID ) = 0; - -//void - virtual const void* getCustomerInformationVoid(const __int64* customerID ) = 0; - virtual void getCustomerInfoAVoid(const __int64*) = 0; - virtual void getCustomerInfoBVoid( ) = 0; - virtual void getCustomerInfoCVoid() = 0; - virtual void getCustomerInfoDVoid(void) = 0; - -//inline - virtual inline const char * getCustomerInfoAInline(char* customer id) = 0; - inline int getCustomerInfoBInline(char* customer id) = 0; - virtual inline friend const unsigned int * getCustomerInfoCInline(char* customer id) = 0; - -//tricky examples - int getCustomerInfoTrickyA(const char) = 0; - int getCustomerInfoTrickyB(int myInt) = 0; - - - - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.h deleted file mode 100644 index 95b70c3017..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.h +++ /dev/null @@ -1,47 +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 CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - - -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -class CustomerInfoImpl2 : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation2(const char* customerID); - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.fragment deleted file mode 100644 index 5c5cb78b87..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.fragment +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" class="CustomerInfoImpl2" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.h deleted file mode 100644 index 7bd355b3ab..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.h +++ /dev/null @@ -1,36 +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. - */ -#ifndef CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: - virtual const char* getCustomerInformation(const char* customerID) = 0; - -}; - - -class CustomerInfoSecond -{ -public: - virtual const char* getCustomerInformationSecond(const char* customerID) = 0; - -}; - - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.h deleted file mode 100644 index 540873174b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.h +++ /dev/null @@ -1,49 +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$ */ - -// Class definition for the implementation - -#ifndef CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - - -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -class CustomerInfoImpl2 : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation2(const char* customerID); - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValue.h deleted file mode 100644 index 4334c82eca..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValue.h +++ /dev/null @@ -1,40 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; -class MyValue -{ -public: - virtual float getMyValue(const char* customerID) = 0; - virtual float getMyValueS(const string& customerID) = 0; - virtual string getCustname(string& customerID) = 0; - virtual const string& getCustnamecs(string customerID) = 0; - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.componentType deleted file mode 100644 index c4e3b35675..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.componentType +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp class="MyValue" header="MyValue.h">
- </interface.cpp>
- </service>
-
- <reference name="customerInfo">
- <interface.cpp header="CustomerInfo.h">
- </interface.cpp>
- </reference>
-
- <reference name="stockQuote">
- <interface.cpp header="StockQuoteService.h">
- </interface.cpp>
- </reference>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.hpp deleted file mode 100644 index 98a342fcb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.hpp +++ /dev/null @@ -1,43 +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$ */
-
-// Class definition for the implementation
-
-#ifndef MyValueImpl_h
-#define MyValueImpl_h
-
-#include "MyValue.h"
-
-
-
-class MyValueImpl : public MyValue
-{
-public:
- MyValueImpl();
- virtual ~MyValueImpl();
- virtual float getMyValue(const char* customerID);
- virtual float getMyValueS(const string& customerID);
- virtual string getCustname(string& customerID);
- virtual const string& getCustnamecs(string customerID);
-
-};
-
-#endif
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index 3f9feeed30..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,38 +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 MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/StockQuoteService.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/StockQuoteService.h deleted file mode 100644 index 6a8fd51534..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/StockQuoteService.h +++ /dev/null @@ -1,37 +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 StockQuoteService_h -#define StockQuoteService_h -#include <string> -#include "commonj/sdo/sdo.h" -using std::string; -class StockQuoteService -{ -public: - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr request) = 0; - -}; - -#endif // StockQuoteService_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/sca.composite deleted file mode 100644 index 9a5cfd8da5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/sca.composite +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--
- <component name="Calculator">
- <implementation.cpp dll="debug/Calculator.dll" header="CalculatorImpl.h"/>
- </component>
- -->
-
- <externalService name="StockQuoteService">
- <interface.cpp header="StockQuoteService.h"/>
- <binding.ws port="http://swanandmokashi.com#wsdl.endpoint(StockQuotes/StockQuotesSoap)"/>
- </externalService>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.fragment deleted file mode 100644 index 48d34f7957..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.fragment +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" class="Other::CustomerInfoImpl" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.h deleted file mode 100644 index 928480df1f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.h +++ /dev/null @@ -1,41 +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 CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: - virtual const char* getCustomerInformation(const char* customerID) = 0; - -}; - - -class CustomerInfoSecond -{ -public: - virtual const char* getCustomerInformationSecond(const char* customerID) = 0; - -}; - - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.h deleted file mode 100644 index 8d2f810db0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.h +++ /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$ */ - -// Class definition for the implementation - -#ifndef CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - -/* -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -*/ -namespace Other { - class CustomerInfoImpl : public CustomerInfo - { - public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformationOther(const char* customerID); - - }; -} - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValue.h deleted file mode 100644 index 4334c82eca..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValue.h +++ /dev/null @@ -1,40 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; -class MyValue -{ -public: - virtual float getMyValue(const char* customerID) = 0; - virtual float getMyValueS(const string& customerID) = 0; - virtual string getCustname(string& customerID) = 0; - virtual const string& getCustnamecs(string customerID) = 0; - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.componentType deleted file mode 100644 index c4e3b35675..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.componentType +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp class="MyValue" header="MyValue.h">
- </interface.cpp>
- </service>
-
- <reference name="customerInfo">
- <interface.cpp header="CustomerInfo.h">
- </interface.cpp>
- </reference>
-
- <reference name="stockQuote">
- <interface.cpp header="StockQuoteService.h">
- </interface.cpp>
- </reference>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.hpp deleted file mode 100644 index 98a342fcb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.hpp +++ /dev/null @@ -1,43 +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$ */
-
-// Class definition for the implementation
-
-#ifndef MyValueImpl_h
-#define MyValueImpl_h
-
-#include "MyValue.h"
-
-
-
-class MyValueImpl : public MyValue
-{
-public:
- MyValueImpl();
- virtual ~MyValueImpl();
- virtual float getMyValue(const char* customerID);
- virtual float getMyValueS(const string& customerID);
- virtual string getCustname(string& customerID);
- virtual const string& getCustnamecs(string customerID);
-
-};
-
-#endif
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index 3f9feeed30..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,38 +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 MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/StockQuoteService.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/StockQuoteService.h deleted file mode 100644 index 6a8fd51534..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/StockQuoteService.h +++ /dev/null @@ -1,37 +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 StockQuoteService_h -#define StockQuoteService_h -#include <string> -#include "commonj/sdo/sdo.h" -using std::string; -class StockQuoteService -{ -public: - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr request) = 0; - -}; - -#endif // StockQuoteService_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/sca.composite deleted file mode 100644 index 9a5cfd8da5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/sca.composite +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--
- <component name="Calculator">
- <implementation.cpp dll="debug/Calculator.dll" header="CalculatorImpl.h"/>
- </component>
- -->
-
- <externalService name="StockQuoteService">
- <interface.cpp header="StockQuoteService.h"/>
- <binding.ws port="http://swanandmokashi.com#wsdl.endpoint(StockQuotes/StockQuotesSoap)"/>
- </externalService>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValue.h deleted file mode 100644 index 90835ca4af..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValue.h +++ /dev/null @@ -1,40 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; - -class MyValue -{ - public: - virtual float getMyValueOther(const char* customerID) = 0; - virtual float getMyValueSOther(const string& customerID) = 0; - virtual string getCustnameOther(string& customerID) = 0; - virtual const string& getCustnamecsOther(string customerID) = 0; -} - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType deleted file mode 100644 index 785be08b72..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp header="MyValue.h">
- </interface.cpp>
- </service>
-
-</componentType>
-
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp deleted file mode 100644 index 04a785cd26..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp +++ /dev/null @@ -1,47 +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$ */ -// Class definition for the implementation - -#ifndef MyValueImpl_h -#define MyValueImpl_h - -#include "MyValue.h" - - -namespace myvaluecorp -{ - namespace implns - { - - class MyValueImpl : public MyValue - { - public: - MyValueImpl(); - virtual ~MyValueImpl(); - virtual float getMyValue(const char* customerID); - virtual float getMyValueS(const string& customerID); - virtual string getCustname(string& customerID); - virtual const string& getCustnamecs(string customerID); - - }; - } -} -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/sca.composite deleted file mode 100644 index 3e3c22a07b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/sca.composite +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValue.h deleted file mode 100644 index bbfcf15ed1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValue.h +++ /dev/null @@ -1,43 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; - -namespace Other { - class MyValue - { - public: - virtual float getMyValueOther(const char* customerID) = 0; - virtual float getMyValueSOther(const string& customerID) = 0; - virtual string getCustnameOther(string& customerID) = 0; - virtual const string& getCustnamecsOther(string customerID) = 0; - } -} - - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.componentType deleted file mode 100644 index 42cc4e9827..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.componentType +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp class="Other::MyValue" header="MyValue.h">
- </interface.cpp>
- </service>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.hpp deleted file mode 100644 index 98a342fcb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.hpp +++ /dev/null @@ -1,43 +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$ */
-
-// Class definition for the implementation
-
-#ifndef MyValueImpl_h
-#define MyValueImpl_h
-
-#include "MyValue.h"
-
-
-
-class MyValueImpl : public MyValue
-{
-public:
- MyValueImpl();
- virtual ~MyValueImpl();
- virtual float getMyValue(const char* customerID);
- virtual float getMyValueS(const string& customerID);
- virtual string getCustname(string& customerID);
- virtual const string& getCustnamecs(string customerID);
-
-};
-
-#endif
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/sca.composite deleted file mode 100644 index 510bf36337..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/sca.composite +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValue.h deleted file mode 100644 index 10c59480a8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValue.h +++ /dev/null @@ -1,41 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; - -namespace Other { - class MyValue - { - public: - virtual float getMyValueOther(const char* customerID) = 0; - virtual float getMyValueSOther(const string& customerID) = 0; - virtual string getCustnameOther(string& customerID) = 0; - virtual const string& getCustnamecsOther(string customerID) = 0; - } -} -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType deleted file mode 100644 index ddb463e3d7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp header="MyValue.h">
- </interface.cpp>
- </service>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp deleted file mode 100644 index 98a342fcb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp +++ /dev/null @@ -1,43 +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$ */
-
-// Class definition for the implementation
-
-#ifndef MyValueImpl_h
-#define MyValueImpl_h
-
-#include "MyValue.h"
-
-
-
-class MyValueImpl : public MyValue
-{
-public:
- MyValueImpl();
- virtual ~MyValueImpl();
- virtual float getMyValue(const char* customerID);
- virtual float getMyValueS(const string& customerID);
- virtual string getCustname(string& customerID);
- virtual const string& getCustnamecs(string customerID);
-
-};
-
-#endif
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/sca.composite deleted file mode 100644 index 510bf36337..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/sca.composite +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/CustomerInfo.fragmentX b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/CustomerInfo.fragmentX deleted file mode 100644 index 717ce02ede..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/CustomerInfo.fragmentX +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" class="CustomerInfoImpl2" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/sca.compositeX b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/sca.compositeX deleted file mode 100644 index bbda577c28..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/sca.compositeX +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--
- <component name="Calculator">
- <implementation.cpp dll="debug/Calculator.dll" header="CalculatorImpl.h"/>
- </component>
- -->
-
- <externalService name="StockQuoteService">
- <interface.cpp header="StockQuoteService.h"/>
- <binding.ws port="http://swanandmokashi.com#wsdl.endpoint(StockQuotes/StockQuotesSoap)"/>
- </externalService>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.fragment deleted file mode 100644 index 5c5cb78b87..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.fragment +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" class="CustomerInfoImpl2" header="CustomerInfoImpl.h"></implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.h deleted file mode 100644 index 928480df1f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.h +++ /dev/null @@ -1,41 +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 CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: - virtual const char* getCustomerInformation(const char* customerID) = 0; - -}; - - -class CustomerInfoSecond -{ -public: - virtual const char* getCustomerInformationSecond(const char* customerID) = 0; - -}; - - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.h deleted file mode 100644 index c275383ab4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.h +++ /dev/null @@ -1,49 +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$ */ - -// Class definition for the implementation - -#ifndef CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - - -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -class CustomerInfoImpl2 : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValue.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValue.h deleted file mode 100644 index 4334c82eca..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValue.h +++ /dev/null @@ -1,40 +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$ */ - -// MyValue.h: interface for the MyValueImpl class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef MyValue_h -#define MyValue_h -#include <string> -using std::string; -class MyValue -{ -public: - virtual float getMyValue(const char* customerID) = 0; - virtual float getMyValueS(const string& customerID) = 0; - virtual string getCustname(string& customerID) = 0; - virtual const string& getCustnamecs(string customerID) = 0; - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.componentType deleted file mode 100644 index c4e3b35675..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.componentType +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="MyValueService">
- <interface.cpp class="MyValue" header="MyValue.h">
- </interface.cpp>
- </service>
-
- <reference name="customerInfo">
- <interface.cpp header="CustomerInfo.h">
- </interface.cpp>
- </reference>
-
- <reference name="stockQuote">
- <interface.cpp header="StockQuoteService.h">
- </interface.cpp>
- </reference>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.hpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.hpp deleted file mode 100644 index 98a342fcb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.hpp +++ /dev/null @@ -1,43 +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$ */
-
-// Class definition for the implementation
-
-#ifndef MyValueImpl_h
-#define MyValueImpl_h
-
-#include "MyValue.h"
-
-
-
-class MyValueImpl : public MyValue
-{
-public:
- MyValueImpl();
- virtual ~MyValueImpl();
- virtual float getMyValue(const char* customerID);
- virtual float getMyValueS(const string& customerID);
- virtual string getCustname(string& customerID);
- virtual const string& getCustnamecs(string customerID);
-
-};
-
-#endif
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index 3f9feeed30..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,38 +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 MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/StockQuoteService.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/StockQuoteService.h deleted file mode 100644 index 6a8fd51534..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/StockQuoteService.h +++ /dev/null @@ -1,37 +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 StockQuoteService_h -#define StockQuoteService_h -#include <string> -#include "commonj/sdo/sdo.h" -using std::string; -class StockQuoteService -{ -public: - virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr request) = 0; - -}; - -#endif // StockQuoteService_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/sca.composite b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/sca.composite deleted file mode 100644 index 9a5cfd8da5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/sca.composite +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="MyValueServiceComposite">
-
- <!-- Expose as a web service -->
- <entryPoint name="MyValueServiceExport" multiplicity="1..1">
- <interface.wsdl interface="" callbackInterface=""></interface.wsdl>
- <binding.ws port="mvs:MyValueServiceSOAP"></binding.ws>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.cpp dll="MyValue" header="MyValueImpl.hpp"></implementation.cpp>
- <properties>
- </properties>
- <references>
- <customerInfo>CustomerInfoComponent</customerInfo>
- <stockQuote>StockQuoteService</stockQuote>
- </references>
- </component>
-
- <!--
- <component name="Calculator">
- <implementation.cpp dll="debug/Calculator.dll" header="CalculatorImpl.h"/>
- </component>
- -->
-
- <externalService name="StockQuoteService">
- <interface.cpp header="StockQuoteService.h"/>
- <binding.ws port="http://swanandmokashi.com#wsdl.endpoint(StockQuotes/StockQuotesSoap)"/>
- </externalService>
-
- <!--wire>
- <source.uri>MyValueServiceComponent/customerInfo</source.uri>
- <target.uri>CustomerInfoComponent</target.uri>
- </wire-->
-
-</composite>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.fragment b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.fragment deleted file mode 100644 index 27d28368f5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.fragment +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<compositeFragment xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:mvs="http://www.myvalue.org/MyValueService/"
- name="CustomerInfoComponent">
-
-
- <component name="CustomerInfoComponent">
- <implementation.cpp dll="CustomerInfo" header="CustomerInfoImpl.h">
- </implementation.cpp>
- <properties>
- <v:Fred>x</v:Fred>
- <v:Joe>23</v:Joe>
- <Joe>42</Joe>
- </properties>
- <references>
- </references>
- </component>
-
-</compositeFragment>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.h deleted file mode 100644 index 32bf7572dc..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.h +++ /dev/null @@ -1,45 +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 CustomerInfo_h -#define CustomerInfo_h - -class CustomerInfo -{ -public: - virtual const char* getCustomerInformationCharPublic(char * p1, const char* customerID ) = 0; - virtual const char* getCustomerInfoACharPublic(char * p1,const char*) = 0; - virtual const char* getCustomerInfoBCharPublic(char * p1, char* customerID ) = 0; - -private: - virtual const char* getCustomerInformationCharPrivate(char * p1, const char* customerID ) = 0; - virtual const char* getCustomerInfoACharPrivate(char * p1,const char*) = 0; - virtual const char* getCustomerInfoBCharPrivate(char * p1, char* customerID ) = 0; - -protected: - virtual const char* getCustomerInformationCharProtected(char * p1, const char* customerID ) = 0; - virtual const char* getCustomerInfoACharProtected(char * p1,const char*) = 0; - virtual const char* getCustomerInfoBCharProtected(char * p1, char* customerID ) = 0; - - -}; - -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.componentType b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.componentType deleted file mode 100644 index c2cfd3b399..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.componentType +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- 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.
--->
-
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <service name="CustomerInfoService">
- <interface.cpp header="/CustomerInfo.h">
- </interface.cpp>
- </service>
-
- <property name="Fred" type="xs:string"/>
- <property name="Joe" type="xs:integer" many="true"/>
-
-</componentType>
-
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.h deleted file mode 100644 index 55f5813303..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.h +++ /dev/null @@ -1,39 +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$ */ - -// Class definition for the implementation - -#ifndef CustomerInfoImpl_h -#define CustomerInfoImpl_h - -#include "CustomerInfo.h" - - - -class CustomerInfoImpl : public CustomerInfo -{ -public: - CustomerInfoImpl(); - virtual ~CustomerInfoImpl(); - virtual const char* getCustomerInformation(const char* customerID); - -}; -#endif diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.cpp deleted file mode 100644 index 14bafd9ce7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.cpp +++ /dev/null @@ -1,65 +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. - */ - -#include "CalculatorImpl_CalculatorService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorImpl_CalculatorService_Proxy* CalculatorImpl_CalculatorService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CalculatorImpl_CalculatorService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CalculatorImpl_CalculatorService_Proxy_Destructor(void* proxy) - { - delete (CalculatorImpl_CalculatorService_Proxy*)proxy; - } -} - -CalculatorImpl_CalculatorService_Proxy::CalculatorImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CalculatorImpl_CalculatorService_Proxy::~CalculatorImpl_CalculatorService_Proxy() -{ - if (target) - delete target; -} - -long CalculatorImpl_CalculatorService_Proxy::subtract( long arg0, long arg1) -{ - tuscany::sca::Operation operation("subtract"); - operation.addParameter("a", &arg0); - operation.addParameter("b", &arg1); - long ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(long*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.h deleted file mode 100644 index 00b163ba76..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef CalculatorImpl_CalculatorService_Proxy_h -#define CalculatorImpl_CalculatorService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "Calculator.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CalculatorImpl_CalculatorService_Proxy : public Calculator -{ -public: - CalculatorImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CalculatorImpl_CalculatorService_Proxy(); - virtual long subtract( long a, long b); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CalculatorImpl_CalculatorService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.cpp deleted file mode 100644 index b6e5c8a9f0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.cpp +++ /dev/null @@ -1,84 +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. - */ - -#include "CalculatorImpl_CalculatorService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorImpl_CalculatorService_Wrapper* CalculatorImpl_CalculatorService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CalculatorImpl_CalculatorService_Wrapper(target); - } -} - -CalculatorImpl_CalculatorService_Wrapper::CalculatorImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CalculatorImpl*)getImplementation(); -} - -CalculatorImpl_CalculatorService_Wrapper::~CalculatorImpl_CalculatorService_Wrapper() -{ - releaseImplementation(); -} - -void* CalculatorImpl_CalculatorService_Wrapper::newImplementation() -{ - return new CalculatorImpl; -} - -void CalculatorImpl_CalculatorService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CalculatorImpl_CalculatorService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "subtract") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(long*)operation.getReturnValue() = impl->subtract(p0, p1); - } - else - { - long* ret = new long; - *ret = impl->subtract(p0, p1); - operation.setReturnValue((const long*)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.h deleted file mode 100644 index 63bae2f75c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CalculatorImpl_CalculatorService_Wrapper_h -#define CalculatorImpl_CalculatorService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CalculatorImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CalculatorImpl_CalculatorService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CalculatorImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CalculatorImpl_CalculatorService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CalculatorImpl* impl; -}; - -#endif // CalculatorImpl_CalculatorService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.cpp deleted file mode 100644 index 79bfdbedbb..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.cpp +++ /dev/null @@ -1,76 +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. - */ - -#include "CalculatorBackImpl_CalculatorService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorBackImpl_CalculatorService_Proxy* CalculatorBackImpl_CalculatorService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CalculatorBackImpl_CalculatorService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CalculatorBackImpl_CalculatorService_Proxy_Destructor(void* proxy) - { - delete (CalculatorBackImpl_CalculatorService_Proxy*)proxy; - } -} - -CalculatorBackImpl_CalculatorService_Proxy::CalculatorBackImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CalculatorBackImpl_CalculatorService_Proxy::~CalculatorBackImpl_CalculatorService_Proxy() -{ - if (target) - delete target; -} - -long CalculatorBackImpl_CalculatorService_Proxy::subtractBack( long arg0, long arg1) -{ - tuscany::sca::Operation operation("subtractBack"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - long ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(long*)operation.getReturnValue(); -} - -long CalculatorBackImpl_CalculatorService_Proxy::addBack( long arg0, long arg1) -{ - tuscany::sca::Operation operation("addBack"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - long ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(long*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.h deleted file mode 100644 index 277a3afb06..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.h +++ /dev/null @@ -1,42 +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. - */ - -#ifndef CalculatorBackImpl_CalculatorService_Proxy_h -#define CalculatorBackImpl_CalculatorService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "otherSubFolder/CalculatorBack.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CalculatorBackImpl_CalculatorService_Proxy : public CalculatorBack -{ -public: - CalculatorBackImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CalculatorBackImpl_CalculatorService_Proxy(); - virtual long subtractBack( long a, long b); - virtual long addBack( long a, long b); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CalculatorBackImpl_CalculatorService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.cpp deleted file mode 100644 index 09dd09c01c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.cpp +++ /dev/null @@ -1,101 +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. - */ - -#include "CalculatorBackImpl_CalculatorService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorBackImpl_CalculatorService_Wrapper* CalculatorBackImpl_CalculatorService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CalculatorBackImpl_CalculatorService_Wrapper(target); - } -} - -CalculatorBackImpl_CalculatorService_Wrapper::CalculatorBackImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CalculatorBackImpl*)getImplementation(); -} - -CalculatorBackImpl_CalculatorService_Wrapper::~CalculatorBackImpl_CalculatorService_Wrapper() -{ - releaseImplementation(); -} - -void* CalculatorBackImpl_CalculatorService_Wrapper::newImplementation() -{ - return new CalculatorBackImpl; -} - -void CalculatorBackImpl_CalculatorService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CalculatorBackImpl_CalculatorService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "subtractBack") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(long*)operation.getReturnValue() = impl->subtractBack(p0, p1); - } - else - { - long* ret = new long; - *ret = impl->subtractBack(p0, p1); - operation.setReturnValue((const long*)ret); - } - return; - } - if (operationName == "addBack") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(long*)operation.getReturnValue() = impl->addBack(p0, p1); - } - else - { - long* ret = new long; - *ret = impl->addBack(p0, p1); - operation.setReturnValue((const long*)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.h deleted file mode 100644 index bfa203598c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CalculatorBackImpl_CalculatorService_Wrapper_h -#define CalculatorBackImpl_CalculatorService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "subFolder/CalculatorBackImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CalculatorBackImpl_CalculatorService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CalculatorBackImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CalculatorBackImpl_CalculatorService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CalculatorBackImpl* impl; -}; - -#endif // CalculatorBackImpl_CalculatorService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.cpp deleted file mode 100644 index 19056e836d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.cpp +++ /dev/null @@ -1,76 +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. - */ - -#include "CalculatorForwardImpl_CalculatorService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorForwardImpl_CalculatorService_Proxy* CalculatorForwardImpl_CalculatorService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CalculatorForwardImpl_CalculatorService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CalculatorForwardImpl_CalculatorService_Proxy_Destructor(void* proxy) - { - delete (CalculatorForwardImpl_CalculatorService_Proxy*)proxy; - } -} - -CalculatorForwardImpl_CalculatorService_Proxy::CalculatorForwardImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CalculatorForwardImpl_CalculatorService_Proxy::~CalculatorForwardImpl_CalculatorService_Proxy() -{ - if (target) - delete target; -} - -long CalculatorForwardImpl_CalculatorService_Proxy::subtractForward( long arg0, long arg1) -{ - tuscany::sca::Operation operation("subtractForward"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - long ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(long*)operation.getReturnValue(); -} - -long CalculatorForwardImpl_CalculatorService_Proxy::addForward( long arg0, long arg1) -{ - tuscany::sca::Operation operation("addForward"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - long ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(long*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.h deleted file mode 100644 index 9213ec625b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.h +++ /dev/null @@ -1,42 +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. - */ - -#ifndef CalculatorForwardImpl_CalculatorService_Proxy_h -#define CalculatorForwardImpl_CalculatorService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "otherSubFolder/CalculatorForward.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CalculatorForwardImpl_CalculatorService_Proxy : public CalculatorForward -{ -public: - CalculatorForwardImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CalculatorForwardImpl_CalculatorService_Proxy(); - virtual long subtractForward( long a, long b); - virtual long addForward( long a, long b); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CalculatorForwardImpl_CalculatorService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.cpp deleted file mode 100644 index 7b1cad7770..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.cpp +++ /dev/null @@ -1,101 +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. - */ - -#include "CalculatorForwardImpl_CalculatorService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CalculatorForwardImpl_CalculatorService_Wrapper* CalculatorForwardImpl_CalculatorService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CalculatorForwardImpl_CalculatorService_Wrapper(target); - } -} - -CalculatorForwardImpl_CalculatorService_Wrapper::CalculatorForwardImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CalculatorForwardImpl*)getImplementation(); -} - -CalculatorForwardImpl_CalculatorService_Wrapper::~CalculatorForwardImpl_CalculatorService_Wrapper() -{ - releaseImplementation(); -} - -void* CalculatorForwardImpl_CalculatorService_Wrapper::newImplementation() -{ - return new CalculatorForwardImpl; -} - -void CalculatorForwardImpl_CalculatorService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CalculatorForwardImpl_CalculatorService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "subtractForward") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(long*)operation.getReturnValue() = impl->subtractForward(p0, p1); - } - else - { - long* ret = new long; - *ret = impl->subtractForward(p0, p1); - operation.setReturnValue((const long*)ret); - } - return; - } - if (operationName == "addForward") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(long*)operation.getReturnValue() = impl->addForward(p0, p1); - } - else - { - long* ret = new long; - *ret = impl->addForward(p0, p1); - operation.setReturnValue((const long*)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.h deleted file mode 100644 index 0cb8404ca3..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CalculatorForwardImpl_CalculatorService_Wrapper_h -#define CalculatorForwardImpl_CalculatorService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "subFolder/CalculatorForwardImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CalculatorForwardImpl_CalculatorService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CalculatorForwardImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CalculatorForwardImpl_CalculatorService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CalculatorForwardImpl* impl; -}; - -#endif // CalculatorForwardImpl_CalculatorService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp deleted file mode 100644 index 85291cd069..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,594 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Proxy* CustomerInfoImpl_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl_CustomerInfoService_Proxy::CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl_CustomerInfoService_Proxy::~CustomerInfoImpl_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationChar( char* arg0, const char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAChar( char* arg0, const char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoAChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBChar( char* arg0, char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoBChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCChar( char* arg0, char arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoCChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDChar( char* arg0, char arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoDChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEChar( char* arg0, char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoEChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFChar( char* arg0, char* arg1, char* arg2) -{ - tuscany::sca::Operation operation("getCustomerInfoFChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - operation.addParameter(&arg2); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGChar( char* arg0, char* arg1, char* arg2, signed char* arg3) -{ - tuscany::sca::Operation operation("getCustomerInfoGChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - operation.addParameter(&arg2); - operation.addParameter(&arg3); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHChar( unsigned char* arg0, const char arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoHChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHChar( unsigned char* arg0, const char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoHChar"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationLong(const long* arg0, const long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoALong(const long* arg0, const long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoALong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBLong( long* arg0, long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoBLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCLong( long arg0, long arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoCLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDLong( long arg0, long arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoDLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoELong( long* arg0, long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoELong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFLong( long* arg0, long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoFLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGLong( signed long* arg0, signed long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoGLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHLong( signed long* arg0, signed long* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoHLong"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationInt( char* arg0, const int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAInt( char* arg0, const int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoAInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBInt( char* arg0, int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoBInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCInt( char* arg0, int arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoCInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDInt( char* arg0, int arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoDInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEInt( char* arg0, int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoEInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFInt( char* arg0, int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoFInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGInt( char* arg0, signed int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoGInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHInt( char* arg0, unsigned int* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoHInt"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationint64( Diamond& arg0, const __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAint64( Diamond& arg0, const __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoAint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBint64( Diamond& arg0, __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoBint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCint64( Diamond& arg0, __int64 arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoCint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDint64( Diamond& arg0, __int64 arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoDint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEint64( Diamond& arg0, __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoEint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFint64( Diamond& arg0, __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoFint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGint64( Diamond& arg0, signed __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoGint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHint64(const Diamond& arg0, unsigned int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoHint64"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const void* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationVoid( float& arg0, const __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationVoid"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - const void* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const void**)operation.getReturnValue(); -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAVoid(const float& arg0, const __int64* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoAVoid"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoBVoid"); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoCVoid"); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoDVoid"); - operation.addParameter(&arg0); - target->invoke(operation); - return; -} - -char CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoEVoid"); - operation.addParameter(&arg0); - char ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(char*)operation.getReturnValue(); -} - -char CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoFVoid"); - char ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(char*)operation.getReturnValue(); -} - -char CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoGVoid"); - operation.addParameter(&arg0); - char ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(char*)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAInline( int arg0, int arg1, int arg2, int arg3, char* customer arg4) -{ - tuscany::sca::Operation operation("getCustomerInfoAInline"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - operation.addParameter(&arg2); - operation.addParameter(&arg3); - operation.addParameter(&arg4); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBInline( int* arg0, int* arg1, int* arg2, char* customer arg3) -{ - tuscany::sca::Operation operation("getCustomerInfoBInline"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - operation.addParameter(&arg2); - operation.addParameter(&arg3); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - -friend const unsigned int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCInline( char* customer arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCInline"); - operation.addParameter(&arg0); - friend const unsigned int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(friend const unsigned int**)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoTrickyA(const char arg0, const char arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoTrickyA"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoTrickyB( int arg0, int arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoTrickyB"); - operation.addParameter(&arg0); - operation.addParameter(&arg1); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h deleted file mode 100644 index cb9e4e6e2a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,90 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h -#define CustomerInfoImpl_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformationChar( char* p1, const char* customerID); - virtual const char* getCustomerInfoAChar( char* p1, const char* ); - virtual const char* getCustomerInfoBChar( char* p1, char* customerID); - virtual const char* getCustomerInfoCChar( char* p1, char customerID); - virtual const char* getCustomerInfoDChar( char* p1, char ); - virtual const char* getCustomerInfoEChar( char* p1, char* ); - virtual const char* getCustomerInfoFChar( char* p1, char* p1, char* customerID); - virtual const char* getCustomerInfoGChar( char* p1, char* , char* p1, signed char* customerID); - virtual const char* getCustomerInfoHChar( unsigned char* customerID, const char ); - virtual const char* getCustomerInfoHChar( unsigned char* customerID, const char* ); - virtual const long* getCustomerInformationLong(const long* customerID, const long* customerID); - virtual const long* getCustomerInfoALong(const long* , const long* ); - virtual const long* getCustomerInfoBLong( long* customerID, long* customerID2); - virtual const long* getCustomerInfoCLong( long customerID, long customerID2); - virtual const long* getCustomerInfoDLong( long , long ); - virtual const long* getCustomerInfoELong( long* , long* ); - virtual const long* getCustomerInfoFLong( long* customerID, long* customerID2); - virtual const long* getCustomerInfoGLong( signed long* customerID, signed long* customerID2); - virtual const long* getCustomerInfoHLong( signed long* customerID, signed long* customerID2); - virtual const int* getCustomerInformationInt( char* , const int* customerID); - virtual const int* getCustomerInfoAInt( char* , const int* ); - virtual const int* getCustomerInfoBInt( char* , int* customerID); - virtual const int* getCustomerInfoCInt( char* , int customerID); - virtual const int* getCustomerInfoDInt( char* , int ); - virtual const int* getCustomerInfoEInt( char* , int* ); - virtual const int* getCustomerInfoFInt( char* , int* customerID); - virtual const int* getCustomerInfoGInt( char* , signed int* customerID); - virtual const int* getCustomerInfoHInt( char* , unsigned int* customerID); - virtual const __int64* getCustomerInformationint64( Diamond& , const __int64* customerID); - virtual const __int64* getCustomerInfoAint64( Diamond& , const __int64* ); - virtual const __int64* getCustomerInfoBint64( Diamond& , __int64* customerID); - virtual const __int64* getCustomerInfoCint64( Diamond& , __int64 customerID); - virtual const __int64* getCustomerInfoDint64( Diamond& myDiamond, __int64 ); - virtual const __int64* getCustomerInfoEint64( Diamond& myDiamond, __int64* ); - virtual const __int64* getCustomerInfoFint64( Diamond& myDiamond, __int64* customerID); - virtual const __int64* getCustomerInfoGint64( Diamond& myDiamond, signed __int64* customerID); - virtual const __int64* getCustomerInfoHint64(const Diamond& myDiamond, unsigned int64* customerID); - virtual const void* getCustomerInformationVoid( float& f, const __int64* customerID); - virtual void getCustomerInfoAVoid(const float& f, const __int64* ); - virtual void getCustomerInfoBVoid(); - virtual void getCustomerInfoCVoid(); - virtual void getCustomerInfoDVoid( void ); - virtual char getCustomerInfoEVoid( void ); - virtual char getCustomerInfoFVoid(); - virtual char getCustomerInfoGVoid( void ); - virtual const char* getCustomerInfoAInline( int , int , int , int , char* customer id); - virtual int getCustomerInfoBInline( int* , int* f, int* g, char* customer id); - virtual friend const unsigned int* getCustomerInfoCInline( char* customer id); - virtual int getCustomerInfoTrickyA(const char , const char ); - virtual int getCustomerInfoTrickyB( int myInt, int myInt); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index be09a57919..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,872 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Wrapper* CustomerInfoImpl_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl*)getImplementation(); -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::~CustomerInfoImpl_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformationChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - const char* p1 = *(const char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformationChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformationChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoAChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - const char* p1 = *(const char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoAChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoAChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoBChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char* p1 = *( char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoBChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoBChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoCChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char& p1 = *( char*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoCChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoCChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoDChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char& p1 = *( char*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoDChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoDChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoEChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char* p1 = *( char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoEChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoEChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoFChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char* p1 = *( char**)operation.getParameterValue(1); - char* p2 = *( char**)operation.getParameterValue(2); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoFChar(p0, p1, p2); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoFChar(p0, p1, p2); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoGChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - char* p1 = *( char**)operation.getParameterValue(1); - char* p2 = *( char**)operation.getParameterValue(2); - signed char* p3 = *( signed char**)operation.getParameterValue(3); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoGChar(p0, p1, p2, p3); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoGChar(p0, p1, p2, p3); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoHChar") - { - unsigned char* p0 = *( unsigned char**)operation.getParameterValue(0); - const char& p1 = *(const char*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoHChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoHChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoHChar") - { - unsigned char* p0 = *( unsigned char**)operation.getParameterValue(0); - const char* p1 = *(const char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoHChar(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoHChar(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInformationLong") - { - const long* p0 = *(const long**)operation.getParameterValue(0); - const long* p1 = *(const long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInformationLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInformationLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoALong") - { - const long* p0 = *(const long**)operation.getParameterValue(0); - const long* p1 = *(const long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoALong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoALong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoBLong") - { - long* p0 = *( long**)operation.getParameterValue(0); - long* p1 = *( long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoBLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoBLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoCLong") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoCLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoCLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoDLong") - { - long& p0 = *( long*)operation.getParameterValue(0); - long& p1 = *( long*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoDLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoDLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoELong") - { - long* p0 = *( long**)operation.getParameterValue(0); - long* p1 = *( long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoELong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoELong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoFLong") - { - long* p0 = *( long**)operation.getParameterValue(0); - long* p1 = *( long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoFLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoFLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoGLong") - { - signed long* p0 = *( signed long**)operation.getParameterValue(0); - signed long* p1 = *( signed long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoGLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoGLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoHLong") - { - signed long* p0 = *( signed long**)operation.getParameterValue(0); - signed long* p1 = *( signed long**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoHLong(p0, p1); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoHLong(p0, p1); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInformationInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - const int* p1 = *(const int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInformationInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInformationInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoAInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - const int* p1 = *(const int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoAInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoAInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoBInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - int* p1 = *( int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoBInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoBInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoCInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - int& p1 = *( int*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoCInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoCInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoDInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - int& p1 = *( int*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoDInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoDInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoEInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - int* p1 = *( int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoEInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoEInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoFInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - int* p1 = *( int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoFInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoFInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoGInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - signed int* p1 = *( signed int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoGInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoGInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoHInt") - { - char* p0 = *( char**)operation.getParameterValue(0); - unsigned int* p1 = *( unsigned int**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoHInt(p0, p1); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoHInt(p0, p1); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInformationint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - const __int64* p1 = *(const __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInformationint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInformationint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoAint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - const __int64* p1 = *(const __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoAint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoAint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoBint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - __int64* p1 = *( __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoBint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoBint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoCint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - __int64& p1 = *( __int64*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoCint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoCint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoDint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - __int64& p1 = *( __int64*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoDint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoDint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoEint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - __int64* p1 = *( __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoEint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoEint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoFint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - __int64* p1 = *( __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoFint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoFint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoGint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - signed __int64* p1 = *( signed __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoGint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoGint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoHint64") - { - Diamond& p0 = *(Diamond*)operation.getParameterValue(0); - unsigned int64* p1 = *( unsigned int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoHint64(p0, p1); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoHint64(p0, p1); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInformationVoid") - { - float& p0 = *(float*)operation.getParameterValue(0); - const __int64* p1 = *(const __int64**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const void**)operation.getReturnValue() = impl->getCustomerInformationVoid(p0, p1); - } - else - { - const void** ret = new const void*; - *ret = impl->getCustomerInformationVoid(p0, p1); - operation.setReturnValue((const const void**)ret); - } - return; - } - if (operationName == "getCustomerInfoAVoid") - { - float& p0 = *(float*)operation.getParameterValue(0); - const __int64* p1 = *(const __int64**)operation.getParameterValue(1); - impl->getCustomerInfoAVoid(p0, p1); - return; - } - if (operationName == "getCustomerInfoBVoid") - { - impl->getCustomerInfoBVoid(); - return; - } - if (operationName == "getCustomerInfoCVoid") - { - impl->getCustomerInfoCVoid(); - return; - } - if (operationName == "getCustomerInfoDVoid") - { - impl->getCustomerInfoDVoid(); - return; - } - if (operationName == "getCustomerInfoEVoid") - { - - if(operation.getReturnValue() != NULL) - { - *(char*)operation.getReturnValue() = impl->getCustomerInfoEVoid(); - } - else - { - char* ret = new char; - *ret = impl->getCustomerInfoEVoid(); - operation.setReturnValue((const char*)ret); - } - return; - } - if (operationName == "getCustomerInfoFVoid") - { - - if(operation.getReturnValue() != NULL) - { - *(char*)operation.getReturnValue() = impl->getCustomerInfoFVoid(); - } - else - { - char* ret = new char; - *ret = impl->getCustomerInfoFVoid(); - operation.setReturnValue((const char*)ret); - } - return; - } - if (operationName == "getCustomerInfoGVoid") - { - - if(operation.getReturnValue() != NULL) - { - *(char*)operation.getReturnValue() = impl->getCustomerInfoGVoid(); - } - else - { - char* ret = new char; - *ret = impl->getCustomerInfoGVoid(); - operation.setReturnValue((const char*)ret); - } - return; - } - if (operationName == "getCustomerInfoAInline") - { - int& p0 = *( int*)operation.getParameterValue(0); - int& p1 = *( int*)operation.getParameterValue(1); - int& p2 = *( int*)operation.getParameterValue(2); - int& p3 = *( int*)operation.getParameterValue(3); - char* customer p4 = *( char* customer*)operation.getParameterValue(4); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoAInline(p0, p1, p2, p3, p4); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoAInline(p0, p1, p2, p3, p4); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoBInline") - { - int* p0 = *( int**)operation.getParameterValue(0); - int* p1 = *( int**)operation.getParameterValue(1); - int* p2 = *( int**)operation.getParameterValue(2); - char* customer p3 = *( char* customer*)operation.getParameterValue(3); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoBInline(p0, p1, p2, p3); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoBInline(p0, p1, p2, p3); - operation.setReturnValue((const int*)ret); - } - return; - } - if (operationName == "getCustomerInfoCInline") - { - char* customer p0 = *( char* customer*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(friend const unsigned int**)operation.getReturnValue() = impl->getCustomerInfoCInline(p0); - } - else - { - friend const unsigned int** ret = new friend const unsigned int*; - *ret = impl->getCustomerInfoCInline(p0); - operation.setReturnValue((const friend const unsigned int**)ret); - } - return; - } - if (operationName == "getCustomerInfoTrickyA") - { - const char& p0 = *(const char*)operation.getParameterValue(0); - const char& p1 = *(const char*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoTrickyA(p0, p1); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoTrickyA(p0, p1); - operation.setReturnValue((const int*)ret); - } - return; - } - if (operationName == "getCustomerInfoTrickyB") - { - int& p0 = *( int*)operation.getParameterValue(0); - int& p1 = *( int*)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoTrickyB(p0, p1); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoTrickyB(p0, p1); - operation.setReturnValue((const int*)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h deleted file mode 100644 index 94b1d5cb4d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CustomerInfoImpl* impl; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp deleted file mode 100644 index f3b2540ba8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,504 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Proxy* CustomerInfoImpl_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl_CustomerInfoService_Proxy::CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl_CustomerInfoService_Proxy::~CustomerInfoImpl_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationChar(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformationChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAChar(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoAChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBChar( char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoBChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCChar( char arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDChar( char arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoDChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEChar( char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoEChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFChar( char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoFChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGChar( signed char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoGChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHChar( unsigned char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoHChar"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationLong(const long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformationLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoALong(const long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoALong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBLong( long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoBLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCLong( long arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDLong( long arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoDLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoELong( long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoELong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFLong( long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoFLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGLong( signed long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoGLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const long* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHLong( unsigned long* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoHLong"); - operation.addParameter(&arg0); - const long* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const long**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationInt(const int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformationInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAInt(const int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoAInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBInt( int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoBInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCInt( int arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDInt( int arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoDInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEInt( int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoEInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFInt( int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoFInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGInt( signed int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoGInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHInt( unsigned int* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoHInt"); - operation.addParameter(&arg0); - const int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const int**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationint64(const __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformationint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAint64(const __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoAint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBint64( __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoBint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCint64( __int64 arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDint64( __int64 arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoDint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoEint64( __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoEint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoFint64( __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoFint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoGint64( signed __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoGint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const __int64* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoHint64( unsigned int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoHint64"); - operation.addParameter(&arg0); - const __int64* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const __int64**)operation.getReturnValue(); -} - -const void* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationVoid(const __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformationVoid"); - operation.addParameter(&arg0); - const void* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const void**)operation.getReturnValue(); -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAVoid(const __int64* arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoAVoid"); - operation.addParameter(&arg0); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoBVoid"); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoCVoid"); - target->invoke(operation); - return; -} - -void CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoDVoid() -{ - tuscany::sca::Operation operation("getCustomerInfoDVoid"); - operation.addParameter(&arg0); - target->invoke(operation); - return; -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoAInline( char* customer arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoAInline"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBInline( char* customer arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoBInline"); - operation.addParameter(&arg0); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - -friend const unsigned int* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoCInline( char* customer arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoCInline"); - operation.addParameter(&arg0); - friend const unsigned int* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(friend const unsigned int**)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoTrickyA(const char arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoTrickyA"); - operation.addParameter(&arg0); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - -int CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoTrickyB( int arg0) -{ - tuscany::sca::Operation operation("getCustomerInfoTrickyB"); - operation.addParameter(&arg0); - int ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(int*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h deleted file mode 100644 index 75f912d3ae..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,86 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h -#define CustomerInfoImpl_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformationChar(const char* customerID); - virtual const char* getCustomerInfoAChar(const char* ); - virtual const char* getCustomerInfoBChar( char* customerID); - virtual const char* getCustomerInfoCChar( char customerID); - virtual const char* getCustomerInfoDChar( char ); - virtual const char* getCustomerInfoEChar( char* ); - virtual const char* getCustomerInfoFChar( char* customerID); - virtual const char* getCustomerInfoGChar( signed char* customerID); - virtual const char* getCustomerInfoHChar( unsigned char* customerID); - virtual const long* getCustomerInformationLong(const long* customerID); - virtual const long* getCustomerInfoALong(const long* ); - virtual const long* getCustomerInfoBLong( long* customerID); - virtual const long* getCustomerInfoCLong( long customerID); - virtual const long* getCustomerInfoDLong( long ); - virtual const long* getCustomerInfoELong( long* ); - virtual const long* getCustomerInfoFLong( long* customerID); - virtual const long* getCustomerInfoGLong( signed long* customerID); - virtual const long* getCustomerInfoHLong( unsigned long* customerID); - virtual const int* getCustomerInformationInt(const int* customerID); - virtual const int* getCustomerInfoAInt(const int* ); - virtual const int* getCustomerInfoBInt( int* customerID); - virtual const int* getCustomerInfoCInt( int customerID); - virtual const int* getCustomerInfoDInt( int ); - virtual const int* getCustomerInfoEInt( int* ); - virtual const int* getCustomerInfoFInt( int* customerID); - virtual const int* getCustomerInfoGInt( signed int* customerID); - virtual const int* getCustomerInfoHInt( unsigned int* customerID); - virtual const __int64* getCustomerInformationint64(const __int64* customerID); - virtual const __int64* getCustomerInfoAint64(const __int64* ); - virtual const __int64* getCustomerInfoBint64( __int64* customerID); - virtual const __int64* getCustomerInfoCint64( __int64 customerID); - virtual const __int64* getCustomerInfoDint64( __int64 ); - virtual const __int64* getCustomerInfoEint64( __int64* ); - virtual const __int64* getCustomerInfoFint64( __int64* customerID); - virtual const __int64* getCustomerInfoGint64( signed __int64* customerID); - virtual const __int64* getCustomerInfoHint64( unsigned int64* customerID); - virtual const void* getCustomerInformationVoid(const __int64* customerID); - virtual void getCustomerInfoAVoid(const __int64* ); - virtual void getCustomerInfoBVoid(); - virtual void getCustomerInfoCVoid(); - virtual void getCustomerInfoDVoid( void ); - virtual const char* getCustomerInfoAInline( char* customer id); - virtual int getCustomerInfoBInline( char* customer id); - virtual friend const unsigned int* getCustomerInfoCInline( char* customer id); - virtual int getCustomerInfoTrickyA(const char ); - virtual int getCustomerInfoTrickyB( int myInt); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index 896a129145..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,760 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Wrapper* CustomerInfoImpl_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl*)getImplementation(); -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::~CustomerInfoImpl_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformationChar") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformationChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformationChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoAChar") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoAChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoAChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoBChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoBChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoBChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoCChar") - { - char& p0 = *( char*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoCChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoCChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoDChar") - { - char& p0 = *( char*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoDChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoDChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoEChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoEChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoEChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoFChar") - { - char* p0 = *( char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoFChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoFChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoGChar") - { - signed char* p0 = *( signed char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoGChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoGChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoHChar") - { - unsigned char* p0 = *( unsigned char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoHChar(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoHChar(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInformationLong") - { - const long* p0 = *(const long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInformationLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInformationLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoALong") - { - const long* p0 = *(const long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoALong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoALong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoBLong") - { - long* p0 = *( long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoBLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoBLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoCLong") - { - long& p0 = *( long*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoCLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoCLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoDLong") - { - long& p0 = *( long*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoDLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoDLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoELong") - { - long* p0 = *( long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoELong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoELong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoFLong") - { - long* p0 = *( long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoFLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoFLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoGLong") - { - signed long* p0 = *( signed long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoGLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoGLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInfoHLong") - { - unsigned long* p0 = *( unsigned long**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const long**)operation.getReturnValue() = impl->getCustomerInfoHLong(p0); - } - else - { - const long** ret = new const long*; - *ret = impl->getCustomerInfoHLong(p0); - operation.setReturnValue((const const long**)ret); - } - return; - } - if (operationName == "getCustomerInformationInt") - { - const int* p0 = *(const int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInformationInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInformationInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoAInt") - { - const int* p0 = *(const int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoAInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoAInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoBInt") - { - int* p0 = *( int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoBInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoBInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoCInt") - { - int& p0 = *( int*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoCInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoCInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoDInt") - { - int& p0 = *( int*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoDInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoDInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoEInt") - { - int* p0 = *( int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoEInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoEInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoFInt") - { - int* p0 = *( int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoFInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoFInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoGInt") - { - signed int* p0 = *( signed int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoGInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoGInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInfoHInt") - { - unsigned int* p0 = *( unsigned int**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const int**)operation.getReturnValue() = impl->getCustomerInfoHInt(p0); - } - else - { - const int** ret = new const int*; - *ret = impl->getCustomerInfoHInt(p0); - operation.setReturnValue((const const int**)ret); - } - return; - } - if (operationName == "getCustomerInformationint64") - { - const __int64* p0 = *(const __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInformationint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInformationint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoAint64") - { - const __int64* p0 = *(const __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoAint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoAint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoBint64") - { - __int64* p0 = *( __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoBint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoBint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoCint64") - { - __int64& p0 = *( __int64*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoCint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoCint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoDint64") - { - __int64& p0 = *( __int64*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoDint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoDint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoEint64") - { - __int64* p0 = *( __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoEint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoEint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoFint64") - { - __int64* p0 = *( __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoFint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoFint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoGint64") - { - signed __int64* p0 = *( signed __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoGint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoGint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInfoHint64") - { - unsigned int64* p0 = *( unsigned int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const __int64**)operation.getReturnValue() = impl->getCustomerInfoHint64(p0); - } - else - { - const __int64** ret = new const __int64*; - *ret = impl->getCustomerInfoHint64(p0); - operation.setReturnValue((const const __int64**)ret); - } - return; - } - if (operationName == "getCustomerInformationVoid") - { - const __int64* p0 = *(const __int64**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const void**)operation.getReturnValue() = impl->getCustomerInformationVoid(p0); - } - else - { - const void** ret = new const void*; - *ret = impl->getCustomerInformationVoid(p0); - operation.setReturnValue((const const void**)ret); - } - return; - } - if (operationName == "getCustomerInfoAVoid") - { - const __int64* p0 = *(const __int64**)operation.getParameterValue(0); - impl->getCustomerInfoAVoid(p0); - return; - } - if (operationName == "getCustomerInfoBVoid") - { - impl->getCustomerInfoBVoid(); - return; - } - if (operationName == "getCustomerInfoCVoid") - { - impl->getCustomerInfoCVoid(); - return; - } - if (operationName == "getCustomerInfoDVoid") - { - impl->getCustomerInfoDVoid(); - return; - } - if (operationName == "getCustomerInfoAInline") - { - char* customer p0 = *( char* customer*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoAInline(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoAInline(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoBInline") - { - char* customer p0 = *( char* customer*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoBInline(p0); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoBInline(p0); - operation.setReturnValue((const int*)ret); - } - return; - } - if (operationName == "getCustomerInfoCInline") - { - char* customer p0 = *( char* customer*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(friend const unsigned int**)operation.getReturnValue() = impl->getCustomerInfoCInline(p0); - } - else - { - friend const unsigned int** ret = new friend const unsigned int*; - *ret = impl->getCustomerInfoCInline(p0); - operation.setReturnValue((const friend const unsigned int**)ret); - } - return; - } - if (operationName == "getCustomerInfoTrickyA") - { - const char& p0 = *(const char*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoTrickyA(p0); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoTrickyA(p0); - operation.setReturnValue((const int*)ret); - } - return; - } - if (operationName == "getCustomerInfoTrickyB") - { - int& p0 = *( int*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(int*)operation.getReturnValue() = impl->getCustomerInfoTrickyB(p0); - } - else - { - int* ret = new int; - *ret = impl->getCustomerInfoTrickyB(p0); - operation.setReturnValue((const int*)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h deleted file mode 100644 index 94b1d5cb4d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CustomerInfoImpl* impl; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp deleted file mode 100644 index 6f2c95f45b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "CustomerInfoImpl2_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl2_CustomerInfoService_Proxy* CustomerInfoImpl2_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl2_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl2_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl2_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl2_CustomerInfoService_Proxy::CustomerInfoImpl2_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl2_CustomerInfoService_Proxy::~CustomerInfoImpl2_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl2_CustomerInfoService_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter("customerID", &arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h deleted file mode 100644 index 594f404d13..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef CustomerInfoImpl2_CustomerInfoService_Proxy_h -#define CustomerInfoImpl2_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl2_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl2_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl2_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl2_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index 57add811a2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,83 +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. - */ - -#include "CustomerInfoImpl2_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl2_CustomerInfoService_Wrapper* CustomerInfoImpl2_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl2_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl2_CustomerInfoService_Wrapper::CustomerInfoImpl2_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl2*)getImplementation(); -} - -CustomerInfoImpl2_CustomerInfoService_Wrapper::~CustomerInfoImpl2_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl2_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl2; -} - -void CustomerInfoImpl2_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl2_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformation") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformation(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformation(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h deleted file mode 100644 index b85533cfd4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl2_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl2_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl2_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl2_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl2_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CustomerInfoImpl2* impl; -}; - -#endif // CustomerInfoImpl2_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index b0d9424ad4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValue(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValue"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueS(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueS"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustname( string& arg0) -{ - tuscany::sca::Operation operation("getCustname"); - operation.addParameter("customerID", &arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecs( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecs"); - operation.addParameter("customerID", &arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index d61c806e44..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValue(const char* customerID); - virtual float getMyValueS(const string& customerID); - virtual string getCustname( string& customerID); - virtual const string& getCustnamecs( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index 7f38178f9c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValue") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValue(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValue(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueS") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueS(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueS(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustname") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustname(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustname(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecs") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecs(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index d3eef80e8f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.cpp deleted file mode 100644 index e6800aa311..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_customerInfo_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_customerInfo_Proxy* MyValueImpl_customerInfo_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_customerInfo_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_customerInfo_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_customerInfo_Proxy*)proxy; - } -} - -MyValueImpl_customerInfo_Proxy::MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_customerInfo_Proxy::~MyValueImpl_customerInfo_Proxy() -{ - if (target) - delete target; -} - -const char* MyValueImpl_customerInfo_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter("customerID", &arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.h deleted file mode 100644 index 3d1d279b7c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_customerInfo_Proxy_h -#define MyValueImpl_customerInfo_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_customerInfo_Proxy : public CustomerInfo -{ -public: - MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_customerInfo_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_customerInfo_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.cpp deleted file mode 100644 index d3fd4fbaf0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_stockQuote_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_stockQuote_Proxy* MyValueImpl_stockQuote_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_stockQuote_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_stockQuote_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_stockQuote_Proxy*)proxy; - } -} - -MyValueImpl_stockQuote_Proxy::MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_stockQuote_Proxy::~MyValueImpl_stockQuote_Proxy() -{ - if (target) - delete target; -} - -commonj::sdo::DataObjectPtr MyValueImpl_stockQuote_Proxy::GetStockQuotes( commonj::sdo::DataObjectPtr arg0) -{ - tuscany::sca::Operation operation("GetStockQuotes"); - operation.addParameter("request", &arg0); - commonj::sdo::DataObjectPtr ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(commonj::sdo::DataObjectPtr*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index ad5cee3ca7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes( commonj::sdo::DataObjectPtr request); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp deleted file mode 100644 index 95c63da613..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Proxy* CustomerInfoImpl_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl_CustomerInfoService_Proxy::CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl_CustomerInfoService_Proxy::~CustomerInfoImpl_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter("customerID", &arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h deleted file mode 100644 index 2bf1b90e87..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h -#define CustomerInfoImpl_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index b32cf3863a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,83 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - -using Other::CustomerInfoImpl; - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Wrapper* CustomerInfoImpl_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl*)getImplementation(); -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::~CustomerInfoImpl_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformation") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformation(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformation(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h deleted file mode 100644 index 82995c96b0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - Other::CustomerInfoImpl* impl; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index b0d9424ad4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValue(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValue"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueS(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueS"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustname( string& arg0) -{ - tuscany::sca::Operation operation("getCustname"); - operation.addParameter("customerID", &arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecs( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecs"); - operation.addParameter("customerID", &arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index d61c806e44..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValue(const char* customerID); - virtual float getMyValueS(const string& customerID); - virtual string getCustname( string& customerID); - virtual const string& getCustnamecs( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index ac104f9aaf..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - -using Other::MyValueImpl; - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValue") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValue(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValue(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueS") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueS(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueS(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustname") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustname(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustname(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecs") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecs(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index df388bf43d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - Other::MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.cpp deleted file mode 100644 index e6800aa311..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_customerInfo_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_customerInfo_Proxy* MyValueImpl_customerInfo_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_customerInfo_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_customerInfo_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_customerInfo_Proxy*)proxy; - } -} - -MyValueImpl_customerInfo_Proxy::MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_customerInfo_Proxy::~MyValueImpl_customerInfo_Proxy() -{ - if (target) - delete target; -} - -const char* MyValueImpl_customerInfo_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter("customerID", &arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.h deleted file mode 100644 index 3d1d279b7c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_customerInfo_Proxy_h -#define MyValueImpl_customerInfo_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_customerInfo_Proxy : public CustomerInfo -{ -public: - MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_customerInfo_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_customerInfo_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.cpp deleted file mode 100644 index d3fd4fbaf0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_stockQuote_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_stockQuote_Proxy* MyValueImpl_stockQuote_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_stockQuote_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_stockQuote_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_stockQuote_Proxy*)proxy; - } -} - -MyValueImpl_stockQuote_Proxy::MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_stockQuote_Proxy::~MyValueImpl_stockQuote_Proxy() -{ - if (target) - delete target; -} - -commonj::sdo::DataObjectPtr MyValueImpl_stockQuote_Proxy::GetStockQuotes( commonj::sdo::DataObjectPtr arg0) -{ - tuscany::sca::Operation operation("GetStockQuotes"); - operation.addParameter("request", &arg0); - commonj::sdo::DataObjectPtr ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(commonj::sdo::DataObjectPtr*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index ad5cee3ca7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes( commonj::sdo::DataObjectPtr request); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index 21d956f547..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValueOther(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValueOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueSOther(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueSOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustnameOther( string& arg0) -{ - tuscany::sca::Operation operation("getCustnameOther"); - operation.addParameter("customerID", &arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecsOther( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecsOther"); - operation.addParameter("customerID", &arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index bb92aa0556..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValueOther(const char* customerID); - virtual float getMyValueSOther(const string& customerID); - virtual string getCustnameOther( string& customerID); - virtual const string& getCustnamecsOther( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index de0f0a0563..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - -using myvaluecorp::implns::MyValueImpl; - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValueOther") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueSOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueSOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueSOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustnameOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustnameOther(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustnameOther(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecsOther") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecsOther(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index cfc7c4c07a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - myvaluecorp::implns::MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index 21d956f547..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValueOther(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValueOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueSOther(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueSOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustnameOther( string& arg0) -{ - tuscany::sca::Operation operation("getCustnameOther"); - operation.addParameter("customerID", &arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecsOther( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecsOther"); - operation.addParameter("customerID", &arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index 210da9a64c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public Other::MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValueOther(const char* customerID); - virtual float getMyValueSOther(const string& customerID); - virtual string getCustnameOther( string& customerID); - virtual const string& getCustnamecsOther( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index f84fcf496b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValueOther") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueSOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueSOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueSOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustnameOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustnameOther(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustnameOther(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecsOther") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecsOther(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index d3eef80e8f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index 21d956f547..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValueOther(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValueOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueSOther(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueSOther"); - operation.addParameter("customerID", &arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustnameOther( string& arg0) -{ - tuscany::sca::Operation operation("getCustnameOther"); - operation.addParameter("customerID", &arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecsOther( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecsOther"); - operation.addParameter("customerID", &arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index 210da9a64c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public Other::MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValueOther(const char* customerID); - virtual float getMyValueSOther(const string& customerID); - virtual string getCustnameOther( string& customerID); - virtual const string& getCustnamecsOther( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index f84fcf496b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValueOther") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueSOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueSOther(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueSOther(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustnameOther") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustnameOther(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustnameOther(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecsOther") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecsOther(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index d3eef80e8f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp deleted file mode 100644 index 543b370282..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "CustomerInfoImpl2_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl2_CustomerInfoService_Proxy* CustomerInfoImpl2_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl2_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl2_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl2_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl2_CustomerInfoService_Proxy::CustomerInfoImpl2_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl2_CustomerInfoService_Proxy::~CustomerInfoImpl2_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl2_CustomerInfoService_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h deleted file mode 100644 index 594f404d13..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef CustomerInfoImpl2_CustomerInfoService_Proxy_h -#define CustomerInfoImpl2_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl2_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl2_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl2_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl2_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index 191dd3eed2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,83 +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. - */ - -#include "CustomerInfoImpl2_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - -using myvaluecorp::implns::CustomerInfoImpl2; - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl2_CustomerInfoService_Wrapper* CustomerInfoImpl2_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl2_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl2_CustomerInfoService_Wrapper::CustomerInfoImpl2_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl2*)getImplementation(); -} - -CustomerInfoImpl2_CustomerInfoService_Wrapper::~CustomerInfoImpl2_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl2_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl2; -} - -void CustomerInfoImpl2_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl2_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformation") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformation(p0); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformation(p0); - operation.setReturnValue((const const char**)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h deleted file mode 100644 index a57f5c4613..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl2_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl2_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl2_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl2_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl2_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - myvaluecorp::implns::CustomerInfoImpl2* impl; -}; - -#endif // CustomerInfoImpl2_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.cpp deleted file mode 100644 index fe996eabdb..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.cpp +++ /dev/null @@ -1,92 +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. - */ - -#include "MyValueImpl_MyValueService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Proxy* MyValueImpl_MyValueService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_MyValueService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_MyValueService_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_MyValueService_Proxy*)proxy; - } -} - -MyValueImpl_MyValueService_Proxy::MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_MyValueService_Proxy::~MyValueImpl_MyValueService_Proxy() -{ - if (target) - delete target; -} - -float MyValueImpl_MyValueService_Proxy::getMyValue(const char* arg0) -{ - tuscany::sca::Operation operation("getMyValue"); - operation.addParameter(&arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -float MyValueImpl_MyValueService_Proxy::getMyValueS(const string& arg0) -{ - tuscany::sca::Operation operation("getMyValueS"); - operation.addParameter(&arg0); - float ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(float*)operation.getReturnValue(); -} - -string MyValueImpl_MyValueService_Proxy::getCustname( string& arg0) -{ - tuscany::sca::Operation operation("getCustname"); - operation.addParameter(&arg0); - string ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(string*)operation.getReturnValue(); -} - -const string& MyValueImpl_MyValueService_Proxy::getCustnamecs( string arg0) -{ - tuscany::sca::Operation operation("getCustnamecs"); - operation.addParameter(&arg0); - target->invoke(operation); - return *(const string*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.h deleted file mode 100644 index d61c806e44..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef MyValueImpl_MyValueService_Proxy_h -#define MyValueImpl_MyValueService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValue.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_MyValueService_Proxy : public MyValue -{ -public: - MyValueImpl_MyValueService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_MyValueService_Proxy(); - virtual float getMyValue(const char* customerID); - virtual float getMyValueS(const string& customerID); - virtual string getCustname( string& customerID); - virtual const string& getCustnamecs( string customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_MyValueService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.cpp deleted file mode 100644 index 5bbd07a72a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.cpp +++ /dev/null @@ -1,122 +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. - */ - -#include "MyValueImpl_MyValueService_Wrapper.h" - -#include "osoa/sca/sca.h" - -using myvaluecorp::implns::MyValueImpl; - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_MyValueService_Wrapper* MyValueImpl_MyValueService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new MyValueImpl_MyValueService_Wrapper(target); - } -} - -MyValueImpl_MyValueService_Wrapper::MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (MyValueImpl*)getImplementation(); -} - -MyValueImpl_MyValueService_Wrapper::~MyValueImpl_MyValueService_Wrapper() -{ - releaseImplementation(); -} - -void* MyValueImpl_MyValueService_Wrapper::newImplementation() -{ - return new MyValueImpl; -} - -void MyValueImpl_MyValueService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void MyValueImpl_MyValueService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getMyValue") - { - const char* p0 = *(const char**)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValue(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValue(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getMyValueS") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(float*)operation.getReturnValue() = impl->getMyValueS(p0); - } - else - { - float* ret = new float; - *ret = impl->getMyValueS(p0); - operation.setReturnValue((const float*)ret); - } - return; - } - if (operationName == "getCustname") - { - string& p0 = *(string*)operation.getParameterValue(0); - - if(operation.getReturnValue() != NULL) - { - *(string*)operation.getReturnValue() = impl->getCustname(p0); - } - else - { - string* ret = new string; - *ret = impl->getCustname(p0); - operation.setReturnValue((const string*)ret); - } - return; - } - if (operationName == "getCustnamecs") - { - string& p0 = *( string*)operation.getParameterValue(0); - const string& ret = impl->getCustnamecs(p0); - operation.setReturnValue(&ret); - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.h deleted file mode 100644 index cfc7c4c07a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef MyValueImpl_MyValueService_Wrapper_h -#define MyValueImpl_MyValueService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "MyValueImpl.hpp" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class MyValueImpl_MyValueService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - MyValueImpl_MyValueService_Wrapper(tuscany::sca::model::Service* target); - virtual ~MyValueImpl_MyValueService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - myvaluecorp::implns::MyValueImpl* impl; -}; - -#endif // MyValueImpl_MyValueService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.cpp deleted file mode 100644 index ffcc1d0003..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_customerInfo_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_customerInfo_Proxy* MyValueImpl_customerInfo_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_customerInfo_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_customerInfo_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_customerInfo_Proxy*)proxy; - } -} - -MyValueImpl_customerInfo_Proxy::MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_customerInfo_Proxy::~MyValueImpl_customerInfo_Proxy() -{ - if (target) - delete target; -} - -const char* MyValueImpl_customerInfo_Proxy::getCustomerInformation(const char* arg0) -{ - tuscany::sca::Operation operation("getCustomerInformation"); - operation.addParameter(&arg0); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.h deleted file mode 100644 index 3d1d279b7c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_customerInfo_Proxy_h -#define MyValueImpl_customerInfo_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_customerInfo_Proxy : public CustomerInfo -{ -public: - MyValueImpl_customerInfo_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_customerInfo_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_customerInfo_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.cpp deleted file mode 100644 index 6e4d0600bd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.cpp +++ /dev/null @@ -1,64 +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. - */ - -#include "MyValueImpl_stockQuote_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - MyValueImpl_stockQuote_Proxy* MyValueImpl_stockQuote_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new MyValueImpl_stockQuote_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void MyValueImpl_stockQuote_Proxy_Destructor(void* proxy) - { - delete (MyValueImpl_stockQuote_Proxy*)proxy; - } -} - -MyValueImpl_stockQuote_Proxy::MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -MyValueImpl_stockQuote_Proxy::~MyValueImpl_stockQuote_Proxy() -{ - if (target) - delete target; -} - -commonj::sdo::DataObjectPtr MyValueImpl_stockQuote_Proxy::GetStockQuotes( commonj::sdo::DataObjectPtr arg0) -{ - tuscany::sca::Operation operation("GetStockQuotes"); - operation.addParameter(&arg0); - commonj::sdo::DataObjectPtr ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(commonj::sdo::DataObjectPtr*)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.h deleted file mode 100644 index ad5cee3ca7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.h +++ /dev/null @@ -1,41 +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. - */ - -#ifndef MyValueImpl_stockQuote_Proxy_h -#define MyValueImpl_stockQuote_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "StockQuoteService.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class MyValueImpl_stockQuote_Proxy : public StockQuoteService -{ -public: - MyValueImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~MyValueImpl_stockQuote_Proxy(); - virtual commonj::sdo::DataObjectPtr GetStockQuotes( commonj::sdo::DataObjectPtr request); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // MyValueImpl_stockQuote_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp deleted file mode 100644 index 4c3d626bfb..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp +++ /dev/null @@ -1,87 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Proxy.h" - -#include "osoa/sca/sca.h" - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Proxy* CustomerInfoImpl_CustomerInfoService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) - { - return new CustomerInfoImpl_CustomerInfoService_Proxy(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void CustomerInfoImpl_CustomerInfoService_Proxy_Destructor(void* proxy) - { - delete (CustomerInfoImpl_CustomerInfoService_Proxy*)proxy; - } -} - -CustomerInfoImpl_CustomerInfoService_Proxy::CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -CustomerInfoImpl_CustomerInfoService_Proxy::~CustomerInfoImpl_CustomerInfoService_Proxy() -{ - if (target) - delete target; -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInformationCharPublic( char* arg0, const char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInformationCharPublic"); - operation.addParameter("p1", &arg0); - operation.addParameter("customerID", &arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoACharPublic( char* arg0, const char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoACharPublic"); - operation.addParameter("p1", &arg0); - operation.addParameter("", &arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - -const char* CustomerInfoImpl_CustomerInfoService_Proxy::getCustomerInfoBCharPublic( char* arg0, char* arg1) -{ - tuscany::sca::Operation operation("getCustomerInfoBCharPublic"); - operation.addParameter("p1", &arg0); - operation.addParameter("customerID", &arg1); - const char* ret; - operation.setReturnValue(&ret); - target->invoke(operation); - return *(const char**)operation.getReturnValue(); -} - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h deleted file mode 100644 index a9b56bdb5c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h -#define CustomerInfoImpl_CustomerInfoService_Proxy_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "/CustomerInfo.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo -{ -public: - CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformationCharPublic( char* p1, const char* customerID); - virtual const char* getCustomerInfoACharPublic( char* p1, const char* ); - virtual const char* getCustomerInfoBCharPublic( char* p1, char* customerID); -private: - tuscany::sca::ServiceWrapper* target; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Proxy_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp deleted file mode 100644 index 2aa9fcbdf2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp +++ /dev/null @@ -1,118 +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. - */ - -#include "CustomerInfoImpl_CustomerInfoService_Wrapper.h" - -#include "osoa/sca/sca.h" - - - -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - CustomerInfoImpl_CustomerInfoService_Wrapper* CustomerInfoImpl_CustomerInfoService_Wrapper_Factory(tuscany::sca::model::Service* target) - { - return new CustomerInfoImpl_CustomerInfoService_Wrapper(target); - } -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (CustomerInfoImpl*)getImplementation(); -} - -CustomerInfoImpl_CustomerInfoService_Wrapper::~CustomerInfoImpl_CustomerInfoService_Wrapper() -{ - releaseImplementation(); -} - -void* CustomerInfoImpl_CustomerInfoService_Wrapper::newImplementation() -{ - return new CustomerInfoImpl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::deleteImplementation() -{ - delete impl; -} - -void CustomerInfoImpl_CustomerInfoService_Wrapper::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - - if (operationName == "getCustomerInformationCharPublic") - { - char* p0 = *( char**)operation.getParameterValue(0); - const char* p1 = *(const char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInformationCharPublic(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInformationCharPublic(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoACharPublic") - { - char* p0 = *( char**)operation.getParameterValue(0); - const char* p1 = *(const char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoACharPublic(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoACharPublic(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - if (operationName == "getCustomerInfoBCharPublic") - { - char* p0 = *( char**)operation.getParameterValue(0); - char* p1 = *( char**)operation.getParameterValue(1); - - if(operation.getReturnValue() != NULL) - { - *(const char**)operation.getReturnValue() = impl->getCustomerInfoBCharPublic(p0, p1); - } - else - { - const char** ret = new const char*; - *ret = impl->getCustomerInfoBCharPublic(p0, p1); - operation.setReturnValue((const const char**)ret); - } - return; - } - - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -} - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h deleted file mode 100644 index 94b1d5cb4d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h -#define CustomerInfoImpl_CustomerInfoService_Wrapper_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "CustomerInfoImpl.h" -#include "tuscany/sca/cpp/CPPServiceWrapper.h" - -class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Service* target); - virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -private: - CustomerInfoImpl* impl; -}; - -#endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/lib/readme.txt b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/lib/readme.txt deleted file mode 100644 index d99c666c6a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/lib/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -Place a junit.jar file (not shipped as part of Tuscany) -in this directory to get the scagen build.xml Ant build -file to find it and Junit classes (without setting the -property "junit.jar.folder". diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.bat b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.bat deleted file mode 100644 index 8ab5e4abdf..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. - -@java -jar %~d0%~p0scagen.jar %* diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.sh b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.sh deleted file mode 100755 index c50f28b98f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# 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. - - -java -jar scagen.jar -dir $2 -output $4
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/BodyPart.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/BodyPart.java deleted file mode 100644 index 4ccbe0c750..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/BodyPart.java +++ /dev/null @@ -1,96 +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. - */ - -/* @version $Rev$ $Date$ */ - - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ - -package org.apache.tuscany.sca.cpp.tools.common; - -/** - * A snippet of C or C++ source code. If this snippet ends with a return - * statement, this body part also contains the return value. - */ -public class BodyPart { - public final static int TRAILING = 0; - - public final static int RETURN = 1; - - public final static int CATCH = 2; - - private String codeFragment; - - private String returnValue = null; - - private Parameter caughtValue = null; - - private int type; - - BodyPart(String cf) { - codeFragment = cf; - type = TRAILING; - } - - BodyPart(String cf, String rv) { - codeFragment = cf; - if (null != rv && !Utils.isSpace(rv)) { - type = RETURN; - returnValue = rv; - } else - type = TRAILING; - } - - BodyPart(String cf, Parameter cv) { - codeFragment = cf; - caughtValue = cv; - type = CATCH; - } - - public String getCodeFragment() { - return codeFragment; - } - - public boolean isTrailing() { - return TRAILING == type; - } - - public boolean isReturn() { - return RETURN == type; - } - - public boolean isCatch() { - return CATCH == type; - } - - public String getReturnValue() { - if (returnValue != null) - return returnValue.trim(); - else - return null; - } - - public Parameter getCaughtValue() { - return caughtValue; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/CParsingTool.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/CParsingTool.java deleted file mode 100644 index 669901b4b5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/CParsingTool.java +++ /dev/null @@ -1,124 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -/** - * The superclass of tools that parse C/C++ code. This CParsingTool provides - * some useful common methods. - */ -public class CParsingTool { - protected boolean failed = false; - - protected Headers headers = new Headers(); - - protected CParsingTool(String[] args) throws Exception { - String text = new String(); - for (int i = 0; i < args.length; i++) - text += args[i] + " "; - Utils.outputDebugString(text); - - Options.set(args); - String config = (String) Options.getOption("-config"); - if (null != config) - Configuration.initialise(config); - } - - /** - * Read in any include files before the main processing of the tool is done. - * This constructs the Headers. - */ - protected Headers preparseHeaders(String option) throws Exception { - Headers headers = new Headers(); - Object o = Options.getOption(option); - if (null != o) { - Utils.outputDebugString("Pre-parsing headers..."); - List includeList; - if (o instanceof List) - includeList = (List) o; - else { - includeList = new ArrayList(); - includeList.add(o); - } - Iterator it = includeList.iterator(); - while (it.hasNext()) { - File include = new File((String) it.next()); - if (!include.isDirectory()) - Utils.rude("Bad include directory " + include); - - DirectoryTree tree = new DirectoryTree(headers, new HashSet( - Arrays.asList(new Object[] { "hpp", "h" }))); - tree.walkTree(include, null, 0); - } - Utils.outputDebugString("Parsing files..."); - } - - return headers; - } - - /** - * Checks the source directory looks good. - */ - protected File checkFile(String option) throws Exception { - String name = (String) Options.getOption(option); - if (null == name) { - printUsage(); - System.exit(-1); - } - - File file = new File(name); - if (!file.isFile() && !file.isDirectory()) - Utils.rude("Bad file or directory " + file); - return file; - } - - /** - * Checks the target directory and creates it if it doesn't already exist. - */ - protected File maybeCreateDirectory(String option) throws Exception { - String name = (String) Options.getOption(option); - if (null == name) { - printUsage(); - System.exit(-1); - } - - File file = new File(name); - if (!file.exists() && !file.mkdir()) - Utils.screenMessage("Failed to create directory " + file); - return file; - } - - protected void printUsage() { - System.out.println("usage: ??"); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Configuration.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Configuration.java deleted file mode 100644 index 246a489c9c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Configuration.java +++ /dev/null @@ -1,132 +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. - */ - -/* @version $Rev$ $Date$ */ - - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * Encapsulates the tool's configuration file - */ -public class Configuration { - private static Set files = new HashSet(); - - private static Set classes = new HashSet(); - - private static Set methods = new HashSet(); - - private static Set macros = new HashSet(); - - private static Set defines = new HashSet(); - - private static Set attributes = new HashSet(); - - private static Map others = new HashMap(); - - /** - * No one creates an instance of this class. - */ - private Configuration() { - } - - /** - * Reads in the configuration file - */ - public static void initialise(String filename) throws Exception { - File file = new File(filename); - FileReader fr = new FileReader(file); - BufferedReader br = new BufferedReader(fr); - String line = br.readLine(); - for (int lineno = 1; null != line; lineno++, line = br.readLine()) { - // Ignore lines starting with a # (comments) and blank lines - if (line.startsWith("#")) - continue; - boolean blank = true; - for (int i = 0; i < line.length() && blank; i++) - if (!Character.isWhitespace(line.charAt(i))) - blank = false; - if (blank) - continue; - - int equals = line.indexOf("="); - if (-1 == equals) - Utils.rude("Bad line in configuration file " + filename - + " lineno " + lineno); - String key = line.substring(0, equals).trim(); - String value = line.substring(equals + 1).trim(); - if ("excludefile".equals(key)) { - files.add(value); - } else if ("excludeclass".equals(key)) { - classes.add(value); - } else if ("excludemethod".equals(key)) { - methods.add(value); - } else if ("macro".equals(key)) { - macros.add(value); - } else if ("define".equals(key)) { - defines.add(value); - } else if ("attribute".equals(key)) { - attributes.add(value); - } else { - others.put(key, value); - } - } - } - - public static boolean fileExcluded(String s) { - return files.contains(s); - } - - public static boolean classExcluded(String s) { - return classes.contains(s); - } - - public static boolean methodExcluded(String className, String method) { - return methods.contains(className + "::" + method); - } - - public static boolean isMacro(String s) { - return macros.contains(s); - } - - public static boolean isDefine(String s) { - return defines.contains(s); - } - - public static boolean isAttribute(String s) { - return attributes.contains(s); - } - - public static String getConfigured(String key) { - return (String) others.get(key); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/DirectoryTree.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/DirectoryTree.java deleted file mode 100644 index 36d0af18b3..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/DirectoryTree.java +++ /dev/null @@ -1,105 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.File; -import java.util.Set; -import java.util.StringTokenizer; - -public class DirectoryTree { - private FileActor actor; - - private Set extensions; - - public DirectoryTree(FileActor actor, Set extensions) { - this.actor = actor; - this.extensions = extensions; - } - - /** - * Starts adding trace into the given file. If the given file is a directory - * then this the starting directory and all code beneath and in this - * directory will be given trace. - * - * @param source - - * either the starting directory or one file to add trace to. - */ - public void walkTree(File source, File target, int depth) throws Exception { - depth++; - boolean noTarget = (null == target); - - if (!source.canRead()) - Utils.rude("Cannot read from source directory " + source); - if (!noTarget && !target.canWrite()) - Utils.rude("Cannot write to target directory " + target); - - if (source.isDirectory()) { - File[] filesInDirectory = source.listFiles(); - for (int i = 0; i < filesInDirectory.length; i++) { - File file = filesInDirectory[i]; - String name = file.getName(); - int dot = name.lastIndexOf('.'); - String ext = null; - if (-1 != dot) - ext = name.substring(dot + 1); - - if (file.isDirectory()) { - File newTarget = null; - if (!noTarget) { - StringTokenizer st = new StringTokenizer( - file.getPath(), "\\/"); - String newdir = null; - while (st.hasMoreTokens()) - newdir = st.nextToken(); - String targetName = maybeAppendSeparator(target - .toString()); - newTarget = new File(targetName + newdir); - if (!newTarget.mkdir()) - Utils.rude("Failed to create target directory " - + newTarget); - } - - // recurse - walkTree(file, newTarget, depth); - } else if (file.isFile() - && (extensions == null || (!file.isHidden() && extensions - .contains(ext)))) { - // this is a file and we need to add trace into it ! - actor.actOnFile(file, target, depth); - } - } - } else { - actor.actOnFile(source, target, depth); - } - } - - public static String maybeAppendSeparator(String name) { - if (!name.endsWith("/") && !name.endsWith("\\")) - name += "/"; - return name; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FileActor.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FileActor.java deleted file mode 100644 index a2bb4ba858..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FileActor.java +++ /dev/null @@ -1,37 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.File; - -/** - * DirectoryTree calls this interface to allow implementations of this interface - * to act on a file in the directory tree. - */ -public interface FileActor { - public void actOnFile(File source, File target, int depth) throws Exception; -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FilePart.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FilePart.java deleted file mode 100644 index b6bdf92878..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FilePart.java +++ /dev/null @@ -1,80 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ - -package org.apache.tuscany.sca.cpp.tools.common; - -/** - * A piece of C++ source code - */ -public class FilePart { - public final static int UNKNOWN = 0; - - public final static int COMMENT = 1; - - public final static int METHOD = 2; - - public final static int FIELD = 3; - - public final static int BEGINSCOPE = 4; - - public final static int ENDSCOPE = 5; - - public final static int DIRECTIVE = 6; - - public final static int WHITESPACE = 7; - - public final static int MACRO = 8; - - public final static int CLASSATTRIBUTE = 9; - - public final static int ENUM = 10; - - public final static int PROTOTYPE = 11; - - public final static int TYPEDEF = 12; - - protected String cppsource; - - protected int type; - - FilePart(String s, int type) { - cppsource = s; - this.type = type; - } - - public int getType() { - return type; - } - - int length() { - return cppsource.length(); - } - - public String toString() { - return cppsource; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Headers.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Headers.java deleted file mode 100644 index 533e1fd14a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Headers.java +++ /dev/null @@ -1,167 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class Headers implements FileActor { - private ArrayList instanceMethods = new ArrayList(); - - private ArrayList staticMethods = new ArrayList(); - - private ArrayList allMethods = new ArrayList(); - - private ArrayList classNames = new ArrayList(); - - private boolean failed = false; - - public void actOnFile(File header, File ignored, int depth) - throws Exception { - if (Configuration.fileExcluded(header.getName())) { - Utils.outputDebugString("excluding " + header + "..."); - return; - } - - Utils.outputDebugString("pre-parsing " + header + "..."); - FileReader fr = null; - try { - fr = new FileReader(header); - } catch (FileNotFoundException fnfe) { - throw fnfe; - } - BufferedReader inputFile = new BufferedReader(fr); - - try { - InputCppSourceCode code = new InputCppSourceCode(inputFile, header - .getName()); - Iterator it = code.getPartIterator(); - while (it.hasNext()) { - FilePart fp = (FilePart) (it.next()); - if (fp.getType() != FilePart.PROTOTYPE) - continue; - PrototypePart pp = (PrototypePart) fp; - String className = pp.className(); - if (null == className) - continue; - String trimClassName = className; - if (className.endsWith("::")) - trimClassName = className.substring(0, - className.length() - 2); - if (!classNames.contains(trimClassName)) - classNames.add(trimClassName); - - Signature sign = new Signature(fp.toString()); - sign.setClassName(className); - //Tuscany - sign.setScope(pp.getSignature().getScope()); - sign.setNamespace(pp.getSignature().getNamespace()); - - // "Clean" the signature by stripping off attributes, - // semicolons, etc - Signature cleaned = new Signature(sign.toStringWithoutAttrs()); - //Tuscany - problem - cleaned.setClassName(className); - cleaned.setScope(pp.getSignature().getScope()); - cleaned.setNamespace(pp.getSignature().getNamespace()); - //Tuscany - end of problem - - - if (-1 == sign.getAttributes().indexOf("static")) - instanceMethods.add(cleaned); - else - staticMethods.add(cleaned); - } - } catch (ParsingException pe) { - failed = true; - } - - inputFile.close(); - allMethods.addAll(staticMethods); - allMethods.addAll(instanceMethods); - } - - public boolean failed() { - return failed; - } - - public boolean isInstanceMethod(Signature sign) { - Iterator it = instanceMethods.iterator(); - while (it.hasNext()) { - Signature s = (Signature) it.next(); - if (s.equals(sign)) - return true; - } - return false; - } - - public boolean isStaticMethod(Signature sign) { - Iterator it = staticMethods.iterator(); - while (it.hasNext()) { - Signature s = (Signature) it.next(); - if (s.equals(sign)) - return true; - } - return false; - } - - public List getMethods(String method) { - ArrayList list = new ArrayList(); - if (null == method) - return list; - - Iterator it = allMethods.iterator(); - while (it.hasNext()) { - Signature s = (Signature) it.next(); - if (method.equals(s.getMethodName())) - list.add(s); - } - return list; - } - - /** - * Tuscany change - a method to get all the method signatures at once - */ - public List getAllMethods() { - ArrayList list = new ArrayList(); - Iterator it = allMethods.iterator(); - while (it.hasNext()) { - Signature s = (Signature) it.next(); - list.add(s); - } - return list; - } - - public boolean isClassName(String text) { - return classNames.contains(text); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java deleted file mode 100644 index 225909e1d1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java +++ /dev/null @@ -1,425 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.BufferedReader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.StringTokenizer; - -public class InputCppSourceCode { - - private ArrayList parts = new ArrayList(); - - private String name; - - public InputCppSourceCode(BufferedReader br, String name) throws Exception { - this.name = name; - - String s = null; - StringBuffer buff = new StringBuffer(); - for (int i = 1;; i++) { - try { - s = br.readLine(); - } catch (Exception e) { - System.err.println("Ignoring exception thrown parsing file " - + name + " line number " + i); - e.printStackTrace(); - break; - } - if (s == null) - break; - buff.append(s + "\n"); - } - String str = buff.toString(); - - // TODO: When checking for rest.startsWith("struct") should - // check the next letter after struct is not alphanumeric otherwise - // we'll get false matches on a function called structify() for - // instance. Also applies to enum, union, public, typedef, etc - - String rest, text = ""; - int scopedepth = 0; - String scope = "public"; - String currentClass = null; - String currentNamespace = null; - for (int idx = 0; idx < str.length(); /* No idx++ */ - ) { - rest = str.substring(idx); - if (Character.isWhitespace(rest.charAt(0))) { - int ridx = 0; - while (ridx < rest.length() - && Character.isWhitespace(rest.charAt(ridx))) - ridx++; - text = rest.substring(0, ridx); - FilePart fp = new FilePart(text, FilePart.WHITESPACE); - parts.add(fp); - idx += ridx; - - } else if (rest.startsWith("/*")) { - int ridx = rest.indexOf("*/"); // Don't use Utils here - text = str.substring(idx, idx + ridx + 2); - FilePart fp = new FilePart(text, FilePart.COMMENT); - parts.add(fp); - idx += text.length(); - - } else if (rest.startsWith("//")) { - text = str.substring(idx, idx + rest.indexOf("\n")); - FilePart fp = new FilePart(text, FilePart.COMMENT); - parts.add(fp); - idx += text.length(); - - } else if (rest.startsWith("#")) { - int ridx = rest.indexOf("\n"); - char c = rest.charAt(ridx - 1); - while (-1 != ridx && '\\' == c) { - String rest2 = rest.substring(ridx + 1); - ridx += rest2.indexOf("\n") + 1; - c = rest.charAt(ridx - 1); - } - text = str.substring(idx, idx + ridx); - FilePart fp = new FilePart(text, FilePart.DIRECTIVE); - parts.add(fp); - idx += text.length(); - - } else if (rest.startsWith("}")) { - if (scopedepth <= 0) //Tuscany need to increase scopedepth for - // namespaces? - Utils.rude("Braces do not match", name, lineNo(str, idx), - rest.substring(0, rest.indexOf("\n"))); - else - scopedepth--; - // TODO: better checking that this brace really ends the class - if (0 == scopedepth) - currentClass = null; - scope = "public"; - parts.add(new FilePart("}", FilePart.ENDSCOPE)); - idx++; - - } else if (rest.startsWith(";")) { - parts.add(new FilePart(";", FilePart.FIELD)); - idx++; - - } else if (!Character.isLetter(rest.charAt(0)) - && '~' != rest.charAt(0) && '_' != rest.charAt(0)) { - Utils.rude("Lines must start with a letter ", name, lineNo(str, - idx), rest.substring(0, rest.indexOf("\n"))); - - } else if (MacroPart.isAMacro(rest)) { - MacroPart mp = MacroPart.create(rest); - parts.add(mp); - idx += mp.length(); - - } else if (beginsScope(rest)) { - - //Tuscany a namespace comes in here - scopedepth++; - text = rest.substring(0, Utils.indexOf(rest, "{") + 1); - FilePart fp = new FilePart(text, FilePart.BEGINSCOPE); - parts.add(fp); - idx += text.length(); - if (Utils.startsWith(text, "class")) { - // TODO: cope with comments here - // TODO: split out classes into a ClassPart - StringTokenizer st = new StringTokenizer(text, - Utils.whitespace + ":{"); - st.nextToken(); // step over "class" - while (st.hasMoreTokens()) { - String word = st.nextToken(); - if (Configuration.isAttribute(word)) - continue; - currentClass = word; - break; - } - } - - //Tuscany - if (Utils.startsWith(text, "namespace")) { - // TODO: cope with comments here - StringTokenizer st = new StringTokenizer(text, - Utils.whitespace + "{"); - st.nextToken(); // step over "namespace" - String word = ""; - while (st.hasMoreTokens()) { - word = st.nextToken(); - if (word.equals("{")) { - break; - } - - } - - if(currentNamespace == null) - { - currentNamespace = word; - } - else - { - currentNamespace += "::" + word; - } - //We have not got to the class yet - //so will need ot deal with the namespace - //when we do - } - // Tuscany end - - } else if (isEnumOrUnion(rest)) { - int ridx = Utils.findMatching(rest, '{', '}') + 1; - String rest2 = rest.substring(ridx); - ridx = idx + ridx + Utils.indexOf(rest2, ';') + 1; - text = str.substring(idx, ridx); - FilePart fp = new FilePart(text, FilePart.ENUM); - parts.add(fp); - idx += text.length(); - - } else if (scopedepth > 0 - && (rest.startsWith("public") - || rest.startsWith("protected") || rest - .startsWith("private"))) { - int colon = rest.indexOf(":"); - if (-1 == colon) - Utils.rude("No colon found after public or private ", name, - lineNo(str, idx), rest.substring(0, rest - .indexOf("\n"))); - scope = str.substring(idx, idx + colon); - text = str.substring(idx, idx + colon + 1); - FilePart fp = new FilePart(text, FilePart.CLASSATTRIBUTE); - parts.add(fp); - idx += text.length(); - - } else if (Utils.startsWith(rest, "typedef")) { - int semicolon = Utils.indexOf(rest, ';'); - int brace = Utils.indexOf(rest, '{'); - - if (-1 == semicolon) - Utils.rude("No semicolon found after typedef", name, - lineNo(str, idx), rest.substring(0, rest - .indexOf("\n"))); - - if (-1 == brace || semicolon < brace) { - // Simple typedef - text = str.substring(idx, idx + semicolon + 1); - } else { - // Typedef of a struct, etc - int endbrace = Utils.findMatching(rest, '{', '}'); - String rest2 = rest.substring(endbrace); - semicolon = Utils.indexOf(rest2, ';'); - text = str.substring(idx, idx + endbrace + semicolon + 1); - } - FilePart fp = new FilePart(text, FilePart.TYPEDEF); - parts.add(fp); - idx += text.length(); - - } else { - if (isMethod(rest)) { - - int brace = Utils.indexOf(rest, '{'); - Signature signature = new Signature(str.substring(idx, idx - + brace)); - if (signature.failed()) - Utils.rude("Signature parsing failed", name, lineNo( - str, idx), signature.getOriginal()); - if (null != currentClass - && null == signature.getClassName()) - signature.setClassName(currentClass); - signature.setScope(scope); - signature.setNamespace(currentNamespace); - - String body = rest.substring(brace); - int endBrace = Utils.findMatching(body, '{', '}'); - body = body.substring(0, endBrace + 1); - int endIdx = idx + signature.originalLength() - + body.length(); - text = str.substring(idx, endIdx); - MethodPart mp = new MethodPart(text, signature, body); - parts.add(mp); - idx += text.length(); - - } else if (isField(rest)) { - int semicolon = Utils.indexOf(rest, ';'); - text = str.substring(idx, idx + semicolon + 1); - FilePart fp = new FilePart(text, FilePart.FIELD); - parts.add(fp); - idx += text.length(); - - } else if (isPrototype(rest)) { - int semicolon = Utils.indexOf(rest, ';'); - text = str.substring(idx, idx + semicolon + 1); - PrototypePart pp = new PrototypePart(text, currentClass, currentNamespace); - pp.setScope(scope); - parts.add(pp); - idx += text.length(); - - } else { - //TODO other file parts here - not sure if there are any - // others? - Utils.rude("Unrecognised file part", name, - lineNo(str, idx), rest.substring(0, rest - .indexOf("\n"))); - } // end if - } // end if - } // end for - } - - public Iterator getPartIterator() { - return parts.iterator(); - } - - private int lineNo(String s, int idx) { - int n = 0; - for (int i = 0; i < idx && i < s.length(); i++) - if ('\n' == s.charAt(i)) - n++; - return n; - } - - /** - * Find out whether we are defining a class, struct or extern "C" which may - * contain function implementations. These will have braces which begin a - * new scope. Ignore function prototypes that return a struct. struct mystr { - * int f1; }; struct mystr func(); struct mystr func() { struct mystr a; - * return a; } - */ - private static boolean beginsScope(String s) throws ParsingException { - if (isMethod(s)) - return false; - - int brace = Utils.indexOf(s, '{'); - int semicolon = Utils.indexOf(s, ';'); - - // Return false for class prototypes, but true for class definitions. - if (Utils.startsWith(s, "class")) { - if (-1 == brace) - return false; - if (-1 == semicolon) - return true; - return brace < semicolon; - } - - if (Utils.startsWith(s, "struct")) { - if (-1 == brace || -1 == semicolon) - return false; - return brace < semicolon; - } - - //Tuscany handle namespace for prototypes - //in a similar way to "class" - if (Utils.startsWith(s, "namespace")) { - if (-1 == brace || -1 == semicolon) - return false; - return brace < semicolon; - } - - return startsWithExternScope(s); - } - - /** - * There are 4 types of extern ... extern int field; extern int func(); - * extern "C" int func() { return 2; } extern "C" { int func() { return 2; } } - * This method should return true only for the last of these three examples - * since only the last one creates a new scope using braces. - */ - private static boolean startsWithExternScope(String s) - throws ParsingException { - if (!s.startsWith("extern")) - return false; - - int brace = Utils.indexOf(s, '{'); - int semicolon = Utils.indexOf(s, ';'); - int bracket = Utils.indexOf(s, '('); - - if (-1 == brace) - return false; - return (-1 == semicolon || brace < semicolon) - && (-1 == bracket || brace < bracket); - } - - /** - * Find out whether we are defining an enum or union which will contain - * braces. Ignore function prototypes that return an enum or union. enum - * colour { red, blue }; enum colour func(); enum colour func() { return - * colour.red; } - */ - private static boolean isEnumOrUnion(String s) throws ParsingException { - if ((!Utils.startsWith(s, "enum") && !Utils.startsWith(s, "union")) - || isMethod(s)) - return false; - - int brace = Utils.indexOf(s, '{'); - int semicolon = Utils.indexOf(s, ';'); - return -1 != brace && (-1 == semicolon || brace < semicolon); - } - - /** - * Rules to recognise fields and methods... - * - * Fields must contain a semicolon Methods may or may not contain a - * semicolon Prototypes must contain a semicolon Fields may or may not - * contain a brace (array initialisers do) Methods must contain a brace - * Prototypes must not contain a brace Fields may or may not contain a - * bracket (casts do) Methods must contain a bracket Prototypes must contain - * a bracket - * - * It's a method if it contains a bracket and then a brace before the first - * semicolon (if there is a semicolon). It's a prototype if it's not a - * method and it contains brackets before a semicolon. It's a field if it's - * not a method or a prototype and it contains a semicolon. If it's not a - * field, a method or a prototype and we haven't recognised it previously - * then it's an error. - */ - private static boolean isMethod(String s) throws ParsingException { - int semicolon = Utils.indexOf(s, ';'); - int brace = Utils.indexOf(s, '{'); - int bracket = Utils.indexOf(s, '('); - - return (-1 != bracket && -1 != brace && bracket < brace && (-1 == semicolon || brace < semicolon)); - } - - private static boolean isPrototype(String s) throws ParsingException { - int semicolon = Utils.indexOf(s, ';'); - int bracket = Utils.indexOf(s, '('); - return !isMethod(s) && -1 != semicolon && -1 != bracket - && bracket < semicolon; - } - - private static boolean isField(String s) throws ParsingException { - int semicolon = Utils.indexOf(s, ';'); - return !isMethod(s) && !isPrototype(s) && -1 != semicolon; - } - - public String getName() { - return name; - } - - public String toString() { - StringBuffer text = new StringBuffer(); - for (int i = 0; i < parts.size(); i++) { - text.append(((FilePart) (parts.get(i))).toString()); - } - return text.toString(); - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MacroPart.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MacroPart.java deleted file mode 100644 index 317ad2fc44..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MacroPart.java +++ /dev/null @@ -1,87 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ - -/* - * A C or C++ macro as it is used in the source code - */ -package org.apache.tuscany.sca.cpp.tools.common; - -class MacroPart extends FilePart { - /** - * Factory method to create a MacroPart. - * - * @param s - * unparsed source code which may start with a define or macro. - */ - static MacroPart create(String s) { - String orig = getOriginalText(s); - if (null == orig) - return null; - return new MacroPart(orig); - } - - MacroPart(String s) { - super(s, FilePart.MACRO); - } - - /** - * @param s - * unparsed source code which may start with a define or macro. - * @return all of s up to the end of the define or macro. - */ - private static String getOriginalText(String s) { - String name = getName(s); - int len = name.length(); - if (null == name) - return null; - else if (Configuration.isDefine(name)) { - return s.substring(0, len); - } else if (Configuration.isMacro(name)) { - String rest = s.substring(len); - len += Utils.findMatching(rest, '(', ')'); - return s.substring(0, len + 1); - } else - return null; - } - - static boolean isAMacro(String s) { - if (s == null || 0 == s.length()) - return false; - String name = getName(s); - return Configuration.isMacro(name) || Configuration.isDefine(name); - } - - private static String getName(String s) { - int i; - for (i = 0; i < s.length(); i++) - if (!Character.isLetterOrDigit(s.charAt(i)) && '_' != s.charAt(i)) - break; - if (s.length() == i) - return null; - return s.substring(0, i); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MethodPart.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MethodPart.java deleted file mode 100644 index a25610c1f9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MethodPart.java +++ /dev/null @@ -1,133 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.util.ArrayList; - -/** - * A C or C++ method from a piece of source code. The method has a signature and - * a body (the bit between the braces). - */ -public class MethodPart extends FilePart { - private Signature signature; - - private String body; - - MethodPart(String s, Signature signature, String body) { - super(s, METHOD); - this.signature = signature; - this.body = body; - } - - public Signature getSignature() { - return signature; - } - - public String getOriginalSignature() { - return signature.getOriginal(); - } - - /** - * Returns the method body as code snippets, each ending with a place where - * a trace statement belongs. The end of the first code snippet is where the - * entry trace should go. The end of every other snippet is a return from - * the method. - */ - public BodyPart[] getBodyParts() throws ParsingException { - String b = body; // Don't alter field member - if (b.startsWith("{")) - b = b.substring(1); - - // Add in trace exit at all the return statements in the method. - ArrayList al = new ArrayList(); - int idxR = Utils.indexOf(b, "return"); - int idxC = Utils.indexOf(b, "catch"); - while (-1 != idxR || -1 != idxC) { - if (-1 == idxC || (-1 != idxR && idxR < idxC)) { - String frag = b.substring(0, idxR); - String rest = b.substring(idxR + "return".length()); - - int semicolon = Utils.indexOf(rest, ';'); - if (-1 == semicolon) - Utils.rude("Missing semicolon in " + signature); - String retVal = rest.substring(0, semicolon); - BodyPart bp = new BodyPart(frag, retVal); - al.add(bp); - b = b.substring(idxR + "return".length() + retVal.length() + 1); - } else { - String frag = b.substring(0, idxC); - String rest = b.substring(idxC); - - int brace = Utils.indexOf(rest, "{"); - if (-1 == brace) - Utils.rude("Missing open brace in " + signature); - Signature signature = new Signature(rest.substring(0, brace)); - frag = frag + rest.substring(0, brace + 1); - BodyPart bp = new BodyPart(frag, signature.getParameters()[0]); - al.add(bp); - b = rest.substring(brace + 1); - } - idxR = Utils.indexOf(b, "return"); - idxC = Utils.indexOf(b, "catch"); - } - - // Add in trace exit before the last } if there are no returns in - // the method or there is code after the last return and the method - // returns void. - // int f1(){try{return f2();}catch(Exception& e){throw;}} - // has code after the last return but having a traceexit before the - // last brace wouldn't compile since the method returns an int. We - // cope with this by only adding in a traceexit before the last brace - // if the method returns void. That may mean we add in an unreachable - // traceexit which may give a compiler warning, but that should be - // benign. - // - // TODO: Not quite good enough for - // void f(int a){if(a){printf("a");}else{printf("!a");return;}} - // as a trace exit is needed before the last } in case a>0 but - // void f(int a){if(a){printf("a");return;}else{printf("!a");return;}} - // would give compiler warnings about unreachable code if a trace - // exit is added before the last brace. This could be tricky to fix. - if ((0 == al.size() || -1 != Utils.indexOf(b, ';')) - && null == signature.getReturnType().getType()) { - - int last = b.lastIndexOf('}'); - if (-1 == last) - Utils.rude("Missing end brace in " + signature); - String b2 = b.substring(0, last); - al.add(new BodyPart(b2)); - b = b.substring(last); - } - - // The final body part is the last } - al.add(new BodyPart(b)); - - BodyPart[] bps = new BodyPart[al.size()]; - System.arraycopy(al.toArray(), 0, bps, 0, al.size()); - return bps; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Options.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Options.java deleted file mode 100644 index 6e951f03de..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Options.java +++ /dev/null @@ -1,164 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - * - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * Command line options passed to a tool's main program. All command line - * options should begin with a dash "-". Some command line options take a value - * which is the next parameter after the option. Others do not. - */ -public class Options { - static HashMap pairs = new HashMap(); - - static List values = new ArrayList(); - - /** - * No one constructs this class. - */ - private Options() { - } - - public static void reset() { - pairs = new HashMap(); - values = new ArrayList(); - } - - /** - * Initialises the options based on the args passed to main - */ - public static void set(String args[]) { - for (int i = 0; i < args.length; i++) { - if (args[i].startsWith("-")) { - if ((i + 1 <= args.length - 1) && // next one is testable - !args[i + 1].startsWith("-") // and it starts with a "-" - ) { - String key = args[i]; - Object pairValue = pairs.get(key); - if (null == pairValue) { - pairs.put(args[i], args[i + 1]); - } else if (pairValue instanceof String) { - List l = new ArrayList(); - l.add(pairValue); - l.add(args[i + 1]); - pairs.put(key, l); - } else if (pairValue instanceof List) { - ((List) pairValue).add(args[i + 1]); - } - i++; // Step over value for this key - } else - values.add(args[i]); - } - } - } - - public static Object getOption(String key) { - return pairs.get(key); - } - - static boolean isOptionSet(String key) { - return values.contains(key) || null!=pairs.get(key); - } - - /** - * This option will cause scagen to print out messages - * about the artefacts it is processing - * @return - */ - public static boolean verbose() { - return isOptionSet("-verbose"); - } - - /** - * This option will cause scagen to print out some - * basic internal log type messages - * @return - */ - public static boolean debug() { - return isOptionSet("-debug"); - } - - /** - * This option will cause scagen to print out some - * text that can be used or pasted into a command - * file to copy all the relevant artefacts from - * where they are found or generated to a specific - * deployment location - * - * @return - */ - public static boolean deploy() { - return isOptionSet("-deploy"); - } - - /** - * This option will prevent scagen from actually writing out - * the generated files. It is useful if used in conjunction - * with the "-deploy" option. - * @return - */ - public static boolean noGenerate() { - return isOptionSet("-nogenerate"); - } - - /** - * This option is useful only when used in conjunction with - * the "-deploy" option. It changes the output to be more like the - * source code of a command script to copy the files to a - * specific place. - * @return - */ - public static boolean outputCommand() { - return isOptionSet("-outputCommand"); - } - - /** - * This option is useful only when used in conjunction with - * the "-deploy" option. It changes the output to be a simple - * list of artefacts. It has no effect if the "-outputCommand" - * option is set. - * - * @return - */ - public static boolean list() { - return isOptionSet("-list"); - } - - /** - * This option is maintained for compatibility with the - * original package source. It is not used by new scagen code. - * - * @return - */ - public static boolean quiet() { - return isOptionSet("-quiet"); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Parameter.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Parameter.java deleted file mode 100644 index 2d98e0a836..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Parameter.java +++ /dev/null @@ -1,216 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - * - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A parameter from a method signature. The parameter is the datatype plus its - * name but not its value. - */ -public class Parameter { - private ArrayList type = new ArrayList(); - - private String name = null; - - private boolean failed = false; - - /** - * Defaults to a parameter in a parameter list so it HAS a parameter name in - * it - */ - Parameter(List parts) { - this(parts, false); - } - - /** - * A parameter which is a return type does not have a parameter name. - * Parameters in a parameter list do have parameter names embedded in them - */ - Parameter(List parts, boolean isRetType) { - if (parts == null || parts.size() == 0) - return; - - // Tuscany: The original code below from apache axis blocks int - // getCustomer(long) - // i.e. no spaces in parameter list. - // We do not need to deal with "..." as parameters to SCS methods. - // - // if (!isRetType && parts.size() == 1) { - // if ("...".equals(parts.get(0))) { - // type.add("..."); - // name = ""; - // } else if (!"void".equals(parts.get(0))) - // failed = true; // Seems like bad C++ code here - // return; - // } - - if (isRetType) { - Iterator it = parts.iterator(); - while (it.hasNext()) - type.add(it.next()); - - // Some methods return have void on their signature and others - // have nothing. So to make them both the same, if a method - // doesn't return anything make type null. - // TODO: This assumption is wrong - methods that return nothing - // default to returning an int! - if (1 == type.size() && "void".equals(type.get(0))) - type = new ArrayList(); - - } else { - // Cope with array subscripts [] after the name - int arrIdx = -1; - for (int i = 0; i < parts.size(); i++) { - String tok = (String) parts.get(i); - if ("[".equals(tok)) { - arrIdx = i; - break; - } - } - - // Find the name - int nameIdx = parts.size() - 1; - if (-1 != arrIdx) - nameIdx = arrIdx - 1; - - // Even in real method declarations, parameters may not have a name - boolean noName = false; - name = (String) parts.get(nameIdx); - // Tuscany: The original code below from apache axis - // was updated to work with signatures of - // the form fn(int) a non-named, no-space, parameter list. - // if (Utils.cPrimitives.contains(name) || - // Utils.cTypeQualifiers.contains(name) ) - // - if (Utils.cPrimitives.contains(name) - || Utils.cTypeQualifiers.contains(name) - || parts.size() == 1) - noName = true; - - if (noName) { - name = null; - for (int i = 0; i < parts.size(); i++) - type.add(parts.get(i)); - } else { - // Construct the type - for (int i = 0; i < nameIdx; i++) - type.add(parts.get(i)); - - if (-1 != arrIdx) - for (int i = arrIdx; i < parts.size(); i++) - type.add(parts.get(i)); - } - } - } - - public boolean failed() { - return failed; - } - - public String getType() { - String s = null; - Iterator it = type.iterator(); - while (it.hasNext()) { - String next = (String) it.next(); - if (null == s) - s = next; - else if ("*".equals(next) || "&".equals(next)) - s += next; - else - s += " " + next; - } - return s; - } - - public String getTypeWithoutConst() { - String s = null; - Iterator it = type.iterator(); - while (it.hasNext()) { - String next = (String) it.next(); - if ("const".equals(next)) - continue; - else if (null == s) - s = next; - else if ("*".equals(next) || "&".equals(next)) - s += next; - else - s += " " + next; - } - return s; - } - - public String getName() { - return name; - } - - public boolean isVoid() { - return 0 == type.size(); - } - - public boolean isDotDotDot() { - return 1 == type.size() && "...".equals(type.get(0)); - } - - /** - * For two parameters to match their types must match or both be null, but - * the parameters names don't have to match. Just because a parameter is - * called something different in a header file as in the the source file - * doesn't mean it's a different parameter. - */ - public boolean equals(Object o) { - if (null == o || !(o instanceof Parameter)) - return false; - Parameter that = (Parameter) o; - if (type.size() != that.type.size()) - return false; - for (int i = 0; i < type.size(); i++) { - String s1 = (String) type.get(i); - String s2 = (String) that.type.get(i); - if (!Utils.safeEquals(s1, s2)) - return false; - } - return true; - } - - public String toString() { - if (0 == type.size()) - return "void"; - if (null == name) - return getType(); - return getType() + " " + name; - } - - public Iterator iterator() { - if (null == type) - return null; - return type.iterator(); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/ParsingException.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/ParsingException.java deleted file mode 100644 index 876d2dc3e0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/ParsingException.java +++ /dev/null @@ -1,48 +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. - */ - -/* @version $Rev$ $Date$ */ - - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - * - */ -package org.apache.tuscany.sca.cpp.tools.common; - -public class ParsingException extends Exception { - - public ParsingException() { - super(); - } - - public ParsingException(String message) { - super(message); - } - - public ParsingException(String message, Throwable cause) { - super(message, cause); - } - - public ParsingException(Throwable cause) { - super(cause); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/PrototypePart.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/PrototypePart.java deleted file mode 100644 index e51b2d781c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/PrototypePart.java +++ /dev/null @@ -1,56 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - * - */ -package org.apache.tuscany.sca.cpp.tools.common; - -/** - * A function prototype in an include file and possibly in a class definition. - */ -public class PrototypePart extends FilePart { - private Signature signature; - - public PrototypePart(String s, String className, String namespace) { - super(s, PROTOTYPE); - signature = new Signature(s); - if (null != className) - signature.setClassName(className); - if (null != namespace && namespace.length()>0) - signature.setNamespace(namespace); - } - - String className() { - return signature.getClassName(); - } - - public Signature getSignature() { - return signature; - } - - public void setScope(String scope) { - signature.setScope(scope); - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Signature.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Signature.java deleted file mode 100644 index d7052b7843..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Signature.java +++ /dev/null @@ -1,506 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* - * Branched from the original class that was also contributed to the - * org.apache.axis.tools.common package. - * - */ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * A C or C++ method signature with the ability to parse it. TODO: properly - * support variable length argument lists using "..." TODO: passing or returning - * function pointers (hopefully not needed) TODO: Cope with ~ <space>Classname() - */ -public class Signature { - private String originalText; - - private String attributes; - - private String className = null; - - private String namespace = null; - - private String methodName = null; - - private Parameter returnType = null; - - private Parameter[] params = null; - - private String trailingAttributes; - - private String scope = "public"; - - private boolean failed = false; - - private boolean traceable = true; - - private final static Set knownAttrs = new HashSet(Arrays - .asList(new Object[] { "public", "private", "extern", "\"C\"", - "virtual", "static", "inline" })); - - private final static Set specialOperators = new HashSet( - Arrays.asList(new Object[] { "(", ")", "*", ",", "&", "]", "[", - "=", "~" })); - - /** - * Takes an unparsed signature string and parses it. - * - * TODO: Should optionally pass in the className here in case it's an inline - * method implementation inside the class{}. Just so the className comes out - * in the trace. - */ - Signature(String s) { - originalText = s; - - try { - List tokens = tokenise(s); - - ArrayList alAttrs = new ArrayList(); - ArrayList alName = new ArrayList(); - ArrayList alParms = new ArrayList(); - ArrayList alTrailAttrs = new ArrayList(); - ArrayList alInits = new ArrayList(); - if (!splitUp(tokens, alAttrs, alName, alParms, alTrailAttrs, - alInits)) { - failed = true; - return; - } - - parseAttributes(alAttrs); - parseNameAndRetType(alName); - parseParameters(alParms); - parseTrailingAttributes(alTrailAttrs); - - // Ignore any tokens after the ) since these are (hopefully) - // constructor initialisers - - traceable = !Configuration.methodExcluded(className, methodName); - } catch (NullPointerException npe) { - failed = true; - traceable = false; - } - } - - /** - * Parse the signature into tokens. This removes whitespace and comments and - * separates out "*", ",", "(", ")", "&", "[" and "]". - */ - private static List tokenise(String s) { - ArrayList tokens = new ArrayList(); - String tok = null; - boolean space = true; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (Character.isWhitespace(c)) { - space = true; - continue; - } - if (space) { - if (tok != null) - tokens.add(tok); - tok = "" + c; - } else - tok += c; - space = false; - - if (tok.endsWith("/*")) { - String sub = s.substring(i); - int endcomm = sub.indexOf("*/"); - if (endcomm == -1) - break; - i += endcomm + 1; - if (tok.equals("/*")) - tok = ""; - else - tok = tok.substring(0, tok.length() - 2); - continue; - } - - if (tok.endsWith("//")) { - String sub = s.substring(i); - int endcomm = sub.indexOf("\n"); - if (endcomm == -1) - break; - i += endcomm; - if (tok.equals("//")) - tok = ""; - else - tok = tok.substring(0, tok.length() - 1); - continue; - } - - if (tok.endsWith("::")) - space = true; - - String sc = "" + c; - if (specialOperators.contains(sc)) { - if (!tok.equals(sc)) { - tokens.add(tok.substring(0, tok.length() - 1)); - tok = sc; - } - space = true; - } - } - tokens.add(tok); - return tokens; - } - - /** - * Split up a tokenised method signature into a list of attributes, a list - * of name and return type tokens, a list of parameter tokens and a list of - * initialiser tokens. - */ - private static boolean splitUp(List tokens, List attrs, List nameAndRet, - List parms, List trailAttrs, List inits) { - - // nameStart points to the start of the return type if there is one - // else the start of the method name - int nameStart; - for (nameStart = 0; nameStart < tokens.size(); nameStart++) { - String tok = (String) (tokens.get(nameStart)); - if (!knownAttrs.contains(tok) && !Configuration.isAttribute(tok)) - break; - } - if (nameStart == tokens.size()) - return false; - - // initStart points to the initialisers, or thrown exceptions after - // the parameter list. throw is a keyword so we can safely search for - // it. - int initStart = tokens.size(); - for (int i = nameStart; i < tokens.size(); i++) { - String tok = (String) tokens.get(i); - if ((tok.startsWith(":") && !tok.startsWith("::")) - || "throw".equals(tok)) - initStart = i; - } - - int parmEnd; - for (parmEnd = initStart - 1; parmEnd > nameStart; parmEnd--) - if (")".equals(tokens.get(parmEnd))) - break; - if (parmEnd == nameStart) - return false; - - int parmStart = parmEnd; - for (parmStart = parmEnd; parmStart > nameStart; parmStart--) - if ("(".equals(tokens.get(parmStart))) - break; - - for (int i = 0; i < tokens.size(); i++) { - Object tok = tokens.get(i); - if (i < nameStart || Configuration.isAttribute((String) tok)) - attrs.add(tok); - else if (i < parmStart) - nameAndRet.add(tok); - else if (i <= parmEnd) - parms.add(tok); - else if (i < initStart) - trailAttrs.add(tok); - else - inits.add(tok); - } - return true; - } - - private void parseAttributes(List list) { - attributes = new String(); - Iterator it = list.iterator(); - while (it.hasNext()) { - if (attributes.length() > 0) - attributes += " "; - String next = (String) it.next(); - - //Tuscancy - //the scope is not present in the attributes - //but is set later in the InputCppSource contructor - if ("public".equals(next) || "protected".equals(next) - || "private".equals(next)) - scope = next; - attributes += next; - } - } - - private void parseNameAndRetType(List list) { - int size = list.size(); - int idx; - // "operator" is a key word so if it's present we know we're - // dealing with operator overloading. The operator that's been - // overloaded might have been split up into multiple tokens. - for (idx = 0; idx < size; idx++) - if ("operator".equals(list.get(idx))) - break; - - if (idx < size) { - methodName = ""; - for (int i = idx; i < size; i++) - methodName += (String) list.get(i); - } else { // No operator overloading - methodName = "" + list.get(size - 1); - idx = size - 1; - } - - // If it's a destructor, the "~" will be split out into a separate - // token, so add it onto the methodName here. - if (idx > 0 && "~".equals(list.get(idx - 1))) { - methodName = "~" + methodName; - idx--; - } - - // The class name comes before the method name - while (idx > 0 && ((String) list.get(idx - 1)).endsWith("::")) { - if (null == className) - className = (String) list.get(idx - 1); - else - className = (String) list.get(idx - 1) + className; - idx--; - } - - // Whatever's left before the classname/methodname must be the - // return type - ArrayList retParm = new ArrayList(); - for (int i = 0; i < idx; i++) - retParm.add(list.get(i)); - - returnType = new Parameter(retParm, true); - } - - /** - * Constructs the parameter list - */ - private void parseParameters(List list) { - ArrayList alParams = new ArrayList(); - Iterator it = list.iterator(); - String token = (String) it.next(); // step over the ( - while (it.hasNext() && !")".equals(token)) { - token = (String) it.next(); - - int template = 0; // Depth of template scope - boolean foundEquals = false; - // Ignore default value for an optional parameter - ArrayList parm = new ArrayList(); - while (!token.equals(")") && (!token.equals(",") || template > 0)) { - if (token.equals("=")) - foundEquals = true; - if (!foundEquals) - parm.add(token); - if (contains(token, "<")) - template++; - if (contains(token, ">")) - template--; - token = (String) it.next(); - } - - // No parameters so break out - if (token.equals(")") && 0 == parm.size()) - break; - - Parameter p = new Parameter(parm); - if (p.failed()) { - failed = true; - return; - } - - // Copes with void func(void) - if (!p.isVoid()) - alParams.add(p); - } - - int size = alParams.size(); - if (size > 0) { - params = new Parameter[size]; - System.arraycopy(alParams.toArray(), 0, params, 0, size); - } - } - - private void parseTrailingAttributes(List list) { - trailingAttributes = new String(); - Iterator it = list.iterator(); - while (it.hasNext()) { - if (trailingAttributes.length() > 0) - trailingAttributes += " "; - trailingAttributes += (String) it.next(); - } - } - - public String getOriginal() { - return originalText; - } - - public int originalLength() { - return originalText.length(); - } - - public boolean failed() { - return failed; - } - - public String getAttributes() { - return attributes; - } - - public String getClassName() { - return className; - } - - /** - * @param namespace The namespace to set. - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * @return Returns the namespace. - */ - public String getNamespace() { - return namespace; - } - - public String getTrimClassName() { - return trimClassName(className); - } - - public String getMethodName() { - return methodName; - } - - public Parameter getReturnType() { - return returnType; - } - - public Parameter[] getParameters() { - return params; - } - - public boolean isConstructor() { - return className != null && methodName != null - && trimClassName(className).equals(methodName); - } - - public boolean isDestructor() { - return className != null && methodName != null - && methodName.startsWith("~") - && methodName.endsWith(trimClassName(className)); - } - - private static String trimClassName(String name) { - if (name.endsWith("::")) - return name.substring(0, name.length() - 2); - return name; - } - - void setClassName(String className) { - if (null == className) - return; - if (!className.endsWith("::")) - className += "::"; - this.className = className; - } - - public String getScope() { - return scope; - } - - /** - * Sets the scope, but only if the scope is not set by an explicit attribute - * in the signature. - */ - public void setScope(String scope) { - if (-1 == attributes.indexOf(this.scope)) - this.scope = scope; - } - - /** - * Should this method be traced? - */ - public boolean traceable() { - return traceable; - } - - private static boolean contains(String src, String tgt) { - if (src == null || tgt == null) - return false; - if (-1 == src.indexOf(tgt)) - return false; - return true; - } - - public boolean equals(Object obj) { - if (null == obj || !(obj instanceof Signature)) - return false; - Signature that = (Signature) obj; - if (!Utils.safeEquals(className, that.className)) - return false; - if (!Utils.safeEquals(methodName, that.methodName)) - return false; - if (!Utils.safeEquals(returnType, that.returnType)) - return false; - if (null == params && null == that.params) - return true; - if (null != params && null == that.params) - return false; - if (null == params && null != that.params) - return false; - if (params.length != that.params.length) - return false; - for (int i = 0; i < params.length; i++) - if (!Utils.safeEquals(params[i], that.params[i])) - return false; - return true; - } - - public String toStringWithoutAttrs() { - String s = new String(); - if (returnType != null) - s += returnType + " "; - if (className != null) - s += className; - s += methodName + "("; - for (int i = 0; params != null && i < params.length; i++) { - if (i > 0) - s += ", "; - s += params[i].toString(); - } - s += ")"; - return s; - } - - public String toString() { - String s = attributes; - if (attributes.length() > 0) - s += " "; - s += toStringWithoutAttrs(); - if (trailingAttributes.length() > 0) - s += " " + trailingAttributes; - return s; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java deleted file mode 100644 index d26c5ec5ae..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java +++ /dev/null @@ -1,556 +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. - */ - -/* @version $Rev$ $Date$ */ - -/* -* Branched from the original class that was also contributed to the -* org.apache.axis.tools.common package. -* -*/ -package org.apache.tuscany.sca.cpp.tools.common; - -import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -//Apache Common Logging -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; - -/** -* Static utility methods. Some of these methods are similar to the methods on -* java.lang.String except they are aware of C/C++ comments and string literals. -* -* TODO: Many of these methods would perform better using StringBuffer not -* String -*/ -public final class Utils { - // All the C primitive data types - public final static Set cPrimitives = new HashSet(Arrays - .asList(new Object[] { "void", "byte", "char", "unsigned", - "signed", "int", "short", "long", "double", "float", - "struct", "class", "enum", "union" })); - - // All the qualifiers that can affect C types - public final static Set cTypeQualifiers = new HashSet( - Arrays.asList(new Object[] { "(", ")", "*", ",", "&", "]", "[", - "const" })); - - public final static String whitespace = " \t\r\n"; - - //private static Log log = LogFactory.getLog(CLASS.class); - - /** - * Never instantiate this class - */ - private Utils() { - } - - /** - * Is this string all whitespace? - */ - static boolean isSpace(String s) { - for (int i = 0; i < s.length(); i++) - if (!Character.isWhitespace(s.charAt(i))) - return false; - return true; - } - - // TODO look for other trailing chars like { (because of class{) - static boolean startsWith(String source, String target) { - if (source == null || target == null) - return false; - if (!source.startsWith(target)) - return false; - if (source.length() == target.length()) - return true; - if (Character.isWhitespace(source.charAt(target.length()))) - return true; - return false; - } - - /** - * Performs a C-aware version of String.indexOf(char) in that it skips - * characters in string literals and comments. - */ - static int indexOf(String s, char c) throws ParsingException { - if ('"' == c) - rude("Utils.indexOf cannot be passed quotes"); - - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == c) - return i; - - i = skip(s.substring(i), i); - if (-1 == i) - return -1; - } - return -1; - } - - /** - * Performs a C-aware version of String.indexOf(String) in that it skips - * characters in string literals and comments and makes sure that the target - * string is not embedded in a longer word. - */ - static int indexOf(String s, String t) { - char t0 = t.charAt(0); - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == t0 - && s.substring(i).startsWith(t)) { - - - // When finding a single non-alphanumeric character - if(t.length() == 1 && !Character.isLetterOrDigit(t0)) - return i; - - // When finding an alphanumeric string - if((0 == i || !Character.isLetterOrDigit(s.charAt(i - 1))) // Check we're matching at the start of a word - && (s.length() == (i + t.length()) || !Character - .isLetterOrDigit(s.charAt(i + t.length())))) // Check we're still matching by the end of the word - return i; - } - - i = skip(s.substring(i), i); - if (-1 == i) - return -1; - } - return -1; - } - - /** - * Matches braces or quotes and is C-aware. It skips characters in string - * literals and comments. - */ - static int findMatching(String s, char c1, char c2) { - int depth = 0; - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == c1) - depth++; - else if (s.charAt(i) == c2) { - depth--; - if (depth == 0) - return i; - } else { - i = skip(s.substring(i), i); - if (-1 == i) - return -1; - } - } - return -1; - } - - /** - * Failed to parse the source code for some reason. This method prints out a - * suitably rude message, and then what? I haven't quite decided yet. - * - * TODO: Do something sensible here like throw an Exception which will give - * up on this file completely and tidy up the output file. It may be just - * too dangerous to try to carry on. But we need to fail in such a way that - * the build system knows that we've failed for this file and can build this - * file without trace. - */ - public static void rude(String reason, String filename, int lineno, - String codefragment) throws ParsingException { - - String text = "Bad C++ code!! "; - if (reason != null) - text += reason; - if (filename != null) - text += " " + filename + " lineno=" + lineno; - if (codefragment != null) - text += " <" + codefragment + ">"; - System.err.println(text); - throw new ParsingException(); - } - - /** - * This method reports an error level problem - * - * @param reason - * why we have an error level problem - */ - public static void rude(String reason) throws ParsingException { - // Apache commons logging - // log.error(Object line, null); - // or for now.... - rude(reason, null, 0, null); - } - - /** - * This method reports an error level problem - * - * @param reason - * why we have an error level problem - */ - public static void screenMessage(String msg) { - // Apache commons logging - // log.error(Object line, null); - // or for now.... - System.out.println(msg); - } - - /** - * Escapes special characters like " so that they can be output in a C - * string literal. Also removes newlines, since C string literals can't be - * split over lines. - */ - String pretty(String s) { - StringBuffer sb = new StringBuffer(s); - for (int i = 0; i < sb.length(); i++) - switch (sb.charAt(i)) { - case '"': - sb = sb.insert(i, '\\'); - i++; - break; - case '\n': - sb = sb.deleteCharAt(i); - i--; - break; - } - return sb.toString(); - } - - private static boolean startsWithComment(String s) { - if (null == s || s.length() < 2) - return false; - if (s.startsWith("//")) - return true; - if (s.startsWith("/*")) - return true; - return false; - } - - private static int endOfComment(String s) { - int idx; - if (s.startsWith("//")) - idx = s.indexOf("\n"); - else { - idx = s.indexOf("*/"); - if (-1 != idx) - idx++; // Step over */ - } - return idx; - } - - private static boolean startsWithStringLiteral(String s) { - if (null == s || s.length() < 1) - return false; - if (s.startsWith("\"") || s.startsWith("'")) - return true; - return false; - } - - private static int endOfStringLiteral(String s) { - boolean escape = false; - char c0 = s.charAt(0); - for (int i = 1; i < s.length(); i++) { - if (!escape && s.charAt(i) == c0) - return i; - - // \" or \' does not end the literal - if ('\\' == s.charAt(i)) - // Escaping a \ should switch escape off so \\' does end - // the literal - escape = !escape; - else - escape = false; - } - return -1; - } - - /** - * If the String s starts with a string literal or a comment, return i plus - * the index of the end of the literal or comment. String literals are - * enclosed in " or ' and comments start with /* or //. - */ - private static int skip(String s, int i) { - int j = 0; - if (startsWithStringLiteral(s)) { - j = endOfStringLiteral(s); - if (-1 == j) - return -1; - } else if (startsWithComment(s)) { - j = endOfComment(s); - if (-1 == j) - return -1; - } - return i + j; - } - - /** - * A better method than .equals() because it doesn't NullPointerException - * when one of the parameters is null. - */ - public static boolean safeEquals(Object o1, Object o2) { - if (null == o1 && null == o2) - return true; - if (null == o1 && null != o2) - return false; - if (null != o1 && null == o2) - return false; - return o1.equals(o2); - } - - public static void outputDebugString(String line) { - if (!Options.quiet()) { - if (Options.debug()) - // Apache commons logging - // log.debug(Object line, null); - // or for now - System.out.println(line); - } - } - - /** - * This static method allows different parts of the code to inform about - * significant events. Code interested in specific types of event can - * register a listener against that type (not written yet) - * - * @param eventType - * An int type enum indicating the type of event. - * @param message - * A message that can be output to the user. - */ - public static final int EVENT_TYPE_XML_ITEM_PARSED = 1; - - public static final int EVENT_TYPE_FILE_PARSED = 2; - - public static final int EVENT_TYPE_FILE_CREATE = 3; - - public static final int VERBOSE_LIMIT = 1024; - - public static final int DEPLOYMENT_ARTEFACT = VERBOSE_LIMIT; - - public static final int DEPLOYMENT_ARTEFACT_ENCOUNTERED = DEPLOYMENT_ARTEFACT + 1; - - public static final int DEPLOYMENT_ARTEFACT_GENERATED = DEPLOYMENT_ARTEFACT + 2; - - public static final int DEPLOYMENT_INPUT_DIRECTORY = DEPLOYMENT_ARTEFACT + 3; - - public static final int DEPLOYMENT_OUTPUT_DIRECTORY = DEPLOYMENT_ARTEFACT + 4; - - private static boolean reportArtefacts = false; - - /** - * An easily callable method to allow tracking/reposting of events in scagen - * and other tools. - * - * @param eventType - * used for classifying event - * @param message - * a user readable message - */ - public static void postEvent(int eventType, String message) { - if (Options.verbose() && eventType < VERBOSE_LIMIT) { - screenMessage(message); - } - - if ((eventType & DEPLOYMENT_ARTEFACT) > 0) { - reportArtefact(message, eventType); - } - - } - - /** - * @param message - * The user message - * @param eventType - * The type of event (input or output). This is used to determine - * if the path name of the file starts with the COMPOSITE_ROOT - * directory or the given output directory as the one of these - * prefixes is removed from the path name in order to give the - * new (destination) path relative to the new composite root - * - * - */ - - static String scagenInputDir = "COMPOSITE_ROOT"; - - static String scagenOutputDir = "SCAGEN_OUTPUT"; - - static String newCompositeRoot = "NEW_COMPOSITE_ROOT"; - - static String generatedDirName = "$sourceDir1"; - - private static void reportArtefact(String message, int eventType) { - - if (Utils.isReportArtefacts()) { - - // Changing the value of the variable below will alter the output of - // the - // deploy assist strings: - // true will result in a "copy source NEW_COMPOSITE_ROOT\dest" output - // and - // false will result in a "inputDir c:\fred" - // "outputDir c:\bob" - // "input c:\fred\sca.composite" - // "output c:\bob\proxy.h" type output - String command = null; - - try { - newCompositeRoot = (String) Options.getOption("-deploy"); - command = (String) Options.getOption("-command"); - } catch (Exception e) { - // let it default - } - - if (null == newCompositeRoot) { - newCompositeRoot = "DEPLOY_COMPOSITE_ROOT"; - } - - if (null == command) { - command = "copy"; - } - - if (Options.outputCommand()) { - - String tail = message; - switch (eventType) { - case DEPLOYMENT_ARTEFACT_ENCOUNTERED: - if (message.startsWith(scagenInputDir)) { - tail = message.substring(scagenInputDir.length()); - } - - String dest = joinPathElements(newCompositeRoot, tail); - - System.out.println(command + " " + platformSlashes(message) - + " " + platformSlashes(dest)); - break; - - case DEPLOYMENT_ARTEFACT_GENERATED: - if (message.startsWith(scagenOutputDir)) { - tail = message.substring(scagenOutputDir.length()); - } - - dest = joinPathElements(newCompositeRoot, tail); - System.out.println(command + " " + platformSlashes(message) - + " " + platformSlashes(dest)); - break; - case DEPLOYMENT_INPUT_DIRECTORY: - scagenInputDir = message; - //System.out.println("inputDir " + message); - break; - case DEPLOYMENT_OUTPUT_DIRECTORY: - scagenOutputDir = message; - //System.out.println("outputDir " + message); - break; - default: - break; - } - - } else { - - if (Options.list()) { - switch (eventType) { - case DEPLOYMENT_ARTEFACT_ENCOUNTERED: - case DEPLOYMENT_ARTEFACT_GENERATED: - System.out.println(platformSlashes(message)); - break; - case DEPLOYMENT_INPUT_DIRECTORY: - case DEPLOYMENT_OUTPUT_DIRECTORY: - default: - break; - } - } else { - switch (eventType) { - case DEPLOYMENT_ARTEFACT_ENCOUNTERED: - //TODO make efficient - System.out.println("$sourceDir1" - + platformSlashes(message.substring(scagenInputDir.length()))); - break; - case DEPLOYMENT_ARTEFACT_GENERATED: - //TODO make efficient - System.out.println(generatedDirName - + platformSlashes(message.substring(scagenOutputDir.length()))); - break; - case DEPLOYMENT_INPUT_DIRECTORY: - scagenInputDir = platformSlashes(message); - System.out.println("sourceDir1=" + scagenInputDir); - break; - case DEPLOYMENT_OUTPUT_DIRECTORY: - scagenOutputDir = platformSlashes(message); - if (!scagenInputDir.equals(scagenOutputDir)) { - generatedDirName = "$sourceDir2"; - System.out.println("sourceDir2=" + scagenOutputDir); - } else { - //generatedDirName = "sourceDir1"; - } - break; - default: - break; - } - } - } - } - } - - /** - * @param tail - * @param tail - * @return - */ - public static String joinPathElements(String root, String tail) { - String separator; - // Stick in a "/" (File.separator) if required. - if ((tail.substring(0, 1).equals("/") || newCompositeRoot.substring( - root.length() - 1, root.length()).equals("/")) - || (tail.substring(0, 1).equals("\\") || root.substring( - root.length() - 1, root.length()).equals("\\")) - - ) { - separator = ""; - } else { - separator = File.separator; - } - String dest = newCompositeRoot + separator + tail; - return dest; - } - - /** - * @param reportArtefacts - * The reportArtefacts to set. - */ - public static void setReportArtefacts(boolean reportArtefacts) { - Utils.reportArtefacts = reportArtefacts; - } - - /** - * @return Returns the reportArtefacts. - */ - private static boolean isReportArtefacts() { - return reportArtefacts; - } - - private static String platformSlashes(String path) { - if (null == path) { - return path; - } - // We need a double level of \\ escapes if the slashes are - // this way round. - String separatorForRegex = File.separator - .replaceAll("\\\\", "\\\\\\\\"); - return path.replaceAll("[/\\\\]+", separatorForRegex); - - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/package.html b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/package.html deleted file mode 100644 index c423477193..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/package.html +++ /dev/null @@ -1,58 +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. ---> - -<html> - -<head> -<title>Design documentation for org\apache\tuscany\sca\cpp\tools\common</title> -</head> - -<body lang=EN-GB> - -<div class=Section1> - -<h1>Overview</h1> - -This package can be used to reflect across C++ source code. It can produce -a network of descriptive objects describing C++ Headers, Signatures, Parameters and so -on that it finds in a given location of the file system. -Each of the descriptive objects has a set of getters that return either -the descriptive child objects, or for primitives, the string that represents the actual -value such as "int" or "myFunction". -<p> -There are also various utility methods that help with navigating the information, for example the Signature -class has an isConstructor method. The API Javadoc contains further details of these. -<p> -The package can scan a directory using a file mask to identify what types -of files are to be scanned. In this application we are interested only -in the function prototypes in the C++ header files. -<p> -The implementation was originated using some java code that was also -contributed to the Apache org.apache.axis.tools.common package. Care -has been taken that the original code was not sourced via Apache. If -this project is adopted by Apache then it is very possible that this -package could be merged with or made obsolete by org.apache.axis.tools.common -and because of this the design and interfaces have been preserved from -the original code as much as possible. - -<p> -</div> -</body> - -</html> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentDomNodeHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentDomNodeHandler.java deleted file mode 100644 index 28974b41a6..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentDomNodeHandler.java +++ /dev/null @@ -1,366 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.cpp.tools.common.Headers; -import org.apache.tuscany.sca.cpp.tools.common.Signature; -import org.apache.tuscany.sca.cpp.tools.common.Utils; -import org.w3c.dom.Node; - -/** - * This class will do the required processing for the <component>element of a - * sca composite file. - */ -public class ComponentDomNodeHandler extends GenericDomNodeHandler { - - /** - * This method will do the "normal" processing and then trigger a call to - * processComponentNode. - * - * @param node - * the node being processed - * @param contextXPath - * the XPath to the node - * @param handlers - * the map pf element names to DomNodeHandlers - * @param parameters - * a map of XPaths to parameters values found so far - */ - - public void handleNode(Node node, String contextXPath, Map handlers, - Map parameters) { - - // Pick up attrs and the interface.cpp child elements - super.handleNode(node, contextXPath, handlers, parameters); - - try { - //OK now go and create the wrapper and proxy for the service - processComponentNode(contextXPath, parameters); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * This method basically moved from the text names of things to operating on - * the actual Files. It will also verify or work out the correct class name - * for the implmentation and complain if this does match at least one - * potential service method in the class. - * - * @param contextXPath - * used to pull the correct values from the parameters map (as - * there can be multiple implementation.cpp elelements in there). - * @param parameters - * a map of XPath keys to attribute values - * @throws Exception - */ - private void processComponentNode(String contextXPath, Map parameters) - throws Exception { - - String implHeader = (String) parameters.get(contextXPath - + "/implementation.cpp/@header"); - String implClass = (String) parameters.get(contextXPath - + "/implementation.cpp/@class"); - - File compositeOrFragmentFile = (File) parameters - .get("compositeOrFragmentFile"); - File implHeaderFile = null; - if (null != compositeOrFragmentFile) { - File dir = compositeOrFragmentFile.getParentFile(); - implHeaderFile = new File(dir, implHeader); - } else { - throw new InternalError( - "Internal error: composite or fragment file not present in internal parameters"); - } - - try { - String resolvedImplClassName = getClassName(implHeaderFile, - implClass); - - // Check or retrieve the impl Class name. - if (null == resolvedImplClassName) { - try { - //A class attribute was set but there were no methods of - // the - // class in the header - System.out - .println("Classname given (" - + implClass - + ") does not match any header file method's classes in file: " - + implHeaderFile.getCanonicalPath()); - } catch (IOException e) { - System.out - .println("Classname given (" - + implClass - + ") does not match any header file method's classes in file: " - + implHeaderFile.getAbsolutePath()); - } - return; - } else { - File target = (File) parameters.get("targetFile"); - // go into the .componentType file and generate the cpp - processComponentTypeFile(implHeaderFile, target, - resolvedImplClassName); - - } - } catch (Exception e) { - String compName = (String) parameters - .get("/compositeFragment/component/@name"); - Utils - .screenMessage("Problem interpreting header or class attributes in " - + compName - + " component, in " - + compositeOrFragmentFile.getPath() + " file"); - System.exit(-2); - } - - } - - /** - * The purpose of this method is to move from the DOM parameters to dealing - * with the actual Files involved. It is from this method that we kick off - * the processing of the componentType file. - * - * @param header - * the implementation header - * @param target - * the directory for the output - * @param implClass - * @throws Exception - */ - private void processComponentTypeFile(File header, File target, - String implClass) throws Exception { - - // The componentType files should be in the same dir as the Impl - // header... - if (header == null || target == null) { - return; - } - - File componentTypeDirectory = header.getParentFile(); - String headerFileName = header.getName(); - String componentTypeName = headerFileName.substring(0, headerFileName - .lastIndexOf(".")); - - File componentTypeFile = new File(componentTypeDirectory, - componentTypeName + ".componentType"); - - ComponentTypeFileHandler ctParser = new ComponentTypeFileHandler(); - - // The implClass is used in the generated wrapper code so we need to - // store - // it so we can tunnel through the standard actOnFile signature. - - int namespaceEnd = -1; - if (null != implClass) { - namespaceEnd = implClass.lastIndexOf("::"); - } - - String namespace = null; - - if (-1 != namespaceEnd) { - namespace = implClass.substring(0, namespaceEnd); - ctParser.setParameter("implNamespace", namespace); - implClass = implClass.substring(namespaceEnd + 2); - } - - if (implClass != null) { - ctParser.setParameter("implClass", implClass); - } - - try { - ctParser.handleComponentTypeFile(componentTypeFile, target); - } catch (Exception e) { - Utils - .screenMessage("There has been a problem parsing the componentType file: " - + componentTypeFile.getCanonicalPath()); - Utils.screenMessage(" the reported errors is " - + e.getLocalizedMessage()); - Utils.screenMessage(" and the java exception stack is below."); - e.printStackTrace(); - throw e; - } - } - - /** - * The resolve and check the classname of the service. If we have an - * implementation class name we have to check that there is: at least one - * (non-private, non constructor or finalizer) method of that class in the - * header If there is no implementation class then we will return the class - * of the first non-private/constructor/finalizer method we find. - * - * @param header - * @param implementationCppClass - * @return - * @throws Exception - */ - private String getClassName(File header, String implementationCppClass) - throws Exception { - String methodClassName = null; - List methods = null; - - if (null == header) { - return null; - } - - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, header - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_PARSED, - "Scagen processing C++ implementation header " - + header.getAbsolutePath()); - - try { - Headers headers = new Headers(); - - headers.actOnFile(header, null, 1); - - methods = headers.getAllMethods(); - - } catch (FileNotFoundException fnfe) { - String path; - try { - path = header.getCanonicalPath(); - } catch (IOException e1) { - path = header.getPath(); - } - Utils.screenMessage("The header file: " + path - + " referenced cannot be found."); - throw fnfe; - } catch (Exception e) { - String path = header.getPath(); - Utils.screenMessage("The header file: " + path - + " referenced is not valid. Reason given is " - + e.getLocalizedMessage()); - throw e; - } - - // We need at least some methods - if (null == methods) { - return null; - } - - // We need at least one service method of to do anything - methods = trimMethodsOfPrivatesConstructorsAndDestrutors(methods); - if (null == methods || methods.size() == 0) { - return null; - } - - // If the user specifies an implementation class then we need at - // least one service method of that class - if (implementationCppClass != null) { - methods = filterMethodsToOneClass(methods, implementationCppClass); - - if (null == methods || methods.size() == 0) { - return null; - } else { - // There was at least one method of the correct type - return implementationCppClass; - } - } else { - // Implementation class is null so we return the fully qualified classname of the - // first service method - Signature s = (Signature) methods.get(0); - String className = s.getTrimClassName(); - String namespace = s.getNamespace(); - if( namespace != null && namespace.length() > 0) - { - className = namespace + "::" + className; - } - - return className; - } - } - - /** - * Filter the mthods supplied to only ones fo the supplied class. - * - * @param methods - * the list of methods - * @param implementationCppClass - * the class we wish - * @return a list of methods of the correct class - */ - private List filterMethodsToOneClass(List methods, - String implementationCppClass) { - - if (null == methods) { - return null; - } - - if (null == implementationCppClass - || implementationCppClass.length() == 0) { - return null; - } - - for (Iterator iter = methods.listIterator(); iter.hasNext();) { - Signature method = (Signature) iter.next(); - - String className = method.getTrimClassName(); - String namespace = method.getNamespace(); - - if (namespace != null && namespace.length() > 0) { - className = namespace + "::" + className; - } - - if (!implementationCppClass.equals(className)) { - iter.remove(); - } - } - - return methods; - - } - - /** - * This method removes contructor and destructor methods from the list. - * - * @param methods - * the list of methods - * @return - */ - private List trimMethodsOfPrivatesConstructorsAndDestrutors(List methods) { - - if (null == methods) { - return null; - } - - for (Iterator iter = methods.listIterator(); iter.hasNext();) { - Signature method = (Signature) iter.next(); - - if (method.isConstructor() || method.isDestructor()) { - iter.remove(); - } - } - - return methods; - } - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentTypeFileHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentTypeFileHandler.java deleted file mode 100644 index 6c86fa25b5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentTypeFileHandler.java +++ /dev/null @@ -1,130 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; - -import org.apache.tuscany.sca.cpp.tools.common.FileActor; -import org.apache.tuscany.sca.cpp.tools.common.Utils; - -/** - * The purpose of this class is to specialise the map of XML element handlers - * for a XXX.componentType file that is used by the XMLFileActor - */ -public class ComponentTypeFileHandler extends XMLFileActor { - - static { - // We set up a map for each element type we wish to handle - // this alows the XML handling code to be generic and type free - // while the handlers don't have to do mcuh XML handling. - - GenericDomNodeHandler gdnh = new GenericDomNodeHandler(); - handlers.put("componentType", gdnh); - handlers.put("interface.cpp", gdnh); - - ServiceDomNodeHandler sdnh = new ServiceDomNodeHandler(); - handlers.put("service", sdnh); - - ReferenceDomNodeHandler rdnh = new ReferenceDomNodeHandler(); - handlers.put("reference", rdnh); - } - - /** - * This method just exists to add the default starting depth of 1 to the - * underlying actOnFile interface - * - * @param componentTypeXML - * @param target - * @throws Exception - */ - public void handleComponentTypeFile(File componentTypeXML, File target) - throws Exception { - // We have already set up the XML element handlers. - actOnFile(componentTypeXML, target, 1); - // We need do no more, the service and reference handlers - // ServiceDomNodeHandler and ReferenceDomNodeHandler - // will take appropriate action. - } - - /** - * This method is the main FileActor method - * - * @see FileActor#actOnFile(File, File, int) Here we create an initial DOM - * and kick off the processing (using the handler map that has been set - * up by the concrete subclass). - * - * @param compositeXML - * the composite or fragment file - * @param target - * the target directory - * @param depth - * not uesed here but in the - * @see FileActor#actOnFile(File, File, int) interface to allow for - * recursive diving into a directory structure. - */ - public void actOnFile(File fileXML, File target, int depth) - throws Exception { - - if (null == fileXML || null == target) { - return; - } - - parameters.put("componentTypeFile", fileXML); - - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, fileXML.getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_PARSED, "Scagen processing SCA componentType file " + fileXML.getAbsolutePath()); - - super.actOnFile(fileXML, target, depth); - - } - - /** - * @return an error message - usually over-ridden. - */ - protected String getContextMessage() { - - String composite = ((File) parameters.get("compositeOrFragmentFile")).getPath(); - if (null == composite) { - composite = "unknown"; - } - - String component = (String) parameters.get("/composite/component/@name"); - if (null == component) { - component = (String) parameters - .get("/compositeFragment/component/@name"); - } - if (null == component) { - composite = "unknown"; - } - - String msg = "when processing composite " + composite; - - msg = msg - + "\nin this composite file, the component \"" - + component - + "\" has an implementation.cpp element with a header attribute \nwhere the C++ header can be found but it has no matching .componentType file present in\nthe same directory as the header."; - - return msg; - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/CompositeOrFragmentFileHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/CompositeOrFragmentFileHandler.java deleted file mode 100644 index 3eb8dc7d98..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/CompositeOrFragmentFileHandler.java +++ /dev/null @@ -1,91 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; - -import org.apache.tuscany.sca.cpp.tools.common.FileActor; -import org.apache.tuscany.sca.cpp.tools.common.Utils; - -/** - * The purpose of this class is purely to specialise the handler map to one with - * a specific ComponentDomNodeHandler. - */ -public class CompositeOrFragmentFileHandler extends XMLFileActor { - - static { - - GenericDomNodeHandler gdnh = new GenericDomNodeHandler(); - - /* - * We use a specific Component node handler in order to be able to - * process multiple components in the same XML file - */ - ComponentDomNodeHandler componentdnh = new ComponentDomNodeHandler(); - handlers.put("component", componentdnh); - - /* - * We are interested inthe elements below but they only need standard - * processing - */ - handlers.put("composite", gdnh); - handlers.put("compositeFragment", gdnh); - handlers.put("implementation.cpp", gdnh); - } - - /** - * This method is the main FileActor method - * - * @see FileActor#actOnFile(File, File, int) Here we create an initial DOM - * and kick off the processing (using the handler map that has been set - * up by the concrete subclass). - * - * @param compositeXML - * the composite or fragment file - * @param target - * the target directory - * @param depth - * not uesed here but in the - * @see FileActor#actOnFile(File, File, int) interface to allow for - * recursive diving into a directory structure. - */ - public void actOnFile(File compositeXML, File target, int depth) - throws Exception { - - if (null == compositeXML || null == target) { - return; - } - - parameters.put("compositeOrFragmentFile", compositeXML); - - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, compositeXML - .getAbsolutePath()); - - Utils.postEvent(Utils.EVENT_TYPE_FILE_PARSED, - "Scagen processing SCA composite file " - + compositeXML.getAbsolutePath()); - - super.actOnFile(compositeXML, target, depth); - - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DirectoryScanner.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DirectoryScanner.java deleted file mode 100644 index 9cf7952afa..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DirectoryScanner.java +++ /dev/null @@ -1,93 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.util.Set; - -import org.apache.tuscany.sca.cpp.tools.common.FileActor; -import org.apache.tuscany.sca.cpp.tools.common.Utils; - -public class DirectoryScanner { - private FileActor actor; - - private Set actOnTheseFileExtensions; - - public DirectoryScanner(FileActor actor, Set extensions) { - this.actor = actor; - this.actOnTheseFileExtensions = extensions; - } - - /** - * - * @param source - * The composite root directory - * @param target - * The directory that will hold the generated output - * @param depth - * The depth from the initial starting point, not significant for - * the Scagen tool as we are only interested in the composite root - * directory but present due to the FileActor actOnFile interface - * method. This code is pulled from the code in the CParsingTool - * class and further work is needed to remove the duplication. - * Tnterface has been left unchanged as we hope to reconverge the - * parser here with the original one once the changes are fed - * back into the original code. - * @throws Exception - */ - public void walkTree(File source, File target, int depth) throws Exception { - depth++; - boolean noTarget = (null == target); - - if (!source.canRead()) - Utils.rude("Cannot read from source directory " + source); - if (!noTarget && !target.canWrite()) - Utils.rude("Cannot write to target directory " + target); - - if (source.isDirectory()) { - File[] filesInDirectory = source.listFiles(); - for (int i = 0; i < filesInDirectory.length; i++) { - File file = filesInDirectory[i]; - String name = file.getName(); - int dot = name.lastIndexOf('.'); - String ext = null; - if (-1 != dot) { - ext = name.substring(dot + 1); - } - - if (file.isFile() - && (actOnTheseFileExtensions == null || (!file - .isHidden() && actOnTheseFileExtensions - .contains(ext)))) { - // this is a file we need to act on! - actor.actOnFile(file, target, depth); - } - } - } else { - return; // Do not act on single files for now we expect a composite - // root directory - // and the "main" class checks its parameters to ensure this is so. - } - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomHandler.java deleted file mode 100644 index 0756b5fc3b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomHandler.java +++ /dev/null @@ -1,83 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.util.Map; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * The purpose of this class it to provide a generic class that can handle both - * a DOM and a DOM node. - * - */ -public class DomHandler extends GenericDomNodeHandler { - /** - * This method will run through the initial level of the DOM using the - * handlers map - * - * @param dom - * the document being consumed - * @param handlers - * the map from element name to node handler - * @param parameters - * a map of parameters - this is often used by a handler to place - * a name-value pair, the name is often an Xpath representation - * of the location of the data in the DOM but handlers are free - * to use whatever they like - the contextXpath is generated as - * an Xpath prefix for those handlers that wish to use it. - */ - public static void handleDom(Document dom, Map handlers, Map parameters) { - if (dom != null) { - NodeList childNodes = dom.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node childNode = childNodes.item(i); - mapNodeToHandlerAndHandle(childNode, "/" - + childNode.getNodeName(), handlers, parameters); - } - } - } - - /** - * - * @param node - * The DOM node being consumed - * @param contextXPath - * The XPath to this node - * @param handlers - * The map from element name to node handler - * @param parameters - * A map of parameters - this is often used by a handler to place - * a name-value pair, the name is often an Xpath representation - * of the location of the data in the DOM but handlers are free - * to use whatever they like - the contextXpath is generated as - * an Xpath prefix for those handlers that wish to use it. - */ - public void handleNode(Node node, String contextXPath, Map handlers, - Map parameters) { - mapNodeToHandlerAndHandle(node, contextXPath, handlers, parameters); - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomNodeHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomNodeHandler.java deleted file mode 100644 index 37c2a1a81c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomNodeHandler.java +++ /dev/null @@ -1,46 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.util.Map; - -import org.w3c.dom.Node; - -public interface DomNodeHandler { - - public static int ELEMENT = 1; - /** - * An interface for classes that can process DOM nodes. - * - * @param node the DOM node being consumed - * @param contextXPath the XPath to this node - * @param handlers The map from element name to node handler - * @param parameters A map of parameters - this is often used by a handler to place - * a name-value pair, the name is often an Xpath like representation of the - * location of the data in the DOM but handlers are free to use whatever - * they like - the contextXpath is generated as an Xpath prefix for those - * handlers that wish to use it. - */ - void handleNode( Node node, String contextXPath, Map handlers, Map parameters ); - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/GenericDomNodeHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/GenericDomNodeHandler.java deleted file mode 100644 index 1ec393959d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/GenericDomNodeHandler.java +++ /dev/null @@ -1,220 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; - -import org.apache.tuscany.sca.cpp.tools.common.Utils; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * - * - * - * - */ -public class GenericDomNodeHandler implements DomNodeHandler { - /** - * This method parses the DOM attributes into name value pairs in the - * parameter map each valued keyed by its XPath. - * - * @param node - * the DOM node being processed - * @param contextPath - * the XPath to the DOM node being processed - * @param parameters - * a scratchpad map of name value pairs - */ - public void transferAttrsToParameters(Node node, String contextPath, - Map parameters) { - - if (node == null || contextPath == null || parameters == null) - return; - - NamedNodeMap attrs = node.getAttributes(); - if (attrs != null) { - for (int i = 0; i < attrs.getLength(); i++) { - Node attr = attrs.item(i); - parameters.put(contextPath + "/" + "@" + attr.getNodeName(), - attr.getNodeValue()); - - // Report the library name to the deployment tool if required. - if ("library".equals(attr.getNodeName())) { - //This is a path relative to the composite root. - //so we need to add it in. - File mod = (File) parameters.get("compositeOrFragmentFile"); - if (null != mod) { - String separatorForRegex = File.separator.replaceAll( - "\\\\", "\\\\\\\\"); - - String end = attr.getNodeValue().replaceAll("[/\\\\]+", - separatorForRegex); - - if (!end.startsWith(File.separator)) { - end = File.separator + end; - } - - String fullPath = mod.getParentFile().getAbsolutePath() - + end; - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, - fullPath); - } - - } - - } - } - return; - } - - /** - * This method will iterate through the DOM node's children and call the - * appropriate handler for each one. - * - * @param node - * the DOM node being processed - * @param contextPath - * the XPath to the DOM node being processed - * @param handlers - * a map of element name to handler objects - * @param parameters - * a scratchpad map of name value pairs - */ - public void handleChildElements(Node node, String contextPath, - Map handlers, Map parameters) { - - if (node == null || contextPath == null) - return; - - NodeList children = node.getChildNodes(); - if (children != null) { - for (int i = 0; i < children.getLength(); i++) { - Node child = children.item(i); - mapNodeToHandlerAndHandle(child, contextPath + "/" - + child.getNodeName(), handlers, parameters); - } - } - return; - } - - /** - * This method will resolve any registered handler for a particular DOM - * element and call the handleNode method on it. If the handlers map has a - * mapping from "entity" to an instance of EntityHandler which implements - * the DomNodeHandler interface then any node that looks like <entity> - * <any_other/><stuff/></entity> - * - * Will be passed to the EntityHandler to process. - * - * @param node - * the DOM node being processed - * @param contextPath - * the XPath to the DOM node being processed - * @param handlers - * a map of element name to handler objects - * @param parameters - * a scratchpad map of name value pairs - */ - public static void mapNodeToHandlerAndHandle(Node node, String contextPath, - Map handlers, Map parameters) { - if (node != null && node.getNodeType() == DomNodeHandler.ELEMENT) { - String nodeName = node.getNodeName(); - if (nodeName != null && nodeName.length() > 0) { - DomNodeHandler handler = (DomNodeHandler) handlers - .get(nodeName); - if (handler != null) { - handler.handleNode(node, contextPath, handlers, parameters); - } - } - } - } - - /** - * This method will place the attributes in this node into the parameter map - * keyed by the XPath and recursively continue processing for any - * sub-elements of the node. - * - * @param node - * The DOM node being consumed - * @param contextXPath - * The XPath to this node - * @param handlers - * The map from element name to node handler - * @param parameters - * A map of parameters - this is often used by a handler to place - * a name-value pair, the name is often an Xpath representation - * of the location of the data in the DOM but handlers are free - * to use whatever they like - the contextXpath is generated as - * an Xpath prefix for those handlers that wish to use it. - */ - public void handleNode(Node node, String contextXPath, Map handlers, - Map parameters) { - - clearParametersAtThisXPath(contextXPath, parameters); - transferAttrsToParameters(node, contextXPath, parameters); - handleChildElements(node, contextXPath, handlers, parameters); - } - - /** - * @param contextXPath - * @param parameters - */ - private void clearParametersAtThisXPath(String contextXPath, Map parameters) { - - // TODO: Slow but works, improve parameters mechanism overall - // to make this unecessary - if (contextXPath == null || parameters == null) { - return; - } - - // We want to clear both /compositeFragment and /composite - // subtrees when we come across the root of either.. - if (contextXPath.equals("/compositeFragment")) { - //clear both this and "composite" - contextXPath = "/composite"; - } - - Set parms = parameters.entrySet(); - if (null != parms) { - Iterator iter = parms.iterator(); - Map.Entry item = null; - String thisKey; - - while (iter.hasNext()) { - item = (Entry) iter.next(); - thisKey = (String) item.getKey(); - if (thisKey.startsWith(contextXPath)) { - //System.out.println(" removing " + thisKey + " for " + - // item.getValue().toString() + " against " + contextXPath); - iter.remove(); - } - } - } - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/LittleClass.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/LittleClass.java deleted file mode 100644 index e7036037c6..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/LittleClass.java +++ /dev/null @@ -1,33 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -/** - * This class is just a convenient application class that is loaded in order to - * get the application class loader. We are interested in the application class - * loader as we use its getResource method to resolve XML files independantly of - * where they are. - */ -public class LittleClass { - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ReferenceDomNodeHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ReferenceDomNodeHandler.java deleted file mode 100644 index 5631249769..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ReferenceDomNodeHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.util.Map; - -import org.apache.tuscany.sca.cpp.tools.common.Options; -import org.w3c.dom.Node; - -/** - * The purpose of this class is to process a <reference>element in a - * componentType file and then trigger a call to the method in ServicesGenerator - * to process the interface header file - */ -public class ReferenceDomNodeHandler extends GenericDomNodeHandler { - - /* - * (non-Javadoc) - * - * @see org.apache.tuscany.sca.cpp.services.DomNodeHandler#handleNode(org.w3c.dom.Node, - * java.lang.String, java.util.Map, java.util.Map) - */ - public void handleNode(Node node, String contextXPath, Map handlers, - Map parameters) { - - // Pick up attrs and children - super.handleNode(node, contextXPath, handlers, parameters); - - //OK we know we are handling a reference - //now go and create the wrapper and proxy for it if it is a C++ reference - if(parameters.containsKey("/componentType/reference/interface.cpp/@header")) { - createProxyForReference(parameters); - } - - } - - /** - * This method is really just an adapter that adapts the -dir Option to a - * value int he parameters map for "composite_root" - * - * @param parameters - * the map of name-value parameters. - */ - private void createProxyForReference(Map parameters) { - try { - String mr = (String) Options.getOption("-dir"); - parameters.put("composite_root", mr); - ServicesGenerator.handleInterfaceHeader(parameters, true); - - } catch (Exception e) { - e.printStackTrace(); - } - - } -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/Scagen.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/Scagen.java deleted file mode 100644 index 19e983c6b1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/Scagen.java +++ /dev/null @@ -1,176 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.apache.tuscany.sca.cpp.tools.common.CParsingTool; -import org.apache.tuscany.sca.cpp.tools.common.Options; -import org.apache.tuscany.sca.cpp.tools.common.Utils; - -/** - * This is the main top level class. Its purpose is to create a - * Composite/FragmentFile handler visitor and pass it to a DirectoryScanner for - * processing. - */ -public class Scagen extends CParsingTool { - - public static Set COMPOSITE_EXTENSIONS = new HashSet(Arrays - .asList(new Object[] { "composite", "fragment" })); - - /** - * @throws Exception - * - */ - public Scagen(String[] args) throws Exception { - super(args); - } - - /** - * Take a directory scanning class and create a vistor that knows how to - * handle any .composite or .fragment that the scanner comes across. - * - * @param args - * standard main args. THe values we expect in this class are - * scagen -dir input_dir -output output_dir - * - */ - public static void main(String[] args) { - boolean failed = false; - try { - Scagen env = new Scagen(args); - CompositeOrFragmentFileHandler composite_handler = new CompositeOrFragmentFileHandler(); - - // Check and access the input SCA composite directory - String name = (String) Options.getOption("-dir"); - if (null == name) { - Utils - .screenMessage("Please provide a SCA composite directory name as a \"-dir\" option."); - env.printUsage(); - System.exit(-1); - } - File source = new File(name); - if (!source.isFile() && !source.isDirectory()) { - Utils - .screenMessage("The SCA composite directory provided as the \"-dir\" option cannot be accessed,"); - Utils.screenMessage("the option given was: " + source); - env.printUsage(); - System.exit(-1); - } - - String deployDir = null; - try { - deployDir = (String) Options.getOption("-deploy"); - if (null != deployDir || Options.deploy()) { - Utils.setReportArtefacts(true); - } - } catch (Exception e) { - // let it default to null - } - - Utils.postEvent(Utils.DEPLOYMENT_INPUT_DIRECTORY, source - .getAbsolutePath()); - - // We check the -output option here as we wish to - // reuse the env.maybeCreateDirectory method - // unchanged from the original that went into axis and it will do a - // System.exit if there is no matching Option - String outputDirName = (String) Options.getOption("-output"); - if (null == outputDirName) { - Utils - .screenMessage("Please provide an output directory name for the generated files as a \"-output\" option."); - env.printUsage(); - System.exit(-1); - } - - File outputDir = new File(outputDirName); - - // Check we can create the output directory - if (outputDir == null || !outputDir.exists() && !outputDir.mkdir()) { - Utils.screenMessage("Failed to create output directory: " - + outputDirName); - env.printUsage(); - System.exit(-1); - } - - Utils.postEvent(Utils.DEPLOYMENT_OUTPUT_DIRECTORY, outputDir - .getAbsolutePath()); - - DirectoryScanner scanner = new DirectoryScanner(composite_handler, - COMPOSITE_EXTENSIONS); - scanner.walkTree(source, outputDir, 1); - - if (0 == composite_handler.getFilesActedOn()) { - Utils - .screenMessage("No SCA composite or fragment files were found in: " - + source); - } - - failed = composite_handler.failed; - - } catch (Exception exception) { - Utils - .screenMessage("Unexpected error occurred while runnning the Scagen tool. The Java exception is below."); - exception.printStackTrace(); - failed = true; - } - - if (failed) { - Utils - .outputDebugString("Finished! (but encountered problems parsing composites)"); - System.exit(-2); - } - - Utils.outputDebugString("Finished!"); - } - - /** - * Provide a hint to the user on how to call this class - */ - protected void printUsage() { - System.out - .println("usage: Java Scagen -dir <input_directory> -output <output_directory> [-verbose] [-deploy <deploy_dir>] [-nogenerate] [-outputCommand] [-command <copy_cmd>]"); - System.out - .println(" -dir <input_directory>: the SCA composite root directory"); - System.out - .println(" -output <output_directory>: a directory to put the generated output into"); - System.out.println(" [-verbose]: report on what scagen is doing"); - System.out - .println(" [-deploy <deploy_dir>]: output text to help in deploying the composite's artefacts"); - System.out - .println(" [-command <copy_cmd>]: a string that is injected into the deploy text"); - System.out - .println(" [-list]: change the deploy output text to a simple list of artefacts"); - System.out - .println(" [-outputCommand]: change the deploy output text to command text format"); - System.out - .println(" output is of form \"copy_cmd <dir>file1 <deploy_dir>file1\""); - System.out - .println(" [-nogenerate]: do not generate proxies and wrappers"); - - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServiceDomNodeHandler.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServiceDomNodeHandler.java deleted file mode 100644 index cedb4bdb54..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServiceDomNodeHandler.java +++ /dev/null @@ -1,71 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.util.Map; - -import org.apache.tuscany.sca.cpp.tools.common.Options; -import org.w3c.dom.Node; - -public class ServiceDomNodeHandler extends GenericDomNodeHandler { - - /* - * (non-Javadoc) - * - * @see org.apache.tuscany.sca.cpp.services.DomNodeHandler#handleNode(org.w3c.dom.Node, - * java.lang.String, java.util.Map, java.util.Map) - */ - public void handleNode(Node node, String contextXPath, Map handlers, - Map parameters) { - - // Pick up attrs and the interface.cpp child elements - super.handleNode(node, contextXPath, handlers, parameters); - - // Only generate if this is a C++ service - if(parameters.containsKey("/componentType/service/interface.cpp/@header")) { - //OK now go and create the wrapper and proxy for the service - createWrapperAndProxyForService(parameters); - } - - } - - /** - * This method will generate the wrapper and proxy C++ and header files for - * the service. - * - * @param parameters - * a map of name-value parameters - */ - private void createWrapperAndProxyForService(Map parameters) { - - try { - String mr = (String) Options.getOption("-dir"); - parameters.put("composite_root", mr); - ServicesGenerator.handleInterfaceHeader(parameters, false); - - } catch (Exception e) { - e.printStackTrace(); - } - - } -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServicesGenerator.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServicesGenerator.java deleted file mode 100644 index 956db364a1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServicesGenerator.java +++ /dev/null @@ -1,831 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.tuscany.sca.cpp.tools.common.CParsingTool; -import org.apache.tuscany.sca.cpp.tools.common.Headers; -import org.apache.tuscany.sca.cpp.tools.common.Options; -import org.apache.tuscany.sca.cpp.tools.common.Parameter; -import org.apache.tuscany.sca.cpp.tools.common.Signature; -import org.apache.tuscany.sca.cpp.tools.common.Utils; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -/** - * This class is the main class that handles the function that parses a C++ - * interface header file into a DOM that holds all the semantic information - * about the interface - method names, parameters and return values. It then - * uses XSLT to generate different "views" of this data plus the parameter map - * from other sources that are the C++ programs for the proxy and wrapper - * implementations and headers. - */ -public class ServicesGenerator extends CParsingTool { - - private static final String OPERATION_NAME_ATTR = "operationNameAttr"; - - private static final String HEADER_NAME_ATTR = "headerNameAttr"; - - private static final String SCA_OPERATION = "scaOperation"; - - private static final String SCA_SERVICE = "scaService"; - - private static final String SCA_OPERATION_RETURN_TYPE = "scaOperationReturnType"; - - private static final String SCA_OPERATION_PARAMETER = "scaOperationParameter"; - - private static final String SCA_OPERATION_PARAMETER_NAME_ATTR = "scaOperationParameterNameAttr"; - - private static final String SCA_OPERATION_PARAMETER_CONST_ATTR = "scaOperationParameterConstAttr"; - - private static final String SCA_INTERFACE_NAME_ATTR = "scaInterfaceNameAttr"; - - private static final String CPP_HEADER = "cppHeader"; - - private static boolean TESTING = true; - - private static TransformerFactory txmf = null; - - private static ServicesGenerator instance = null; - - public ServicesGenerator(String[] args) throws Exception { - super(args); - txmf = TransformerFactory.newInstance(); - } - - /** - * - * @param parameters - * @param forReference - * true if we are creating a proxy for a reference (rather than - * for a service) - * @throws Exception - * - * The design is - * <ul> - * <li>handleInterfaceHeader - * <li>createDOMofMethods - * <li>createProxyCPPFromDom(outputDir, dom); - * <li>createProxyHeaderFromDom(outputDir, dom); - * </ul> - * - * plus if we are not generating for a reference element - * <ul> - * <li>createWrapperCPPFromDom(outputDir, dom); - * <li>createWrapperHeaderFromDom(outputDir, dom); - * <ul> - * Each of the create.... methods calls createOutputFromDom with a different - * style sheet. - * - */ - public static void handleInterfaceHeader(Map parameters, - boolean forReference) throws Exception { - boolean failed = false; - - String type = null; - if (forReference) { - type = "reference"; - } else { - type = "service"; - } - String interfaceHeaderFilename = (String) parameters - .get("/componentType/" + type + "/interface.cpp/@header"); - - String componentTypeFileHeaderName = interfaceHeaderFilename; - - String sca_composite_root = (String) Options.getOption("-dir"); - parameters.put("composite_root", sca_composite_root); - - if (sca_composite_root != null && interfaceHeaderFilename != null - && interfaceHeaderFilename.length() > 0) { - String separator; - // Stick in a "/" (File.separator) if required. - if ((interfaceHeaderFilename.substring(0, 1).equals("/") || sca_composite_root - .substring(sca_composite_root.length() - 1, - sca_composite_root.length()).equals("/")) - || (interfaceHeaderFilename.substring(0, 1).equals("\\") || sca_composite_root - .substring(sca_composite_root.length() - 1, - sca_composite_root.length()).equals("\\")) - - ) { - separator = ""; - } else { - separator = File.separator; - } - interfaceHeaderFilename = sca_composite_root + separator - + interfaceHeaderFilename; - } - - File outputDir = (File) parameters.get("targetDirectoryFile"); - - String[] args = new String[] { "-source", interfaceHeaderFilename, - "-target", outputDir.getPath() }; - ServicesGenerator gen = new ServicesGenerator(args); - File file; - try { - if (null == interfaceHeaderFilename) { - gen.printUsage(); - System.exit(-1); - } - - file = new File(interfaceHeaderFilename); - if (!file.isFile()) { - if (file.isDirectory()) { - Utils - .rude("This tool works at the header file level and not for directories like " - + file); - } - Utils.rude("Bad file or directory " + file); - } - File source = file; - if (!outputDir.exists() && !outputDir.mkdir()) - Utils.rude("Failed to create directory " + outputDir); - - // The class below is the one that will go through the header - // file(s) - Headers headers = new Headers(); - - if (null != interfaceHeaderFilename) { - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, file - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_PARSED, - "Scagen processing C++ interface header " - + file.getAbsolutePath()); - headers.actOnFile(file, outputDir, 1); - Utils.outputDebugString("Parsing files..."); - } - - String nameOfSorR = null; - String referenceName = null; - String serviceName = null; - - if (forReference) { - - Object rn = parameters.get("/componentType/reference/@name"); - - if (rn instanceof String) { - referenceName = (String) rn; - nameOfSorR = referenceName; - } - } else { - - Object sn = parameters.get("/componentType/service/@name"); - - if (sn instanceof String) { - serviceName = (String) sn; - nameOfSorR = serviceName; - } - } - - String compositeXmlFileHeader = null; - String compositeXmlFileHeaderNoExt = null; - Object compositeh = parameters - .get("/composite/component/implementation.cpp/@header"); - - if (compositeh == null) { - compositeh = parameters - .get("/compositeFragment/component/implementation.cpp/@header"); - } - - if (compositeh instanceof String) { - File f = new File((String) compositeh); - compositeXmlFileHeader = (String) compositeh; - - String fname = f.getName(); - compositeXmlFileHeaderNoExt = fname.substring(0, fname - .lastIndexOf('.')); - - } - - String implClassNameAttrFromCompositeFile = (String) parameters - .get("implClass"); - String implClassNamespaceAttrFromCompositeFile = (String) parameters - .get("implNamespace"); - - if(implClassNamespaceAttrFromCompositeFile == null || implClassNamespaceAttrFromCompositeFile.length() == 0) - { - implClassNamespaceAttrFromCompositeFile = ""; - } - else - { - implClassNamespaceAttrFromCompositeFile += "::"; - } - - String interfaceClassNameAttrFromComponentTypeFile; - if (forReference) { - interfaceClassNameAttrFromComponentTypeFile = (String) parameters - .get("/componentType/reference/interface.cpp/@class"); - } else { - interfaceClassNameAttrFromComponentTypeFile = (String) parameters - .get("/componentType/service/interface.cpp/@class"); - } - - List methods = headers.getAllMethods(); - - // Pull out one of the methods' namespace attributes. - String intfNamespace = null; - if (methods.size() > 0) { - Signature method = (Signature) methods.get(0); - intfNamespace = method.getNamespace(); - } - - if (interfaceClassNameAttrFromComponentTypeFile != null) { - methods = filterToPublicMethodsOfGivenClass(methods, - interfaceClassNameAttrFromComponentTypeFile, true); - } else { - //We want to filter to methods of the class whose - //name matches the header file name. - // String intfClassName = (String) parameters.get("intfClass"); - // - String headerFileBase = file.getName().replaceAll( - "\\.h|\\.hpp|\\.h++", ""); - - methods = filterToPublicMethodsOfGivenClass(methods, - headerFileBase, false); - } - - Document dom = createDOMofMethods(methods, source, serviceName, - referenceName, nameOfSorR, null, - componentTypeFileHeaderName, compositeXmlFileHeader, - compositeXmlFileHeaderNoExt, intfNamespace, - interfaceClassNameAttrFromComponentTypeFile, - implClassNameAttrFromCompositeFile, implClassNamespaceAttrFromCompositeFile); - -// // Print out the generated DOM -// StringWriter sw = new StringWriter(); -// OutputFormat outputFormat = new OutputFormat("xml", "UTF-8", true); -// XMLSerializer serializer = new XMLSerializer(sw, outputFormat); -// serializer.serialize(dom); -// System.out.println("DOM:\n"+sw.toString()); - - - createProxyCPPFromDom(outputDir, dom); - createProxyHeaderFromDom(outputDir, dom); - - if (!forReference) { - createWrapperCPPFromDom(outputDir, dom); - createWrapperHeaderFromDom(outputDir, dom); - } - - } catch (Exception exception) { - exception.printStackTrace(); - failed = true; - } - - if (failed) { - Utils.outputDebugString("Finished! (but encountered problems)"); - System.exit(-2); - } - } - - /** - * This methods takes a list of methods and filters them to only contain the - * public methods of the given class - * - * @param methods - * a list of methods - * @param className - * we will return a list of only this classes methods from the - * methods parameter - * @param attrSpecified - * if the user does not specify one we ignore namespaces - * @return - */ - private static List filterToPublicMethodsOfGivenClass(List methods, - String className, boolean useNamespace) { - if (methods != null && className != null && className.length() > 0) { - for (Iterator iter = methods.listIterator(); iter.hasNext();) { - Signature method = (Signature) iter.next(); - String scope = method.getScope(); - String sig = method.getOriginal(); - String namespace = method.getNamespace(); - - String qualifiedClassName; - if (useNamespace && null != namespace && 0 < namespace.length()) { - qualifiedClassName = namespace + "::" - + method.getTrimClassName(); - } else { - qualifiedClassName = method.getTrimClassName(); - } - - // If we are not public or the classname does not match - // remove... - if (!qualifiedClassName.equals(className) - || -1 == scope.indexOf("public")) { - iter.remove(); - } - } - } - return methods; - } - - /** - * Use an XSLT transformation to create a Proxy "view" of the DOM - * information - * - * @param outputDir - * where to put the C++ - * @param dom - * the DOM of semantic method information - * @throws TransformerException - */ - private static void createProxyCPPFromDom(File outputDir, Document dom) - throws TransformerException { - - //Create the Filename from the Service Name in the DOM - if (dom == null) { - return; - } - - String serviceOrReferenceName = "noSorRNameDefined"; - - String implClass = "nocompositeXmlFileHeaderDefined"; - - Element topNode = dom.getDocumentElement(); - if (null != topNode) { - Attr attr = topNode.getAttributeNode("nameOfSorR"); - if (attr != null) { - serviceOrReferenceName = attr.getNodeValue(); - } - - attr = topNode.getAttributeNode("implClass"); - if (attr != null) { - implClass = attr.getNodeValue(); - } - } - - File proxyCPP = new File(outputDir, implClass + "_" - + serviceOrReferenceName + "_Proxy.cpp"); - if (null != proxyCPP) { - - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_GENERATED, proxyCPP - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_CREATE, - "Scagen creating SCA for C++ proxy implementation " - + proxyCPP.getAbsolutePath()); - } - - createOutputFromDom(dom, proxyCPP, - "org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl"); - - } - - /** - * Use an XSLT transformation to create a Wrapper "view" of the DOM - * information - * - * @param outputDir - * where to put the C++ - * @param dom - * the DOM of semantic method information - * @throws TransformerException - */ - private static void createWrapperCPPFromDom(File outputDir, Document dom) - throws TransformerException { - - //Create the Filename from the Service Name in the DOM - if (dom == null) { - return; - } - - String serviceName = "noServiceDefined"; - - String implClass = "nocompositeXmlFileHeaderDefined"; - - Element topNode = dom.getDocumentElement(); - if (null != topNode) { - Attr attr = topNode.getAttributeNode("serviceName"); - if (attr != null) { - serviceName = attr.getNodeValue(); - } - - attr = topNode.getAttributeNode("implClass"); - if (attr != null) { - implClass = attr.getNodeValue(); - } - } - - File wrapperCPP = new File(outputDir, implClass + "_" + serviceName - + "_Wrapper.cpp"); - if (null != wrapperCPP) { - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_GENERATED, wrapperCPP - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_CREATE, - "Scagen creating SCA for C++ wrapper implementation " - + wrapperCPP.getAbsolutePath()); - } - createOutputFromDom(dom, wrapperCPP, - "org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl"); - - } - - /** - * Use an XSLT transformation to create a Proxy header "view" of the DOM - * information - * - * @param outputDir - * where to put the C++ - * @param dom - * the DOM of sematic method information - * @throws TransformerException - */ - private static void createProxyHeaderFromDom(File outputDir, Document dom) - throws TransformerException { - - //Create the Filename from the Service Name in the DOM - if (dom == null) { - return; - } - - String serviceOrReferenceName = "noServiceDefined"; - String intfClass = "noInterfaceClassNameOrDefaultDefined"; - String implClass = "noImplementationClassOrDefaultDefined"; - - Element topNode = dom.getDocumentElement(); - if (null != topNode) { - Attr attr = topNode.getAttributeNode("nameOfSorR"); - if (attr != null) { - serviceOrReferenceName = attr.getNodeValue(); - } - attr = topNode.getAttributeNode("intfClass"); - if (attr != null) { - intfClass = attr.getNodeValue(); - } - attr = topNode.getAttributeNode("implClass"); - if (attr != null) { - implClass = attr.getNodeValue(); - } - } - - File proxyHeader = new File(outputDir, implClass + "_" - + serviceOrReferenceName + "_Proxy.h"); - if (null != proxyHeader) { - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_GENERATED, proxyHeader - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_CREATE, - "Scagen creating SCA for C++ proxy header " - + proxyHeader.getAbsolutePath()); - } - - createOutputFromDom(dom, proxyHeader, - "org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl"); - - } - - /** - * Use an XSLT transformation to create a Wrapper header "view" of the DOM - * information - * - * @param outputDir - * where to put the C++ - * @param dom - * the DOM of sematic method information - * @throws TransformerException - */ - private static void createWrapperHeaderFromDom(File outputDir, Document dom) - throws TransformerException { - - //Create the Filename from the Service Name in the DOM - if (dom == null) { - return; - } - - String serviceName = "noServiceDefined"; - - String implClass = "nocompositeXmlFileHeaderDefined"; - - Element topNode = dom.getDocumentElement(); - if (null != topNode) { - Attr attr = topNode.getAttributeNode("serviceName"); - if (attr != null) { - serviceName = attr.getNodeValue(); - } - - attr = topNode.getAttributeNode("implClass"); - if (attr != null) { - implClass = attr.getNodeValue(); - } - } - - File wrapperHeader = new File(outputDir, implClass + "_" + serviceName - + "_Wrapper.h"); - - if (null != wrapperHeader) { - Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_GENERATED, wrapperHeader - .getAbsolutePath()); - Utils.postEvent(Utils.EVENT_TYPE_FILE_CREATE, - "Scagen creating SCA for C++ wrapper header " - + wrapperHeader.getAbsolutePath()); - } - createOutputFromDom(dom, wrapperHeader, - "org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl"); - - } - - /** - * This method will return a class loader that can see the resources that - * are parts of "this" package. - */ - private static ClassLoader getALoader() { - - LittleClass lc; - try { - lc = new LittleClass(); - return lc.getClass().getClassLoader(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * This method will generically process the DOM using a stylesheet passed - * in. - * - * @param dom - * the source of data (the model) - * @param outputFile - * where to put the result - * @param xslTransformationFileName - * the xsl file containing the "view" - * @throws TransformerException - */ - private static void createOutputFromDom(Document dom, File outputFile, - String xslTransformationFileName) throws TransformerException { - - if(Options.noGenerate()){ - return; - } - - InputStream stream = getALoader().getResourceAsStream( - xslTransformationFileName); - StreamSource ss = new StreamSource(stream); - StreamResult out = new StreamResult(outputFile); - try { - Transformer xslt = txmf.newTransformer(ss); - - // Unless a width is set, there will be only line breaks but no - // indentation. - // The IBM JDK and the Sun JDK don't agree on the property name, - // so we set them both. - // - try { - xslt.setOutputProperty( - "{http://xml.apache.org/xalan}indent-amount", "2"); - } catch (Throwable t) { - //OK to ignore this, depends on XSLT engine and one will fail - } - try { - xslt.setOutputProperty( - "{http://xml.apache.org/xslt}indent-amount", "2"); - } catch (Throwable t) { - //OK to ignore this, depends on XSLT engine and one will fail - } - - DOMSource from = new DOMSource(dom); - - xslt.transform(from, out); - - } catch (TransformerConfigurationException e) { - e.printStackTrace(); - throw (e); - } catch (TransformerException e) { - e.printStackTrace(); - throw (e); - } finally { - try { - stream.close(); - } catch (IOException e1) { - // unlikely but if - // we can't close it, we can't close it - } - } - - } - - //TODO clear up the parameter list below to make it smaller if - // possible - /** - * This method will create A DOM containing all the semantic information - * that it can extract from a C++ header file. - * - * @param methods - * a list of methods that are going into the DOM - * @param source - * the header file the methods came from - * @param serviceName - * the name of the service - * @referenceName the name of the reference - * @nameOfSorR the non null one of the two parameters above - * @headerClassName the name of the header class - * @param compositeXmlFileImplHeaderNameWithPathAndExt - * the source filename - * @param compositeXmlFileHeaderNoExtorPath - * the shortname of the source file - * @param implClass - * the implementation class - * @param intfClass - * the interface we are turning into a service - * @return - */ - private static Document createDOMofMethods(List methods, File source, - String serviceName, String referenceName, String nameOfSorR, - String headerClassName, - String componentTypeXmlFileIntfHeaderNameWithPathAndExt, - String compositeXmlFileImplHeaderNameWithPathAndExt, - String compositeXmlFileHeaderNoExtorPath, String intfNamespace, - String intfClass, String implClass, String implNamespace) { - - if (methods == null) { - return null; - } - - // Create a DOM of the methods - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - Document document = null; - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - document = builder.newDocument(); - - Element root = (Element) document.createElement(CPP_HEADER); - - root.setAttribute(HEADER_NAME_ATTR, source.getPath()); - - document.appendChild(root); - - Element intf = (Element) document.createElement(SCA_SERVICE); - root.appendChild(intf); - - // Go through all the signatures we have collected... - Signature s = null; - for (Iterator iter = methods.iterator(); iter.hasNext();) { - s = (Signature) iter.next(); - - // Each signature is an operation - Element op = document.createElement(SCA_OPERATION); - op.setAttribute(OPERATION_NAME_ATTR, s.getMethodName()); - intf.appendChild(op); - - Parameter[] parms = s.getParameters(); - if (parms != null) { - - for (int i = 0; i < parms.length; i++) { - Element parm = (Element) document - .createElement(SCA_OPERATION_PARAMETER); - String type_string = parms[i].getTypeWithoutConst() - .toString(); - - type_string = type_string.replaceAll(":: ", "::"); - - Text text = document.createTextNode(type_string); - parm.appendChild(text); - parm.setAttribute(SCA_OPERATION_PARAMETER_NAME_ATTR, - parms[i].getName()); - - if (parms[i].getTypeWithoutConst().intern() != parms[i] - .getType().intern()) { - parm.setAttribute( - SCA_OPERATION_PARAMETER_CONST_ATTR, "true"); - } - - op.appendChild(parm); - // TO DO only really stores the value - // unsafely/temporarily - // which is fine while we handle everything at the - // end of parsing the "leaf" that represents that actual - // interface/service but the below will cause the second - // service - // processed to overwite the first one in the DOM. I we - // wish - // to do some overall processing at the end we will have - // to - // use a better more XPath like key that varies by - // instance - // of the service. - intf.setAttribute(SCA_INTERFACE_NAME_ATTR, s - .getTrimClassName()); - } - } - - Element rc = document.createElement(SCA_OPERATION_RETURN_TYPE); - rc.appendChild(document.createTextNode(s.getReturnType() - .toString().replaceAll(":: ", "::"))); - op.appendChild(rc); - - root.appendChild(intf); - } - - // Set the name of the Service - // here, if we are not passed one we use - // the classname from the last header function signature... - if (serviceName == null && s != null) { - serviceName = s.getTrimClassName(); - } - - // this is used for the proxy file name but we need to - // use the reference name if this is pulled in due to it - // being a reference!!! - if (serviceName != null) - root.setAttribute("serviceName", serviceName); - if (referenceName != null) - root.setAttribute("referenceName", referenceName); - if (nameOfSorR != null) - root.setAttribute("nameOfSorR", nameOfSorR); - - if (implClass != null) { - root.setAttribute("implClass", implClass); - } else { - root.setAttribute("implClass", compositeXmlFileHeaderNoExtorPath); - } - - if (implClass != null) { - root.setAttribute("implNamespace", implNamespace); - } - - // default class name to the name of the header... - if (headerClassName == null && source != null) { - headerClassName = source.getName().replaceAll( - "\\.h|\\.hpp|\\.h++", ""); - } - root.setAttribute("headerClassName", headerClassName); - - if (null == intfClass) { - intfClass = headerClassName; - } - - if (null != intfNamespace) { - root.setAttribute("namespace", intfNamespace); - if (null != intfClass && !intfClass.startsWith(intfNamespace)) { - intfClass = intfNamespace + "::" + intfClass; - } - } - - root.setAttribute("intfClass", intfClass); - - if (componentTypeXmlFileIntfHeaderNameWithPathAndExt == null) { - componentTypeXmlFileIntfHeaderNameWithPathAndExt = "componentTypeHeader"; - } - root.setAttribute("componentTypeHeader", - componentTypeXmlFileIntfHeaderNameWithPathAndExt); - - if (compositeXmlFileImplHeaderNameWithPathAndExt == null) { - compositeXmlFileImplHeaderNameWithPathAndExt = "compositeXmlFileImplHeader"; - } - root.setAttribute("compositeXmlFileHeader", - compositeXmlFileImplHeaderNameWithPathAndExt); - - if (compositeXmlFileHeaderNoExtorPath == null) { - compositeXmlFileHeaderNoExtorPath = "compositeXmlFileHeaderNoExt"; - } - root.setAttribute("compositeXmlFileHeaderNoExt", - compositeXmlFileHeaderNoExtorPath); - - } catch (ParserConfigurationException pce) { - // Parser with specified options can't be built - pce.printStackTrace(); - } - - return document; - - } - -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/XMLFileActor.java b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/XMLFileActor.java deleted file mode 100644 index dd260c9787..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/XMLFileActor.java +++ /dev/null @@ -1,208 +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. - */ - -/* @version $Rev$ $Date$ */ - -package org.apache.tuscany.sca.cpp.tools.services; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.apache.tuscany.sca.cpp.tools.common.FileActor; -import org.apache.tuscany.sca.cpp.tools.common.Utils; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -/** - * The purpose of this abstract class is to provide a home for the standard - * processing that is involved in turning a XML file into an internal DOM. - */ -public abstract class XMLFileActor implements FileActor { - - protected static Map handlers = new HashMap(); - - protected static Map parameters = new HashMap(); - - public boolean failed; - - private int filesActedOn=0; - - protected static TransformerFactory transformerFactory = TransformerFactory - .newInstance(); - - /** - * This method is the main FileActor method - * - * @see FileActor#actOnFile(File, File, int) Here we create an initial DOM - * and kick off the processing (using the handler map that has been set - * up by the concrete subclass). - * - * @param compositeXML - * the composite or fragment file - * @param target - * the target directory - * @param depth - * not uesed here but in the - * @see FileActor#actOnFile(File, File, int) interface to allow for - * recursive diving into a directory structure. - */ - public void actOnFile(File compositeXML, File target, int depth) - throws Exception { - - if (null == compositeXML || null == target) { - return; - } - - filesActedOn++; - - parameters.put("sourceFile", compositeXML); - parameters.put("targetFile", target); - - if (transformerFactory.getFeature(DOMSource.FEATURE) - && transformerFactory.getFeature(DOMResult.FEATURE)) { - Document dom = createDomFromXMLFile(compositeXML); - if (dom != null) { - parameters.put("targetDirectoryFile", target); - DomHandler.handleDom(dom, handlers, parameters); - } - } - } - - /** - * This method builds an in memory DOM from an XML file - * - * @param xmlSourceFile - * the XML file we are handling - * @return the resulting document - */ - protected Document createDomFromXMLFile(File xmlSourceFile) { - Document dom = null; - DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); - //We do not validate via f.setValidating(true); - f.setNamespaceAware(true); - - try { - DocumentBuilder parser = f.newDocumentBuilder(); - dom = parser.parse(xmlSourceFile); - } catch (SAXException sxe) { - String path; - try { - path = xmlSourceFile.getCanonicalPath(); - } catch (IOException e) { - path = xmlSourceFile.getPath(); - } - Utils.screenMessage("There has been a SAXException of type " - + sxe.getLocalizedMessage()); - if (null != xmlSourceFile) { - Utils.screenMessage(" when processing file " + path); - } else { - Utils.screenMessage(" as the input file is null."); - } - -// Leave for possible future debug option -// Utils.screenMessage(" The returned Java exception is below."); -// if (sxe.getException() != null) -// sxe.getException().printStackTrace(); -// else -// sxe.printStackTrace(); - } catch (ParserConfigurationException pce) { - String path; - try { - path = xmlSourceFile.getCanonicalPath(); - } catch (IOException e) { - path = xmlSourceFile.getPath(); - } - Utils - .screenMessage("There has been a ParserConfigurationException of type " - + pce.getLocalizedMessage()); - if (null != xmlSourceFile) { - Utils.screenMessage(" when processing file " + path); - } else { - Utils.screenMessage(" as the input file is null."); - } - -// Leave for possible future debug option -// Utils.screenMessage(" The returned Java exception is below."); -// pce.printStackTrace(); - - } catch (IOException ioe) { - String path; - try { - path = xmlSourceFile.getCanonicalPath(); - } catch (IOException e) { - path = xmlSourceFile.getPath(); - } - - Utils.screenMessage("Unable to open file " + path); - Utils.screenMessage(this.getContextMessage()); - - - - } - - return dom; - } - - /** - * @return an error message - usually over-ridden. - */ - private String getContextMessage() { - return "Check the file exists and can be read."; - } - - /** - * Set a parameter - * - * @param name - * @param value - */ - public void setParameter(String name, Object value) { - parameters.put(name, value); - } - - /** - * Get a parameter - * - * @param name - * @param value - * @return the value of the parameter - */ - public Object getParameter(String name, Object value) { - return parameters.get(name); - } - - - - /** - * @return Returns the filesActedOn. - */ - public int getFilesActedOn() { - return filesActedOn; - } -}
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/package.html b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/package.html deleted file mode 100644 index ea15ca587b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/package.html +++ /dev/null @@ -1,159 +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. ---> - -<html> - -<head> -<title>Design documentation for org\apache\tuscany\sca\cpp\tools\services</title> -</head> - -<body lang=EN-GB> - -<div class=Section1> - -<h1>Overview</h1> - - - -<p>This package contains classes that generate C++ wrappers and -proxies for C++ implementations of SCA services. </p> - -<h2>What the package does</h2> - -<p>The Scagen class main method will take in an input and -output directory name. The input directory is taken to be the SCA composite root -directory. The tool will generate the wrapper and proxy headers and methods -bodies in the output directory. </p> - -<p>These proxies and wrappers enable the SCA for C++ runtime to -act as a conduit for SCA C++ calls in a type free manner. Client code can call -the type specific functions that are in the generated proxy classes. The call -is marshalled into a generic format and a SCA for C++ runtime function with a -standard signature is invoked. The details of the call are passed as data. </p> - -<p>On the other end of the runtime, a generated function with a -standard signature is called, this function will inspect the data that -represents the call’s method name and call the appropriate type specific -function in the C++ implementation. </p> - -<h2>The Input Data Used</h2> - -<p>The input directory passed to the Scagen method is taken to -be the SCA composite root directory. All the sca.composite and .fragment files in -that directory are inspected to resolve all the <component/> elements -within them. </p> - -<p>Each <component/> element found is inspected to see if -it has a <implementation.cpp/> element within it. </p> - -<p>Each <implementation.cpp/> element should have a -header attribute that represents a C++ header file that contains function -prototypes for the C++ implementation of the service. An optional class -attribute can be used to select one class if more than one that is present in -the header file. The default class is the one with the same name as the header -file. The tool will verify that the implementation header contains an -appropriate class prototype. </p> - - - -<p>The directory that contains the implementation header should -also contain a matching .componentType file for the equivalent SCA component. So -for example, a MyServiceImpl.h file would have a corresponding MyServiceImpl.componentType -file in the same directory. </p> - - - -<p>Each componentType file is inspected for <service/> -and <reference/> elements. For each <service/> element that is -found that contains a <interface.cpp/> element within it,</p> - -<p>the header attribute of the <interface.cpp/> is taken -as the filename of the C++ interface header for the SCA service. This C++ -header file is opened and used as a means for specifying the SCA service -resulting in an appropriate wrapper and proxy being generated for this service -interface. Both method bodies and headers are generated in the given output -directory. The processing of a <reference/> element is the same except -that only a proxy header and implementation are generated. </p> - - - - - -<h2>Outline Design: How it Works</h2> - - - -<p>The basic approach is to scan in the XML files by first -creating a DOM document tree of them and then recursively rifling through the DOM -with some generic code in the XMLFileActorClass by default this processing will -build up a map which maps the XPath location of attributes to their values. -Additionally subclasses can add to a “handlers map” which maps from the name of -a particular element to an object that implements the DomNodeHandler interface. -If the XMLFileActor code comes across any element that has an equivalent handler -in the handler map the objects handleNode method will be called. </p> - -<p>Typically the DomNodeHandler’s handle node interface will -use XPath to pull out the parameters that it is interested in from the -parameters map that is being built up by the generic code. </p> - -<p>This design was chosen as the Java level specified for the -original implementation did not have direct XPath query of XML data but it was -known that this would be available in Java 1.5 onwards. The design allows the -DOM and parameters map handling to be replaced in the future with JRE 1.5 code -with less impact on the rest of the code.</p> - - - -<p>The processing leads to the parsing of the C++ interface -files using the org\apache\tuscany\sca\cpp\tools\common package. This results -in a Headers object</p> - -<p>that contains a List of Signature objects, each one -representing a function prototype found in the header. </p> - - - -<p>We are aiming to get all the semantic data we want to use -into a DOM document (this represents the model of our input data) and then use -XSLT to create the 4 different views of this data:</p> - -<p>Proxy C++ header</p> - -<p>Proxy C++ body</p> - -<p>Wrapper C++ header</p> - -<p>Wrapper C++ body</p> - - - -<p>So we prepopulate the DOM with parameter data that comes -from the XML files and then iterate through the Signatures that are returned -from the C++ header parser transferring the useful data into the DOM. </p> - - - -<p>We than use 4 XSLT stylesheets to generate the C++ output -files as required. </p> - -</div> - -</body> - -</html> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl deleted file mode 100644 index 3d9dafa103..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl +++ /dev/null @@ -1,278 +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. ---> -<!-- - - TODO There is duplication in the "..no_parms" templates with - the equivalent templates they are based on - that it would be - fairly easy to factor out. ---> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages - - This stylesheet creates the CPP implementation of the - proxy body for a given SCA service - --> -<xsl:output method="text"/> - -<!-- We do not generate output sourced from cppScopes --> -<xsl:template match="cppScope"></xsl:template> - -<!-- We do not generate output sourced from private scaOperations --> -<xsl:template match="scaOperation[@cppScope='private']"> -</xsl:template> - -<!-- We do not generate output sourced from the operation return types --> -<xsl:template match="scaOperationReturnType"> -</xsl:template> - - -<!-- - CPP Header/Root ---> -<xsl:template match="cppHeader">/* - * 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. - */ - -<xsl:apply-templates select="scaService" mode="include_header"/> - -#include "osoa/sca/sca.h" -<xsl:apply-templates/> <!-- should go on to generic scaService below --> -</xsl:template> - -<!-- --> -<!-- Service --> -<!-- --> -<xsl:template match="scaService"> -<xsl:variable name="clazz"> - <xsl:value-of select="../@implClass"/> - <xsl:text>_</xsl:text> - <xsl:value-of select="../@nameOfSorR"/> - <xsl:text>_Proxy</xsl:text> -</xsl:variable> -<xsl:text> -extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - </xsl:text><xsl:value-of select="$clazz"/> -<xsl:text>* </xsl:text> -<xsl:value-of select="$clazz"/> -<xsl:text>_Factory(tuscany::sca::ServiceWrapper* target) - { - return new </xsl:text><xsl:value-of select="$clazz"/><xsl:text>(target); - } - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - void </xsl:text> -<xsl:value-of select="$clazz"/> -<xsl:text>_Destructor(void* proxy) - { - delete (</xsl:text><xsl:value-of select="$clazz"/><xsl:text>*)proxy; - } -} - -</xsl:text> -<xsl:value-of select="$clazz"/><xsl:text>::</xsl:text><xsl:value-of select="$clazz"/>(tuscany::sca::ServiceWrapper* targ) : target(targ) -{ -} - -<xsl:value-of select="$clazz"/><xsl:text>::~</xsl:text><xsl:value-of select="$clazz"/>() -{ - if (target) - delete target; -}<!-- -OK we have done the stuff that is not specific to any function in the service -now we can do another apply-templates to pick up on the 0, 1 or more scaOperation -DOM nodes that each relate to a function in the service - --> -<xsl:apply-templates/> -<!-- Always make sure we have a (visible) final newline --> -<xsl:text> - -</xsl:text> -</xsl:template> - -<!-- This template is just a small function that will generate the - #include that pulls in the correct C++ header - --> -<xsl:template match="scaService" mode="include_header"> -<xsl:variable name="clazz"> - <xsl:value-of select="../@implClass"/> - <xsl:text>_</xsl:text> - <xsl:value-of select="../@nameOfSorR"/> - <xsl:text>_Proxy</xsl:text> -</xsl:variable> -<xsl:text>#include "</xsl:text> -<xsl:value-of select="$clazz"/> -<xsl:text>.h"</xsl:text> -</xsl:template> - - - -<!-- --> -<!-- Operation --> -<!-- --> -<xsl:template match="scaOperation"> -<xsl:variable name="clazz"> - <xsl:value-of select="../../@implClass"/> - <xsl:text>_</xsl:text> - <xsl:value-of select="../../@nameOfSorR"/> - <xsl:text>_Proxy</xsl:text> -</xsl:variable> - -<!-- ignore the constructor and destructor --> -<xsl:if test="@operationNameAttr != $clazz - and @operationNameAttr != concat('~', $clazz)" > -<xsl:text> -</xsl:text> -<xsl:value-of select="scaOperationReturnType"/> -<xsl:text> </xsl:text> -<xsl:value-of select="$clazz"/><xsl:text>::</xsl:text> -<xsl:value-of select="@operationNameAttr"/><xsl:text>(</xsl:text> -<xsl:for-each select="scaOperationParameter"> -<xsl:if test=".!='void'"> - <xsl:variable name="scaOperationParameterNameAttr"> - <xsl:value-of select="concat('arg', position()-1 )"/> - </xsl:variable> - <xsl:variable name="isConst"> - <xsl:value-of select="@scaOperationParameterConstAttr"/> - </xsl:variable> - <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text> - <xsl:value-of select="."/> <!-- get the actual type --> - <xsl:text> </xsl:text> - <xsl:value-of select="$scaOperationParameterNameAttr"/> - <xsl:choose> - <xsl:when test="position()=last()"> - </xsl:when> - <xsl:otherwise> - <xsl:text>, </xsl:text> - </xsl:otherwise> - </xsl:choose> -</xsl:if> <!-- test=".!='void'" --> - -</xsl:for-each> -<xsl:text>) -{</xsl:text> -<xsl:call-template name="proxy_method_body"/> -<xsl:text> -} -</xsl:text> -</xsl:if> -</xsl:template> - - -<xsl:template name="proxy_method_body"> - <xsl:variable name="noOfParms"> - <xsl:choose> - <xsl:when test=".='void'"> -<xsl:text>0</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="last()"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> -<xsl:text> - tuscany::sca::Operation operation("</xsl:text> - <xsl:value-of select="@operationNameAttr"/> - <xsl:text>");</xsl:text> - <xsl:if test="$noOfParms!=0"> - <xsl:for-each select="scaOperationParameter"> - <xsl:call-template name="proxy_method_body_set_parameter"/> - </xsl:for-each> - </xsl:if> - <xsl:call-template name="proxy_method_body_prepare_return_var"/> - <xsl:text> - target->invoke(operation);</xsl:text> - <xsl:call-template name="proxy_method_body_return"/> -</xsl:template> - - -<xsl:template name="proxy_method_body_return"> - <xsl:variable name="type"> - <xsl:value-of select="scaOperationReturnType/text()"/> - </xsl:variable> - <xsl:choose> - <xsl:when test="$type='void'"><!-- nothing --> - <xsl:text> - return;</xsl:text> - </xsl:when> - <xsl:when test="contains($type, '&')"><!-- reference --> - <xsl:variable name="type_no_amp"> - <xsl:value-of select="substring-before($type, '&')"/> - </xsl:variable> - <xsl:text> - return *(</xsl:text><xsl:value-of select="$type_no_amp"/><xsl:text>*)operation.getReturnValue();</xsl:text> - </xsl:when> - <xsl:otherwise><!-- simple type --> - <xsl:text> - return *(</xsl:text><xsl:value-of select="$type"/><xsl:text>*)operation.getReturnValue();</xsl:text> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -<xsl:template name="proxy_method_body_prepare_return_var"> - <xsl:variable name="type"> - <xsl:value-of select="scaOperationReturnType/text()"/> - </xsl:variable> - <xsl:choose> - <xsl:when test="$type='void'"><!-- nothing --> - <!-- nothing --> - </xsl:when> - <xsl:when test="contains($type, '&')"><!-- reference --> - </xsl:when> - <xsl:otherwise> -<xsl:text> - </xsl:text> <xsl:value-of select="$type"/><xsl:text> ret; - operation.setReturnValue(&ret);</xsl:text> - </xsl:otherwise> - </xsl:choose> - -</xsl:template> - - -<xsl:template name="proxy_method_body_set_parameter"> - <xsl:variable name="scaOperationParameterNameAttrInner"> - <xsl:value-of select="concat('arg', position()-1 )"/> - </xsl:variable> - <xsl:variable name="type"> - <xsl:value-of select="."/> - </xsl:variable> - operation.addParameter("<xsl:value-of select="@scaOperationParameterNameAttr"/>", &<xsl:value-of select="$scaOperationParameterNameAttrInner"/><xsl:text>);</xsl:text> -</xsl:template> -</xsl:stylesheet> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl deleted file mode 100644 index 2f5edb3a93..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl +++ /dev/null @@ -1,228 +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. ---> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages - - - - This stylesheet creates the CPP implementation of the - - proxy header for a given SCA service - --> - - <xsl:output method="text" /> - - <!-- Delete cppScopes --> - <xsl:template match="cppScope"></xsl:template> - - <!-- Delete private methods cppScopes --> - <xsl:template match="scaOperation[@cppScope='private']"> - </xsl:template> - - <!-- Delete private methods cppScopes --> - <xsl:template match="scaOperationReturnType"></xsl:template> - - - <!-- --> - <!-- CPP Header/Root --> - <!-- --> - <xsl:template match="cppHeader"> - <xsl:variable name="class"> - <xsl:value-of select="concat(@implClass, '_', @nameOfSorR, '_Proxy')"/> - </xsl:variable> -<xsl:text>/* - * 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. - */ - -</xsl:text> - <xsl:call-template name="ifndef_start"> - <xsl:with-param name="class" - select="$class"/> - </xsl:call-template> - - - <xsl:call-template name="include_headers"> - <xsl:with-param name="componentTypeHeader" - select="@componentTypeHeader"/> - </xsl:call-template> - - <xsl:apply-templates select="scaService" mode="class_body"/> - - <xsl:call-template name="ifndef_end"> - <xsl:with-param name="class" - select="$class"/> - </xsl:call-template> -<!-- Always make sure we have a (visible) final newline --> -<xsl:text> - -</xsl:text> -</xsl:template> - - -<!-- Here are the subroutine templates in order --> - - <xsl:template name="ifndef_start"> - <!--For example, - #ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h - #define CustomerInfoImpl_CustomerInfoService_Proxy_h - --> - <xsl:param name="class"/> - <xsl:text>#ifndef </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> -<!-- newline --> -<xsl:text> -</xsl:text> - <xsl:text>#define </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> -<!-- newline --> -<xsl:text> - -</xsl:text> - <xsl:text>#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif </xsl:text> -<!-- newline --> -<xsl:text> - -</xsl:text> - </xsl:template> - - <xsl:template name="include_headers"> - <!--For example, - #include "CustomerInfo.h" - #include "tuscany/sca/core/ServiceWrapper.h" - --> - <xsl:param name="componentTypeHeader"/> - <xsl:text>#include "</xsl:text><xsl:value-of select="translate($componentTypeHeader,'\','/')"/><xsl:text>"</xsl:text> -<!-- newline --> -<xsl:text> -</xsl:text> - <xsl:text>#include "tuscany/sca/core/ServiceWrapper.h"</xsl:text> - </xsl:template> - - <xsl:template match="scaService" mode="class_body"> - <!--For example - class proxyclassname : public interface_class - { - constructor - destructor - then apply operation templates for operations - }; - - E.g. Specifically - - class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo - { - public: - CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*); - virtual ~CustomerInfoImpl_CustomerInfoService_Proxy(); - virtual const char* getCustomerInformation(const char* customerID); - private: - tuscany::sca::ServiceWrapper* target; - }; - --> - <!-- TODO second definition, remove? --> - <xsl:variable name="class"> - <xsl:value-of select="concat(../@implClass, '_', ../@nameOfSorR, '_Proxy')"/> - </xsl:variable> -<xsl:text> - -class </xsl:text> -<xsl:value-of select="$class"/> -<xsl:text> : public </xsl:text><xsl:value-of select="../@intfClass"/> -<xsl:text> -{ -public: - </xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::ServiceWrapper*);</xsl:text> - <xsl:text> - virtual ~</xsl:text><xsl:value-of select="$class"/><xsl:text>(); -</xsl:text> - <!-- operations --> - <xsl:apply-templates/> -<xsl:text>private: - tuscany::sca::ServiceWrapper* target; -}; -</xsl:text> - </xsl:template> - - <xsl:template name="ifndef_end"> - <!--For example, - #endif // CustomerInfoImpl_CustomerInfoService_Proxy_h - --> - <xsl:param name="class"/> - <xsl:text> -#endif // </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> - </xsl:template> - - - - - - -<!-- Operation --> -<!--For example - virtual const char* getCustomerInformation(const char* customerID); ---> -<xsl:template match="scaOperation"> -<xsl:variable name="class"> - <xsl:value-of select="concat(../../@implClass, '_', ../../@nameOfSorR, '_Proxy')"/> -</xsl:variable> -<xsl:if test="@operationNameAttr != $class - and @operationNameAttr != concat('~', $class)" > -<xsl:text> virtual </xsl:text> -<xsl:value-of select="scaOperationReturnType"/> -<xsl:text> </xsl:text> -<xsl:value-of select="@operationNameAttr"/><xsl:text>(</xsl:text> -<xsl:for-each select="scaOperationParameter"> - <xsl:variable name="isConst"> - <xsl:value-of select="@scaOperationParameterConstAttr"/> - </xsl:variable> - <xsl:variable name="noOfParms"> - <xsl:value-of select="last()"/> - </xsl:variable> - <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text> - <xsl:value-of select="."/> <!-- get the actual type --> - <xsl:text> </xsl:text> - <xsl:value-of select="@scaOperationParameterNameAttr"/> - <xsl:choose> - <xsl:when test="position()=last()"></xsl:when> - <xsl:otherwise> - <xsl:text>, </xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:for-each> -<xsl:text>); -</xsl:text> -</xsl:if> -</xsl:template> -</xsl:stylesheet> - - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl deleted file mode 100644 index f983917e36..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl +++ /dev/null @@ -1,290 +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. ---> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages - - - - This stylesheet creates the CPP implementation of the - - wrapper body for a given SCA service - --> -<xsl:output method="text"/> - -<!-- Delete cppScopes --> -<xsl:template match="cppScope"></xsl:template> - -<!-- Delete private methods cppScopes --> -<xsl:template match="scaOperation[@cppScope='private']"> -</xsl:template> - -<!-- Don't act on return types --> -<xsl:template match="scaOperationReturnType"> -</xsl:template> - - -<!-- --> -<!-- CPP Header/Root --> -<!-- --> -<xsl:template match="cppHeader">/* - * 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. - */ - -<xsl:apply-templates select="scaService" mode="include_header"/> - -#include "osoa/sca/sca.h" - -<xsl:if test="not(@implNamespace = '')">using <xsl:value-of select="@implNamespace"/><xsl:value-of select="@implClass"/>;</xsl:if> -<xsl:text><!-- newline --> - -</xsl:text> -<!-- thats the prologue over and done with - now continue with the scaServiceElement --> -<xsl:apply-templates/> <!-- will be applied to scaService --> -<!-- Always make sure we have a final newline --> -<xsl:text> - -</xsl:text> -</xsl:template> - -<!-- --> -<!-- Service --> -<!-- --> -<xsl:template match="scaService"> -<xsl:variable name="class"> - <xsl:value-of select="../@implClass"/> - <xsl:text>_</xsl:text> - <xsl:value-of select="../@serviceName"/> - <xsl:text>_Wrapper</xsl:text> -</xsl:variable> -<xsl:text>extern "C" -{ - - #if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) - #endif - </xsl:text><xsl:value-of select="$class"/> -<xsl:text>* </xsl:text> -<xsl:value-of select="$class"/> -<xsl:text>_Factory(tuscany::sca::model::Service* target) - { - return new </xsl:text><xsl:value-of select="$class"/><xsl:text>(target); - } -} - -</xsl:text> -<xsl:value-of select="$class"/><xsl:text>::</xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) -{ - impl = (</xsl:text><xsl:value-of select="../@implClass"/><xsl:text>*)getImplementation(); -} - -</xsl:text> -<xsl:value-of select="$class"/><xsl:text>::~</xsl:text><xsl:value-of select="$class"/><xsl:text>() -{ - releaseImplementation(); -} - -void* </xsl:text> -<xsl:value-of select="$class"/><xsl:text>::newImplementation() -{ - return new </xsl:text><xsl:value-of select="../@implClass"/><xsl:text>; -} - -void </xsl:text> -<xsl:value-of select="$class"/><xsl:text>::deleteImplementation() -{ - delete impl; -} - -void </xsl:text><xsl:value-of select="$class"/><xsl:text>::invokeService(tuscany::sca::Operation& operation) -{ - const std::string& operationName = operation.getName(); - -</xsl:text> -<xsl:apply-templates/><!-- an if statment for each operation --> -<xsl:text> - - throw osoa::sca::ServiceRuntimeException("Invalid operation"); - -}</xsl:text> -</xsl:template> - -<xsl:template match="scaService" mode="include_header"> -<xsl:variable name="class"> - <xsl:value-of select="../@implClass"/> - <xsl:text>_</xsl:text> - <xsl:value-of select="../@serviceName"/> - <xsl:text>_Wrapper</xsl:text> -</xsl:variable> -<xsl:text>#include "</xsl:text> -<xsl:value-of select="$class"/> -<xsl:text>.h"</xsl:text> -</xsl:template> - -<!-- --> -<!-- Operation --> -<!-- --> -<xsl:template match="scaOperation"> -<!--For example - if (operationName == "getCustomerInformation") - { - operation.setReturnValue(impl->getCustomerInformation((const char*)parms[0])); - return; - } ---> -<xsl:if test="@operationNameAttr != ../../@intfClass - and @operationNameAttr != concat('~', ../../@intfClass)" > -<xsl:text> if (operationName == "</xsl:text> -<xsl:value-of select="@operationNameAttr"/> -<xsl:text>") - { -</xsl:text> - <xsl:call-template name="this_operation_body"/> -<xsl:text> - } -</xsl:text> - -</xsl:if> -</xsl:template> - -<xsl:template name="this_operation_body"> -<xsl:if test="./scaOperationParameter/text() != 'void' "> - <xsl:if test="normalize-space(./scaOperationParameter/text()) != ' ' "> - <xsl:if test="./scaOperationParameter/text() != '' "> - <xsl:for-each select="scaOperationParameter"> - <xsl:call-template name="prepare_parameter_n"/> - </xsl:for-each> - </xsl:if> - </xsl:if> -</xsl:if> -<xsl:call-template name="invoke_for_return_type"/> -<xsl:text> - return;</xsl:text> -</xsl:template> - -<xsl:template name="prepare_parameter_n"> - <xsl:variable name="isConst"> - <xsl:value-of select="@scaOperationParameterConstAttr"/> - </xsl:variable> - <xsl:variable name="type"> - <xsl:value-of select="."/> - </xsl:variable> -<xsl:text> </xsl:text> - <xsl:choose> - <xsl:when test="contains($type, '&')"><!-- reference --> - <xsl:variable name="type_no_amp"> - <xsl:value-of select="substring-before($type, '&')"/> - </xsl:variable> - <xsl:value-of select="$type"/><xsl:text> p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text><xsl:value-of select="$type_no_amp"/> - <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>); -</xsl:text> - </xsl:when> - <xsl:when test="contains($type, '*')"><!-- pointer --> - <xsl:if test="contains($isConst,'true')">const </xsl:if> - <xsl:value-of select="."/><xsl:text> p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text> - <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text> - <xsl:value-of select="$type"/> - <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>); -</xsl:text> - </xsl:when> - <xsl:when test="contains($type, 'DataObjectPtr')"><!-- DataObjectPtr --> - <xsl:text>commonj::sdo::DataObjectPtr& p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(commonj::sdo::DataObjectPtr*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>);</xsl:text> - </xsl:when> - <xsl:otherwise><!-- simple type --> - <xsl:if test="contains($isConst,'true')">const </xsl:if><xsl:value-of select="$type"/><xsl:text>& p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text> - <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text> - <xsl:value-of select="$type"/> - <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>); -</xsl:text> - - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -<xsl:template name="invoke_for_return_type"> - <xsl:variable name="type"> - <xsl:value-of select="./scaOperationReturnType/text()"/> - </xsl:variable> - <xsl:choose> - <!-- VOID --> - <xsl:when test="$type='void'"> -<xsl:text> </xsl:text> - <xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;</xsl:text> - </xsl:when> - <xsl:when test="contains($type, '&')"><!-- reference --> - <xsl:text> </xsl:text><xsl:value-of select="$type"/><xsl:text> ret = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;</xsl:text> - <xsl:text> - operation.setReturnValue(&ret);</xsl:text> - </xsl:when> - <xsl:otherwise><!-- simple type --> - <xsl:text> - if(operation.getReturnValue() != NULL) - { - *(</xsl:text><xsl:value-of select="$type"/><xsl:text>*)operation.getReturnValue() = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>; - } - else - { - </xsl:text><xsl:value-of select="$type"/><xsl:text>* ret = new </xsl:text><xsl:value-of select="$type"/><xsl:text>; - *ret = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>; - operation.setReturnValue((const </xsl:text><xsl:value-of select="$type"/><xsl:text>*)ret); - }</xsl:text> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -<xsl:template name="impl_arrow_op_brackets_and_parms"><!-- context is "scaOperation" --> - <xsl:text>impl-></xsl:text><xsl:value-of select="./@operationNameAttr"/><xsl:text>(</xsl:text> -<xsl:if test="./scaOperationParameter/text() != 'void' "> - <xsl:if test="./scaOperationParameter/text() != '' "> - <xsl:if test="normalize-space(./scaOperationParameter/text()) != ' ' "> - <xsl:for-each select="scaOperationParameter"> - <xsl:call-template name="parameter_for_parameter_list"/> - </xsl:for-each> -</xsl:if> -</xsl:if> -</xsl:if> -<xsl:text>)</xsl:text> -</xsl:template> - -<xsl:template name="parameter_for_parameter_list"> -<xsl:text>p</xsl:text><xsl:value-of select="position()-1"/> - <xsl:choose> - <xsl:when test="position()=last()"></xsl:when> - <xsl:otherwise> - <xsl:text>, </xsl:text> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - - - -</xsl:stylesheet> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl deleted file mode 100644 index c8157fe2f6..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl +++ /dev/null @@ -1,191 +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. ---> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> -<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages - - - - This stylesheet creates the CPP implementation of the - - wrapper header for a given SCA service - --> - <xsl:output method="text" /> - - <!-- Delete cppScopes --> - <xsl:template match="cppScope"></xsl:template> - - <!-- Delete private methods cppScopes --> - <xsl:template match="scaOperation[@cppScope='private']"> - </xsl:template> - - <!-- Delete private methods cppScopes --> - <xsl:template match="scaOperationReturnType"></xsl:template> - - - <!-- --> - <!-- CPP Header/Root --> - <!-- --> - <xsl:template match="cppHeader"> - <xsl:variable name="class"> - <xsl:value-of select="concat(@implClass, '_', @serviceName, '_Wrapper')"/> - </xsl:variable> -<xsl:text>/* - * 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. - */ - -</xsl:text> - <xsl:call-template name="ifndef_start"> - <xsl:with-param name="class" - select="$class"/> - </xsl:call-template> - - - <xsl:call-template name="include_headers"> - <xsl:with-param name="header" - select="@compositeXmlFileHeader"/> - </xsl:call-template> - - <xsl:apply-templates select="scaService" mode="class_body"/> - - <xsl:call-template name="ifndef_end"> - <xsl:with-param name="class" - select="$class"/> - </xsl:call-template> -<!-- Always make sure we have a (visible) final return --> -<xsl:text> - -</xsl:text> -</xsl:template> - - -<!-- Here are the subroutine templates in order --> - - <xsl:template name="ifndef_start"> - <!--For example, - #ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h - #define CustomerInfoImpl_CustomerInfoService_Wrapper_h - --> - <xsl:param name="class"/> - <xsl:text>#ifndef </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> -<!-- newline --> -<xsl:text> -</xsl:text> - <xsl:text>#define </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> -<!-- newline --> -<xsl:text> - -</xsl:text> - <xsl:text>#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif </xsl:text> -<!-- newline --> -<xsl:text> - -</xsl:text> - </xsl:template> - - <xsl:template name="include_headers"> - <!--For example, - #include "CustomerInfoImpl.h" - #include "tuscany/sca/cpp/CPPServiceWrapper.h" - --> - <xsl:param name="header"/> - <xsl:text>#include "</xsl:text><xsl:value-of select="translate($header,'\','/')"/><xsl:text>"</xsl:text> -<!-- newline --> -<xsl:text> -</xsl:text> - <xsl:text>#include "tuscany/sca/cpp/CPPServiceWrapper.h"</xsl:text> - </xsl:template> - - <xsl:template match="scaService" mode="class_body"> - <!--For example - class wrapperclassname : public tuscany::sca::cpp::CPPServiceWrapper - { - constructor - destructor - then apply operation templates for operations - }; - - E.g. Specifically - - class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper - { - public: - CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Component*); - virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper(); - virtual void invoke(tuscany::sca::Operation& operation); - - private: - CustomerInfoImpl* impl; - }; - --> - <!-- TODO second definition, remove? --> - <xsl:variable name="class"> - <xsl:value-of select="concat(../@implClass, '_', ../@serviceName, '_Wrapper')"/> - </xsl:variable> -<xsl:text> - -class </xsl:text> -<xsl:value-of select="$class"/> -<xsl:text> : public tuscany::sca::cpp::CPPServiceWrapper -{ -public: - </xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::model::Service* target);</xsl:text> - <xsl:text> - virtual ~</xsl:text><xsl:value-of select="$class"/><xsl:text>(); - virtual void invokeService(tuscany::sca::Operation& operation); - virtual void* newImplementation(); - virtual void deleteImplementation(); -</xsl:text> -<xsl:text>private: - </xsl:text> - <xsl:value-of select="../@implNamespace"/><xsl:value-of select="../@implClass"/><xsl:text>* impl; -}; -</xsl:text> - </xsl:template> - - <xsl:template name="ifndef_end"> - <!--For example, - #endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h - --> - <xsl:param name="class"/> - <xsl:text> -#endif // </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text> - </xsl:template> - -<xsl:template match="scaOperation"> -</xsl:template> - -</xsl:stylesheet> - - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-implementation-cpp.xsd b/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-implementation-cpp.xsd deleted file mode 100644 index ac2004bd73..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-implementation-cpp.xsd +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"></include> - - <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation"/> - <complexType name="CPPImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="library" type="NCName" use="required"/> - <attribute name="path" type="NCName" use="optional"/> - <attribute name="header" type="NCName" use="required"/> - <attribute name="class" type="Name" use="optional"/> - <attribute name="scope" type="sca:CPPImplementationScope" use="optional" /> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - - <simpleType name="CPPImplementationScope"> - <restriction base="string"> - <enumeration value="stateless" /> - <enumeration value="composite" /> - </restriction> - </simpleType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd b/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd deleted file mode 100644 index a8493fe726..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/> - <complexType name="CPPInterface"> - <complexContent> - <extension base="sca:Interface"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="header" type="NCName" use="required" /> - <attribute name="class" type="Name" use="optional" /> - <attribute name="callbackHeader" type="NCName" use="optional" /> - <attribute name="callbackClass" type="Name" use="optional" /> - <attribute name="remotable" type="boolean" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/AUTHORS b/sca-cpp/trunk/contrib/runtime/extensions/php/AUTHORS deleted file mode 100644 index e69de29bb2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/AUTHORS +++ /dev/null diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/COPYING b/sca-cpp/trunk/contrib/runtime/extensions/php/COPYING deleted file mode 100755 index 6b0b1270ff..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/COPYING +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/ChangeLog b/sca-cpp/trunk/contrib/runtime/extensions/php/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/ChangeLog +++ /dev/null diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/INSTALL b/sca-cpp/trunk/contrib/runtime/extensions/php/INSTALL deleted file mode 100644 index 059a43057b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/INSTALL +++ /dev/null @@ -1,2 +0,0 @@ -Please read the GettingStarted.html document for information on -building and installing Tuscany SCA Native PHP extemstion diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/LICENSE b/sca-cpp/trunk/contrib/runtime/extensions/php/LICENSE deleted file mode 100755 index f433b1a53f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/Makefile.am deleted file mode 100644 index fb661fec63..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/Makefile.am +++ /dev/null @@ -1,24 +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. - -SUBDIRS = src samples - -datadir=$(prefix) - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/NEWS b/sca-cpp/trunk/contrib/runtime/extensions/php/NEWS deleted file mode 100644 index e69de29bb2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/NEWS +++ /dev/null diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/NOTICE b/sca-cpp/trunk/contrib/runtime/extensions/php/NOTICE deleted file mode 100644 index b240b0a121..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Tuscany SCA Native -Copyright 2005, 2007 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/)
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/README b/sca-cpp/trunk/contrib/runtime/extensions/php/README deleted file mode 100644 index ad96622516..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/README +++ /dev/null @@ -1,276 +0,0 @@ -PHP Extension for C++ SCA README -================================ - -Overview --------- - -The PHP extension for C++ SCA allows PHP scripts to be used to implement SCA components. -This is achieved by using the C++ SCA extension API to drive script execution through the -PHP embedding SAPI. In its current incarnation the PHP Extension requires that a full SCDL -description is provided for each PHP component, i.e. we are not yet making use of the meta data -provided by the annotations that can appear in PHP SCA components. - -There are various styles of PHP script that are supported. The examples here are taken from -the PHPCalculator sample and if you look at the SCDL files provided with the sample you can -see the component type and composite files that tie these components into the working system - -SCA Service ------------ - -/** - * @service - * @binding.ws - */ -class Divide { - - /** - * @reference - * @binding.tuscany cppDivideService - */ - public $another_divide; - - /** - * Division - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function div($num1, $num2) { - return $this->another_divide->div($num1, $num2); - } - -} - -PHP Class ---------- - -class Multiply { - function mul($num1, $num2) { - $result = $num1 * $num2; - - $log_proxy = SCA::getService("log_service"); - $log_proxy->log_message($result); - - return $result; - } -} - -PHP Function ------------- - -function sub($num1, $num2){ - $result = $num1 - $num2; - - $log_proxy = SCA::getService("log_service"); - $log_proxy->log_message($result); - - return $result; -} - -PHP Script ----------- - -$num1 = $_REQUEST[0]; -$num2 = $_REQUEST[1]; - -$result = $num1 + $num2; - -$log_proxy = SCA::getService("log_service"); -$log_proxy->log_message($result); - -echo $result; - -TODO ----- -* I struggled for a long time with a missing symbol problem loading sdo.so at runtime on linux. - I got round this by creating a standalone Makefile for the CalculatorClient exe. All the - shared objects that are loaded are compiled with the normal automake toolchain still but this - solves the problem. I need to investigate in detail what's going on here. Having someone - else try building with the full automake configuration would be insteresting -* The problem from above does appear when running SCA behind axis hence I am unable to test with - remote clients -* The SCA_SDO build generates sdo.so and the Tuscany PHP Extension tries to load libsdo.so. - One side needs fixing. For now I just copy the library -* SDO passing in and out of components is coded but not tested -* Returning values from plain PHP scripts (scripts without classes and functions) is not - operating correctly -* Error handling needs looking at. Many situations are not trapped and those - that are may not be reported correctly -* Reorganize the extension code so that Tuscany SCA can be loaded by PHP running in Apache - and accessed through SCA references. This will play the same role as SCA running hosted - in Axis2C and will open up the service bindings implemented in PHP SCA_SDO. -* Implement meta data exchange between the PHP SCA implementation and the Tuscany C++ SCA - implementations so that selected parts of the SCDL definition can be omitted. -* There is a threading issue with the way that we are firing up the PHP embedding SAPI - TSRM should solve it fails on the embedding initialization for some reason. - -Dependencies ------------- -PHP5.2.0 source code - - (http://php.net/) - The binary release of PHP doesn't ship with the header files required to build - against the PHP embedding SAPI and runtime libraries. So go get the PHP source - code and build PHP. PHP will need to be configured correctly in order to - work properly when embedded in C++ SCA. Here are some sample configuration - statements but they will need to be tailored for you specific environment: - - Winodws - ------- - cscript configure.js --with-extra-includes=win32build\include; - libxml2-2.6.26.threads\include; - iconv-1.9.1.win32\include; - libcurl-7.15.4-nossl\include - --with-extra-libs=win32build\lib; - libxml2-2.6.26.threads\lib; - iconv-1.9.1.win32\lib; - libcurl-7.15.4-nossl\lib - --enable-debug - --enable-soap - --enable-apache2handler=shared - --enable-embed - --with-curl=C:\simon\apps\libcurl-7.15.4-nossl - - Note. This configure line is artificially broken across sever lines to aid - readability here. You will need to join it all back together on one line to - run it. - - Linux - ----- - ./configure --enable-debug \ - --enable-soap \ - --enable-fastcgi \ - --with-zlib \ - --enable-embed \ - --with-tsrm-pthreads \ - --enable-maintainer-zts - Note. debug, pthreads, maintainer-zts, fastcgi are not absolute requirements but just - represent the environment I was testing with when I wrote this. - -SCA_SDO PECL extension AVOCET branch source code - (http://pecl.php.net/package/SCA_SDO) - Provides the SCA framework for PHP and the necessary mediation code to translate - between Tuscany SCA and PHP SCA. Go get the AVOCET branch from PECL cvs - - export CVSROOT=:pserver:cvsread@cvs.php.net/repository - cvs export -r AVOCET pecl/sdo - - The process to build this code varies quite considerably between windows and Linux. - Take a look at the instructions in the SCA_SDO manual, follow the documentation link - from the projects PECL page (http://uk2.php.net/sdo/). - - Once built you will need to copy the library sdo.so to - libsdo.so so that the Tuscany PHPExtension can load it given the makefile - configuration as it stands. For example, on linux - - ln -s sdo.so libsdo.so - - -Building on windows -------------------- - -The Visual C++ Express solution provided with C++ SCA includes a project -to build the PHP extension. This project relies on being able to access the -PHP include files from the source code directory and the PHP lib files from the -binary install. Make sure your environment is set as follows before you start -Visual C++ Express (if you do this after you start Visual C++ Express it will -not pick up the changes) - -PHP_HOME = the root directory of the PHP 5.2.0 source code install -PATH = ensure that the root directory of the PHP 5.2.0 binary install appears - -PHP_SCA_SDO_HOME = the directory in which the SCA_SDO pecl extension source is installed - -These changes come over and above the environment changes you need to make -to build the core C++ SCA software. I have the following set in my environment but -of course the details depend on where you have the various bits of software installed. - -AXIS2C_HOME=c:\axis2c-bin-0.96-win32 -LIBXML2_HOME=c:\libxml2-2.6.26.ein32 -ICONV_HOME=c:\iconv-1.9.2.win32 -ZLIB_HOME=c:\zlib-1.2.3.win32 -TUSCANY_SCACPP=c:\sca\deploy -TUSCANY_SDOCPP=c:\sdo\deploy - -Now compile the PHP extension. Compiling with VC++ Express requires some care - -1/ Ensure that the PHP include files are configured correctly for - compiling against C++ SCA in Visual C++ express - - See - http://bugs.php.net/bug.php?id=39130 - - Comment out two lines in $(PHP_HOME)/main/config.w32.h: - #define _USE_32BIT_TIME_T 1 - #define HAVE_STDLIB_H 1 - - -Building on Linux ------------------ - -The PHP extension comes with a set of automake files so that the PHP extension is built -at the same time as all of the other extensions assuming that appropriate environment -variables are set. The build.sh script that can be found under the top level sca directory -checks whether the PHP_LIB and PHP_INCLUDE variables are set and if so enables compilation -of the PHP extension automatically by adding --enable-php to the configure line. - -There are a number of environment variables that the build depends on. I find setting the -following variables useful. - -# the location of libxm2 -export LIBXML2_LIB=/usr/lib -export LIBXML2_INCLUDE=/usr/include/libxml2 - -# the location of PHP -export PHP_LIB=/usr/local/lib -export PHP_INCLUDE=/usr/local/include/php - -# the location of the PHP SCA_SDO extension source -# the lib location depends oh the configuration options used -# when building PHP so beware -export PHP_SCA_SDO_INCLUDE=where ever you install the SCA_SDO package source -export PHP_SCA_SDO_LIB=$PHP_LIB/php/extensions/no-debug-zts-20060613/ - -# the location of axis2 -export AXIS2C_HOME=/usr/local/axis2c-bin-0.96-linux - -# the install directories for the tuscany sca and sdo projects -export TUSCANY_SDOCPP=/usr/local/tuscany/cpp/sdo/deploy -export TUSCANY_SCACPP=/usr/local/tuscany/cpp/sca/deploy - -Once these are set running sca/build.sh should compile and install the PHP extension. - -Testing the PHP Extension -------------------------- - -In order to run the PHP extension successfully as an embedded component of the -C++ SCA runtime the PHP environment must be configured correctly. This configuration -is provided by the php.ini file. The location of this file depends on your installation -of PHP but by default is as follows. - -/usr/local/bin - PHP executables -/usr/local/lib/php.ini - the ini file that tell PHP where to look for scripts and - extension libraries -/usr/local/lib/php - PHP runtime installation, extension files and tests - -As is usually the case your milage may vary but wherever PHP is installed you will find -a similar set of directories. To force PHP to look in the correct place use the following -setting - -# tell PHP specifically where to find php.ini rather than relying on the default -set PHPRC=/usr/local/lib - -The php.ini file must be configured to load the SCA_SDO extension so you would expect to -see the following modifications to the file. - -; around line 528 you need to set the variable that tells PHP where to -; load extension libraries from. This varies depending on how PHP has been -; compiled and installed, for example, -extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/" - -; around line 512 you need to set the variable that tells PHP where to -; load included scripts from. There are windows and unix versions. Here -; is a Unix example -include_path=".:/usr/local/lib/php:/usr/local/lib/php/PEAR:/usr/local/tuscany/cppsca/samples/PHPCalculator/deploy/sample.calculator" - -; around line 673 you will find the end of the list of enabled extensions. We need to turn -; on SDO so add the following line. sdo.so should be found in "extension_dir". -extension=sdo.so - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/autogen.sh b/sca-cpp/trunk/contrib/runtime/extensions/php/autogen.sh deleted file mode 100755 index af38864985..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/autogen.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# 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. - -for i in "libtoolize --force" aclocal autoconf autoheader -do - echo -n "Running $i..." - $i || exit 1 - echo 'done.' -done - -echo -n 'Running automake...' -automake --add-missing -echo 'done.' -exit 0 - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/build.sh b/sca-cpp/trunk/contrib/runtime/extensions/php/build.sh deleted file mode 100755 index 41e96d0565..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/build.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -# 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. - -SCA_PHP_EXTENSION_HOME=`pwd` - -if [ x$TUSCANY_SCACPP = x ]; then -echo "TUSCANY_SCACPP not set" -exit; -fi - -echo "Using SCA installed at $TUSCANY_SCACPP" - -if [ x$PHP_LIB = x ]; then -echo "PHP_LIB not set." -exit; -elif [ x$PHP_INCLUDE = x ]; then -echo "PHP_INCLUDE not set." -exit; -elif [ x$PHP_SCA_SDO_INCLUDE = x ]; then -echo "PHP_SCA_SDO_INCLUDE not set." -exit; -elif [ x$PHP_SCA_SDO_LIB = x ]; then -echo "PHP_SCA_SDO_LIB not set." -exit; -fi -echo "Building PHP extension with PHP installed at $PHP_LIB, $PHP_INCLUDE" -echo "and PHP SCA and SDO installed at $PHP_SCA_SDO_LIB, $PHP_SCA_SDO_INCLUDE" - -#cd ${TUSCANY_SCACPP_HOME}/samples -#./autogen.sh - -cd ${SCA_PHP_EXTENSION_HOME} -./autogen.sh - - -./configure --prefix=${TUSCANY_SCACPP}/extensions/php -make -make install - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/configure.ac b/sca-cpp/trunk/contrib/runtime/extensions/php/configure.ac deleted file mode 100644 index d68d262b78..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/configure.ac +++ /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. - -dnl run autogen.sh to generate the configure script. - -AC_PREREQ(2.59) -AC_INIT(tuscany_sca_php, 1.0-incubator-M3) -AC_CANONICAL_SYSTEM -AM_CONFIG_HEADER(tuscany_sca_php_config.h) -AM_INIT_AUTOMAKE([tar-ustar]) -AC_PREFIX_DEFAULT(/usr/local/tuscany/sca/extensions/php) - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL - -# Check for running on Darwin -AC_MSG_CHECKING([Checking if running on Darwin]) -UNAME=`uname -s` -if test "x$UNAME" = "xDarwin"; then - AC_DEFINE([IS_DARWIN], [1], [Set to 1 when running on Darwin - Mac OSX]) - AC_MSG_RESULT(yes) - AC_SUBST([libsuffix],[".dylib"]) - is_darwin=true -else - AC_MSG_RESULT(no) - AC_SUBST([libsuffix],[".so"]) - is_darwin=false -fi -AM_CONDITIONAL([DARWIN], [test x$is_darmin = xtrue]) - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_CHECK_HEADERS([inttypes.h stdlib.h string.h sys/time.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_C_INLINE - -# Checks for library functions. -AC_FUNC_CLOSEDIR_VOID -AC_FUNC_STAT -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([getcwd putenv strdup]) -# AC_CONFIG_SUBDIRS([samples]) - - -AC_CONFIG_FILES([Makefile - src/Makefile - samples/Makefile - samples/PHPCalculator/Makefile - samples/PHPCalculator/sample.calculator/Makefile - samples/PHPCalculator/sample.calculator.client/Makefile - ]) -AC_OUTPUT - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/Makefile.am deleted file mode 100644 index 920828ef4f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = PHPCalculator
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am deleted file mode 100644 index fd34c6442a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am +++ /dev/null @@ -1,21 +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. - -deploydir=$(prefix)/samples/PHPCalculator/deploy -SUBDIRS = sample.calculator sample.calculator.client -EXTRA_DIST = *.composite -deploy_DATA = *.composite diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/README b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/README deleted file mode 100644 index dbee1f5f85..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/README +++ /dev/null @@ -1,32 +0,0 @@ -Tuscany SCA for C++ Samples - PHP Calculator Sample -=================================================== - -This is a simple sample to show how an SCA composite can wire together -a number of components to implement a Calculator service and expose that service as -to a number of different tpyes of client. The sample components are implemented in various -ways to demonstrate the different features of the PHP SCA extension. - -There are two sub projects in this workspace: - - sample.calculator - This contains the source code and SCDL artifacts for the SCA Calculator - composite implementing the sample Calculator - - - sample.calculator.client - A sample client which does a local call to the Calculator service - -A Python client is used because the work to enable PHP to host SCA is not done yet - -Windows -======= -tba - -Linux -===== - -The make install will deploy this under $TUSCANY_SCACPP/extensions/php/samples - -To run the sample - -cd $TUSCANY_SCACPP/extensions/php/samples/PHPCalculator/deploy/sample.calculator.client -./runclient.sh - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite deleted file mode 100644 index ada4d89a1c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - name="sample.calculator.app"> - - <component name="sample.calculator.CalculatorComponent"> - <implementation.composite name="sample.calculator" /> - </component> - -</composite> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am deleted file mode 100644 index 548f9bdcb8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am +++ /dev/null @@ -1,24 +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. - -deploydir=$(prefix)/samples/PHPCalculator/deploy -clientdir=$(deploydir)/sample.calculator.client - -client_DATA = *.py -client_SCRIPTS = runclient.sh -EXTRA_DIST = *.py *.php runclient.sh - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py deleted file mode 100644 index d4b37ee2b2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py +++ /dev/null @@ -1,50 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -# -# -# This Python code is a simple sample that provides a Python -# client for the Calculator sample - - -import sys -import sca - -op = sys.argv[1] -val1 = sys.argv[2] -val2 = sys.argv[3] - -# Locate the calculator service -calc = sca.locateservice("CalculatorComponent/CalculatorService") - -# Invoke the calculator operations -if op == 'add': - result = calc.add(val1, val2) - -elif op == 'sub': - result = calc.sub(val1, val2) - -elif op == 'mul': - result = calc.mul(val1, val2) - -elif op == 'div': - result = calc.div(val1, val2) - - -print "calculator_client: ",op,"(",val1,",",val2,") = ",result - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh deleted file mode 100755 index 54ebfdbde4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -# 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. - -APFULLDIR=`pwd` - -if [ x$TUSCANY_SCACPP = x ]; then -echo "TUSCANY_SCACPP not set" -exit; -fi -echo "Using SCA installed at $TUSCANY_SCACPP" - -if [ x$TUSCANY_SDOCPP = x ]; then -echo "TUSCANY_SDOCPP not set" -exit; -fi -echo "Using SDO installed at $TUSCANY_SDOCPP" - -if [ x$PYTHON_LIB != x ]; then -echo "Using Python library installed at $PYTHON_LIB" -export LD_LIBRARY_PATH=$PYTHON_LIB:$LD_LIBRARY_PATH -export PATH=$PYTHON_LIB/../bin:$PATH -fi - -export LD_LIBRARY_PATH=$PHP_SCA_SDO_LIB:$TUSCANY_SCACPP/lib:$TUSCANY_SCACPP/extensions/python/lib:$TUSCANY_SDOCPP/lib:$LD_LIBRARY_PATH -export PYTHONPATH=$TUSCANY_SCACPP/extensions/python/lib:$PYTHONPATH - -export TUSCANY_SCACPP_ROOT=$APFULLDIR/../ -export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent -export TUSCANY_SCACPP_BASE_URI=http://localhost:9090 - -cd $TUSCANY_SCACPP_ROOT/sample.calculator.client -python calculator_client.py mul 7 6 diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType deleted file mode 100644 index 5a6c3a199e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> - - <service name="CalculatorService"> - <interface.php/> - </service> - - <reference name="div_service"> - <interface.php/> - </reference> - -</componentType> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php deleted file mode 100644 index f0f35bab56..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -# 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. -# -# -include 'SCA/SCA.php'; - -/** - * @service - * @binding.ws - */ -class Calculator { - - - /** - * @reference - * @binding.php Multiply.php - */ - public $mul_service; - - /** - * @reference - * @binding.tuscany div_service - */ - public $div_service; - - /** - * Addition - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function add($num1, $num2) { - printf("in Calculator::add"); - return $num1 + $num2; -// return $this->add_service->add($num1, $num2); - } - - /** - * Subtraction - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function sub($num1, $num2) { - return $num1 - $num2; -// return $this->sub_service->sub($num1, $num2); - } - - /** - * Multiplication - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function mul($num1, $num2) { - return $this->mul_service->mul($num1, $num2); - } - - /** - * Division - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function div($num1, $num2) { - return $this->div_service->div($num1, $num2); - } -} - -?> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType deleted file mode 100644 index b50b20d9c6..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> - <service name="DivideService"> - <interface.php/> - </service> - - <reference name="log_service"> - <interface.php/> - </reference> -</componentType> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php deleted file mode 100644 index 5a08e5b063..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -# 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. -# -# - -/** - * @service - * @binding.php - */ -class Divide { - - /** - * Division - * - * @param float $num1 (the first number) - * @param float $num2 (the second number) - * @return float The result - */ - function div($num1, $num2) { - - $result = $num1 / $num2; - - $log_proxy = SCA::getService("log_service"); - $log_proxy->log_message($result); - - return $result; - - } - -} - -?> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType deleted file mode 100644 index f945c6af8c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> - <service name="LogService"> - <interface.php/> - </service> -</componentType> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php deleted file mode 100644 index 0a955f36d3..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -# 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. -# -# - -/** - * @service - */ -class Log { - - /** - * Log - * - * @param string $message (the message to be logged) - */ - function log_message($message) { - SCA::$logger->toLog('>>> ' . $message); - } -} - -?> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am deleted file mode 100644 index 10020c4f03..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am +++ /dev/null @@ -1,23 +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. - -deploydir=$(prefix)/samples/PHPCalculator/deploy -compositedir=$(deploydir)/sample.calculator - -composite_DATA = *.composite *.componentType *.php -EXTRA_DIST = *.composite *.componentType *.php - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php deleted file mode 100644 index ed2e75edc8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -# 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. -# -# -require 'SCA/SCA.php'; - -class Multiply { - - /** - * @reference - * @binding.php Log.php - */ - public $log_service; - - function mul($num1, $num2) { - $result = $num1 * $num2; - -// $this->log_service->log_message($result); - - return $result; - } -} - -?> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite b/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite deleted file mode 100644 index f1a82a70db..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - name="sample.calculator"> - - <component name="CalculatorComponent"> - <implementation.php module="Calculator" class="Calculator" scope="composite"/> - <reference name="div_service">DivideComponent</reference> - </component> - - - <component name="DivideComponent"> - <implementation.php module="Divide" class="Divide" scope="composite"/> - <reference name="log_service">LogComponent</reference> - </component> - - <component name="LogComponent"> - <implementation.php module="Log" class="Log" scope="composite"/> - </component> - - - - - -</composite> - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/php/src/Makefile.am deleted file mode 100644 index d0b04262f5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/Makefile.am +++ /dev/null @@ -1,57 +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. - -libdir=$(prefix)/lib -lib_LTLIBRARIES = libtuscany_sca_php.la - -noinst_HEADERS = \ -tuscany/sca/php/*.h \ -tuscany/sca/php/model/*.h - -libtuscany_sca_php_la_SOURCES = \ -tuscany/sca/php/PHPExtension.cpp \ -tuscany/sca/php/PHPImplementationExtension.cpp \ -tuscany/sca/php/PHPInterfaceExtension.cpp \ -tuscany/sca/php/PHPServiceWrapper.cpp \ -tuscany/sca/php/PHPServiceProxy.cpp \ -tuscany/sca/php/sca.cpp \ -tuscany/sca/php/model/PHPImplementation.cpp \ -tuscany/sca/php/model/PHPInterface.cpp \ -tuscany/sca/php/model/PHPReferenceBinding.cpp \ -tuscany/sca/php/model/PHPServiceBinding.cpp - -libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L${PHP_LIB} -lphp5 \ - -L${PHP_SCA_SDO_LIB} -lsdo - -INCLUDES = -I${TUSCANY_SCACPP}/include \ - -I${TUSCANY_SDOCPP}/include \ - -I${PHP_INCLUDE} \ - -I${PHP_INCLUDE}/main \ - -I${PHP_INCLUDE}/Zend \ - -I${PHP_INCLUDE}/TSRM \ - -I${PHP_INCLUDE}/sapi/embed \ - -I${PHP_SCA_SDO_INCLUDE} - -moduledir=$(prefix)/module -extension = libtuscany_sca_php$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp deleted file mode 100644 index 0ffb660139..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp +++ /dev/null @@ -1,71 +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/php/PHPExtension.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/php/PHPImplementationExtension.h" -#include "tuscany/sca/php/PHPInterfaceExtension.h" - - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_php_initialize() - { - tuscany::sca::php::PHPExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace php - { - // =================================================================== - // Constructor for the PHPExtension class. - // =================================================================== - PHPExtension::PHPExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PHPExtension class. - // =================================================================== - PHPExtension::~PHPExtension() - { - logentry(); - } - - void PHPExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerImplementationExtension(new PHPImplementationExtension()); - SCARuntime::getCurrentRuntime()->registerInterfaceExtension(new PHPInterfaceExtension()); - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h deleted file mode 100644 index 971ed93c86..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h +++ /dev/null @@ -1,57 +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_php_phpextension_h -#define tuscany_sca_php_phpextension_h - -namespace tuscany -{ - namespace sca - { - namespace php - { - - class PHPExtension - { - public: - /** - * Default constructor - */ - PHPExtension(); - - /** - * Destructor - */ - virtual ~PHPExtension(); - - static void initialize(); - - private: - - }; - - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_phpextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp deleted file mode 100644 index 101667302f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp +++ /dev/null @@ -1,73 +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/php/PHPImplementationExtension.h" -#include "tuscany/sca/php/model/PHPImplementation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - // =================================================================== - // Constructor for the PHPImplementationExtension class. - // =================================================================== - PHPImplementationExtension::PHPImplementationExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PHPImplementationExtension class. - // =================================================================== - PHPImplementationExtension::~PHPImplementationExtension() - { - logentry(); - } - - const string PHPImplementationExtension::extensionName("php"); - const string PHPImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPImplementation"); - - // =================================================================== - // loadModelElement - load the info from implementation.php - // =================================================================== - ComponentType* PHPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation) - { - logentry(); - - string module = scdlImplementation->getCString("module"); - string className = scdlImplementation->getCString("class"); - - PHPImplementation* phpImpl = new PHPImplementation(composite, module, className); - - return phpImpl; - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h deleted file mode 100644 index 604c4ea102..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h +++ /dev/null @@ -1,74 +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_php_phpimplementationextension_h -#define tuscany_sca_php_phpimplementationextension_h - -#include "tuscany/sca/extension/ImplementationExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace php - { - - class PHPImplementationExtension : public ImplementationExtension - { - public: - /** - * Default constructor - */ - PHPImplementationExtension(); - - /** - * Destructor - */ - virtual ~PHPImplementationExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema element for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.phpn") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ComponentType* getImplementation( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlImplementation); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_phpimplementationextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp deleted file mode 100644 index a07c499dec..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp +++ /dev/null @@ -1,76 +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/php/PHPInterfaceExtension.h" -#include "tuscany/sca/php/model/PHPInterface.h" -#include "tuscany/sca/util/Logging.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - // =================================================================== - // Constructor for the PHPInterfaceExtension class. - // =================================================================== - PHPInterfaceExtension::PHPInterfaceExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PHPInterfaceExtension class. - // =================================================================== - PHPInterfaceExtension::~PHPInterfaceExtension() - { - logentry(); - } - - const string PHPInterfaceExtension::extensionName("php"); - const string PHPInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface"); - - // =================================================================== - // loadModelElement - load the info from interface.php - // =================================================================== - tuscany::sca::model::Interface* PHPInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface) - { - logentry(); - - // Determine the type - string ifType = scdlInterface->getType().getName(); - if (ifType == "PHPInterface") - { - bool remotable = scdlInterface->getBoolean("remotable"); - bool conversational = scdlInterface->getBoolean("conversational"); - - return new PHPInterface(remotable, conversational); - } - return 0; - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h deleted file mode 100644 index 4279376300..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h +++ /dev/null @@ -1,74 +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_php_phpinterfaceextension_h -#define tuscany_sca_php_phpinterfaceextension_h - -#include "tuscany/sca/extension/InterfaceExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace php - { - - class PHPInterfaceExtension : public InterfaceExtension - { - public: - /** - * Default constructor - */ - PHPInterfaceExtension(); - - /** - * Destructor - */ - virtual ~PHPInterfaceExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#PHPInterface") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::Interface* getInterface( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlInterface); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_phpinterfaceextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp deleted file mode 100644 index 4b66c42a5b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp +++ /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$ */ - -#include "tuscany/sca/php/PHPServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/php/model/PHPReferenceBinding.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - - // ============================================ - // Constructor: Create a proxy from a reference - // ============================================ - PHPServiceProxy::PHPServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // Get the service wrapper - PHPReferenceBinding* referenceBinding = (PHPReferenceBinding*)reference->getBinding(); - serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - } - - // ========================================== - // Constructor: Create a proxy from a service - // ========================================== - PHPServiceProxy::PHPServiceProxy(Service* service) - : ServiceProxy(NULL) - { - logentry(); - - // Get the service wrapper - serviceWrapper = service->getBinding()->getServiceWrapper(); - } - - // ========== - // Destructor - // ========== - PHPServiceProxy::~PHPServiceProxy() - { - logentry(); - } - - // ===================================================== - // invokeService: invoke the service wired to this proxy - // ===================================================== - void PHPServiceProxy::invokeService(Operation& operation) - { - logentry(); - - // Invoke the service - serviceWrapper->invoke(operation); - } - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h deleted file mode 100644 index bddb262617..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h +++ /dev/null @@ -1,83 +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_php_phpserviceproxy_h -#define tuscany_sca_php_phpserviceproxy_h - -#include "tuscany/sca/php/export.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - namespace php - { - - /** - * Holds a proxy for a given reference from a component implemented in PHP. - */ - class PHPServiceProxy : public 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. - */ - PHPServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param service The service on the target component. - */ - PHPServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PHPServiceProxy(); - - /** - * Invoke the wired service. - */ - virtual void invokeService(Operation& operation); - - private: - - /** - * The target service wrapper - */ - ServiceWrapper* serviceWrapper; - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_phpserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp deleted file mode 100644 index 8c92be0d83..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp +++ /dev/null @@ -1,505 +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$ */ - -#ifdef WIN32 - -// some strangeness in the build that causes -// WinSock.h and WinSock2.h to be included leading to redefinitions -#define _WINSOCKAPI_ - -// sdo.cpp also includes the math libraries and causes redeclarations -// of all the math functions -#define _INC_MATH - -#endif //WIN32 - -#include <iostream> -#include <sstream> - -#include <sapi/embed/php_embed.h> - - -#include "tuscany/sca/php/PHPServiceWrapper.h" -#include "tuscany/sca/php/PHPServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/php/model/PHPImplementation.h" - - -#include "sca.h" -#include "php_sdo_int.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - - int embedSAPIInitializeCount = 0; - - // Global callbacks used by the PHP engine - - // Callback for SAPI error - void php_sapi_error(int type, const char *error_msg, ...) - { - logwarning("PHP sapi error: %s", error_msg); - //TODO - do something sensible with this output - zend_bailout(); - } - - // Callback for log messages - void php_log_message(char *message) - { - loginfo("PHP log: %s", message); - //TODO - do something sensible with this output - } - - // Callback for unbuffered writes (echo, print etc.) - int php_ub_write(const char *str, unsigned int str_length TSRMLS_DC) - { - logentry(); - loginfo("PHP Output: %s", str); - //TODO - do something sensible with this output - return str_length; - } - - // Callback for errors - void php_error_cb(int type, - const char *error_filename, - const uint error_lineno, - const char *format, va_list args) - { - logentry(); - - char buffer[2048]; - int len; - - len = snprintf(buffer, 2048, "Error in file %s on line %d: ", error_filename, error_lineno); - vsnprintf(buffer + len, (2048 - len), format, args); - logwarning("PHP error: %s", buffer); - //TODO - do something sensible with this output - zend_bailout(); - } - - - // =========== - // Constructor - // =========== - PHPServiceWrapper::PHPServiceWrapper(Service* service) - : ServiceWrapper(service) - { - logentry(); - - component = service->getComponent(); - interf = service->getType()->getInterface(); - remotable = interf->isRemotable(); - - // ----------------------------------------------- - // Get the implementation for the target component - // ----------------------------------------------- - PHPImplementation* impl = (PHPImplementation*)component->getType(); - if (!impl) - { - string msg = "Component " + component->getName() + " has no implementation defined"; - throwException(SystemConfigurationException, msg.c_str()); - } - - loginfo("Module: %s", impl->getModule().c_str()); - loginfo("Class: %s", impl->getClass().c_str()); - } - - // ========== - // Destructor - // ========== - PHPServiceWrapper::~PHPServiceWrapper() - { - logentry(); - } - - - // ====================================================================== - // invoke: wrapper call to service with setting the component context - // ====================================================================== - void PHPServiceWrapper::invoke(Operation& operation) - { - zval z_func_name, retval, z_component_name, z_class_name, z_operation_name, z_arg_array; - zval *params[5]; - - logentry(); - - // set the current component in the SCA runtime - // so that other things can get at it thorugh this - // static class - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->setCurrentComponent(component); - - try - { - // get the component type information - PHPImplementation* impl = (PHPImplementation*)component->getType(); - - // get the directory containing the component type - const string &compositeDir = impl->getComposite()->getRoot(); - - // get some useful information that will be used later - // when we construct the wrapper script - string componentName = component->getName(); - string className = impl->getClass(); - string operationName = operation.getName(); - loginfo("Component %s class %s operation: %s", - componentName.c_str(), - className.c_str(), - operationName.c_str()); - - // load the PHP logging and error callback methods - php_embed_module.log_message = php_log_message; - php_embed_module.ub_write = php_ub_write; - php_embed_module.sapi_error = php_sapi_error; - - // would normally use the following macro before the embeded call - // but we need to take account of multiple nested calls - // and ZTS threading safety is not behaving itself - // PHP_EMBED_START_BLOCK(/* argc */ 0, /* argv */ NULL) - // ===================================================================== - { -#ifdef ZTS - static void ***tsrm_ls; - loginfo("ZTS enabled"); - - printf("tsrm_ls = %x, embedSAPIInitializeCount = %d\n", - tsrm_ls, embedSAPIInitializeCount); -#endif - - if ( embedSAPIInitializeCount == 0 ) - { - embedSAPIInitializeCount = 1; - - php_embed_init(0, NULL PTSRMLS_CC); - - // load up the sca module that provides the interface between - // C++ and user space PHP - zend_first_try { - zend_startup_module(&sca_module_entry); - } zend_end_try(); - } else { - embedSAPIInitializeCount++; - } - - zend_try { - // set error handler - zend_error_cb = php_error_cb; - - /* - * Open the include files - */ - // includeFile("SCA/SCA.php" TSRMLS_CC); - // includeFile("SCA/Bindings/tuscany/SCA_TuscanyWrapper.php" TSRMLS_CC); - - /* Instantiate a SCA_Tuscany (mediator) object, and - * set its operation property - */ - zval z_tuscany_mediator; - zval *pz_mediator = &z_tuscany_mediator; - INIT_ZVAL(z_tuscany_mediator); - zend_class_entry *ce_mediator = - zend_fetch_class("SCA_Tuscany", sizeof("SCA_Tuscany") - 1, 0 TSRMLS_CC); - object_init_ex(pz_mediator, ce_mediator); - z_tuscany_mediator.value.obj.handlers->add_ref(pz_mediator TSRMLS_CC); - - zend_update_property_long(ce_mediator, pz_mediator, - "operation", sizeof("operation") - 1, (long)&operation TSRMLS_CC); - - /* get the class info loaded up */ - zend_eval_string("include 'SCA/SCA.php';", - NULL, "Include SCA" TSRMLS_CC); - zend_eval_string("include 'SCA/Bindings/tuscany/SCA_TuscanyWrapper.php';", - NULL, "Include SCA_TuscanyWrapper" TSRMLS_CC); - - /* Now instantiate an SCA_TuscanyWrapper object and call its constructor */ - zval z_tuscany_wrapper; - zval *pz_tuscany_wrapper = &z_tuscany_wrapper; - INIT_ZVAL(z_tuscany_wrapper); - object_init_ex(pz_tuscany_wrapper, - zend_fetch_class("SCA_TuscanyWrapper", sizeof("SCA_TuscanyWrapper") - 1, 0 TSRMLS_CC)); - z_tuscany_wrapper.value.obj.handlers->add_ref(pz_tuscany_wrapper TSRMLS_CC); - - ZVAL_STRING(&z_func_name, "__construct", 1); - ZVAL_STRING(&z_component_name, (char *)componentName.c_str(), 1); - if( &className != NULL && className.size() > 0) { - ZVAL_STRING(&z_class_name, (char *)className.c_str(), 1); - } else { - ZVAL_NULL(&z_class_name); - } - ZVAL_STRING(&z_operation_name, (char *)operationName.c_str(), 1); - - array_init(&z_arg_array); - - // get the parameters from the operation structure - for(unsigned int i = 0; i < operation.getNParms(); i++) - { - const Operation::Parameter& parm = operation.getParameter(i); - //printf("Arg %d type %d\n", i, parm.getType()); - switch(parm.getType()) - { - case Operation::BOOL: - { - add_next_index_bool(&z_arg_array, (int)*(bool*)parm.getValue() ); - break; - } - case Operation::SHORT: - case Operation::USHORT: - case Operation::LONG: - case Operation::ULONG: - { - add_next_index_long(&z_arg_array, *(long*)parm.getValue() ); - break; - } - case Operation::FLOAT: - { - add_next_index_double(&z_arg_array,( double)*(float*)parm.getValue() ); - break; - } - case Operation::DOUBLE: - case Operation::LONGDOUBLE: - { - add_next_index_double(&z_arg_array, *(double*)parm.getValue() ); - break; - } - case Operation::CHARS: - { - add_next_index_string(&z_arg_array, *(char**)parm.getValue(), 1 ); - break; - } - case Operation::STRING: - { - add_next_index_string(&z_arg_array, (char*)(*(string*)parm.getValue()).c_str(), 1 ); - break; - } - case Operation::DATAOBJECT: - { - // convert the tuscany SDO into a PHP SDO - - // create the object - zval *sdo; - ALLOC_INIT_ZVAL(sdo); - sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC); - - // add it to the arg array - add_next_index_zval(&z_arg_array, sdo); - break; - } - default: - { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Argument type %d not supported", - class_name, - space, - get_active_function_name(TSRMLS_C), - parm.getType()); - } - } - } - - params[0] = &z_tuscany_mediator; - params[1] = &z_component_name; - params[2] = &z_class_name; - params[3] = &z_operation_name; - params[4] = &z_arg_array; - - call_user_function(EG(function_table), - &pz_tuscany_wrapper, - &z_func_name, - &retval, - 5, - params TSRMLS_CC); - - zval_dtor(&z_func_name); - zval_dtor(&z_component_name); - zval_dtor(&z_class_name); - zval_dtor(&z_operation_name); - zval_dtor(&z_arg_array); - - string script; - script = "include '" + compositeDir + "/" + impl->getModule() + ".php';"; - loginfo("Script: %s", script.c_str()); - - // call the dynamically created script - // I'm not trapping the return value here - // as it seems to prevent any kind of output - // being produced. Needs investigation. - //zval retval; - zend_eval_string((char *) script.c_str(), - NULL, //&retval, - "Include module" TSRMLS_CC); - - loginfo(">>>> About to call SCA_TuscanyWrapper->invoke()"); - - /* Now call SCA_TuscanyWrapper->invoke() ... */ - ZVAL_STRING(&z_func_name, "invoke", 1); - call_user_function(EG(function_table), - &pz_tuscany_wrapper, &z_func_name, - &retval, 0, NULL TSRMLS_CC); - - loginfo("<<<< Return from SCA_TuscanyWrapper->invoke()"); - - zval_dtor(&z_func_name); - - /* ... and copy the return value into the operation */ - switch(Z_TYPE(retval)) - { - case IS_NULL: - { - //printf("NULL response"); - break; - } - case IS_BOOL: - { - bool *newBool = new bool; - *newBool = ZEND_TRUTH(Z_BVAL(retval)); - operation.setReturnValue(newBool); - break; - } - case IS_LONG: - { - long *newLong = new long; - *newLong = Z_LVAL(retval); - operation.setReturnValue(newLong); - break; - } - case IS_DOUBLE: - { - //double *newDouble = new double; - float *newDouble = new float; - *newDouble = (float)Z_DVAL(retval); - operation.setReturnValue(newDouble); - break; - } - case IS_STRING: - { - string newString (Z_STRVAL(retval)); - operation.setReturnValue(&newString); - break; - } - case IS_OBJECT: - { - // convert the PHP SDO into a Tuscany SDO - DataObjectPtr sdo = sdo_do_get(&retval TSRMLS_CC); - operation.setReturnValue(&sdo); - break; - } - default: - { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Input argument type %d not supported on invoke", - class_name, - space, - get_active_function_name(TSRMLS_C), - Z_TYPE(retval)); - } - } - } zend_catch { - /* int exit_status = EG(exit_status); */ - } - zend_end_try(); - - if ( embedSAPIInitializeCount == 1 ) - { - php_embed_shutdown(TSRMLS_C); - loginfo("Engine shutdown"); - } - else - { - embedSAPIInitializeCount--; - } - } - // ===================================================================== - } - catch (...) - { - runtime->unsetCurrentComponent(); - throw; - } - runtime->unsetCurrentComponent(); - - } - - // ====================================================================== - // getServiceWrapper: create a wrapper for the target ComponentService - // ====================================================================== - PHPServiceWrapper* PHPServiceWrapper::getServiceWrapper(Service* service) - { - logentry(); - PHPServiceWrapper* serviceWrapper = 0; - - // --------------------------------- - // Create an instance of the wrapper - // --------------------------------- - serviceWrapper = new PHPServiceWrapper(service); - if (!serviceWrapper) - { - string msg = "Could not create new PHPServiceWrapper"; - throwException(SystemConfigurationException, msg.c_str()); - } - - return serviceWrapper; - } - - /* Not used at the moment - * Can find the include file and execute it, - * but doesn't make the contents available - */ - void PHPServiceWrapper::includeFile(char *includeFileName TSRMLS_DC) - { - zend_file_handle include_file_handle; - - include_file_handle.type = ZEND_HANDLE_FP; - include_file_handle.filename = includeFileName; - include_file_handle.opened_path = NULL; - include_file_handle.free_filename = 0; - if (!(include_file_handle.handle.fp = php_fopen_with_path( - include_file_handle.filename, "rb", PG(include_path), - &include_file_handle.opened_path TSRMLS_CC))) { - php_error(E_ERROR, - "Could not open %s", include_file_handle.filename); - return; - } - php_execute_script(&include_file_handle TSRMLS_CC); - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h deleted file mode 100644 index be20f34217..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h +++ /dev/null @@ -1,112 +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_php_phpservicewrapper_h -#define tuscany_sca_php_phpservicewrapper_h - -#include "tuscany/sca/php/export.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Interface.h" - -#include <TSRM/TSRM.h> - -namespace tuscany -{ - namespace sca - { - namespace php - { - class PHPInterface; - - /** - * 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 SCA_PHP_API PHPServiceWrapper : public ServiceWrapper - { - public: - /** - * Factory method to create a new PHPServiceWrapper 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 PHPServiceWrapper* getServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Constructor. - * @param target The component service to which this wrapper refers. - */ - PHPServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PHPServiceWrapper(); - - /** - * 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. - */ - virtual void invoke(Operation& operation); - - - protected: - - - private: - - /** - * Utility method to execute a script on the include_path. - */ - static void includeFile(char *includeFileName TSRMLS_DC); - - /** - * The component to which this wrapper refers. - */ - tuscany::sca::model::Component* component; - - /** - * Set to true if the service is remotable. - */ - bool remotable; - - /** - * A pointer to the interface which the service exposes. - */ - tuscany::sca::model::Interface* interf; - - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_phpservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/export.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/export.h deleted file mode 100644 index 11a9519361..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/export.h +++ /dev/null @@ -1,41 +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_php_export_h -#define tuscany_sca_php_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_PHP_EXPORTS -#define SCA_PHP_API __declspec(dllexport) -#else -#define SCA_PHP_API __declspec(dllimport) -#endif - -#else -#include <sys/time.h> -#include <inttypes.h> -#include <stdlib.h> -#define SCA_PHP_API -#endif - -#endif // tuscany_sca_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp deleted file mode 100644 index 63f1672ec5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp +++ /dev/null @@ -1,85 +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/util/Logging.h" -#include "tuscany/sca/php/model/PHPImplementation.h" -#include "tuscany/sca/php/model/PHPServiceBinding.h" -#include "tuscany/sca/php/model/PHPReferenceBinding.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - - namespace php - { - - // Constructor - PHPImplementation::PHPImplementation(Composite* composite, const string& module, const string& className) - : ComponentType(composite, module), - module(module), className(className) - { - logentry(); - } - - PHPImplementation::~PHPImplementation() - { - logentry(); - } - - void PHPImplementation::initializeComponent(Component* component) - { - logentry(); - ComponentType::initializeComponent(component); - - // Create PHP bindings for all the services - const Component::SERVICE_MAP& services = component->getServices(); - Component::SERVICE_MAP::const_iterator iter = services.begin(); - for (unsigned int i=0; i< services.size(); i++) - { - Service *service = iter->second; - PHPServiceBinding* binding = new PHPServiceBinding(service); - service->setBinding(binding); - iter++; - } - - // Create PHP bindings for all the references - const Component::REFERENCE_MAP& references = component->getReferences(); - Component::REFERENCE_MAP::const_iterator refiter = references.begin(); - for (int ri=0; ri< references.size(); ri++) - { - Reference *reference = refiter->second; - PHPReferenceBinding* binding = new PHPReferenceBinding(reference); - reference->setBinding(binding); - refiter++; - } - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h deleted file mode 100644 index 78e678dff5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.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_php_model_phpimplementation_h -#define tuscany_sca_php_model_phpimplementation_h - -#include <string> - -#include "tuscany/sca/model/ComponentType.h" - - -namespace tuscany -{ - namespace sca - { - namespace php - { - /** - * Holds information about an SCA implementation written in PHP - */ - class PHPImplementation : public tuscany::sca::model::ComponentType - { - - public: - /** - * Constructor. - * @param composite Composite containing this implementation. - * @param module Name of the module. - * @param modulePath Path to the module (could be a blank string - * if this is not specified). - * @param className Name of the class in the module (could be a blank string - * if this is not specified). - */ - PHPImplementation(tuscany::sca::model::Composite* composite, const std::string& module, const std::string& className); - - /** - * Destructor - */ - virtual ~PHPImplementation(); - - /** - * Initialize a component of this type. - * @param component The component to initialize. - */ - virtual void initializeComponent(tuscany::sca::model::Component* component); - - /** - * Returns the name of the module. - * @return The name of the module. - */ - const std::string& getModule() const { return module; } - - /** - * Get the name of the class. - * @return The class name if specified. - */ - const std::string& getClass() const { return className; } - - private: - - /** - * Name of the module. - */ - std::string module; - - /** - * Name of the class in the header file declaring the implementation. - * May be an empty string if not set in the SCDL file. - */ - std::string className; - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_model_phpimplementation_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp deleted file mode 100644 index cbea3f2b71..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp +++ /dev/null @@ -1,53 +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/util/Logging.h" -#include "tuscany/sca/php/export.h" -#include "tuscany/sca/php/model/PHPInterface.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - namespace php - { - const string PHPInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface"); - - // Constructor - PHPInterface::PHPInterface( - bool remotable, - bool conversational) - : Interface(remotable, conversational) - { - logentry(); - } - - PHPInterface::~PHPInterface() - { - logentry(); - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h deleted file mode 100644 index 9a4f658eb0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - - -#ifndef tuscany_sca_php_model_phpinterface_h -#define tuscany_sca_php_model_phpinterface_h - -#include <string> - -#include "tuscany/sca/php/export.h" -#include "tuscany/sca/model/Interface.h" - -namespace tuscany -{ - namespace sca - { - namespace php - { - /** - * Holds information about an interface described using a PHP - * header file. - */ - class PHPInterface : public tuscany::sca::model::Interface - { - - public: - /** - * Constuctor. - * @param scope The scope of the interface (stateless or composite). - * @param remotable True if the interface is remotable. - */ - PHPInterface( - bool remotable, - bool conversational); - - /** - * Destructor. - */ - virtual ~PHPInterface(); - - /** - * return the QName of the schema type for this interface type - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp") - */ - const std::string& getInterfaceTypeQName() { return typeQName; }; - - /** - * The QName of the schema type for this interface type. - */ - SCA_PHP_API static const std::string typeQName; - - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_model_phpinterface_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp deleted file mode 100644 index 919d4c8646..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp +++ /dev/null @@ -1,61 +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/util/Logging.h" -#include "tuscany/sca/php/model/PHPReferenceBinding.h" -#include "tuscany/sca/php/PHPServiceProxy.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - - // Constructor - PHPReferenceBinding::PHPReferenceBinding(Reference* reference) - : ReferenceBinding(reference, ""), serviceProxy(NULL) - { - } - - // Destructor - PHPReferenceBinding::~PHPReferenceBinding() - { - } - - ServiceProxy* PHPReferenceBinding::getServiceProxy() - { - return serviceProxy; - } - - void PHPReferenceBinding::configure(ServiceBinding* binding) - { - setTargetServiceBinding(binding); - - serviceProxy = new PHPServiceProxy(getReference()); - } - - } // End namespace - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h deleted file mode 100644 index 45b422da2c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h +++ /dev/null @@ -1,82 +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_php_model_phpreferencebinding_h -#define tuscany_sca_php_model_phpreferencebinding_h - -#include <string> - -#include "tuscany/sca/model/ReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace php - { - /** - * Information about a PHP service binding for service or a reference. - */ - class PHPReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - */ - PHPReferenceBinding(tuscany::sca::model::Reference* reference); - - /** - * Destructor. - */ - virtual ~PHPReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; }; - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual ServiceProxy* getServiceProxy(); - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - private: - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_model_phpreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp deleted file mode 100644 index 4d18424ae2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp +++ /dev/null @@ -1,58 +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/util/Logging.h" -#include "tuscany/sca/php/model/PHPServiceBinding.h" -#include "tuscany/sca/php/PHPServiceWrapper.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace php - { - - // Constructor - PHPServiceBinding::PHPServiceBinding(Service* service) - : ServiceBinding(service, "") - { - logentry(); - serviceWrapper = PHPServiceWrapper::getServiceWrapper(service); - } - - // Destructor - PHPServiceBinding::~PHPServiceBinding() - { - logentry(); - } - - ServiceWrapper* PHPServiceBinding::getServiceWrapper() - { - logentry(); - return (ServiceWrapper*)serviceWrapper; - } - - } // End namespace php - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h deleted file mode 100644 index ef3d6b1604..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.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_php_model_phpservicebinding_h -#define tuscany_sca_php_model_phpservicebinding_h - -#include <string> - -#include "tuscany/sca/model/ServiceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace php - { - /** - * Information about a PHP service binding for service or a reference. - */ - class PHPServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param port The definition of the port to which the entrypoint - * or external service is to be bound. This is of the form - * "namespace"#endpoint("service"/"port") - */ - PHPServiceBinding(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PHPServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - virtual ServiceWrapper* getServiceWrapper(); - - private: - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace php - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_php_model_phpservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/php_sca.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/php_sca.h deleted file mode 100644 index 8aea8dadb2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/php_sca.h +++ /dev/null @@ -1,132 +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. - */ - -/* $ Id: $ */ - -#ifndef PHP_SCA_H -#define PHP_SCA_H - -#include "tuscany/sca/core/Operation.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <main/php.h> - -#ifdef HAVE_SCA - -#include <main/php_ini.h> -#include <main/SAPI.h> -#include <ext/standard/info.h> -#include <Zend/zend_extensions.h> -#ifdef __cplusplus -} // extern "C" -#endif -#ifdef __cplusplus -extern "C" { -#endif - - -//extern zend_module_entry sca_module_entry; -#define phpext_sca_ptr &sca_module_entry - -#ifdef PHP_WIN32 -#define PHP_SCA_API __declspec(dllexport) -#else -#define PHP_SCA_API -#endif - -PHP_MINIT_FUNCTION(sca); -PHP_MSHUTDOWN_FUNCTION(sca); -PHP_MINFO_FUNCTION(sca); - -#ifdef ZTS -#include "TSRM/TSRM.h" -#endif - -#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) - -#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) - -#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) - -#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) -#define PROP_SET_STRINGL(name, s, l) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) - - -PHP_METHOD(SCA_Tuscany, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) -ZEND_END_ARG_INFO() -#else /* PHP 4.x */ -#define SCA_Tuscany____construct_args NULL -#endif - -PHP_METHOD(SCA_Tuscany, invoke); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__invoke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) - ZEND_ARG_INFO(0, component_name) - ZEND_ARG_INFO(0, reference_name) - ZEND_ARG_INFO(0, method_name) -#if (PHP_MINOR_VERSION > 0) - ZEND_ARG_ARRAY_INFO(0, arguments, 1) -#else - ZEND_ARG_INFO(0, arguments) -#endif -ZEND_END_ARG_INFO() -#else /* PHP 4.x */ -#define SCA_Tuscany__invoke_args NULL -#endif - -PHP_METHOD(SCA_Tuscany, getArgArray); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__getArgArray_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#else /* PHP 4.x */ -#define SCA_Tuscany__getArgArray_args NULL -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - - - -#endif /* PHP_HAVE_SCA */ - -#endif /* PHP_SCA_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.cpp b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.cpp deleted file mode 100644 index 4078226f63..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.cpp +++ /dev/null @@ -1,517 +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. - */ - -/* $ Id: $ */ - -#ifdef WIN32 - -// some strangeness in the build that causes -// WinSock.h and WinSock2.h to be included leading to redefinitions -#define _WINSOCKAPI_ - -#endif //WIN32 - -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/php/PHPServiceProxy.h" -#include "commonj/sdo/RefCountingPointer.h" - -using namespace std; -using namespace tuscany::sca; -using namespace tuscany::sca::model; -using namespace tuscany::sca::php; -using namespace commonj::sdo; - -#define HAVE_SCA 1 - - -#include "php_sca.h" -#include "sca.h" - -#if HAVE_SCA - -#include "php_sdo.h" -#include "php_sdo_int.h" -/* {{{ Class definitions */ - -/* {{{ Class SCA_Tuscany */ - -static zend_class_entry * SCA_Tuscany_ce_ptr = NULL; - -/* {{{ Methods */ - -/* {{{ proto void __construct(int operation_handle) - */ -PHP_METHOD(SCA_Tuscany, __construct) -{ - zval *_this_zval = getThis(); - zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval); - - long operation_handle = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &operation_handle) == FAILURE) { - return; - } - - if (!operation_handle) { - php_error(E_ERROR, "SCA_Tuscany ctor called with NULL operation"); - } - - PROP_SET_LONG(operation, operation_handle); -} -/* }}} __construct */ - -/* {{{ proto int invoke(string component_name, string reference_name, string method_name, array arguments) - Invoke a Tuscany component */ -PHP_METHOD(SCA_Tuscany, invoke) -{ - //zval * _this_zval = NULL; - const char * component_name = NULL; - int component_name_len = 0; - const char * reference_name = NULL; - int reference_name_len = 0; - const char * method_name = NULL; - int method_name_len = 0; - zval * arguments = NULL; - HashTable * arguments_hash = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssa/", - &component_name, &component_name_len, - &reference_name, &reference_name_len, - &method_name, &method_name_len, - &arguments) == FAILURE) { - return; - } - - arguments_hash = HASH_OF(arguments); - - // find the correct service proxy - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - Component* component = runtime->getCurrentComponent(); - Reference* ref = component->findReference(reference_name); - if(!ref) { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Can't find reference %s", - class_name, - space, - get_active_function_name(TSRMLS_C), - reference_name); - return; - } - - ReferenceBinding* refBinding = ref->getBinding(); - PHPServiceProxy *serviceProxy = (PHPServiceProxy*) refBinding->getServiceProxy(); - - // construct an operation structure - Operation operation(method_name); - - // add the parameters to the operation - for ( zend_hash_internal_pointer_reset(arguments_hash); - zend_hash_has_more_elements(arguments_hash) == SUCCESS; - zend_hash_move_forward(arguments_hash) ) - { - zval **data; - - if ( zend_hash_get_current_data(arguments_hash, - (void**)&data ) == FAILURE ) - { - continue; - } - - char *hashKey; - uint hashKeyLength; - ulong hashIndex; - int type; - - type = zend_hash_get_current_key_ex(arguments_hash, - &hashKey, - &hashKeyLength, - &hashIndex, - 0, - NULL); - - switch(Z_TYPE_PP(data)) - { - case IS_NULL: - { - //printf("NULL argument"); - break; - } - case IS_BOOL: - { - convert_to_boolean(*data); - bool *newBool = new bool; - *newBool = ZEND_TRUTH(Z_BVAL_PP(data)); - operation.addParameter(newBool); - break; - } - case IS_LONG: - { - convert_to_long(*data); - long *newLong = new long; - *newLong = Z_LVAL_PP(data); - operation.addParameter(newLong); - break; - } - case IS_DOUBLE: - { - //convert_to_double(*data); - //double *newDouble = new double; - convert_to_double(*data); - float *newDouble = new float; - *newDouble = (float)Z_DVAL_PP(data); - operation.addParameter(newDouble); - break; - } - case IS_STRING: - { - convert_to_string(*data); - string newString (Z_STRVAL_PP(data)); - operation.addParameter(&newString); - break; - } - case IS_OBJECT: - { - // convert the PHP SDO into a Tuscany SDO - DataObjectPtr sdo = sdo_do_get(*data TSRMLS_CC); - operation.addParameter(&sdo); - break; - } - default: - { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Input argument type %d not supported on invoke", - class_name, - space, - get_active_function_name(TSRMLS_C), - Z_TYPE_PP(data)); - } - } - } - - // call the proxy - serviceProxy->invokeService(operation); - - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - ZVAL_BOOL(return_value, *(bool*)operation.getReturnValue()); - break; - } - case Operation::SHORT: - case Operation::USHORT: - case Operation::LONG: - case Operation::ULONG: - { - ZVAL_LONG(return_value, *(long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - case Operation::DOUBLE: - case Operation::LONGDOUBLE: - { - ZVAL_DOUBLE(return_value, (double)*(float*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - ZVAL_STRING(return_value, (char*)operation.getReturnValue(), 1); - break; - } - case Operation::STRING: - { - ZVAL_STRING(return_value, (char*)((string*)operation.getReturnValue())->c_str(), 1); - break; - } - case Operation::VOID_TYPE: - { - // do nothing - break; - } - case Operation::DATAOBJECT: - { - // convert the tuscany SDO into a PHP SDO - sdo_do_new(return_value, *(DataObjectPtr*)operation.getReturnValue() TSRMLS_CC); - break; - } - default: - { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Response type %d not supported on invoke", - class_name, - space, - get_active_function_name(TSRMLS_C), - operation.getReturnType()); - } - } - -} -/* }}} invoke */ - -/* {{{ proto array getArgArray() - return the arguments for the operation as an array */ -PHP_METHOD(SCA_Tuscany, getArgArray) -{ - zval * _this_zval = getThis(); - zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval); - - if (ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; - } - - array_init(return_value); - - // get the operation object from the object properties - Operation *operation = (Operation *)PROP_GET_LONG(operation); - - // get the parameters from the operation structure - for(unsigned int i = 0; i < operation->getNParms(); i++) - { - const Operation::Parameter& parm = operation->getParameter(i); - //printf("Arg %d type %d\n", i, parm.getType()); - switch(parm.getType()) - { - case Operation::BOOL: - { - add_next_index_bool(return_value,(int)*(bool*)parm.getValue() ); - break; - } - case Operation::SHORT: - case Operation::USHORT: - case Operation::LONG: - case Operation::ULONG: - { - add_next_index_long(return_value,*(long*)parm.getValue() ); - break; - } - case Operation::FLOAT: - { - add_next_index_double(return_value,(double)*(float*)parm.getValue() ); - break; - } - case Operation::DOUBLE: - case Operation::LONGDOUBLE: - { - add_next_index_double(return_value,*(double*)parm.getValue() ); - break; - } - case Operation::CHARS: - { - add_next_index_string(return_value,*(char**)parm.getValue(), 1 ); - break; - } - case Operation::STRING: - { - add_next_index_string(return_value,(char*)(*(string*)parm.getValue()).c_str(), 1 ); - break; - } - case Operation::DATAOBJECT: - { - // convert the tuscany SDO into a PHP SDO - - // create the object - zval *sdo; - ALLOC_INIT_ZVAL(sdo); - sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC); - - // add it to the arg array - add_next_index_zval(return_value, sdo); - break; - } - default: - { - char *class_name; - char *space; - class_name = get_active_class_name(&space TSRMLS_CC); - php_error(E_ERROR, - "%s%s%s(): Argument type %d not supported", - class_name, - space, - get_active_function_name(TSRMLS_C), - parm.getType()); - } - } - } -} -/* }}} getArgArray */ - -static zend_function_entry SCA_Tuscany_methods[] = { - PHP_ME(SCA_Tuscany, __construct, SCA_Tuscany____construct_args, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_ME(SCA_Tuscany, invoke, SCA_Tuscany__invoke_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(SCA_Tuscany, getArgArray, SCA_Tuscany__getArgArray_args, ZEND_ACC_PUBLIC) - { NULL, NULL, NULL } -}; - -/* }}} Methods */ - -static void class_init_SCA_Tuscany(TSRMLS_D) -{ - zend_class_entry ce; - - INIT_CLASS_ENTRY(ce, "SCA_Tuscany", SCA_Tuscany_methods); - SCA_Tuscany_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); - - /* {{{ Property registration */ - - zend_declare_property_null(SCA_Tuscany_ce_ptr, - "operation", sizeof("operation") -1, - ZEND_ACC_PUBLIC TSRMLS_CC); - - /* }}} Property registration */ - -} - -/* }}} Class SCA_Tuscany */ - -/* }}} Class definitions*/ - -/* {{{ sca_functions[] */ -function_entry sca_functions[] = { - { NULL, NULL, NULL } -}; -/* }}} */ - -/* {{{ cross-extension dependencies */ - -#if ZEND_EXTENSION_API_NO >= 220050617 -static zend_module_dep sca_deps[] = { - ZEND_MOD_REQUIRED("sdo") - {NULL, NULL, NULL, 0} -}; -#endif -/* }}} */ - -/* {{{ sca_module_entry */ -zend_module_entry sca_module_entry = { -#if ZEND_EXTENSION_API_NO >= 220050617 - STANDARD_MODULE_HEADER_EX, NULL, - sca_deps, -#else - STANDARD_MODULE_HEADER, -#endif - - "sca", - sca_functions, - PHP_MINIT(sca), /* Replace with NULL if there is nothing to do at php startup */ - PHP_MSHUTDOWN(sca), /* Replace with NULL if there is nothing to do at php shutdown */ - NULL, /* Replace with NULL if there is nothing to do at request start */ - NULL, /* Replace with NULL if there is nothing to do at request end */ - PHP_MINFO(sca), - "0.0.1", - STANDARD_MODULE_PROPERTIES -}; -/* }}} */ - -#ifdef COMPILE_DL_SCA -extern "C" { -ZEND_GET_MODULE(sca) -} // extern "C" -#endif - - -/* {{{ PHP_MINIT_FUNCTION */ -PHP_MINIT_FUNCTION(sca) -{ - /* We use the SDO extension for reference because it is a prereq */ - zend_module_entry *req_module_entry; - char *req_module_name = "libxml"; - if (zend_hash_find(&module_registry, req_module_name, strlen(req_module_name)+1, (void**)&req_module_entry) == SUCCESS) { - if (req_module_entry->zend_debug != ZEND_DEBUG || - req_module_entry->zts != USING_ZTS || - req_module_entry->zend_api != ZEND_MODULE_API_NO) { - php_error(E_ERROR, - "Cannot initialize module sca.\nModule sca compiled with module API=%d, debug=%d, thread-safety=%d\nModule %n compiled with module API=%d, debug=%d, thread-safety=%d\nThese options need to match", - req_module_name, - ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, - req_module_entry->zend_api, req_module_entry->zend_debug, req_module_entry->zts); - return FAILURE; - } - } else { - /* The dependency checker should already have found this, but to be on the safe side ... */ - php_error (E_ERROR, - "Cannot load module sca because required module %n is not loaded", - req_module_name); - return FAILURE; - } - - class_init_SCA_Tuscany(TSRMLS_C); - - return SUCCESS; -} -/* }}} */ - - -/* {{{ PHP_MSHUTDOWN_FUNCTION */ -PHP_MSHUTDOWN_FUNCTION(sca) -{ - /* - * There is some corruption going on at shutdown. - * The following hack eliminates the symptom, but there's probably still - * an underlying problem. - */ - free(SCA_Tuscany_ce_ptr->name); - SCA_Tuscany_ce_ptr->name = NULL; - destroy_zend_class(&SCA_Tuscany_ce_ptr); - SCA_Tuscany_ce_ptr = NULL; - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION */ -PHP_MINFO_FUNCTION(sca) -{ - php_info_print_box_start(0); - php_printf("<p>SCA Extension</p>\n"); - php_printf("<p>Version 0.0.1alpha (2007-01-15)</p>\n"); - php_printf("<p><b>Authors:</b></p>\n"); - php_printf("<p>Simon Laws <slaws@php.net> (lead)</p>\n"); - php_printf("<p>Caroline Maynard <cem@php.net> (lead)</p>\n"); - php_info_print_box_end(); - php_info_print_table_start(); - php_info_print_table_header(2, "SCA", "enabled"); - php_info_print_table_row(2, "SCA Version", "0.0.1"); - php_info_print_table_end(); - -} -/* }}} */ - -/* Other functions not directly related to implementing the - SCA_Tuscany extension */ - -#endif /* HAVE_SCA */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.h b/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.h deleted file mode 100644 index 5bbc9001dc..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/src/tuscany/sca/php/sca.h +++ /dev/null @@ -1,49 +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. - */ - -/* $ Id: $ */ - -#ifndef SCA_H -#define SCA_H - -#include "tuscany/sca/core/Operation.h" - -#include <main/php.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern zend_module_entry sca_module_entry; - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif /* SCA_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/sca-cpp/trunk/contrib/runtime/extensions/php/xsd/sca-implementation-php.xsd b/sca-cpp/trunk/contrib/runtime/extensions/php/xsd/sca-implementation-php.xsd deleted file mode 100644 index c40d63799a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/php/xsd/sca-implementation-php.xsd +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="implementation.php" type="sca:PHPImplementation" substitutionGroup="sca:implementation"/> - <complexType name="PHPImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="module" type="NCName" use="required"/> - <attribute name="class" type="Name" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/python/Makefile.am deleted file mode 100644 index 83e70b4b94..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/Makefile.am +++ /dev/null @@ -1,24 +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. - -SUBDIRS = src - -datadir=$(prefix)/extensions/python - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/python/src/Makefile.am deleted file mode 100644 index 15d75f8c42..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/Makefile.am +++ /dev/null @@ -1,63 +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. - -libdir=$(prefix)/extensions/python/lib -lib_LTLIBRARIES = libtuscany_sca_python.la - -pydir=$(prefix)/extensions/python/lib -py_DATA = tuscany/sca/python/sca_proxy.py -EXTRA_DIST = tuscany/sca/python/sca_proxy.py - -rootdir=$(prefix)/extensions/python - -noinst_HEADERS = \ -tuscany/sca/python/*.h \ -tuscany/sca/python/model/*.h - -libtuscany_sca_python_la_SOURCES = \ -tuscany/sca/python/PythonExtension.cpp \ -tuscany/sca/python/PythonImplementationExtension.cpp \ -tuscany/sca/python/PythonInterfaceExtension.cpp \ -tuscany/sca/python/PythonServiceWrapper.cpp \ -tuscany/sca/python/PythonServiceProxy.cpp \ -tuscany/sca/python/sca_module.cpp \ -tuscany/sca/python/model/PythonImplementation.cpp \ -tuscany/sca/python/model/PythonInterface.cpp \ -tuscany/sca/python/model/PythonReferenceBinding.cpp \ -tuscany/sca/python/model/PythonServiceBinding.cpp - -# Need python env varibles set. e.g: -# PYTHON_LIB=/usr/lib -# PYTHON_INCLUDE=/usr/include/python2.4 -# PYTHON_VERSION=python2.4 -libtuscany_sca_python_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L${PYTHON_LIB} -l${PYTHON_VERSION} - -INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${PYTHON_INCLUDE} - -moduledir=$(prefix)/extensions/python/module -extension = libtuscany_sca_python$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) - -rm -f $(libdir)/sca.so - $(LN_S) $(libdir)/libtuscany_sca_python$(libsuffix) $(libdir)/sca.so diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp deleted file mode 100644 index 0274ffc774..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.cpp +++ /dev/null @@ -1,76 +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/python/PythonExtension.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/python/PythonImplementationExtension.h" -#include "tuscany/sca/python/PythonInterfaceExtension.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_python_initialize() - { - tuscany::sca::python::PythonExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace python - { - // =================================================================== - // Constructor for the PythonExtension class. - // =================================================================== - PythonExtension::PythonExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PythonExtension class. - // =================================================================== - PythonExtension::~PythonExtension() - { - logentry(); - } - - void PythonExtension::initialize() - { - logentry(); - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->registerImplementationExtension(new PythonImplementationExtension()); - runtime->registerInterfaceExtension(new PythonInterfaceExtension()); - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.h deleted file mode 100644 index 783f37a228..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonExtension.h +++ /dev/null @@ -1,57 +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_python_pythonextension_h -#define tuscany_sca_python_pythonextension_h - -namespace tuscany -{ - namespace sca - { - namespace python - { - - class PythonExtension - { - public: - /** - * Default constructor - */ - PythonExtension(); - - /** - * Destructor - */ - virtual ~PythonExtension(); - - static void initialize(); - - private: - - }; - - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_pythonextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp deleted file mode 100644 index 84cc34c6a4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.cpp +++ /dev/null @@ -1,86 +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/python/PythonImplementationExtension.h" -#include "tuscany/sca/python/model/PythonImplementation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - // =================================================================== - // Constructor for the PythonImplementationExtension class. - // =================================================================== - PythonImplementationExtension::PythonImplementationExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PythonImplementationExtension class. - // =================================================================== - PythonImplementationExtension::~PythonImplementationExtension() - { - logentry(); - } - - const string PythonImplementationExtension::extensionName("python"); - const string PythonImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PythonImplementation"); - - // =================================================================== - // loadModelElement - load the info from implementation.python - // =================================================================== - ComponentType* PythonImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation) - { - logentry(); - - string module = scdlImplementation->getCString("module"); - string path = scdlImplementation->getCString("path"); - string className = scdlImplementation->getCString("class"); - string scopeName = scdlImplementation->getCString("scope"); - - PythonImplementation::Scope scope; - if (scopeName == "composite") - { - scope = PythonImplementation::COMPOSITE; - } - else - { - scope = PythonImplementation::STATELESS; - } - - PythonImplementation* pythonImpl = new PythonImplementation(composite, module, path, className, scope); - - return pythonImpl; - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.h deleted file mode 100644 index c94925c3fc..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonImplementationExtension.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - - -#ifndef tuscany_sca_python_pythonimplementationextension_h -#define tuscany_sca_python_pythonimplementationextension_h - -#include "tuscany/sca/extension/ImplementationExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace python - { - - class PythonImplementationExtension : public ImplementationExtension - { - public: - /** - * Default constructor - */ - PythonImplementationExtension(); - - /** - * Destructor - */ - virtual ~PythonImplementationExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.python") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ComponentType* getImplementation( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlImplementation); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_pythonimplementationextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp deleted file mode 100644 index 1d5e3b6361..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.cpp +++ /dev/null @@ -1,123 +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/python/PythonInterfaceExtension.h" -#include "tuscany/sca/python/model/PythonInterface.h" -#include "tuscany/sca/util/Logging.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - // =================================================================== - // Constructor for the PythonInterfaceExtension class. - // =================================================================== - PythonInterfaceExtension::PythonInterfaceExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the PythonInterfaceExtension class. - // =================================================================== - PythonInterfaceExtension::~PythonInterfaceExtension() - { - logentry(); - } - - const string PythonInterfaceExtension::extensionName("python"); - const string PythonInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PythonInterface"); - - // =================================================================== - // loadModelElement - load the info from interface.python - // =================================================================== - tuscany::sca::model::Interface* PythonInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface) - { - logentry(); - - // Determine the type - string ifType = scdlInterface->getType().getName(); - if (ifType == "PythonInterface") - { - bool remotable = scdlInterface->getBoolean("remotable"); - bool conversational = scdlInterface->getBoolean("conversational"); - - return new PythonInterface(remotable, conversational); - //DataObjectList& operationList = scdlInterface->getList("operation"); - - //for(int i=0; i<operationList.size(); i++) - //{ - // string opName = operationList[i]->getCString("name"); - - // if(operationList[i]->hasProperty("returnType")) - // { - // string returnType = operationList[i]->getCString("returnType"); - - // if(returnType == "string") - // { - // pythonInterface->addOperation(opName, PythonInterface::STRING); - // } - // else if(returnType == "int") - // { - // pythonInterface->addOperation(opName, PythonInterface::INT); - // } - // else if(returnType == "long") - // { - // pythonInterface->addOperation(opName, PythonInterface::LONG); - // } - // else if(returnType == "boolean") - // { - // pythonInterface->addOperation(opName, PythonInterface::BOOLEAN); - // } - // else if(returnType == "float") - // { - // pythonInterface->addOperation(opName, PythonInterface::FLOAT); - // } - // else if(returnType == "other") - // { - // pythonInterface->addOperation(opName, PythonInterface::OTHER); - // } - // else - // { - // pythonInterface->addOperation(opName, PythonInterface::NONE); - // } - // } - // else - // { - // // No return Type provided - set as NONE - // pythonInterface->addOperation(opName, PythonInterface::NONE); - // } - //} - // - //return pythonInterface; - } - return 0; - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h deleted file mode 100644 index 803d94743d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonInterfaceExtension.h +++ /dev/null @@ -1,74 +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_python_pythoninterfaceextension_h -#define tuscany_sca_python_pythoninterfaceextension_h - -#include "tuscany/sca/extension/InterfaceExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace python - { - - class PythonInterfaceExtension : public InterfaceExtension - { - public: - /** - * Default constructor - */ - PythonInterfaceExtension(); - - /** - * Destructor - */ - virtual ~PythonInterfaceExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#PythonInterface") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::Interface* getInterface( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlInterface); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_pythoninterfaceextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp deleted file mode 100644 index 9282bb953c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.cpp +++ /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$ */ - -#include "tuscany/sca/python/PythonServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/python/model/PythonReferenceBinding.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - - // ============================================ - // Constructor: Create a proxy from a reference - // ============================================ - PythonServiceProxy::PythonServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // Get the service wrapper - PythonReferenceBinding* referenceBinding = (PythonReferenceBinding*)reference->getBinding(); - serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - } - - // ========================================== - // Constructor: Create a proxy from a service - // ========================================== - PythonServiceProxy::PythonServiceProxy(Service* service) - : ServiceProxy(NULL) - { - logentry(); - - // Get the service wrapper - serviceWrapper = service->getBinding()->getServiceWrapper(); - } - - // ========== - // Destructor - // ========== - PythonServiceProxy::~PythonServiceProxy() - { - logentry(); - } - - // ===================================================== - // invokeService: invoke the service wired to this proxy - // ===================================================== - void PythonServiceProxy::invokeService(Operation& operation) - { - logentry(); - - // Invoke the service - serviceWrapper->invoke(operation); - } - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h deleted file mode 100644 index 64f856f51d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceProxy.h +++ /dev/null @@ -1,83 +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_python_pythonserviceproxy_h -#define tuscany_sca_python_pythonserviceproxy_h - -#include "export.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - namespace python - { - - /** - * Holds a proxy for a given reference from a component implemented in Python. - */ - class PythonServiceProxy : public 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. - */ - PythonServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param service The service on the target component. - */ - SCA_PYTHON_API PythonServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PythonServiceProxy(); - - /** - * Invoke the wired service. - */ - virtual void invokeService(Operation& operation); - - private: - - /** - * The target service wrapper - */ - ServiceWrapper* serviceWrapper; - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_pythonserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp deleted file mode 100644 index cb876827bd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp +++ /dev/null @@ -1,1095 +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 "commonj/sdo/SDO.h" - -#include "tuscany/sca/python/PythonServiceWrapper.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/python/model/PythonImplementation.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - - /** - * Prints out PyObject and dir(PyObject) - * for debugging purposes - */ - void printPyObject(char * name, PyObject *pObj) - { - PyObject* pObjRepr = PyObject_Repr(pObj); - loginfo("PyObject %s: %s", name, PyString_AsString(pObjRepr)); - Py_DECREF(pObjRepr); - - PyObject* pObjDir = PyObject_Dir(pObj); - PyObject* pObjDirRepr = PyObject_Repr(pObjDir); - loginfo("PyObject dir(%s): %s", name, PyString_AsString(pObjDirRepr)); - Py_DECREF(pObjDirRepr); - Py_DECREF(pObjDir); - } - - // =========== - // Constructor - // =========== - PythonServiceWrapper::PythonServiceWrapper(Service* service) - : ServiceWrapper(service) - { - logentry(); - - component = service->getComponent(); - implementation = (PythonImplementation*)component->getType(); - - pythonModule = NULL; - pythonClassInstance = NULL; - - // ----------------------------------------------- - // Get the implementation for the target component - // ----------------------------------------------- - PythonImplementation* impl = (PythonImplementation*)component->getType(); - if (!impl) - { - string msg = "Component " + component->getName() + " has no implementation defined"; - throwException(SystemConfigurationException, msg.c_str()); - } - - // Initialize the Python environment - Py_Initialize(); - - // Add the path to the composite (+ any further path specified) to the Python sys.path - string path = component->getComposite()->getRoot(); - if(impl->getModulePath().size() > 0) - { - path += "/" + impl->getModulePath(); - } - - loginfo("Module: %s", impl->getModule().c_str()); - loginfo("Path: %s", path.c_str()); - loginfo("Class: %s", impl->getClass().c_str()); - - PyObject* pSysName = PyString_FromString("sys"); - PyObject* pSys = PyImport_Import(pSysName); - Py_DECREF(pSysName); - - if(pSys != NULL) - { - PyObject* pSysPath = PyObject_GetAttrString(pSys, "path"); - - if(pSysPath != NULL && PyList_Check(pSysPath)) - { - PyObject* pPath = PyString_FromString(path.c_str()); - PyList_Append(pSysPath, pPath); - - Py_DECREF(pPath); - Py_DECREF(pSysPath); - } - Py_DECREF(pSys); - } - - if(&(impl->getModule()) != NULL && impl->getModule().size() > 0) - { - // Now import the module - PyObject* pModuleName = PyString_FromString(impl->getModule().c_str()); - - pythonModule = PyImport_Import(pModuleName); - Py_DECREF(pModuleName); - } - - if (!pythonModule) - { - if(PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Failed to load module named " + impl->getModule() + " on path " + path; - throwException(SystemConfigurationException, msg.c_str()); - } - printPyObject("pythonModule",pythonModule); - } - - // ========== - // Destructor - // ========== - PythonServiceWrapper::~PythonServiceWrapper() - { - logentry(); - - Py_XDECREF(pythonClassInstance); - Py_XDECREF(pythonModule); - Py_Finalize(); - } - - // ====================================================================== - // newInstance: create a new class instance - // ====================================================================== - PyObject* PythonServiceWrapper::newInstance() - { - logentry(); - - PythonImplementation* impl = (PythonImplementation*)component->getType(); - string className = impl->getClass(); - - PyObject* pClassInstance = NULL; - if (pythonModule != NULL) - { - if(&className != NULL && className.size() > 0) - { - // We have a class name, so create an instance and use this to invoke the correct function - PyObject* pClass = PyObject_GetAttrString(pythonModule, (char*) className.c_str()); - - if(pClass == NULL) - { - if(PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Cannot find class named " + className + " in Python module"; - throwException(SystemConfigurationException, msg.c_str()); - } - - pClassInstance = PyInstance_New(pClass, NULL, NULL); - - if(pClassInstance == NULL || !PyInstance_Check(pClassInstance)) - { - if(PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Could not create new instance of class named " + className + " in Python module"; - throwException(ServiceInvocationException, msg.c_str()); - } - Py_XDECREF(pClass); - } - } - return pClassInstance; - } - - // ====================================================================== - // getInstance: get a class instance for this scope - // ====================================================================== - PyObject* PythonServiceWrapper::getInstance() - { - logentry(); - - PythonImplementation::Scope scope = implementation->getScope(); - if (scope == PythonImplementation::COMPOSITE) - { - if (!pythonClassInstance) - { - pythonClassInstance = newInstance(); - } - return pythonClassInstance; - } - else // (scope == PythonImplementation::STATELESS) - { - return newInstance(); - } - } - - // ====================================================================== - // releaseImplementation: release the implementation for this scope - // ====================================================================== - void PythonServiceWrapper::releaseInstance() - { - logentry(); - - PythonImplementation::Scope scope = implementation->getScope(); - if(scope == PythonImplementation::STATELESS) - { - // Delete the class instance if there is one - if(pythonClassInstance != NULL && PyInstance_Check(pythonClassInstance)) - { - Py_DECREF(pythonClassInstance); - pythonClassInstance = NULL; - } - - // Need to reload the module - PyObject* reloadedPythonModule = PyImport_ReloadModule(pythonModule); - - if(reloadedPythonModule != NULL) - { - // Get rid of old pythonModule and replace with the reloaded one - Py_DECREF(pythonModule); - pythonModule = reloadedPythonModule; - } - } - } - - // ====================================================================== - // invoke: wrapper call to service with setting the component context - // ====================================================================== - void PythonServiceWrapper::invoke(Operation& operation) - { - logentry(); - - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->setCurrentComponent(component); - - - // Load the references & properties into the module - addReferences(pythonModule); - addProperties(pythonModule); - - try - { - loginfo("Operation: %s", operation.getName().c_str()); - - PyObject* pFunc = NULL; - pythonClassInstance = getInstance(); - - if(pythonClassInstance != NULL && PyInstance_Check(pythonClassInstance)) - { - // Get the function from the instance - pFunc = PyObject_GetAttrString(pythonClassInstance, (char*) operation.getName().c_str()); - } - if(pFunc == NULL && pythonModule != NULL) - { - // Get the function directly from the module if it could not be got from an instance - pFunc = PyObject_GetAttrString(pythonModule, (char*) operation.getName().c_str()); - } - if(pFunc == NULL) - { - // Can't get the function from the class or module - string msg = "Python module or class instance has not been created"; - throwException(ServiceInvocationException, msg.c_str()); - } - - if (pFunc && PyCallable_Check(pFunc)) - { - PyObject* pArgs = PyTuple_New(operation.getNParms()); - PyObject* pKeywordsDict = PyDict_New(); - PyObject* pValue = NULL; - - // Load up the xml.etree.ElementTree module for dealing with SDO params and return values - PyObject* elementTreeModuleName = PyString_FromString("xml.etree.ElementTree"); - PyObject* elementTreeModule = PyImport_Import(elementTreeModuleName); - - if(elementTreeModule == NULL) - { - // pre-Python2.5? - try to get an installed elementtree package - elementTreeModuleName = PyString_FromString("elementtree.ElementTree"); - elementTreeModule = PyImport_Import(elementTreeModuleName); - } - if(elementTreeModule == NULL) - { - // Still null - throw a warning but carry on - user may not need XML - logwarning("Could not load Python ElementTree module - is it installed? SDO and XML will not be supported"); - } - - for(unsigned int i = 0; i < operation.getNParms(); i++) - { - const Operation::Parameter& parm = operation.getParameter(i); - switch(parm.getType()) - { - case Operation::BOOL: - { - if( *(bool*)parm.getValue()) - { - //boolean true - pValue = Py_True; - } - else - { - pValue = Py_False; - } - break; - } - case Operation::SHORT: - { - pValue = PyInt_FromLong(*(short*)parm.getValue()); - break; - } - case Operation::USHORT: - { - pValue = PyInt_FromLong(*(unsigned short*)parm.getValue()); - break; - } - case Operation::INT: - { - pValue = PyInt_FromLong(*(int*)parm.getValue()); - break; - } - case Operation::UINT: - { - pValue = PyInt_FromLong(*(unsigned int*)parm.getValue()); - break; - } - case Operation::LONG: - { - pValue = PyLong_FromLong(*(long*)parm.getValue()); - break; - } - case Operation::ULONG: - { - pValue = PyLong_FromUnsignedLong(*(unsigned long*)parm.getValue()); - break; - } - case Operation::FLOAT: - { - pValue = PyFloat_FromDouble(*(float*)parm.getValue()); - break; - } - case Operation::DOUBLE: - { - pValue = PyFloat_FromDouble(*(double*)parm.getValue()); - break; - } - case Operation::LONGDOUBLE: - { - pValue = PyFloat_FromDouble(*(long double*)parm.getValue()); - break; - } - case Operation::CHARS: - { - pValue = PyString_FromString(*(char**)parm.getValue()); - break; - } - case Operation::STRING: - { - pValue = PyString_FromString((*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - if(elementTreeModule != NULL) - { - DataObjectPtr dob = *(DataObjectPtr*)parm.getValue(); - - // Convert a DataObject to a xml.etree.ElementTree Element object - Composite* composite = component->getComposite(); - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - char* str = xmlHelper->save( - dob, - dob->getType().getURI(), - dob->getType().getName()); - - loginfo("Converting SDO DataObject to Python ElementTree: %s", str); - - // Get the xml.etree.ElementTree.XML function - PyObject* elementTreeXMLFunc = PyObject_GetAttrString(elementTreeModule, "XML"); - - // Call the XML() function with the XML string - pValue = PyObject_CallFunction(elementTreeXMLFunc, "s", str); - - Py_DECREF(elementTreeXMLFunc); - } - else - { - throwException(ServiceDataException, "Could not convert SDO DataObject to Python ElementTree as ElementTree module could not be loaded"); - } - break; - } - default: - throwException(ServiceDataException, "Operation parameter type not supported"); - } - - if (!pValue) - { - Py_DECREF(pArgs); - - if(PyErr_Occurred()) - { - PyErr_Print(); - } - - string msg = "Error converting parameter into Python type"; - throwException(ServiceDataException, msg.c_str()); - - } - //printPyObject("Param value", pValue); - - // If we have a param name, put it in the keyword args - if(parm.hasName()) - { - PyDict_SetItemString(pKeywordsDict, parm.getName().c_str(), pValue); - Py_DECREF(pValue); - } - else - { - /* pValue reference stolen here: */ - PyTuple_SetItem(pArgs, i, pValue); - } - } - - // Resize the args to the correct length - _PyTuple_Resize(&pArgs, operation.getNParms() - PyDict_Size(pKeywordsDict)); - - loginfo("Calling python func with %d args and %d keyword args", PyTuple_Size(pArgs), PyDict_Size(pKeywordsDict)); - - pValue = PyObject_Call(pFunc, pArgs, pKeywordsDict); - //printPyObject("Return value", pValue); - - Py_DECREF(pArgs); - if (pValue != NULL) - { - char buf[20]; - if(PyInt_Check(pValue) || PyLong_Check(pValue)) - { - long* data = new long; - if(PyInt_Check(pValue)) - { - loginfo("Int return value: %d", PyInt_AsLong(pValue)); - *data = PyInt_AsLong(pValue); - } - else - { - loginfo("Long return value: %l", PyLong_AsLong(pValue)); - *data = PyLong_AsLong(pValue); - } - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = (*data != 0); - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - sprintf(buf, "%d", *data); - *(char**)operation.getReturnValue() = buf; - break; - } - case Operation::STRING: - { - sprintf(buf, "%d", *data); - *(string*)operation.getReturnValue() = buf; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - } - else if(PyBool_Check(pValue)) - { - loginfo("Bool return value: %d", (pValue == Py_True)); - bool* data = new bool; - *data = (pValue == Py_True); - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = *data; - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - if(*data) - { - *(char**)operation.getReturnValue() = "true"; - } - else - { - *(char**)operation.getReturnValue() = "false"; - } - break; - } - case Operation::STRING: - { - if(*data) - { - *(string*)operation.getReturnValue() = "true"; - } - else - { - *(string*)operation.getReturnValue() = "false"; - } - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - } - else if(PyFloat_Check(pValue)) - { - loginfo("Float return value: %f", PyFloat_AsDouble(pValue)); - - double* data = new double; - *data = PyFloat_AsDouble(pValue); - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = (*data != 0.0); - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - sprintf(buf, "%f", *data); - *(char**)operation.getReturnValue() = buf; - break; - } - case Operation::STRING: - { - sprintf(buf, "%f", *data); - *(string*)operation.getReturnValue() = buf; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - } - else if(PyString_Check(pValue)) - { - loginfo("String return value: %s", PyString_AsString(pValue)); - const char** data = new const char*; - *data = PyString_AsString(pValue); - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - // If the string is empty or "0" or "false" set to false, otherwise true - if(strlen(*data) == 0 || strcmp(*data, "0") == 0 || strcmp(*data, "false") == 0) - { - *(bool*)operation.getReturnValue() = false; - } - else - { - *(bool*)operation.getReturnValue() = true; - } - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)atoi(*data); - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)atoi(*data); - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)atoi(*data); - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)atoi(*data); - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)atol(*data); - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)atol(*data); - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)atof(*data); - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)atof(*data); - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)atof(*data); - break; - } - case Operation::CHARS: - { - *(const char**)operation.getReturnValue() = *data; - break; - } - case Operation::STRING: - { - *(string*)operation.getReturnValue() = *data; - break; - } - default: - { - // The type is set as something else or has not been set - string* stringData = new string; - *stringData = *data; - operation.setReturnValue(stringData); - } - } - } - else - { - PyObject* pIsElement = Py_False; - - if(elementTreeModule != NULL) - { - // Get the xml.etree.ElementTree.iselement function - PyObject* elementTreeIsElementFunc = PyObject_GetAttrString(elementTreeModule, "iselement"); - - // Call the iselement() function with pValue to check it - pIsElement = PyObject_CallFunction(elementTreeIsElementFunc, "O", pValue); - Py_DECREF(elementTreeIsElementFunc); - } - - if(PyObject_IsTrue(pIsElement) == 1) - { - // pValue is an xml.etree.ElementTree.Element - convert to SDO - PyObject* elementTreeToStringFunc = PyObject_GetAttrString(elementTreeModule, "tostring"); - PyObject* pElemString = PyObject_CallFunction(elementTreeToStringFunc, "O", pValue); - char* data = PyString_AsString(pElemString); - - loginfo("Converting Python ElementTree to SDO DataObject: %s", data); - - Composite* composite = component->getComposite(); - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - XMLDocumentPtr xmlDoc = xmlHelper->load(data); - DataObjectPtr* dataObjectData = new DataObjectPtr; - if (xmlDoc != NULL) - { - *dataObjectData = xmlDoc->getRootDataObject(); - } - else - { - *dataObjectData = NULL; - } - - if (*dataObjectData != NULL) - { - operation.setReturnValue(dataObjectData); - } - else - { - string msg = "xml.etree.ElementTree.Element could not be converted to a DataObject"; - throwException(ServiceDataException, msg.c_str()); - } - - Py_DECREF(elementTreeToStringFunc); - Py_DECREF(pElemString); - } - else - { - PyObject* valueRepr = PyObject_Repr(pValue); - PyObject* valueType = PyObject_Type(pValue); - PyObject* valueTypeRepr = PyObject_Repr(valueType); - loginfo("Return value of unknown type (%s) has repr: %s", PyString_AsString(valueTypeRepr), PyString_AsString(valueRepr)); - Py_DECREF(valueTypeRepr); - Py_DECREF(valueType); - Py_DECREF(valueRepr); - } - - Py_DECREF(pIsElement); - } - - Py_DECREF(elementTreeModule); - Py_DECREF(elementTreeModuleName); - Py_DECREF(pValue); - } - else - { - Py_DECREF(pFunc); - Py_XDECREF(elementTreeModule); - Py_XDECREF(elementTreeModuleName); - - string msg = "Error whilst calling Python function "+operation.getName()+": "; - if(PyErr_Occurred()) - { - PyObject *pErrorType, *pErrorValue, *pErrorTraceback; - PyErr_Fetch(&pErrorType, &pErrorValue, &pErrorTraceback); - - if (pErrorType != NULL && pErrorValue != NULL) - { - PyObject* pErrorTypeStr = PyObject_Str(pErrorType); - PyObject* pErrorValueStr = PyObject_Str(pErrorValue); - msg += PyString_AsString(pErrorTypeStr); - msg += " : "; - msg += PyString_AsString(pErrorValueStr); - Py_DECREF(pErrorTypeStr); - Py_DECREF(pErrorValueStr); - } - else - { - msg += "No Python Error information provided"; - } - Py_XDECREF(pErrorType); - Py_XDECREF(pErrorValue); - Py_XDECREF(pErrorTraceback); - - PyErr_Print(); - } - - throwException(ServiceInvocationException, msg.c_str()); - } - } - else - { - if (PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Cannot find the operation named " + operation.getName() + " in the Python module"; - throwException(ServiceInvocationException, msg.c_str()); - } - Py_XDECREF(pFunc); - - } - catch (...) - { - releaseInstance(); - runtime->unsetCurrentComponent(); - throw; - } - releaseInstance(); - runtime->unsetCurrentComponent(); - } - - - // ========================================================================== - // Add any properties into the loaded implementation module as Python objects - // ========================================================================== - void PythonServiceWrapper::addProperties(PyObject* module) - { - logentry(); - - // Set all the configured properties - DataObjectPtr properties = component->getProperties(); - PropertyList pl = properties->getInstanceProperties(); - - for (unsigned int i = 0; i < pl.size(); i++) - { - if (properties->isSet(pl[i])) - { - string propName = pl[i].getName(); - string propValue = properties->getCString(pl[i]); - PyObject* property; - - if(pl[i].isMany()) - { - //TODO - deal with properties that are many - } - - switch(pl[i].getTypeEnum()) - { - case Type::BooleanType: - { - if(properties->getBoolean(pl[i])) - { - property = Py_True; - } - else - { - property = Py_False; - } - Py_INCREF(property); - break; - } - case Type::BigIntegerType: - case Type::BigDecimalType: - case Type::LongType: - { - property = PyLong_FromLongLong(properties->getLong(pl[i])); - break; - } - case Type::ShortType: - case Type::IntType: - { - property = PyInt_FromLong(properties->getInt(pl[i])); - break; - } - case Type::DoubleType: - case Type::FloatType: - { - property = PyFloat_FromDouble(properties->getDouble(pl[i])); - break; - } - case Type::DataObjectType: - { - // Serialize a DataObject and create a python string object from the XML - DataObjectPtr data = properties->getDataObject(pl[i]); - XMLHelperPtr helper = HelperProvider::getXMLHelper(properties->getDataFactory()); - string serializedData = helper->save(data, - data->getType().getURI(), - data->getType().getName()); - - loginfo("Converting SDO DataObject to Python ElementTree: %s", serializedData.c_str()); - - // Get the xml.etree.ElementTree.XML function - PyObject* elementTreeModuleName = PyString_FromString("xml.etree.ElementTree"); - PyObject* elementTreeModule = PyImport_Import(elementTreeModuleName); - PyObject* elementTreeXMLFunc = PyObject_GetAttrString(elementTreeModule, "XML"); - - // Call the XML() function with the XML string - property = PyObject_CallFunction(elementTreeXMLFunc, "s", serializedData.c_str()); - - Py_DECREF(elementTreeXMLFunc); - Py_DECREF(elementTreeModule); - Py_DECREF(elementTreeModuleName); - break; - } - case Type::CharacterType: - case Type::StringType: - case Type::TextType: - case Type::UriType: - default: - { - // For strings and by default create a python string object - property = PyString_FromString(propValue.c_str()); - break; - } - } - - int success = PyModule_AddObject(module, (char*)propName.c_str(), property); - - if(success == 0) - { - loginfo("Added property named %s with type %s and value %s to python module", propName.c_str(), pl[i].getType().getName(), propValue.c_str()); - } - else - { - logwarning("Failed to add property named %s to python module", propName.c_str()); - } - } - } - } - - - // ====================================================================== - // Add any references into the loaded implementation module as class instances that look like - // the classes defined in the interface.python xml - // ====================================================================== - void PythonServiceWrapper::addReferences(PyObject* module) - { - logentry(); - - // Import the TuscanySCA python-extension module - PyObject* pModuleName = PyString_FromString("sca_proxy"); - PyObject* sca_proxy_module = PyImport_Import(pModuleName); - Py_DECREF(pModuleName); - - if(!sca_proxy_module) - { - if(PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Failed to load the sca_proxy Python module - has it been successfully installed?\nReferences from Python components will not be supported"; - logwarning(msg.c_str()); - } - else - { - // Get the sca_proxy class - PyObject* sca_proxy_class = PyObject_GetAttrString(sca_proxy_module, "sca_proxy_class"); - - // Iterate through the references of the current component, adding - // each reference to the module - Component::REFERENCE_MAP references = component->getReferences(); - Component::REFERENCE_MAP::iterator pos; - for( pos = references.begin(); pos != references.end(); ++pos) - { - ReferenceType* referenceType = ((Reference*) pos->second)->getType(); - string referenceName = referenceType->getName(); - - PyObject* tuscanySCAArgs = PyTuple_New(2); - PyObject* refName = PyString_FromString(referenceType->getName().c_str()); - PyTuple_SetItem(tuscanySCAArgs, 0, refName); - Py_INCREF(Py_True); - PyTuple_SetItem(tuscanySCAArgs, 1, Py_True); - - // Create the instance of the TuscanySCAReference class - PyObject* sca_proxy_classInstance = PyInstance_New(sca_proxy_class, tuscanySCAArgs, NULL); - Py_DECREF(tuscanySCAArgs); - - int success = PyModule_AddObject(module, (char*)referenceName.c_str(), sca_proxy_classInstance); - - if(success == 0) - { - loginfo("Successfully added sca_proxy_class instance as %s to pythonModule", referenceName.c_str()); - } - else - { - logwarning("Failed to add sca_proxy_class instance as %s to pythonModule", referenceName.c_str()); - } - } - Py_DECREF(sca_proxy_module); - } - } - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h deleted file mode 100644 index fbf75b3223..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.h +++ /dev/null @@ -1,142 +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_python_pythonservicewrapper_h -#define tuscany_sca_python_pythonservicewrapper_h - - -// undefine _DEBUG so Python does not need it's deebug dll -#ifdef _DEBUG -#undef _DEBUG -#define _SCA_PYTHON_DEBUG -#endif -#include <Python.h> -#ifdef _SCA_PYTHON_DEBUG -#define _DEBUG -#endif - -#include "tuscany/sca/python/export.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/python/model/PythonImplementation.h" - - -namespace tuscany -{ - namespace sca - { - namespace python - { - class PythonInterface; - - /** - * 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 PythonServiceWrapper : public ServiceWrapper - { - public: - - /** - * Constructor. - * @param target The component service to which this wrapper refers. - */ - PythonServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PythonServiceWrapper(); - - /** - * 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. - */ - virtual void invoke(Operation& operation); - - - protected: - - /** - * Return the current instance of the python class. - * @return A pointer to an instance of the python class. - */ - virtual PyObject* getInstance(); - - /** - * Creates a new instance of the python class. - * @return A pointer to a new instance of the python class. - */ - virtual PyObject* newInstance(); - - /** - * Indicates that the current instance of the python module or class - * has been finished with. - */ - virtual void releaseInstance(); - - - private: - /** - * Holds a class instance if a classname is provided. - * Will be constructed each time if scope is set to STATELESS - */ - PyObject* pythonClassInstance; - - /** - * Holds the module - */ - PyObject* pythonModule; - - /** - * Adds references to the provided implementation module or class instance - */ - void addReferences(PyObject* module); - - /** - * Adds properties to the provided implementation module or class instance - */ - void addProperties(PyObject* module); - - /** - * The component to which this wrapper refers. - */ - tuscany::sca::model::Component* component; - - /** - * The component implementation - */ - PythonImplementation* implementation; - - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_pythonservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/export.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/export.h deleted file mode 100644 index b608a50711..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/export.h +++ /dev/null @@ -1,41 +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_python_export_h -#define tuscany_sca_python_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_PYTHON_EXPORTS -#define SCA_PYTHON_API __declspec(dllexport) -#else -#define SCA_PYTHON_API __declspec(dllimport) -#endif - -#else -#include <sys/time.h> -#include <inttypes.h> -#include <stdlib.h> -#define SCA_PYTHON_API -#endif - -#endif // tuscany_sca_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp deleted file mode 100644 index 235468eca9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.cpp +++ /dev/null @@ -1,131 +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/util/Logging.h" -#include "tuscany/sca/python/model/PythonImplementation.h" -#include "tuscany/sca/python/model/PythonServiceBinding.h" -#include "tuscany/sca/python/model/PythonReferenceBinding.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - - namespace python - { - - // Constructor - PythonImplementation::PythonImplementation( - Composite* composite, const string& module, const string& modulePath, const string& className, Scope scope) - : ComponentType(composite, modulePath + "/" + module), - module(module), modulePath(modulePath), className(className), scope(scope) - { - logentry(); - - // Create a default service for this componentType - ServiceType* defaultServiceType = new ServiceType(this, "", NULL, NULL); - addServiceType(defaultServiceType); - } - - PythonImplementation::~PythonImplementation() - { - logentry(); - } - - /** - * Overrides the findReferenceType method in ComponentType. - * This allows us to create references without needing a componentType file. - */ - ReferenceType* PythonImplementation::findReferenceType(const string& referenceName) - { - logentry(); - - ReferenceType* refType = ComponentType::findReferenceType(referenceName); - if(!refType) - { - // The reference has not yet been created - try creating it - refType = new ReferenceType(this, referenceName, NULL, NULL, ReferenceType::ONE_ONE); - addReferenceType(refType); - } - - return refType; - } - - /** - * Overrides the findPropertyType method in ComponentType. - * This allows us to create properties without needing a componentType file. - */ - const commonj::sdo::Property* PythonImplementation::findPropertyType(const string& propertyName) - { - logentry(); - - const commonj::sdo::Property* prop = ComponentType::findPropertyType(propertyName); - if(!prop) - { - ComponentType::addPropertyType(propertyName, "http://www.w3.org/2001/XMLSchema#string", false, NULL); - // Just added it so it should now be available - prop = ComponentType::findPropertyType(propertyName); - loginfo("Added string property named %s to Python component", propertyName.c_str()); - } - - return prop; - } - - void PythonImplementation::initializeComponent(Component* component) - { - logentry(); - ComponentType::initializeComponent(component); - - // Create Python bindings for all the services - const Component::SERVICE_MAP& services = component->getServices(); - Component::SERVICE_MAP::const_iterator iter = services.begin(); - for (unsigned int i=0; i< services.size(); i++) - { - Service *service = iter->second; - PythonServiceBinding* binding = new PythonServiceBinding(service); - service->setBinding(binding); - iter++; - } - - // Create Python bindings for all the references - const Component::REFERENCE_MAP& references = component->getReferences(); - Component::REFERENCE_MAP::const_iterator refiter = references.begin(); - for (int ri=0; ri< references.size(); ri++) - { - Reference *reference = refiter->second; - PythonReferenceBinding* binding = new PythonReferenceBinding(reference); - reference->setBinding(binding); - refiter++; - } - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.h deleted file mode 100644 index 75b14529bf..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonImplementation.h +++ /dev/null @@ -1,145 +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_python_model_pythonimplementation_h -#define tuscany_sca_python_model_pythonimplementation_h - -#include <string> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/model/ComponentType.h" - - -namespace tuscany -{ - namespace sca - { - namespace python - { - /** - * Holds information about an SCA implementation written in Python - */ - class PythonImplementation : public tuscany::sca::model::ComponentType - { - - public: - /** - * Scope of the component implementation. - */ - enum Scope - { - COMPOSITE, - STATELESS - }; - - /** - * Constructor. - * @param composite The composite containing this implementation. - * @param module Name of the module. - * @param modulePath Path to the module (could be a blank string - * if this is not specified). - * @param className Name of the class in the module (could be a blank string - * if this is not specified). - */ - PythonImplementation(tuscany::sca::model::Composite* composite, - const std::string& module, const std::string& modulePath, const std::string& className, - Scope scope); - - /** - * Destructor - */ - virtual ~PythonImplementation(); - - /** - * Initialize a component of this type. - * @param component The component to initialize. - */ - virtual void initializeComponent(tuscany::sca::model::Component* component); - - /** - * Override the ComponentType::findReferenceType method - * to allow Python components to be defined without requiring - * a componentType side-file - */ - virtual tuscany::sca::model::ReferenceType* findReferenceType(const std::string& referenceName); - - /** - * Override the ComponentType::findPropertyType method - * to allow Python components to be defined without requiring - * a componentType side-file - */ - virtual const commonj::sdo::Property* findPropertyType(const std::string& propertyName); - - - /** - * Returns the name of the module. - * @return The name of the module. - */ - const std::string& getModule() const { return module; } - - /** - * Get the header path. - * @return The pathe element of the header. - */ - const std::string& getModulePath() const { return modulePath; } - - /** - * Get the name of the class. - * @return The class name if specified. - */ - const std::string& getClass() const { return className; } - - /** - * Returns the implementation scope - */ - Scope getScope() const { return scope; } - - private: - - /** - * Name of the module. - */ - std::string module; - - /** - * Path to the module. - */ - std::string modulePath; - - /** - * Name of the class in the header file declaring the implementation. - * May be an empty string if not set in the SCDL file. - */ - std::string className; - - /** - * The implementation scope - */ - Scope scope; - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_model_pythonimplementation_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp deleted file mode 100644 index 3c30f363b8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.cpp +++ /dev/null @@ -1,53 +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/util/Logging.h" -#include "tuscany/sca/python/export.h" -#include "tuscany/sca/python/model/PythonInterface.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - namespace python - { - const string PythonInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#PythonInterface"); - - // Constructor - PythonInterface::PythonInterface( - bool remotable, - bool conversational) - : Interface(remotable, conversational) - { - logentry(); - } - - PythonInterface::~PythonInterface() - { - logentry(); - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h deleted file mode 100644 index cfc2ca8914..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonInterface.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - - -#ifndef tuscany_sca_python_model_pythoninterface_h -#define tuscany_sca_python_model_pythoninterface_h - -#include <string> - -#include "tuscany/sca/python/export.h" -#include "tuscany/sca/model/Interface.h" - -namespace tuscany -{ - namespace sca - { - namespace python - { - /** - * Holds information about an interface described using a Python - * header file. - */ - class PythonInterface : public tuscany::sca::model::Interface - { - - public: - /** - * Constuctor. - * @param scope The scope of the interface (stateless or composite). - * @param remotable True if the interface is remotable. - */ - PythonInterface( - bool remotable, - bool conversational); - - /** - * Destructor. - */ - virtual ~PythonInterface(); - - /** - * return the QName of the schema type for this interface type - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp") - */ - const std::string& getInterfaceTypeQName() { return typeQName; }; - - /** - * The QName of the schema type for this interface type. - */ - SCA_PYTHON_API static const std::string typeQName; - - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_model_pythoninterface_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp deleted file mode 100644 index 958a3a86ac..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.cpp +++ /dev/null @@ -1,61 +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/util/Logging.h" -#include "tuscany/sca/python/model/PythonReferenceBinding.h" -#include "tuscany/sca/python/PythonServiceProxy.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - - // Constructor - PythonReferenceBinding::PythonReferenceBinding(Reference* reference) - : ReferenceBinding(reference, ""), serviceProxy(NULL) - { - } - - // Destructor - PythonReferenceBinding::~PythonReferenceBinding() - { - } - - ServiceProxy* PythonReferenceBinding::getServiceProxy() - { - return serviceProxy; - } - - void PythonReferenceBinding::configure(ServiceBinding* binding) - { - setTargetServiceBinding(binding); - - serviceProxy = new PythonServiceProxy(getReference()); - } - - } // End namespace python - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h deleted file mode 100644 index 65028f4613..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonReferenceBinding.h +++ /dev/null @@ -1,82 +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_python_model_pythonreferencebinding_h -#define tuscany_sca_python_model_pythonreferencebinding_h - -#include <string> - -#include "tuscany/sca/model/ReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace python - { - /** - * Information about a Python service binding for service or a reference. - */ - class PythonReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - */ - PythonReferenceBinding(tuscany::sca::model::Reference* reference); - - /** - * Destructor. - */ - virtual ~PythonReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PythonImplementationBinding"; }; - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual ServiceProxy* getServiceProxy(); - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - private: - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_model_pythonreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp deleted file mode 100644 index 061aeb7515..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.cpp +++ /dev/null @@ -1,58 +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/util/Logging.h" -#include "tuscany/sca/python/model/PythonServiceBinding.h" -#include "tuscany/sca/python/PythonServiceWrapper.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace python - { - - // Constructor - PythonServiceBinding::PythonServiceBinding(Service* service) - : ServiceBinding(service, "") - { - logentry(); - serviceWrapper = new PythonServiceWrapper(service); - } - - // Destructor - PythonServiceBinding::~PythonServiceBinding() - { - logentry(); - } - - ServiceWrapper* PythonServiceBinding::getServiceWrapper() - { - logentry(); - return (ServiceWrapper*)serviceWrapper; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.h deleted file mode 100644 index 9a803cdced..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/model/PythonServiceBinding.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_python_model_pythonservicebinding_h -#define tuscany_sca_python_model_pythonservicebinding_h - -#include <string> - -#include "tuscany/sca/model/ServiceBinding.h" - -namespace tuscany -{ - namespace sca - { - namespace python - { - /** - * Information about a Python service binding for service or a reference. - */ - class PythonServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param port The definition of the port to which the entrypoint - * or external service is to be bound. This is of the form - * "namespace"#endpoint("service"/"port") - */ - PythonServiceBinding(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~PythonServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PythonImplementationBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - virtual ServiceWrapper* getServiceWrapper(); - - private: - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace python - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_python_model_pythonservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp deleted file mode 100644 index dc2c7bfe22..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_module.cpp +++ /dev/null @@ -1,540 +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 <string> -#include <iostream> -#include <sstream> - -// undefine _DEBUG so Python does not need it's debug dll -#ifdef _DEBUG -#undef _DEBUG -#define _SCA_PYTHON_DEBUG -#endif -#include <Python.h> -#ifdef _SCA_PYTHON_DEBUG -#define _DEBUG -#endif - -#include "commonj/sdo/SDO.h" - -#include "PythonServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/core/Operation.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -static PyObject* scaError; - -/** -* Prints out PyObject and dir(PyObject) -* for debugging purposes -*/ -static void printPyObject(char* prefix, char* name, PyObject* pObj) -{ - PyObject* pObjRepr = PyObject_Repr(pObj); - PyTypeObject* type = pObj->ob_type; - loginfo("%s printPyObject (%s) %s = %s", prefix, type->tp_name, name, PyString_AsString(pObjRepr)); - Py_XDECREF(pObjRepr); - - if(pObj != NULL) - { - PyObject* pObjDir = PyObject_Dir(pObj); - PyObject* pObjDirRepr = PyObject_Repr(pObjDir); - loginfo("%s printPyObject dir(%s): %s", prefix, name, PyString_AsString(pObjDirRepr)); - Py_DECREF(pObjDirRepr); - Py_DECREF(pObjDir); - } -} - -static PyObject* sca_locateservice(PyObject *self, PyObject *args) -{ - logentry(); - - // Get the service name - PyObject* pServiceName = PyTuple_GetItem(args, 0); - - // Import the SCA python-extension module - PyObject* pModuleName = PyString_FromString("sca_proxy"); - PyObject* sca_proxy_module = PyImport_Import(pModuleName); - Py_DECREF(pModuleName); - - if(!sca_proxy_module) - { - if(PyErr_Occurred()) - { - PyErr_Print(); - } - string msg = "Failed to load the sca_proxy Python module - has it been successfully installed?\nReferences from Python components will not be supported"; - logerror(msg.c_str()); - } - else - { - // Get the sca_proxy class - PyObject* sca_proxy_class = PyObject_GetAttrString(sca_proxy_module, "sca_proxy_class"); - - PyObject* scaArgs = PyTuple_New(2); - PyTuple_SetItem(scaArgs, 0, pServiceName); - Py_INCREF(Py_True); - PyTuple_SetItem(scaArgs, 1, Py_False); - - // Create the instance of the scaReference class - PyObject* sca_proxy_classInstance = PyInstance_New(sca_proxy_class, scaArgs, NULL); - Py_DECREF(scaArgs); - - return sca_proxy_classInstance; - } - - Py_INCREF(Py_None); - return Py_None; -} - - -static tuscany::sca::python::PythonServiceProxy* getServiceProxy(PyObject *args) -{ - logentry(); - - tuscany::sca::python::PythonServiceProxy* serviceProxy = NULL; - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - - // The first argument holds the name - string name; - PyObject* pName = PyTuple_GetItem(args, 0); - if(pName && PyString_Check(pName)) - { - name = PyString_AsString(pName); - } - if(name.size() > 0) - { - loginfo("Service/Reference name is %s", name.c_str()); - } - else - { - string msg = "Service/Reference name has not been set"; - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - - // The second argument is a boolean - PyObject* isReference = PyTuple_GetItem(args, 1); - - // Get the serviceProxy from the reference or service name provided - if(PyObject_IsTrue(isReference)) - { - Component* component = runtime->getCurrentComponent(); - Reference* ref = component->findReference(name); - if(!ref) - { - string msg = "Could not find the reference: "+name; - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - - return NULL; - } - - ReferenceBinding* refBinding = ref->getBinding(); - serviceProxy = (tuscany::sca::python::PythonServiceProxy*) refBinding->getServiceProxy(); - } - else - { - Component* component = runtime->getDefaultComponent(); - Composite* composite = (Composite*)component->getType(); - Service* service = composite->findComponentService(name); - - if(!service) - { - string msg = "Could not find service: "+name; - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - - serviceProxy = new tuscany::sca::python::PythonServiceProxy(service); - } - - return serviceProxy; -} - - -static PyObject* sca_invoke(PyObject *self, PyObject *args) -{ - logentry(); - - tuscany::sca::python::PythonServiceProxy* pythonServiceProxy = getServiceProxy(args); - if(!pythonServiceProxy) - { - return NULL; - } - - // Get the component from the reference or service provided - Component* component = NULL; - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - - PyObject* isReference = PyTuple_GetItem(args, 1); - if(PyObject_IsTrue(isReference)) - { - component = runtime->getCurrentComponent(); - } - else - { - component = runtime->getDefaultComponent(); - } - - // Get the name of the operation to invoke - string operationName; - PyObject* opName = PyTuple_GetItem(args, 2); - if(opName && PyString_Check(opName)) - { - operationName = PyString_AsString(opName); - } - - if(operationName.size() > 0) - { - loginfo("sca_invoke Operation name: %s", operationName.c_str()); - } - else - { - string msg = "Operation name has not been set"; - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - - // Create the Operation object - Operation operation(operationName.c_str()); - - // Load up the xml.etree.ElementTree module for dealing with SDO params and return values - PyObject* elementTreeModuleName = PyString_FromString("xml.etree.ElementTree"); - PyObject* elementTreeModule = PyImport_Import(elementTreeModuleName); - - if(elementTreeModule == NULL) - { - // pre-Python2.5? - try to get an installed elementtree package - elementTreeModuleName = PyString_FromString("elementtree.ElementTree"); - elementTreeModule = PyImport_Import(elementTreeModuleName); - } - if(elementTreeModule == NULL) - { - // Still null - throw a warning but carry on - user may not need XML - logwarning("Could not load Python ElementTree module - is it installed? SDO and XML will not be supported"); - } - - // Parameters are the fourth argument - PyObject* paramTuple = PyTuple_GetItem(args, 3); - unsigned int numberOfArgs = (unsigned int) PyTuple_Size(paramTuple); - loginfo("sca_invoke %d arg parameters supplied", numberOfArgs); - - // Keyword parameters (AKA named arguments) are the fifth argument - PyObject* keywordParamDict = PyTuple_GetItem(args, 4); - loginfo("sca_invoke %d keyword parameters supplied", PyDict_Size(keywordParamDict)); - - PyObject* paramKeys = PyDict_Keys(keywordParamDict); - - // Go through all the supplied parameters (args and keyword args) - for(unsigned int i=0; i < (numberOfArgs + PyList_Size(paramKeys)); i++) - { - string* paramName; - PyObject* param; - - if(i < PyTuple_Size(paramTuple)) - { - param = PyTuple_GetItem(paramTuple, i); - paramName = new string(); - } - else - { - PyObject* key = PyList_GetItem(paramKeys, i-numberOfArgs); - param = PyDict_GetItem(keywordParamDict, key); - paramName = new string(PyString_AsString(key)); - } - - if(PyInt_Check(param)) - { - loginfo("Int param %d %s: %d", i, (*paramName).c_str(), PyInt_AsLong(param)); - long* intData = new long; - *intData = PyInt_AsLong(param); - operation.addParameter(*paramName, intData); - } - else if(PyBool_Check(param)) - { - loginfo("Bool param %d %s: %d", i, (*paramName).c_str(), (param == Py_True)); - bool* boolData = new bool; - *boolData = (param == Py_True); - operation.addParameter(*paramName, boolData); - } - else if(PyLong_Check(param)) - { - loginfo("Long param %d %s: %l", i, (*paramName).c_str(), PyLong_AsLong(param)); - long* longData = new long; - *longData = PyLong_AsLong(param); - operation.addParameter(*paramName, longData); - } - else if(PyFloat_Check(param)) - { - loginfo("Float param %d %s: %f", i, (*paramName).c_str(), PyFloat_AsDouble(param)); - double* doubleData = new double; - *doubleData = PyFloat_AsDouble(param); - operation.addParameter(*paramName, doubleData); - } - else if(PyString_Check(param)) - { - loginfo("String param %d %s: %s", i, (*paramName).c_str(), PyString_AsString(param)); - const char** stringData = new const char*; - *stringData = PyString_AsString(param); - operation.addParameter(*paramName, stringData); - } - else - { - PyObject* pIsElement = Py_False; - if(elementTreeModule != NULL) - { - // Get the xml.etree.ElementTree.iselement function - PyObject* elementTreeIsElementFunc = PyObject_GetAttrString(elementTreeModule, "iselement"); - - // Call the iselement() function with pValue to check it - pIsElement = PyObject_CallFunction(elementTreeIsElementFunc, "O", param); - } - - if(PyObject_IsTrue(pIsElement) == 1) - { - // pValue is an xml.etree.ElementTree.Element - convert to SDO - PyObject* elementTreeToStringFunc = PyObject_GetAttrString(elementTreeModule, "tostring"); - PyObject* pElemString = PyObject_CallFunction(elementTreeToStringFunc, "O", param); - char* data = PyString_AsString(pElemString); - loginfo("SDO param %d %s: %s", i, (*paramName).c_str(), data); - - loginfo("Converting Python ElementTree to SDO DataObject: %s", data); - - Composite* composite = component->getComposite(); - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - XMLDocumentPtr xmlDoc = xmlHelper->load(data); - - DataObjectPtr* dataObjectData = new DataObjectPtr; - if (xmlDoc != NULL) - { - *dataObjectData = xmlDoc->getRootDataObject(); - } - else - { - *dataObjectData = NULL; - } - if (*dataObjectData != NULL) - { - operation.addParameter(*paramName, dataObjectData); - } - else - { - string msg = "xml.etree.ElementTree.Element could not be converted to a DataObject"; - logerror(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - Py_DECREF(elementTreeToStringFunc); - Py_DECREF(pElemString); - } - else - { - - PyObject* paramRepr = PyObject_Repr(param); - PyObject* paramType = PyObject_Type(param); - PyObject* paramTypeRepr = PyObject_Repr(paramType); - - string msg = "sca_invoke Param "; - msg += i; - msg += "is of unknown type ("; - msg += PyString_AsString(paramTypeRepr); - msg += ") and has repr: "; - msg += PyString_AsString(paramRepr); - - logerror(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - - Py_DECREF(paramTypeRepr); - Py_DECREF(paramType); - Py_DECREF(paramRepr); - - return NULL; - } - } - } - - PyObject* returnValue = NULL; - - try - { - // Invoke the wired service - pythonServiceProxy->invokeService(operation); - } - catch(TuscanyRuntimeException& ex) - { - string msg = "Exception whilst invoking the "; - msg += operationName.c_str(); - msg += " operation on an SCA service/reference: "; - msg += ex.getEClassName(); - msg += ": "; - msg += ex.getMessageText(); - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - catch(...) - { - string msg = "Exception whilst invoking the "; - msg += operationName.c_str(); - msg += " operation on an SCA service/reference"; - - logwarning(msg.c_str()); - PyErr_SetString(scaError, msg.c_str()); - return NULL; - } - - - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - if(*(bool*)operation.getReturnValue()) - { - returnValue = Py_True; - } - else - { - returnValue = Py_False; - } - break; - } - case Operation::SHORT: - { - returnValue = PyInt_FromLong(*(short*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - returnValue = PyLong_FromLong(*(long*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - returnValue = PyInt_FromLong(*(unsigned short*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - returnValue = PyLong_FromLong(*(unsigned long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - returnValue = PyFloat_FromDouble(*(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - returnValue = PyFloat_FromDouble(*(double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - returnValue = PyFloat_FromDouble(*(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - returnValue = PyString_FromString(*(char**)operation.getReturnValue()); - break; - } - case Operation::STRING: - { - returnValue = PyString_FromString((*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - if(elementTreeModule != NULL) - { - DataObjectPtr dob = *(DataObjectPtr*)operation.getReturnValue(); - - // Convert a DataObject to a xml.etree.ElementTree Element object - Composite* composite = component->getComposite(); - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - char* str = xmlHelper->save( - dob, - dob->getType().getURI(), - dob->getType().getName()); - - loginfo("Converting SDO DataObject to Python ElementTree: %s", str); - - // Get the xml.etree.ElementTree.XML function - PyObject* elementTreeXMLFunc = PyObject_GetAttrString(elementTreeModule, "XML"); - - // Call the XML() function with the XML string - returnValue = PyObject_CallFunction(elementTreeXMLFunc, "s", str); - - Py_DECREF(elementTreeXMLFunc); - } - else - { - logwarning("Could not convert SDO DataObject to Python ElementTree as ElementTree module could not be loaded. Returning NONE"); - Py_INCREF(Py_None); - returnValue = Py_None; - } - break; - } - default: - { - Py_INCREF(Py_None); - returnValue = Py_None; - } - - } - - Py_XDECREF(elementTreeModuleName); - Py_XDECREF(elementTreeModule); - - return returnValue; -} -static PyMethodDef ModuleMethods[] = -{ - {"locateservice", (PyCFunction) sca_locateservice, METH_VARARGS, "Locates an SCA service & returns an sca_proxy_class instance"}, - {"invoke", (PyCFunction) sca_invoke, METH_VARARGS, "Invoke an operation on an SCA service or reference"}, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -PyMODINIT_FUNC initsca(void) -{ - logentry(); - - // Create a new module - PyObject* module = Py_InitModule("sca", ModuleMethods); - - scaError = PyErr_NewException("sca.error", NULL, NULL); - Py_INCREF(scaError); - PyModule_AddObject(module, "error", scaError); -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_proxy.py b/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_proxy.py deleted file mode 100644 index 92a224275e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/src/tuscany/sca/python/sca_proxy.py +++ /dev/null @@ -1,57 +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.
-#
-#
-#
-#
-# This Python code is used in the SCA package and
-# provides the proxy objects to a Python SCA component or SCA
-# client.
-#
-# This is done by overloading the __getattr__ method which makes
-# calls to myProxy.anyMethod go to __getattr__ which will return
-# the invokeFunction defined inside the invoke method
-
-import sca
-
-class sca_proxy_class:
-
- sca_proxy_name = ''
- sca_proxy_is_reference = 1
-
- def __init__(self, name, isReference):
- self.sca_proxy_name = name
- self.sca_proxy_is_reference = isReference
- return
-
- def invoke(self, operationName):
-
- def invokeFunction(*args, **kwargs):
- # Pass the args and keywords in to the invoke method as arguments
- return sca.invoke(self.sca_proxy_name, self.sca_proxy_is_reference, operationName, args, kwargs)
-
- return invokeFunction
-
- def __getattr__(self, operationName):
- return self.invoke(operationName)
-
- def __str__(self):
- return '<sca_proxy.sca_proxy_class instance for ' + self.sca_proxy_name + '>'
-
- def __repr__(self):
- return '<sca_proxy.sca_proxy_class instance for ' + self.sca_proxy_name + '>'
-
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-implementation-python.xsd b/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-implementation-python.xsd deleted file mode 100644 index 5730e66116..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-implementation-python.xsd +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="implementation.python" type="sca:PythonImplementation" substitutionGroup="sca:implementation"/> - <complexType name="PythonImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="module" type="NCName" use="required"/> - <attribute name="path" type="NCName" use="optional"/> - <attribute name="class" type="Name" use="optional"/> - <attribute name="scope" type="sca:PythonImplementationScope" use="optional" /> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - - <simpleType name="PythonImplementationScope"> - <restriction base="string"> - <enumeration value="stateless" /> - <enumeration value="composite" /> - </restriction> - </simpleType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-interface-python.xsd b/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-interface-python.xsd deleted file mode 100644 index 1ce24b7249..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/python/xsd/sca-interface-python.xsd +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="interface.python" type="sca:PythonInterface" substitutionGroup="sca:interface"/> - <complexType name="PythonInterface"> - <complexContent> - <extension base="sca:Interface"> - <sequence> - <element name="operation" type="sca:PythonOperation" minOccurs="0" maxOccurs="unbounded" /> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="remotable" type="boolean" use="optional" /> - <attribute name="conversational" type="boolean" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> - - <complexType name="PythonOperation"> - <complexContent> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="name" type="string" use="required" /> - <attribute name="returnType" type="sca:PythonReturnTypes" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </complexContent> - </complexType> - - <simpleType name="PythonReturnTypes"> - <restriction base="string"> - <enumeration value="string" /> - <enumeration value="int" /> - <enumeration value="long" /> - <enumeration value="boolean" /> - <enumeration value="float" /> - <enumeration value="other" /> - </restriction> - </simpleType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/Makefile.am deleted file mode 100644 index 742a8152ad..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -SUBDIRS = interface reference service -datadir=$(prefix)/extensions/rest - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/Makefile.am deleted file mode 100644 index f963effea2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/Makefile.am deleted file mode 100644 index a2b7ac74e4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -libdir=$(prefix)/extensions/rest/interface/lib -lib_LTLIBRARIES = libtuscany_sca_rest_interface.la - -noinst_HEADERS = tuscany/sca/rest/*.h tuscany/sca/rest/model/*.h - -libtuscany_sca_rest_interface_la_SOURCES = \ -tuscany/sca/rest/RESTInterfaceExtension.cpp \ -tuscany/sca/rest/model/RESTInterface.cpp - -libtuscany_sca_rest_interface_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include - -moduledir=$(prefix)/extensions/rest/interface/module -extension = libtuscany_sca_rest_interface$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp deleted file mode 100644 index c69febf39a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.cpp +++ /dev/null @@ -1,85 +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/rest/RESTInterfaceExtension.h" -#include "tuscany/sca/rest/model/RESTInterface.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_rest_interface_initialize() - { - tuscany::sca::rest::RESTInterfaceExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace rest - { - // =================================================================== - // Constructor for the RESTInterfaceExtension class. - // =================================================================== - RESTInterfaceExtension::RESTInterfaceExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the RESTInterfaceExtension class. - // =================================================================== - RESTInterfaceExtension::~RESTInterfaceExtension() - { - logentry(); - } - - const string RESTInterfaceExtension::extensionName("rest"); - const string RESTInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTInterface"); - - // =================================================================== - // loadModelElement - load the info from interface.rest - // =================================================================== - tuscany::sca::model::Interface* RESTInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface) - { - logentry(); - - return new RESTInterface(); - } - - void RESTInterfaceExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerInterfaceExtension(new RESTInterfaceExtension()); - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h deleted file mode 100644 index de61ee5751..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/RESTInterfaceExtension.h +++ /dev/null @@ -1,76 +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_rest_restinterfaceextension_h -#define tuscany_sca_rest_restinterfaceextension_h - -#include "tuscany/sca/extension/InterfaceExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - class RESTInterfaceExtension : public InterfaceExtension - { - public: - /** - * Default constructor - */ - RESTInterfaceExtension(); - - /** - * Destructor - */ - virtual ~RESTInterfaceExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema type for this interface extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.rest") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::Interface* getInterface( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlInterface); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_rest_restinterfaceextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/exportinterface.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/exportinterface.h deleted file mode 100644 index f3636f0d39..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/exportinterface.h +++ /dev/null @@ -1,38 +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_rest_exportinterface_h -#define tuscany_sca_rest_exportinterface_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_REST_INTERFACE_EXPORTS -#define SCA_REST_INTERFACE_API __declspec(dllexport) -#else -#define SCA_REST_INTERFACE_API __declspec(dllimport) -#endif - -#else -#define SCA_REST_INTERFACE_API -#endif - -#endif // tuscany_sca_rest_exportinterface_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.cpp deleted file mode 100644 index 34feda2049..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.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/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/rest/model/RESTInterface.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - const string RESTInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTInterface"); - - // Constructor - RESTInterface::RESTInterface() - : Interface(true, false) - { - logentry(); - } - - RESTInterface::~RESTInterface() - { - logentry(); - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h deleted file mode 100644 index 88aacecc16..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/interface/src/tuscany/sca/rest/model/RESTInterface.h +++ /dev/null @@ -1,80 +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_rest_model_restinterface_h -#define tuscany_sca_rest_model_restinterface_h - -#include <string> - -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/rest/exportinterface.h" - - -namespace tuscany -{ - namespace sca - { - namespace rest - { - /** - * Holds information about a REST interface - */ - class RESTInterface : public tuscany::sca::model::Interface - { - - public: - /** - * Constuctor. - * @param header Name of the header file containing the class that - * describes the interface. - * @param className Name of the class in the header file that - * describes the interface. - * @param scope The scope of the interface (stateless or composite). - * @param remotable True if the interface is remotable. - */ - RESTInterface(); - - /** - * Destructor. - */ - virtual ~RESTInterface(); - - /** - * return the QName of the schema type for this interface type - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.rest") - */ - virtual const std::string& getInterfaceTypeQName() { return typeQName; }; - - /** - * The QName of the schema type for this interface type. - */ - SCA_REST_INTERFACE_API static const std::string typeQName; - - private: - - }; - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_rest_model_restinterface_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/Makefile.am deleted file mode 100644 index 2a0247f16f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = curl
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/Makefile.am deleted file mode 100644 index f963effea2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/Makefile.am deleted file mode 100644 index f6e6c28b55..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -libdir=$(prefix)/extensions/rest/reference/lib -lib_LTLIBRARIES = libtuscany_sca_rest_reference.la - -noinst_HEADERS = tuscany/sca/rest/*.h tuscany/sca/rest/model/*.h - -libtuscany_sca_rest_reference_la_SOURCES = \ -tuscany/sca/rest/RESTServiceBindingExtension.cpp \ -tuscany/sca/rest/model/RESTServiceBinding.cpp \ -tuscany/sca/rest/RESTServiceWrapper.cpp - -libtuscany_sca_rest_reference_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(top_builddir)/runtime/extensions/rest/interface/src -ltuscany_sca_rest_interface \ - -L${CURL_LIB} -lcurl - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I$(top_builddir)/runtime/extensions/rest/interface/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${CURL_INCLUDE} - -moduledir=$(prefix)/extensions/rest/reference/module -extension = libtuscany_sca_rest_reference$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp deleted file mode 100644 index f8eb9ad05c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.cpp +++ /dev/null @@ -1,89 +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. -*/ - -#include "RESTServiceBindingExtension.h" -#include "model/RESTServiceBinding.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_rest_reference_initialize() - { - tuscany::sca::rest::RESTServiceBindingExtension::initialize(); - } -} - - -namespace tuscany -{ - namespace sca - { - namespace rest - { - // =================================================================== - // Constructor for the RESTServiceBinding class. - // =================================================================== - RESTServiceBindingExtension::RESTServiceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the RESTServiceBindingExtension class. - // =================================================================== - RESTServiceBindingExtension::~RESTServiceBindingExtension() - { - logentry(); - } - - const string RESTServiceBindingExtension::extensionName("rest"); - const string RESTServiceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTBinding"); - - - // =================================================================== - // loadModelElement - load the info from binding.rest - // =================================================================== - ServiceBinding* RESTServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding) - { - string uri = scdlBinding->getCString("uri"); - - RESTServiceBinding* serviceBinding = new RESTServiceBinding(service, uri); - - return serviceBinding; - } - - void RESTServiceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerServiceBindingExtension(new RESTServiceBindingExtension()); - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h deleted file mode 100644 index ad1d861d95..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceBindingExtension.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef tuscany_sca_extension_rest_restservicebindingextension_h -#define tuscany_sca_extension_rest_restservicebindingextension_h - -#include "tuscany/sca/extension/ServiceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - class RESTServiceBindingExtension : public ServiceBindingExtension - { - public: - /** - * Default constructor - */ - RESTServiceBindingExtension(); - - /** - * Destructor - */ - virtual ~RESTServiceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.rest") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ServiceBinding* getServiceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Service* service, - commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif //tuscany_sca_extension_rest_restservicebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp deleted file mode 100644 index e28e7976e8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.cpp +++ /dev/null @@ -1,1225 +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$ */ -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4091) -#endif - -#include <curl/curl.h> -#include <curl/types.h> -#include <curl/easy.h> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/SDOUtils.h" -#include "RESTServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/CompositeReference.h" -#include "model/RESTServiceBinding.h" -#include "tuscany/sca/rest/model/RESTInterface.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - class ResponseChunk { - public: - ResponseChunk() : memory(NULL), size(0) - { - } - - ~ResponseChunk() - { - if (memory) - { - free(memory); - } - } - - char *memory; - int size; - }; - - class RequestChunk { - public: - RequestChunk() : memory(NULL), size(0), read(0) - { - } - - ~RequestChunk() - { - } - - const char *memory; - int size; - int read; - }; - - class HeaderChunk { - public: - HeaderChunk() : location("") - { - } - - ~HeaderChunk() - { - } - - string location; - }; - - size_t write_callback(void *ptr, size_t size, size_t nmemb, void *data) - { - int realsize = size * nmemb; - ResponseChunk *mem = (ResponseChunk *)data; - - if (mem->memory != NULL) - { - mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1); - } - else - { - mem->memory = (char *)malloc(mem->size + realsize + 1); - } - memcpy(&(mem->memory[mem->size]), ptr, realsize); - mem->size += realsize; - mem->memory[mem->size] = 0; - return realsize; - } - - static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *data) - { - int realsize = size * nmemb; - RequestChunk *mem = (RequestChunk *)data; - - if (realsize > mem->size - mem->read) - { - realsize = mem->size - mem->read; - } - if (realsize != 0) - { - memcpy(ptr, &(mem->memory[mem->read]), realsize); - mem->read += realsize; - } - return realsize; - } - - size_t header_callback(void *ptr, size_t size, size_t nmemb, void *data) - { - int realsize = size * nmemb; - HeaderChunk* mem = (HeaderChunk*)data; - - char* str = new char[realsize + 1]; - memcpy(str, ptr, realsize); - str[realsize] = 0; - - if (strlen(str) > 10 && !strncmp(str, "Location: ", 10)) - { - string s = &str[10]; - mem->location = s.substr(0,s.find_last_not_of("\r\n")+1); - } - - delete str; - - return realsize; - } - - bool RESTServiceWrapper::initialized = false; - - RESTServiceWrapper::RESTServiceWrapper(Service* service) : ServiceWrapper(service) - { - logentry(); - - DataFactoryPtr dataFactory = service->getComponent()->getComposite()->getDataFactory(); - try { - const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType"); - } catch (SDORuntimeException&) - { - dataFactory->addType("http://tempuri.org", "RootType", false, false, false); - dataFactory->addType("http://tempuri.org", "Wrapper", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Wrapper", - "http://tempuri.org", "Wrapper", - false, false, true); - dataFactory->addType("http://tempuri.org", "Part", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Part", - "http://tempuri.org", "Part", - false, false, true); - } - - if (!initialized) - { - curl_global_init(CURL_GLOBAL_ALL); - initialized = true; - } - } - - RESTServiceWrapper::~RESTServiceWrapper() - { - } - - /// - /// This method will be called when a service call needs to be made. - /// - void RESTServiceWrapper::invoke(Operation& operation) - { - logentry(); - - const string& operationName = operation.getName(); - - loginfo("Service: %s, operation: %s", getService()->getType()->getName().c_str() , operationName.c_str()); - - for (unsigned int i=0; i<operation.getNParms(); i++) - { - loginfo("Parameter: %p, type %u", operation.getParameterValue(i),(int) operation.getParameterType(i)); - } - - // Get the service, composite reference and composite - Service* service = getService(); - CompositeReference* compositeReference = (CompositeReference*)service->getComponent(); - Composite* composite = compositeReference->getComposite(); - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - - // Get the REST binding - RESTServiceBinding* binding = (RESTServiceBinding *)service->getBinding(); - Interface* iface = service->getType()->getInterface(); - - // Init the curl session - CURL *curl_handle = curl_easy_init(); - - RequestChunk requestChunk; - ResponseChunk responseChunk; - HeaderChunk headerChunk; - - // Some servers don't like requests that are made without a user-agent - curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); - - // Get the operation name - string opName = operation.getName(); - - // If we have a REST interface, the operation name translates to an HTTP verb - if (iface != NULL && iface->getInterfaceTypeQName() == RESTInterface::typeQName) - { - - // HTTP GET - if (opName == "retrieve") - { - // Build the request URL - bool firstParm = 0; - string uri; - if (operation.getNParms() !=0) - { - - // If the first parameter is a URI, then we'll use it, - // otherwise we'll use the binding URI - ostringstream s0; - writeParameter(xmlHelper, s0, operation.getParameter(0)); - string p0 = s0.str(); - if (p0.find("://") != string::npos) - { - firstParm = 1; - uri = p0; - } - else - { - uri = getBindingURI(); - } - } - else - { - uri = getBindingURI(); - } - // Add the parameters to the end of the URI - ostringstream os; - if (uri[uri.length()-1] == '?') - { - // If the URI ends with a "?" then we use the query - // form param=value& - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms(); i++) - { - Operation::Parameter param = operation.getParameter(i); - - if(param.hasName()) - { - os << param.getName() << "="; - } - else - { - // No name - use "param1", etc - os << "param" << (i + 1) << "="; - } - writeParameter(xmlHelper, os, param); - if (i < operation.getNParms()-1) - os << "&"; - } - } - else - { - // Add the parameters in the form - // value1 / value2 / value3 - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms(); i++) - { - os << "/"; - writeParameter(xmlHelper, os, operation.getParameter(i)); - } - } - - string url = os.str(); - //loginfo("RESTServiceWrapper: HTTP GET %s", url.c_str()); - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - - // Send all data to this function - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&responseChunk); - - // Send all headers to this function - curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)&headerChunk); - - // Perform the HTTP GET - CURLcode rc = curl_easy_perform(curl_handle); - - if (rc) - { - throwException(ServiceInvocationException, curl_easy_strerror(rc)); - } - - // Get the output data out of the returned document - long httprc; - curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &httprc); - - string responsePayload = ""; - if (responseChunk.memory) - { - responsePayload = string((const char*)responseChunk.memory, responseChunk.size); - } - - if (httprc == 200) - { - if (responsePayload != "") - { - //TODO Remove this workaround once SDO supports loading of open top level content - // The workaround is to wrap the open content in a wrapper element - string xmldecl; - string xml; - Utils::rTokeniseString("?>", responsePayload, xmldecl, xml); - string part = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - part += "<Part xmlns=\"http://tempuri.org\" xmlns:tns=\"http://tempuri.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; - part += xml; - part += "\n</Part>"; - - setReturn(xmlHelper, part, operation); - } - else - { - throwException(ServiceInvocationException, "Failed to retrieve resource, empty response"); - } - } - else - { - ostringstream msg; - msg << "Failed to retrieve REST resource, HTTP code: " << httprc; - if (responsePayload != "") - { - msg << ", payload: " << responsePayload; - } - throwException(ServiceInvocationException, msg.str().c_str()); - } - } - else if (opName == "create") - { - // HTTP POST - - // Set the target URL - string url = getBindingURI(); - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - - // Create the input payload - ostringstream spayload; - writeParameter(xmlHelper, spayload, operation.getParameter(0)); - const string& requestPayload = spayload.str(); - requestChunk.memory = requestPayload.c_str(); - requestChunk.size = requestPayload.size(); - - curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, requestChunk.size); - - // Read all data using this function - curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_READDATA, (void *)&requestChunk); - - // Send all data to this function - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&responseChunk); - - // Send all headers to this function - curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)&headerChunk); - - // Configure headers - curl_slist *requestHeaders = NULL; - requestHeaders = curl_slist_append(requestHeaders, "Expect:"); - requestHeaders = curl_slist_append(requestHeaders, "Content-Type: text/xml"); - curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, requestHeaders); - - // Perform the HTTP POST - curl_easy_setopt(curl_handle, CURLOPT_POST, true); - CURLcode rc = curl_easy_perform(curl_handle); - - curl_slist_free_all(requestHeaders); - - if (rc) - { - throwException(ServiceInvocationException, curl_easy_strerror(rc)); - } - - // Get the output and location of the created resource - string responsePayload = ""; - if (responseChunk.memory) - { - responsePayload = string((const char*)responseChunk.memory, responseChunk.size); - } - - long httprc; - curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &httprc); - if (httprc == 201) - { - string* location = new string; - *location = headerChunk.location; - operation.setReturnValue(location); - } - else - { - ostringstream msg; - msg << "Failed to create REST resource, HTTP code: " << httprc; - if (responsePayload != "") - { - msg << ", payload: " << responsePayload; - } - throwException(ServiceInvocationException, msg.str().c_str()); - } - } - else if (opName == "update") - { - // HTTP PUT - - // Build the request URL - bool firstParm = 0; - string uri; - if (operation.getNParms() > 1) - { - - // If the first parameter is a URI, then we'll use it, - // otherwise we'll use the binding URI - ostringstream s0; - writeParameter(xmlHelper, s0, operation.getParameter(0)); - string p0 = s0.str(); - if (p0.find("://") != string::npos) - { - firstParm = 1; - uri = p0; - } - else - { - uri = getBindingURI(); - } - } - else - { - uri = getBindingURI(); - } - // Add the parameters to the end of the URI - ostringstream os; - if (uri[uri.length()-1] == '?') - { - // If the URI ends with a "?" then we use the query - // form param=value& - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms()-1; i++) - { - Operation::Parameter param = operation.getParameter(i); - if(param.hasName()) - { - os << param.getName() << "="; - } - else - { - // No name - use "param1", etc - os << "param" << (i + 1) << "="; - } - writeParameter(xmlHelper, os, param); - if (i < operation.getNParms()-1) - os << "&"; - } - } - else - { - // Add the parameters in the form - // value1 / value2 / value3 - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms()-1; i++) - { - os << "/"; - writeParameter(xmlHelper, os, operation.getParameter(i)); - } - } - - string url = os.str(); - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - - // Create the input payload - ostringstream spayload; - writeParameter(xmlHelper, spayload, operation.getParameter(operation.getNParms()-1)); - const string& requestPayload = spayload.str(); - requestChunk.memory = requestPayload.c_str(); - requestChunk.size = requestPayload.size(); - - // Read all data using this function - curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_READDATA, (void *)&requestChunk); - - // Send all data to this function - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&responseChunk); - - // Send all headers to this function - curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)&headerChunk); - - // Configure headers - curl_slist *requestHeaders = NULL; - requestHeaders = curl_slist_append(requestHeaders, "Expect:"); - requestHeaders = curl_slist_append(requestHeaders, "Content-Type: text/xml"); - curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, requestHeaders); - - // Perform the HTTP PUT - curl_easy_setopt(curl_handle, CURLOPT_PUT, true); - curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, true) ; - long size = (long)requestChunk.size; - curl_easy_setopt(curl_handle, CURLOPT_INFILESIZE, size); - - CURLcode rc = curl_easy_perform(curl_handle); - - curl_slist_free_all(requestHeaders); - - if (rc) - { - throwException(ServiceInvocationException, curl_easy_strerror(rc)); - } - - // Get the output and location of the created resource - string responsePayload = ""; - if (responseChunk.memory) - { - responsePayload = string((const char*)responseChunk.memory, responseChunk.size); - } - - long httprc; - curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &httprc); - if (httprc != 200) - { - ostringstream msg; - msg << "Failed to update REST resource, HTTP code: " << httprc; - if (responsePayload != "") - { - msg << ", payload: " << responsePayload; - } - throwException(ServiceInvocationException, msg.str().c_str()); - } - } - else if (opName == "delete") - { - // HTTP DELETE - - // Build the request URL - bool firstParm = 0; - string uri; - if (operation.getNParms() !=0) - { - - // If the first parameter is a URI, then we'll use it, - // otherwise we'll use the binding URI - ostringstream s0; - writeParameter(xmlHelper, s0, operation.getParameter(0)); - string p0 = s0.str(); - if (p0.find("://") != string::npos) - { - firstParm = 1; - uri = p0; - } - else - { - uri = getBindingURI(); - } - } - else - { - uri = getBindingURI(); - } - // Add the parameters to the end of the URI - ostringstream os; - if (uri[uri.length()-1] == '?') - { - // If the URI ends with a "?" then we use the query - // form param=value& - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms(); i++) - { - Operation::Parameter param = operation.getParameter(i); - - if(param.hasName()) - { - os << param.getName() << "="; - } - else - { - // No name - use "param1", etc - os << "param" << (i + 1) << "="; - } - writeParameter(xmlHelper, os, param); - if (i < operation.getNParms()-1) - os << "&"; - } - } - else - { - // Add the parameters in the form - // value1 / value2 / value3 - os << uri; - for (unsigned int i = firstParm; i < operation.getNParms(); i++) - { - os << "/"; - writeParameter(xmlHelper, os, operation.getParameter(i)); - } - } - - string url = os.str(); - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - - // Send all data to this function - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&responseChunk); - - // Send all headers to this function - curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)&headerChunk); - - // Perform the HTTP DELETE - curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "DELETE"); - CURLcode rc = curl_easy_perform(curl_handle); - if (rc) - { - throwException(ServiceInvocationException, curl_easy_strerror(rc)); - } - - // Get the output data out of the returned document - string responsePayload = ""; - if (responseChunk.memory) - { - responsePayload = string((const char*)responseChunk.memory, responseChunk.size); - } - - long httprc; - curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &httprc); - if (httprc != 200) - { - ostringstream msg; - msg << "Failed to delete REST resource, HTTP code: " << httprc; - if (responsePayload != "") - { - msg << ", payload: " << responsePayload; - } - throwException(ServiceInvocationException, msg.str().c_str()); - } - } - else - { - string msg = "Unknown REST verb: " + opName; - throwException(ServiceInvocationException, msg.c_str()); - } - } - else - { - // Not a REST interface, XML / HTTP command style - curl_slist *requestHeaders = NULL; - struct curl_httppost *formpost = NULL; - ostringstream spayload; - string requestPayload; - string url; - - // If the request contains complex content then we'll use - // a POST, otherwise we use a GET with a query string - bool complexContent = false; - for (unsigned int i=0; i<operation.getNParms(); i++) - { - if (operation.getParameter(i).getType() == Operation::DATAOBJECT) - { - complexContent = true; - break; - } - } - - if (complexContent) - { - // Set the target URL - string uri = getBindingURI(); - ostringstream os; - os << uri << "/" << opName; - url = os.str(); - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - - // Disable the 100 continue handshake - requestHeaders = curl_slist_append(requestHeaders, "Expect:"); - - if (operation.getNParms() == 1) - { - // Single parameter, send it as the body of the POST - - // Create the input payload - writeParameter(xmlHelper, spayload, operation.getParameter(0)); - requestPayload = spayload.str(); - requestChunk.memory = requestPayload.c_str(); - requestChunk.size = requestPayload.size(); - - curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, requestChunk.size); - - // Read all data using this function - curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_READDATA, (void *)&requestChunk); - - // Set the content type - requestHeaders = curl_slist_append(requestHeaders, "Content-Type: text/xml"); - - // This will be a POST - curl_easy_setopt(curl_handle, CURLOPT_POST, true); - } - else - { - - // Multiple parameters, use a form type POST - struct curl_httppost *lastptr = NULL; - for (unsigned int i=0; i<operation.getNParms(); i++) - { - ostringstream pname; - Operation::Parameter param = operation.getParameter(i); - - if(param.hasName()) - { - pname << param.getName(); - } - else - { - // No name - use "param1", etc - pname << "param" << (i+1); - } - - const char* ctype; - if (param.getType() == Operation::DATAOBJECT) - { - ctype ="text/xml"; - } - else - { - ctype = "text/plain"; - } - - ostringstream pvalue; - writeParameter(xmlHelper, pvalue, param); - - curl_formadd(&formpost, - &lastptr, - CURLFORM_CONTENTTYPE, ctype, - CURLFORM_COPYNAME, pname.str().c_str(), - CURLFORM_COPYCONTENTS, pvalue.str().c_str(), - CURLFORM_END); - } - - // Set the form into the request - curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost); - } - } - else - { - - // Build the request URL, uri / opName ? params - string uri = getBindingURI(); - ostringstream os; - os << uri << "/" << opName; - - // Add the parameters to the end of the URL in the form - // param=value& - for (unsigned int i=0; i<operation.getNParms(); i++) - { - if (i == 0) - os << "?"; - - Operation::Parameter param = operation.getParameter(i); - if(param.hasName()) - { - os << param.getName() << "="; - } - else - { - // No name - use "param1", etc - os << "param" << (i + 1) << "="; - } - writeParameter(xmlHelper, os, param); - if (i < operation.getNParms()-1) - os << "&"; - } - - url = os.str(); - loginfo("RESTServiceWrapper: HTTP GET %s", url.c_str()); - - curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str()); - } - - // Send all data to this function - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback); - - // Pass our 'chunk' struct to the callback function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&responseChunk); - - // Configure the headers - if (requestHeaders) - { - curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, requestHeaders); - } - - loginfo("RESTServiceWrapper: Performing HTTP request"); - // Perform the HTTP request - CURLcode rc = curl_easy_perform(curl_handle); - - loginfo("RESTServiceWrapper: Completed HTTP request"); - // Free any headers - if (requestHeaders) - { - curl_slist_free_all(requestHeaders); - } - - // Cleanup the form - if (complexContent) - { - curl_formfree(formpost); - } - - if (rc) - { - throwException(ServiceInvocationException, curl_easy_strerror(rc)); - } - - if (responseChunk.memory) - { - string responsePayload((const char*)responseChunk.memory, responseChunk.size); - - - loginfo("RESTServiceWrapper: responsePayload: %s", responsePayload.c_str()); - - //TODO Remove this workaround once SDO supports loading of open top level content - // The workaround is to wrap the open content in a wrapper element - string xmldecl; - string xml; - Utils::rTokeniseString("?>", responsePayload, xmldecl, xml); - string part = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - part += "<Part xmlns=\"http://tempuri.org\" xmlns:tns=\"http://tempuri.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; - part += xml; - part += "\n</Part>"; - - setReturn(xmlHelper, part, operation); - } - } - - // Cleanup curl session - curl_easy_cleanup(curl_handle); - } - - - const string RESTServiceWrapper::getBindingURI() - { - string bindingURI = ""; - - // Get the binding URI configured on the top level component - Service* service = getService(); - CompositeReference* compositeReference = (CompositeReference*)service->getComponent(); - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - Component* component = runtime->getDefaultComponent(); - Reference* reference = component->findReference(compositeReference->getName()); - if (reference != NULL) - { - ReferenceBinding* binding = reference->getBinding(); - if (binding != NULL && binding->getURI() != "") - { - bindingURI = binding->getURI(); - } - } - if (bindingURI == "") - { - // Get the binding URI configured on the binding - RESTServiceBinding* binding = (RESTServiceBinding *)service->getBinding(); - bindingURI = binding->getURI(); - } - if (bindingURI != "") - { - - // Prepend the default base URI if the URI is not absolute - if (bindingURI.find("://") == string::npos) - { - bindingURI = runtime->getDefaultBaseURI() + string("/rest/") + bindingURI; - } - } - return bindingURI; - } - - - void RESTServiceWrapper::writeParameter(XMLHelperPtr xmlHelper, ostringstream& os, const Operation::Parameter& parm) - { - logentry(); - - switch(parm.getType()) - { - case Operation::BOOL: - { - os << *(bool*)parm.getValue(); - break; - } - case Operation::SHORT: - { - os << *(short*)parm.getValue(); - break; - } - case Operation::INT: - { - os << *(long*)parm.getValue(); - break; - } - case Operation::LONG: - { - os << *(long*)parm.getValue(); - break; - } - case Operation::USHORT: - { - os << *(short*)parm.getValue(); - break; - } - case Operation::UINT: - { - os << *(long*)parm.getValue(); - break; - } - case Operation::ULONG: - { - os << *(long*)parm.getValue(); - break; - } - case Operation::FLOAT: - { - os << *(float*)parm.getValue(); - break; - } - case Operation::DOUBLE: - { - os << *(long double*)parm.getValue(); - break; - } - case Operation::LONGDOUBLE: - { - os << *(long double*)parm.getValue(); - break; - } - case Operation::CHARS: - { - os << *(char**)parm.getValue(); - break; - } - case Operation::STRING: - { - os << (*(string*)parm.getValue()).c_str(); - break; - } - case Operation::DATAOBJECT: - { - DataObjectPtr dob = *(DataObjectPtr*)parm.getValue(); - XMLDocumentPtr doc = xmlHelper->createDocument(dob, NULL, NULL); - xmlHelper->save(doc, os); - break; - } - default: - { - break; - } - } - } - - void RESTServiceWrapper::setReturn(XMLHelperPtr xmlHelper, string& payload, - Operation& operation) - { - logentry(); - - //TODO Remove this workaround once SDO supports loading of open top level content - // The workaround is to wrap the open content in a wrapper element - string xmldecl; - string xml; - Utils::rTokeniseString("?>", payload, xmldecl, xml); - string body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - body += "<Wrapper xmlns=\"http://tempuri.org\" xmlns:tns=\"http://tempuri.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; - body += xml; - body += "\n</Wrapper>"; - - // Convert the body to an SDO DataObject - DataObjectPtr outputWrapperDataObject = NULL; - XMLDocumentPtr theXMLDocument = xmlHelper->load(body.c_str(), NULL); - if (theXMLDocument != 0) - { - outputWrapperDataObject = theXMLDocument->getRootDataObject(); - } - if(!outputWrapperDataObject) - { - ostringstream msg; - msg << "Could not convert received document to SDO: " << body; - throwException(ServiceDataException, msg.str().c_str()); - } - - // Get the body part - DataObjectPtr outputDataObject = NULL; - PropertyList bpl = outputWrapperDataObject->getInstanceProperties(); - if (bpl.size()!=0) - { - if (bpl[0].isMany()) - { - DataObjectList& parts = outputWrapperDataObject->getList((unsigned int)0); - outputDataObject = parts[0]; - } - else - { - outputDataObject = outputWrapperDataObject->getDataObject(bpl[0]); - } - } - if (outputDataObject == NULL) - { - ostringstream msg; - msg << "Could not convert body part to SDO: " << body; - throwException(ServiceDataException, msg.str().c_str()); - } - - PropertyList pl = outputDataObject->getInstanceProperties(); - unsigned int i = 0; - - switch(pl[i].getTypeEnum()) - { - case Type::BooleanType: - { - bool* boolData = new bool; - *boolData = outputDataObject->getBoolean(pl[i]); - operation.setReturnValue(boolData); - } - break; - case Type::ByteType: - { - char* byteData = new char; - *byteData = outputDataObject->getByte(pl[i]); - operation.setReturnValue(byteData); - } - break; - case Type::BytesType: - { - int len = outputDataObject->getLength(pl[i]); - char* bytesData = new char[len+1]; - int bytesWritten = outputDataObject->getBytes(pl[i], bytesData, len); - // Ensure the bytes end with the null char. Not sure if this is neccessary - if(bytesWritten <= len) - { - bytesData[bytesWritten] = 0; - } - else - { - bytesData[len] = 0; - } - operation.setReturnValue(&bytesData); - } - break; - case Type::CharacterType: - { - // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType - wchar_t* charData = new wchar_t; - *charData = outputDataObject->getCharacter(pl[i]); - operation.setReturnValue(charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = new long double; - *doubleData = outputDataObject->getDouble(pl[i]); - operation.setReturnValue(doubleData); - } - break; - case Type::FloatType: - { - float* floatData = new float; - *floatData = outputDataObject->getFloat(pl[i]); - operation.setReturnValue(floatData); - } - break; - case Type::IntType: - { - long* intData = new long; - *intData = outputDataObject->getInt(pl[i]); - operation.setReturnValue(intData); - } - break; - case Type::ShortType: - { - short* shortData = new short; - *shortData = outputDataObject->getShort(pl[i]); - operation.setReturnValue(shortData); - } - break; - case Type::StringType: - { - string* str = new string(outputDataObject->getCString(pl[i])); - operation.setReturnValue(str); - } - break; - case Type::DataObjectType: - { - if (!strcmp(pl[0].getType().getURI(), SDOUtils::sdoURI) && - !strcmp(pl[0].getType().getName(), "OpenDataObject")) { - - /* - * This code deals with xsd:any element parameters - * Get each element as a DataObject and add in to the parameter list - */ - DataObjectList& dataObjectList = outputDataObject->getList(pl[i]); - - for(unsigned int j=0; j<dataObjectList.size(); j++) - { - DataObjectPtr dob = dataObjectList[j]; - if(!dob) - { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = NULL; - operation.setReturnValue(dataObjectData); - loginfo("Null OpenDataObject return value"); - } - else - { - - SequencePtr sequence = dob->getSequence(); - if (sequence->size()!=0) - { - // Return a text element - if (sequence->isText(0)) - { - string* stringData = new string(sequence->getCStringValue(0)); - operation.setReturnValue(stringData); - } - else - { - // Return a DataObject representing a complex element - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = sequence->getDataObjectValue(0); - if(!*dataObjectData) - { - loginfo("Null DataObject return value"); - } - else - { - (*dataObjectData)->detach(); - } - operation.setReturnValue(dataObjectData); - } - } - else - { - // Empty content, add an empty string - loginfo("Null OpenDataObject return value"); - string *stringData = new string(""); - operation.setReturnValue(stringData); - } - } - } - } - else { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = outputDataObject->getDataObject(pl[i]); - if(!*dataObjectData) - { - loginfo("Null SDO DataObject return value"); - } - else - { - (*dataObjectData)->detach(); - } - operation.setReturnValue(dataObjectData); - } - } - break; - default: - { - ostringstream msg; - msg << "Unsupported result type: " << pl[i].getTypeEnum(); - throwException(ServiceDataException, msg.str().c_str()); - } - } - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h deleted file mode 100644 index 42e136a5d4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/RESTServiceWrapper.h +++ /dev/null @@ -1,90 +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$ */ - -#ifndef tuscany_sca_extension_rest_restservicewrapper_h -#define tuscany_sca_extension_rest_restservicewrapper_h - -#include <sstream> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - - namespace rest - { - - class RESTServiceWrapper : public ServiceWrapper - { - public: - - /** - * Constructor. - * @param target The service wrapper represents a Web service. - */ - RESTServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor - */ - virtual ~RESTServiceWrapper(); - - /** - * 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); - - private: - - /** - * Used to track initialization of the CURL library - */ - static bool initialized; - - /** - * Get the configured binding URI - */ - const std::string getBindingURI(); - - /** - * Write a parameter into a URL - */ - void writeParameter(commonj::sdo::XMLHelperPtr xmlHelper, std::ostringstream& os, const Operation::Parameter& parm); - - /** - * Set the return value on the given operation - */ - void setReturn(commonj::sdo::XMLHelperPtr xmlHelper, std::string& payload, Operation& operation); - - }; - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_rest_restservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp deleted file mode 100644 index 72701bfa65..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.cpp +++ /dev/null @@ -1,59 +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$ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/rest/model/RESTServiceBinding.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/rest/RESTServiceWrapper.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - // Constructor - RESTServiceBinding::RESTServiceBinding(Service* service, const string& uri) - : ServiceBinding(service, uri) - { - logentry(); - - serviceWrapper = new RESTServiceWrapper(service); - } - - // Destructor - RESTServiceBinding::~RESTServiceBinding() - { - logentry(); - } - - ServiceWrapper* RESTServiceBinding::getServiceWrapper() - { - logentry(); - - return serviceWrapper; - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h deleted file mode 100644 index d19bcdacf5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/reference/curl/src/tuscany/sca/rest/model/RESTServiceBinding.h +++ /dev/null @@ -1,76 +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$ */ - -#ifndef tuscany_sca_extension_rest_model_restservicebinding_h -#define tuscany_sca_extension_rest_model_restservicebinding_h - -#include <string> - -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/Service.h" - -namespace tuscany -{ - namespace sca - { - namespace rest - { - /** - * Information about a REST binding for a service or a reference. - */ - class RESTServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - */ - RESTServiceBinding(tuscany::sca::model::Service* service, const std::string& uri); - - /** - * Destructor. - */ - virtual ~RESTServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RESTBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - virtual ServiceWrapper* getServiceWrapper(); - - private: - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_rest_model_restservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/Makefile.am deleted file mode 100644 index 2ecfda6c6c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = httpd
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/Makefile.am deleted file mode 100644 index f963effea2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/Makefile.am deleted file mode 100644 index e5b3ce85bd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -libdir=$(prefix)/extensions/rest/service/lib -lib_LTLIBRARIES = \ -libtuscany_sca_rest_service.la \ -libtuscany_sca_mod_rest.la - -noinst_HEADERS = \ -tuscany/sca/rest/*.h \ -tuscany/sca/rest/model/*.h - -libtuscany_sca_rest_service_la_SOURCES = \ -tuscany/sca/rest/RESTReferenceBindingExtension.cpp \ -tuscany/sca/rest/model/RESTReferenceBinding.cpp \ -tuscany/sca/rest/RESTServiceProxy.cpp - -libtuscany_sca_rest_service_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(top_builddir)/runtime/extensions/rest/interface/src -ltuscany_sca_rest_interface - -rootdir=$(prefix)/extensions/rest/service - -libtuscany_sca_mod_rest_la_SOURCES = \ -tuscany/sca/rest/ModREST.cpp - -libtuscany_sca_mod_rest_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(top_builddir)/runtime/extensions/rest/service/httpd/src -ltuscany_sca_rest_service \ - -L$(top_builddir)/runtime/extensions/rest/interface/src -ltuscany_sca_rest_interface - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I$(top_builddir)/runtime/extensions/rest/interface/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${HTTPD_INCLUDE} -I${APR_INCLUDE} - -moduledir=$(prefix)/extensions/rest/service/module -extension = libtuscany_sca_rest_service$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/ModREST.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/ModREST.cpp deleted file mode 100644 index 4a63991515..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/ModREST.cpp +++ /dev/null @@ -1,1372 +0,0 @@ -/* - * Copyright 2006 The Apache Software Foundation. - * - * 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. - */ - -#include <sstream> - -#include "apr_strings.h" -#include "apr_fnmatch.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" -#include "ap_config.h" -#include "httpd.h" - -// This section removes the windows/httpd build error "strtoul_is_not_a_portable_function_use_strtol_instead" -#if defined(WIN32) || defined (_WINDOWS) -#ifdef strtoul -#undef strtoul -#endif -#define strtoul strtoul -#endif - -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_script.h" -#include "util_md5.h" - -#include "mod_core.h" - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "RESTServiceProxy.h" -#include "model/RESTReferenceBinding.h" -#include "tuscany/sca/rest/model/RESTInterface.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/CompositeService.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/WSDLDefinition.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "tuscany/sca/model/WSDLMessagePart.h" -#include "tuscany/sca/model/WSDLInterface.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - - -extern "C" -{ - extern module AP_MODULE_DECLARE_DATA sca_rest_module; -} - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - typedef struct rest_server_config_rec - { - char * home; - } rest_server_config_rec_t; - - typedef struct rest_dir_config_rec - { - char * root; - char * path; - char * base_uri; - char * component; - } rest_dir_config_rec_t; - - CompositeService* initializeSCARuntime(const char* home, const char* root, - const char* path, const char* baseURI, const char *component, const char* service); - - DataObjectPtr createPayload(DataFactoryPtr dataFactory, - Operation& operation, const WSDLOperation& wsdlOperation); - - void addPart(XMLHelperPtr xmlHelper, string& payload, Operation& operation); - - int logHeaders(void* request, const char* key, const char* value); - - /** - * Initialize the SCA runtime - */ - CompositeService* initializeSCARuntime(const char* home, const char* root, - const char* path, const char* baseURI, const char *component, const char* service) - { - logentry(); - loginfo("Home: %s", home); - loginfo("Root: %s", root); - loginfo("Path: %s", path); - loginfo("Base URI: %s", baseURI); - loginfo("Component: %s", component); - loginfo("Service: %s", service); - - try - { - SCARuntime* runtime = SCARuntime::initializeSharedRuntime(home, root, path, baseURI); - - string componentName; - if (strlen(component)) - { - componentName = component; - } - else - { - componentName = runtime->getDefaultComponentName(); - } - string serviceName = service; - - loginfo("Resolving composite: %s, service: %s", componentName.c_str(), serviceName.c_str()); - Component* compositeComponent = runtime->getSystem()->findComponent(componentName); - if (compositeComponent == NULL) - { - string msg = "Component not found " + componentName; - throwException(SystemConfigurationException, msg.c_str()); - } - runtime->setDefaultComponent(compositeComponent); - - Composite* composite = (Composite*)compositeComponent->getType(); - CompositeService* compositeService = (CompositeService*)composite->findComponent(serviceName); - if (compositeService == NULL) - { - string msg = "Composite service not found " + serviceName; - throwException(SystemConfigurationException, msg.c_str()); - } - - return compositeService; - } - catch(TuscanyRuntimeException &ex) - { - ostringstream msg; - msg << ex; - logerror("Failed to initialize SCA runtime: %s", msg.str().c_str()); - throw; - } - } - - bool printRequest = false; - - int logHeaders(void* request, const char* key, const char* value) - { - loginfo("Header key: %s, value: %s", key, value); - if (printRequest) - { - ap_rprintf((request_rec*)request, "<br>Header key: %s, value: %s", key, value); - } - return 1; - } - - int rest_handler(request_rec *request) - { - logentry(); - - if (strcmp(request->handler, "sca_rest_module")) - { - return DECLINED; - } - - try { - - // Set up the read policy - int rc = ap_setup_client_block(request, REQUEST_CHUNKED_DECHUNK); - if (rc != OK) - { - return rc; - } - ap_should_client_block(request); - if (request->read_chunked == true && request->remaining == 0) - { - request->chunked = true; - } - - apr_table_setn(request->headers_out, "Connection", "close"); - - if (printRequest) - { - // Set the content type - ap_set_content_type(request, "text/html"); - - // Send the response document - ap_rputs("<html><body><p>Tuscany Mod_rest works!", request); - } - - rest_server_config_rec_t* server_conf = (rest_server_config_rec_t*)ap_get_module_config(request->server->module_config, &sca_rest_module); - loginfo("Tuscany home: %s", server_conf->home); - if (printRequest) - { - ap_rprintf(request, "<p>Tuscany home: %s", server_conf->home); - } - - rest_dir_config_rec_t* dir_conf = (rest_dir_config_rec_t*)ap_get_module_config(request->per_dir_config, &sca_rest_module); - loginfo("Tuscany root: %s", dir_conf->root); - if (printRequest) - { - ap_rprintf(request, "<p>Tuscany root: %s", dir_conf->root); - } - loginfo("Tuscany path: %s", dir_conf->path); - if (printRequest) - { - ap_rprintf(request, "<p>Tuscany path: %s", dir_conf->path); - } - loginfo("SCA component: %s", dir_conf->component); - if (printRequest) - { - ap_rprintf(request, "<p>SCA component: %s", dir_conf->component); - } - - if (request->protocol) - { - loginfo("Protocol: %s", request->protocol); - if (printRequest) - { - ap_rprintf(request, "<p>Protocol: %s", request->protocol); - } - } - - if (request->method) - { - loginfo("HTTP method: %s", request->method); - if (printRequest) - { - ap_rprintf(request, "<p>HTTP method: %s", request->method); - } - } - - loginfo("HTTP method number: %d", request->method_number); - if (printRequest) - { - ap_rprintf(request, "<p>HTTP method number: %d", request->method_number); - } - - const char* content_type = apr_table_get(request->headers_in, "Content-Type"); - if (content_type) - { - loginfo("Content type: %s", content_type); - if (printRequest) - { - ap_rprintf(request, "<p>Content type: %s", content_type); - } - } - else - { - content_type = "text/plain"; - } - - if (request->content_encoding) - { - loginfo("Content encoding: %s", request->content_encoding); - if (printRequest) - { - ap_rprintf(request, "<p>Content encoding: %s", request->content_encoding); - } - } - - if (printRequest) - { - ap_rputs("<p>", request); - } - apr_table_do(logHeaders, request, request->headers_in, NULL); - - if (request->uri) - { - loginfo("URI: %s", request->uri); - if (printRequest) - { - ap_rprintf(request, "<p>URI: %s", request->uri); - } - } - - if (request->path_info) - { - loginfo("Path info: %s", request->path_info); - if (printRequest) - { - ap_rprintf(request, "<p>Path info: %s", request->path_info); - } - } - - if (request->args) - { - loginfo("Args: %s", request->args); - if (printRequest) - { - ap_rprintf(request, "<p>Args: %s", request->args); - } - } - - if (printRequest) - { - ap_rputs("</body></html>", request); - } - - // Extract the service and component names from the HTTP URI path - string path; - if (strlen(request->path_info) != 0 && *(request->path_info) == '/') - { - path = request->path_info + 1; - } - else - { - path = request->path_info; - } - string uri; - - string component; - string service; - if (strlen(dir_conf->component)) - { - // The path only specifies the service, the component name - // is configured in the directory/location configured - component = dir_conf->component; - Utils::tokeniseString("/", path, service, uri); - } - else - { - // The path must be in the form component / service - string path2; - Utils::tokeniseString("/", path, component, path2); - Utils::tokeniseString("/", path2, service, uri); - } - - loginfo("Component name: %s", component.c_str()); - loginfo("Service name: %s", service.c_str()); - - // Initialize the SCA runtime - CompositeService* compositeService = initializeSCARuntime( - server_conf->home, dir_conf->root, dir_conf->path, dir_conf->base_uri, component.c_str(), service.c_str()); - - if(!compositeService) - { - throwException(SystemConfigurationException, - "Failed to initialize SCA runtime, could not initialize CompositeService"); - } - - Composite* composite = compositeService->getComposite(); - DataFactoryPtr dataFactory = composite->getDataFactory(); - if (dataFactory == 0) - { - throwException(SystemConfigurationException, - "Failed to initialize SCA runtime, could not get DataFactory"); - } - XMLHelperPtr xmlHelper = composite->getXMLHelper(); - - // Get the REST binding - Reference* reference = compositeService->getReference(); - RESTReferenceBinding* binding = (RESTReferenceBinding*)reference->getBinding(); - - // Get the REST proxy - RESTServiceProxy* proxy = (RESTServiceProxy*)binding->getServiceProxy(); - - // Get the component interface - Interface* iface = reference->getType()->getInterface(); - - if (request->method_number == M_GET) - { - // Handle an HTTP GET - - // Determine the operation to invoke - WSDLOperation wsdlOperation; - string wsdlNamespace = ""; - string op_name = ""; - string uriArgs = ""; - if (iface != NULL) - { - // If we have a REST interface, the operation name is "retrieve" - if (iface->getInterfaceTypeQName() == RESTInterface::typeQName) - { - op_name = "retrieve"; - uriArgs = uri; - } - else if (iface->getInterfaceTypeQName() == WSDLInterface::typeQName) - { - // we have a WSDL interface, the operation name is part of the URI - Utils::tokeniseString("/", uri, op_name, uriArgs); - - // look for the WSDL operation definition - WSDLInterface* wsdlInterface = (WSDLInterface*)iface; - wsdlNamespace = wsdlInterface->getNamespaceURI(); - - if (wsdlNamespace != "") - { - WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace); - if (wsdl == 0) - { - string msg = "WSDL not found for: " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - try - { - wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str()); - } - catch(SystemConfigurationException&) - { - throw; - } - - if (!wsdlOperation.isDocumentStyle() || !wsdlOperation.isWrappedStyle()) - { - throwException(ServiceInvocationException, - "Only wrapped document style WSDL operations are currentlysupported"); - } - } - } - } - else - { - Utils::tokeniseString("/", uri, op_name, uriArgs); - } - - // Create a default document literal wrapped WSDL operation - if (wsdlNamespace == "") - { - WSDLMessagePart inPart(op_name, "", "http://tempuri.org"); - WSDLMessagePart outPart((op_name+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeService->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(op_name.c_str()); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(op_name, inPart); - wsdlOperation.setOutputMessagePart((op_name+"Response"), outPart); - } - - // Create the input DataObject - Operation operation(op_name.c_str()); - - // Parse the args part of the URI - if (uriArgs != "") - { - string args = uriArgs; - for (; args != ""; ) - { - string param; - string next; - Utils::tokeniseString("/", args, param, next); - if (param != "") - { - string* data = new string; - *data = param; - operation.addParameter(data); - } - args = next; - } - } - - // Parse the query string - if (request->args) - { - string query = request->args; - for (; query != ""; ) - { - string param; - string next; - Utils::tokeniseString("&", query, param, next); - if (param != "") - { - string n; - string* data = new string; - Utils::tokeniseString("=", param, n, *data); - operation.addParameter(data); - } - query = next; - } - } - DataObjectPtr inputDataObject = createPayload(dataFactory, operation, wsdlOperation); - - // Dispatch to the REST proxy - DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject); - - // Send the output DataObject - if (iface!=NULL && - iface->getInterfaceTypeQName() == RESTInterface::typeQName) - { - if (outputDataObject == NULL) - { - throwException(ServiceInvocationException, "Null output from REST create operation"); - } - else - { - - // Pure REST, send the response document - XMLHelperPtr xm = HelperProvider::getXMLHelper(dataFactory); - DataObjectList& l = outputDataObject->getList("return"); - if (l.size() != 0) - { - DataObjectPtr resourceDataObject = l[0]; - XMLDocumentPtr doc = xm->createDocument( - resourceDataObject, - resourceDataObject->getType().getURI(), - resourceDataObject->getType().getName()); - char* str = xm->save(doc); - - // Calculate an Etag hash for the response - char* etag = ap_md5(request->pool, (const unsigned char*)str); - - // Handle a conditional GET, if the etag matches the etag - // sent by the client, we don't need to send the whole response - const char* match = apr_table_get(request->headers_in, "If-None-Match"); - if (match != NULL && !strcmp(etag, match)) - { - loginfo("REST resource matches ETag, sending HTTP 304 response code"); - request->status = HTTP_NOT_MODIFIED; - } - else - { - loginfo("Sending response: %s", str); - ap_set_content_type(request, "text/xml"); - apr_table_setn(request->headers_out, "ETag", etag); - - // Send an Etag header to allow caching and - // conditional gets - apr_table_setn(request->headers_out, "ETag", etag); - - ap_rputs(str, request); - } - } - else - { - loginfo("REST resource not found, sending HTTP 404 response code"); - request->status = HTTP_NOT_FOUND; - - return OK; - } - } - } - else - { - // Command style, send the response wrapper element - - if (outputDataObject == NULL) - { - loginfo("Sending empty response"); - //request->status = HTTP_NO_CONTENT; - } - else - { - XMLHelperPtr xm = HelperProvider::getXMLHelper(dataFactory); - DataObjectList& l = outputDataObject->getList("return"); - if (l.size() != 0) - { - DataObjectPtr resultDataObject = l[0]; - XMLDocumentPtr doc = xm->createDocument( - resultDataObject, - resultDataObject->getType().getURI(), - resultDataObject->getType().getName()); - char* str = xm->save(doc); - - loginfo("Sending response: %s", str); - ap_set_content_type(request, "text/xml"); - ap_rputs(str, request); - } - else - { - loginfo("Sending empty response"); - //request->status = HTTP_NO_CONTENT; - } - } - } - - return OK; - } - else if (request->method_number == M_POST) - { - // Handle an HTTP POST - - // Determine the operation to invoke - WSDLOperation wsdlOperation; - string wsdlNamespace = ""; - string op_name = ""; - string uriArgs = ""; - if (iface != NULL) - { - // If we have a REST interface, the operation name is "create" - if (iface->getInterfaceTypeQName() == RESTInterface::typeQName) - { - op_name = "create"; - } - else if (iface->getInterfaceTypeQName() == WSDLInterface::typeQName) - { - // we have a WSDL interface, the operation name is part of the URI - Utils::tokeniseString("/", uri, op_name, uriArgs); - - // look for the WSDL operation definition - WSDLInterface* wsdlInterface = (WSDLInterface*)iface; - wsdlNamespace = wsdlInterface->getNamespaceURI(); - - if (wsdlNamespace != "") - { - WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace); - if (wsdl == 0) - { - string msg = "WSDL not found for: " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - try - { - wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str()); - } - catch(SystemConfigurationException&) - { - throw; - } - - if (!wsdlOperation.isDocumentStyle() || !wsdlOperation.isWrappedStyle()) - { - throwException(ServiceInvocationException, - "Only wrapped document style WSDL operations are currentlysupported"); - } - } - } - } - else - { - Utils::tokeniseString("/", uri, op_name, uriArgs); - } - - // Create a default document literal wrapped WSDL operation - if (wsdlNamespace == "") - { - WSDLMessagePart inPart(op_name, "", "http://tempuri.org"); - WSDLMessagePart outPart((op_name+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeService->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(op_name.c_str()); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(op_name, inPart); - wsdlOperation.setOutputMessagePart((op_name+"Response"), outPart); - } - - // Create the input DataObject - Operation operation(op_name.c_str()); - - // Parse the args part of the URI - if (uriArgs != "") - { - string args = uriArgs; - for (; args != ""; ) - { - string param; - string next; - Utils::tokeniseString("/", args, param, next); - if (param != "") - { - string* data = new string; - *data = param; - operation.addParameter(data); - } - args = next; - } - } - - // Parse the query string - if (request->args) - { - string query = request->args; - for (; query != ""; ) - { - string param; - string next; - Utils::tokeniseString("&", query, param, next); - if (param != "") - { - string n; - string* data = new string; - Utils::tokeniseString("=", param, n, *data); - operation.addParameter(data); - } - query = next; - } - } - - // Read the POST input - ostringstream sinput; - char buffer[2049]; - for ( ; ; ) - { - int size = ap_get_client_block(request, buffer, 2048); - if (size > 0) - { - buffer[size] = '\0'; - sinput << buffer; - } - else if (size == 0) - { - break; - } - else if (size < 0) - { - throwException(ServiceInvocationException, "Error reading POST input"); - } - } - string input = sinput.str(); - - string contentType = content_type; - if (contentType.find("multipart/form-data") == 0) - { - // This is a multipart POST, extract each part from the - // POST body - string begin; - string boundary; - Utils::tokeniseString("boundary=", contentType, begin, boundary); - - for (;;) - { - // Read each part - string part; - string next; - Utils::tokeniseString(boundary, input, part, next); - input = next; - - // Skip first and last empty parts - if (part.length() == 0 || part == "--") - continue; - - // Read headers - bool xml = false; - int empty = -1; - for (;;) - { - string header; - Utils::tokeniseString("\r\n", part, header, next); - part = next; - if (header == "") - { - // Two empty lines signal the beginning of the content - empty++; - if (empty == 1) - break; - } - else - { - empty = 0; - - // Detect XML content - if (header == "Content-Type: text/xml") - xml = true; - } - } - - // Read the part content - if (part.length()) - { - // Strip the trailer - string value; - Utils::tokeniseString("\r\n--", part, value, next); - - if (xml) - { - // Add an XML parameter to the operation - addPart(xmlHelper, value, operation); - } - else - { - // Add a text parameter to the operation - string* stringData = new string; - *stringData = value; - operation.addParameter(stringData); - } - } - - // Read till the end of the POST body - if (input.length() == 0) - break; - } - } - else - { - // The POST body represents a single part - addPart(xmlHelper, input, operation); - } - - DataObjectPtr inputDataObject = createPayload(dataFactory, operation, wsdlOperation); - - // Dispatch to the REST proxy - DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject); - - // Send the response back to the client - if (iface!=NULL && - iface->getInterfaceTypeQName() == RESTInterface::typeQName) - { - // Pure REST, send the location of the created resource - - if (outputDataObject == NULL) - { - throwException(ServiceInvocationException, "Null output from REST create operation"); - } - - string location = ""; - - DataObjectList& l = outputDataObject->getList("return"); - if (l.size()) - { - location = l.getCString(0); - } - - if (location == "") - { - loginfo("No resource location, sending HTTP 400 response code"); - request->status = HTTP_BAD_REQUEST; - - return OK; - } - - string locuri = request->uri; - locuri += '/'; - locuri += location; - - const char* loc = ap_construct_url(request->pool, locuri.c_str(), request); - loginfo("Sending resource location: %s", loc); - apr_table_setn(request->headers_out, "Location", loc); - apr_table_setn(request->headers_out, "Content-Location", loc); - request->status = HTTP_CREATED; - - // Send the created resource entity back to the client - ap_set_content_type(request, "text/xml"); - ap_rputs(input.c_str(), request); - - } - else - { - // Command style, send the response element - - if (outputDataObject == NULL) - { - loginfo("Sending empty response"); - //request->status = HTTP_NO_CONTENT; - } - else - { - XMLHelperPtr xm = HelperProvider::getXMLHelper(dataFactory); - DataObjectList& l = outputDataObject->getList("return"); - if (l.size() != 0) - { - DataObjectPtr resultDataObject = l[0]; - XMLDocumentPtr doc = xm->createDocument( - resultDataObject, - resultDataObject->getType().getURI(), - resultDataObject->getType().getName()); - char* str = xm->save(doc); - - loginfo("Sending response: %s", str); - ap_set_content_type(request, "text/xml"); - ap_rputs(str, request); - } - else - { - loginfo("Sending empty response"); - //request->status = HTTP_NO_CONTENT; - } - } - } - - return OK; - } - else if (request->method_number == M_PUT) - { - - // Handle an HTTP PUT - - // Determine the operation to invoke - WSDLOperation wsdlOperation; - string wsdlNamespace = ""; - string op_name = "update"; - string uriArgs = uri; - - // Create a default document literal wrapped WSDL operation - WSDLMessagePart inputPart(op_name, "", "http://tempuri.org"); - WSDLMessagePart outputPart((op_name+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeService->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(op_name.c_str()); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(op_name, inputPart); - wsdlOperation.setOutputMessagePart((op_name+"Response"), outputPart); - - // Create the input DataObject - Operation operation(op_name.c_str()); - - // Parse the args part of the URI - if (uriArgs != "") - { - string args = uriArgs; - for (; args != ""; ) - { - string param; - string next; - Utils::tokeniseString("/", args, param, next); - if (param != "") - { - string* data = new string; - *data = param; - operation.addParameter(data); - } - args = next; - } - } - - // Parse the query string - if (request->args) - { - string query = request->args; - for (; query != ""; ) - { - string param; - string next; - Utils::tokeniseString("&", query, param, next); - if (param != "") - { - string n; - string* data = new string; - Utils::tokeniseString("=", param, n, *data); - operation.addParameter(data); - } - query = next; - } - } - - // Read the PUT input - ostringstream sinput; - char buffer[2049]; - for ( ; ; ) - { - int size = ap_get_client_block(request, buffer, 2048); - if (size > 0) - { - buffer[size] = '\0'; - sinput << buffer; - } - else if (size == 0) - { - break; - } - else if (size < 0) - { - throwException(ServiceInvocationException, "Error reading PUT input"); - } - } - string input = sinput.str(); - addPart(xmlHelper, input, operation); - - DataObjectPtr inputDataObject = createPayload(dataFactory, operation, wsdlOperation); - - // Dispatch to the REST proxy - DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject); - - // Empty response - //request->status = HTTP_NO_CONTENT; - return OK; - } - else if (request->method_number == M_DELETE) - { - - // Determine the operation to invoke - WSDLOperation wsdlOperation; - string wsdlNamespace = ""; - string op_name = "delete"; - string uriArgs = uri; - - // Create a default document literal wrapped WSDL operation - WSDLMessagePart inPart(op_name, "", "http://tempuri.org"); - WSDLMessagePart outPart((op_name+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeService->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(op_name.c_str()); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(op_name, inPart); - wsdlOperation.setOutputMessagePart((op_name+"Response"), outPart); - - // Create the input DataObject - Operation operation(op_name.c_str()); - - // Parse the args part of the URI - if (uriArgs != "") - { - string args = uriArgs; - for (; args != ""; ) - { - string param; - string next; - Utils::tokeniseString("/", args, param, next); - if (param != "") - { - string* data = new string; - *data = param; - operation.addParameter(data); - } - args = next; - } - } - - // Parse the query string - if (request->args) - { - string query = request->args; - for (; query != ""; ) - { - string param; - string next; - Utils::tokeniseString("&", query, param, next); - if (param != "") - { - string n; - string* data = new string; - Utils::tokeniseString("=", param, n, *data); - operation.addParameter(data); - } - query = next; - } - } - - DataObjectPtr inputDataObject = createPayload(dataFactory, operation, wsdlOperation); - - // Dispatch to the REST proxy - DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject); - - // Empty response - //request->status = HTTP_NO_CONTENT; - return OK; - } - else - { - if (request->method) - { - logerror("Unsupported HTTP method: %s", request->method); - } - else - { - logerror("Unsupported HTTP method: %d", request->method_number); - } - return HTTP_NOT_IMPLEMENTED; - } - } - catch(TuscanyRuntimeException& ex) - { - ostringstream msg; - msg << ex; - logerror("Failed to process REST request: %s", msg.str().c_str()); - return HTTP_INTERNAL_SERVER_ERROR; - } - } - - DataObjectPtr createPayload(DataFactoryPtr dataFactory, Operation& operation, const WSDLOperation& wsdlOperation) - { - logentry(); - - DataObjectPtr inputDataObject; - string inputTypeUri; - string inputTypeName; - try - { - // Since its Document wrapped, there will only be one part - std::list<std::string> partList = wsdlOperation.getInputMessagePartNames(); - const WSDLMessagePart &inputMessage = - wsdlOperation.getInputMessagePart(partList.front()); - inputTypeName = inputMessage.getPartType(); - inputTypeUri = inputMessage.getPartUri(); - - // Create the input wrapper - const Type& rootType = dataFactory->getType(inputTypeUri.c_str(), "RootType"); - const Property& prop = rootType.getProperty(inputTypeName.c_str()); - const Type& inputType = prop.getType(); - inputDataObject = dataFactory->create(inputType); - } - catch (SDORuntimeException&) - { - try - { - // Create the input wrapper - const Type& inputType = - dataFactory->getType(inputTypeUri.c_str(), inputTypeName.c_str()); - inputDataObject = dataFactory->create(inputType); - } - catch (SDORuntimeException&) - { - - // The input wrapper type is not known, create an open DataObject - inputDataObject = dataFactory->create("http://tempuri.org", "Wrapper"); - } - } - - // Go through data object to set the input parameters - PropertyList pl = inputDataObject->getType().getProperties(); - - if(pl.size() == 0) - { - if(inputDataObject->getType().isOpenType() && inputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with sending xsd:any elements - */ - for (int i=0; i<operation.getNParms(); i++) - { - ostringstream pname; - pname << "param" << (i+1); - DataObjectList& l = inputDataObject->getList(pname.str()); - - const Operation::Parameter& parm = operation.getParameter(i); - switch(parm.getType()) - { - case Operation::STRING: - { - l.append((*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - l.append(*(DataObjectPtr*)parm.getValue()); - break; - } - default: - { - break; - } - } - } - } - } - else { - - // Each parameter in the operation should be a property on the request dataobject - for (unsigned int i=0; i<operation.getNParms(); i++) - { - const Operation::Parameter& parm = operation.getParameter(i); - switch(parm.getType()) - { - case Operation::STRING: - { - inputDataObject->setCString(i, (*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - inputDataObject->setDataObject(i, *(DataObjectPtr*)parm.getValue()); - break; - } - default: - { - break; - } - } - } - } - - return inputDataObject; - } - - void addPart(XMLHelperPtr xmlHelper, string& payload, Operation& operation) - { - logentry(); - - - //TODO Remove this workaround once SDO supports loading of open top level content - // The workaround is to wrap the open content in a wrapper element - string xmldecl; - string xml; - Utils::rTokeniseString("?>", payload, xmldecl, xml); - string body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - body += "<Wrapper xmlns=\"http://tempuri.org\" xmlns:tns=\"http://tempuri.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; - body += xml; - body += "\n</Wrapper>"; - - // Convert the body to an SDO DataObject - DataObjectPtr inputWrapperDataObject = NULL; - XMLDocumentPtr theXMLDocument = xmlHelper->load(body.c_str(), NULL); - if (theXMLDocument != 0) - { - inputWrapperDataObject = theXMLDocument->getRootDataObject(); - } - if(!inputWrapperDataObject) - { - ostringstream msg; - msg << "Could not convert received document to SDO: " << body; - throwException(ServiceDataException, msg.str().c_str()); - } - - // Get the body part - DataObjectPtr inputDataObject = NULL; - PropertyList bpl = inputWrapperDataObject->getInstanceProperties(); - if (bpl.size()!=0) - { - if (bpl[0].isMany()) - { - DataObjectList& parts = inputWrapperDataObject->getList((unsigned int)0); - inputDataObject = parts[0]; - } - else - { - inputDataObject = inputWrapperDataObject->getDataObject(bpl[0]); - } - } - if (inputDataObject == NULL) - { - ostringstream msg; - msg << "Could not convert received document to SDO: " << body; - throwException(ServiceDataException, msg.str().c_str()); - } - - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = inputDataObject; - (*dataObjectData)->detach(); - operation.addParameter(dataObjectData); - } - - const char *rest_set_home(cmd_parms *cmd, void *dummy, - const char *arg) - { - rest_server_config_rec_t *conf = (rest_server_config_rec_t*)ap_get_module_config( - cmd->server->module_config, &sca_rest_module); - conf->home = apr_pstrdup(cmd->pool, arg); - return NULL; - } - - const char *rest_set_path(cmd_parms *cmd, void *c, - const char *arg) - { - rest_dir_config_rec_t *conf = (rest_dir_config_rec_t*)c; - conf->path = apr_pstrdup(cmd->pool, arg); - return NULL; - } - - const char *rest_set_root(cmd_parms *cmd, void *c, - const char *arg) - { - rest_dir_config_rec_t *conf = (rest_dir_config_rec_t*)c; - conf->root = apr_pstrdup(cmd->pool, arg); - return NULL; - } - - const char *rest_set_base_uri(cmd_parms *cmd, void *c, - const char *arg) - { - rest_dir_config_rec_t *conf = (rest_dir_config_rec_t*)c; - conf->base_uri = apr_pstrdup(cmd->pool, arg); - return NULL; - } - - const char *rest_set_component(cmd_parms *cmd, void *c, - const char *arg) - { - rest_dir_config_rec_t *conf = (rest_dir_config_rec_t*)c; - conf->component = apr_pstrdup(cmd->pool, arg); - return NULL; - } - - const command_rec rest_module_cmds[] = - { - AP_INIT_TAKE1("TuscanyHome", (const char*(*)())tuscany::sca::rest::rest_set_home, NULL, RSRC_CONF, - "Tuscany home directory"), - AP_INIT_TAKE1("TuscanyPath", (const char*(*)())tuscany::sca::rest::rest_set_path, NULL, ACCESS_CONF, - "Tuscany SCA composite search path"), - AP_INIT_TAKE1("TuscanyRoot", (const char*(*)())tuscany::sca::rest::rest_set_root, NULL, ACCESS_CONF, - "Tuscany root SCA configuration path"), - AP_INIT_TAKE1("TuscanyBaseURI", (const char*(*)())tuscany::sca::rest::rest_set_base_uri, NULL, ACCESS_CONF, - "Tuscany SCA system base URI"), - AP_INIT_TAKE1("TuscanyComponent", (const char*(*)())tuscany::sca::rest::rest_set_component, NULL, ACCESS_CONF, - "SCA component name"), - {NULL} - }; - - int rest_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, - server_rec *s) - { - return OK; - } - - void rest_child_init(apr_pool_t* p, server_rec* svr_rec) - { - rest_server_config_rec_t *conf = (rest_server_config_rec_t*)ap_get_module_config( - svr_rec->module_config, &sca_rest_module); - - if(false) - { - fprintf(stderr, "[Tuscany] Due to one or more errors mod_rest loading" - " failed. Causing apache2 to stop loading\n"); - exit(APEXIT_CHILDFATAL); - } - } - - void register_hooks(apr_pool_t *p) - { - ap_hook_handler(rest_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(rest_init, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_child_init(rest_child_init, NULL, NULL, APR_HOOK_MIDDLE); - } - - void *rest_create_dir_config(apr_pool_t *p, char *dirspec) - { - rest_dir_config_rec_t* conf = (rest_dir_config_rec_t* )apr_palloc(p, sizeof(*conf)); - conf->path = ""; - conf->root = ""; - conf->base_uri = ""; - conf->component = ""; - return conf; - } - - void* rest_create_server_config(apr_pool_t *p, server_rec *s) - { - rest_server_config_rec_t* conf = (rest_server_config_rec_t* )apr_palloc(p, sizeof(*conf)); - conf->home = ""; - return conf; - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -extern "C" -{ - - module AP_MODULE_DECLARE_DATA sca_rest_module = - { - STANDARD20_MODULE_STUFF, - tuscany::sca::rest::rest_create_dir_config, /* dir config */ - NULL, /* dir merger --- default is to override */ - tuscany::sca::rest::rest_create_server_config, /* server config */ - NULL, /* merge server config */ - tuscany::sca::rest::rest_module_cmds, /* command table */ - tuscany::sca::rest::register_hooks /* register_hooks */ - }; - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.cpp deleted file mode 100644 index 18720f42f5..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.cpp +++ /dev/null @@ -1,86 +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. -*/ - -#include "RESTReferenceBindingExtension.h" -#include "model/RESTReferenceBinding.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_rest_service_initialize() - { - tuscany::sca::rest::RESTReferenceBindingExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace rest - { - // =================================================================== - // Constructor for the RESTReferenceBinding class. - // =================================================================== - RESTReferenceBindingExtension::RESTReferenceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the RESTReferenceBindingExtension class. - // =================================================================== - RESTReferenceBindingExtension::~RESTReferenceBindingExtension() - { - logentry(); - } - - const string RESTReferenceBindingExtension::extensionName("rest"); - const string RESTReferenceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RESTBinding"); - - // =================================================================== - // loadModelElement - load the info from binding.rest - // =================================================================== - ReferenceBinding* RESTReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding) - { - string uri = scdlBinding->getCString("uri"); - - RESTReferenceBinding* referenceBinding = new RESTReferenceBinding(reference, uri); - - return referenceBinding; - } - - void RESTReferenceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerReferenceBindingExtension(new RESTReferenceBindingExtension()); - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.h deleted file mode 100644 index 0d9e41841b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTReferenceBindingExtension.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef tuscany_sca_extension_rest_restreferencebindingextension_h -#define tuscany_sca_extension_rest_restreferencebindingextension_h - -#include "tuscany/sca/extension/ReferenceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - class RESTReferenceBindingExtension : public ReferenceBindingExtension - { - public: - /** - * Default constructor - */ - RESTReferenceBindingExtension(); - - /** - * Destructor - */ - virtual ~RESTReferenceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.rest") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ReferenceBinding* getReferenceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Reference *reference, - commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_rest_restreferencebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.cpp deleted file mode 100644 index 95affe6202..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.cpp +++ /dev/null @@ -1,567 +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 <sstream> - -#include "commonj/sdo/SDO.h" - -#include "RESTServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/SDOUtils.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ComponentType.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/WSDLDefinition.h" -#include "tuscany/sca/model/WSDLInterface.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "tuscany/sca/model/WSDLMessagePart.h" -#include "model/RESTReferenceBinding.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - // ============================ - // Constructor: Create a proxy - // ============================ - RESTServiceProxy::RESTServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // Get the target service wrapper - RESTReferenceBinding* referenceBinding = (RESTReferenceBinding*)reference->getBinding(); - serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - - DataFactoryPtr dataFactory = reference->getComponent()->getComposite()->getDataFactory(); - try { - const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType"); - } catch (SDORuntimeException&) - { - dataFactory->addType("http://tempuri.org", "RootType", false, false, false); - dataFactory->addType("http://tempuri.org", "Wrapper", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Wrapper", - "http://tempuri.org", "Wrapper", - false, false, true); - dataFactory->addType("http://tempuri.org", "Part", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Part", - "http://tempuri.org", "Part", - false, false, true); - } - } - - // ========== - // Destructor - // ========== - RESTServiceProxy::~RESTServiceProxy() - { - logentry(); - } - - /// - /// This method will be called to process an operation invocation. - /// - DataObjectPtr RESTServiceProxy::invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject) - { - logentry(); - - Reference* reference = getReference(); - Component* component = reference->getComponent(); - Composite* composite = component ->getComposite(); - - RESTReferenceBinding* referenceBinding = (RESTReferenceBinding*)reference->getBinding(); - DataFactoryPtr dataFactoryPtr = reference->getComponent()->getComposite()->getDataFactory(); - - // Since its Document wrapped, there will only be one message part - std::list<std::string> partList = wsdlOperation.getOutputMessagePartNames(); - const WSDLMessagePart &part = wsdlOperation.getOutputMessagePart(partList.front()); - const char* outputTypeURI = part.getPartUri().c_str(); - const char* outputTypeName = part.getPartName().c_str(); - - loginfo("WSDLOperation input message Type: %s#%s", - wsdlOperation.getInputMessageUri().c_str(), - wsdlOperation.getInputMessageName().c_str()); - loginfo("WSDLOperation output part Type: %s#%s", - outputTypeURI, - outputTypeName); - - // Create new Operation object and set parameters and return value - Operation operation(wsdlOperation.getOperationName().c_str()); - - try - { - - // Go through the input data object to set the operation parameters - PropertyList pl = inputDataObject->getInstanceProperties(); - - for(int i=0; i<pl.size(); i++) - { - const char* name = pl[i].getName(); - - switch (pl[i].getTypeEnum()) - { - case Type::BooleanType: - { - bool* boolData = new bool; - *boolData = inputDataObject->getBoolean(pl[i]); - operation.addParameter(boolData); - } - break; - case Type::ByteType: - { - char* byteData = new char; - *byteData = inputDataObject->getByte(pl[i]); - operation.addParameter(byteData); - } - break; - case Type::BytesType: - { - int len = inputDataObject->getLength(pl[i]); - char** bytesData = new char*; - *bytesData = new char[len+1]; - int bytesWritten = inputDataObject->getBytes(pl[i], *bytesData, len); - // Ensure the bytes end with the null char. Not sure if this is neccessary - if(bytesWritten <= len) - { - (*bytesData)[bytesWritten] = 0; - } - else - { - (*bytesData)[len] = 0; - } - operation.addParameter(bytesData); - } - break; - case Type::CharacterType: - { - // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType - wchar_t* charData = new wchar_t; - *charData = inputDataObject->getCharacter(pl[i]); - operation.addParameter(charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = new long double; - *doubleData = inputDataObject->getDouble(pl[i]); - operation.addParameter(doubleData); - } - break; - case Type::FloatType: - { - float* floatData = new float; - *floatData = inputDataObject->getFloat(pl[i]); - operation.addParameter(floatData); - } - break; - case Type::IntType: - { - long* intData = new long; - *intData = inputDataObject->getInt(pl[i]); - operation.addParameter(intData); - } - break; - case Type::ShortType: - { - short* shortData = new short; - *shortData = inputDataObject->getShort(pl[i]); - operation.addParameter(shortData); - } - break; - case Type::StringType: - { - string* stringData; - if (pl[i].isMany()) - { - DataObjectList& l = inputDataObject->getList(pl[i]); - stringData = new string(l.getCString(0)); - } - else - { - if(inputDataObject->isSet(pl[i])) - { - stringData = new string(inputDataObject->getCString(pl[i])); - } - else - { - // The data is not set, so pass an empty string as the parameter - stringData = new string(); - } - } - operation.addParameter(stringData); - } - break; - case Type::DataObjectType: - { - if (!strcmp(pl[i].getType().getURI(), SDOUtils::sdoURI) && - !strcmp(pl[i].getType().getName(), "OpenDataObject")) { - - /* - * This code deals with xsd:any element parameters - * Get each element as a DataObject and add in to the parameter list - */ - - DataObjectList& dataObjectList = inputDataObject->getList(pl[i]); - - for(int j=0; j<dataObjectList.size(); j++) - { - DataObjectPtr dob = dataObjectList[j]; - if(!dob) - { - - // Add a null DataObject ptr - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = NULL; - loginfo("Null OpenDataObject parameter named %s[%d]", name, j); - operation.addParameter(dataObjectData); - } - else - { - - SequencePtr sequence = dob->getSequence(); - if (sequence->size()!=0) - { - // Add a text element - if (sequence->isText(0)) - { - string* stringData = new string(sequence->getCStringValue(0)); - operation.addParameter(stringData); - } - else - { - // Add a complex element DataObject - DataObjectPtr* dataObjectData =new DataObjectPtr; - *dataObjectData = sequence->getDataObjectValue(0); - if(!*dataObjectData) - { - loginfo("Null DataObject parameter named %s", name); - } - else - { - (*dataObjectData)->detach(); - } - operation.addParameter(dataObjectData); - } - } - else - { - // Empty content, add an empty string - loginfo("Empty OpenDataObject parameter named %s[%d]", name, j); - string* stringData = new string(""); - operation.addParameter(stringData); - } - } - } - } - else { - DataObjectPtr* dataObjectData = new DataObjectPtr; - if (pl[i].isMany()) - { - DataObjectList& l = inputDataObject->getList((unsigned int)i); - *dataObjectData = l[0]; - } - else - { - *dataObjectData = inputDataObject->getDataObject(pl[i]); - } - if(!*dataObjectData) - { - loginfo("Null DataObject parameter named %s", name); - } - else - { - (*dataObjectData)->detach(); - } - operation.addParameter(dataObjectData); - } - } - break; - default: - { - ostringstream msg; - msg << "Unsupported param type: " << pl[i].getTypeEnum(); - throwException(SystemConfigurationException, msg.str().c_str()); - } - } - } - - // Call into the target service wrapper - serviceWrapper->invoke(operation); - - // Set the data in the outputDataObject to be returned - DataObjectPtr outputDataObject; - try { - - // Create the output wrapper - const Type& rootType = dataFactoryPtr->getType(outputTypeURI, "RootType"); - const Property& prop = rootType.getProperty(outputTypeName); - const Type& outputType = prop.getType(); - outputDataObject = dataFactoryPtr->create(outputType); - } - catch (SDORuntimeException&) - { - try - { - - // Create the output wrapper - const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName); - outputDataObject = dataFactoryPtr->create(outputType); - } - catch (SDORuntimeException&) - { - // The output wrapper type is not known, create an open DataObject - outputDataObject = dataFactoryPtr->create("http://tempuri.org", "Wrapper"); - } - } - - setOutputData(operation, outputDataObject, dataFactoryPtr); - - return outputDataObject; - } - catch(SDORuntimeException& ex) - { - throwException(ServiceInvocationException, ex); - } - catch(TuscanyRuntimeException& ex) - { - throw; - } - } - - - void RESTServiceProxy::setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr) - { - logentry(); - - // Go through data object to set the return value - PropertyList pl = outputDataObject->getType().getProperties(); - - if(pl.size() == 0) - { - if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with returning xsd:any elements - */ - DataObjectList& l = outputDataObject->getList("return"); - Operation::ParameterType resultType = operation.getReturnType(); - switch(resultType) - { - case Operation::BOOL: - { - l.append(*(bool*)operation.getReturnValue()); - break; - } - case Operation::SHORT: - { - l.append(*(short*)operation.getReturnValue()); - break; - } - case Operation::INT: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - l.append(*(short*)operation.getReturnValue()); - break; - } - case Operation::UINT: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - l.append(*(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - l.append(*(long double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - l.append(*(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - l.append(*(char**)operation.getReturnValue()); - break; - } - case Operation::STRING: - { - l.append((*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - l.append(*(DataObjectPtr*)operation.getReturnValue()); - break; - } - default: - { - break; - } - } - } - else - { - loginfo("No return values defined"); - } - } - else { - - // Should only be one return value.. This goes through all return values - for(int i=0; i<pl.size(); i++) - { - const char* name = pl[i].getName(); - - Operation::ParameterType resultType = operation.getReturnType(); - switch(resultType) - { - case Operation::BOOL: - { - outputDataObject->setBoolean(pl[i], *(bool*)operation.getReturnValue()); - break; - } - case Operation::SHORT: - { - outputDataObject->setShort(pl[i], *(short*)operation.getReturnValue()); - break; - } - case Operation::INT: - { - outputDataObject->setInt(pl[i], *(int*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - outputDataObject->setInt(pl[i], *(long*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - outputDataObject->setInt(pl[i], *(unsigned short*)operation.getReturnValue()); - break; - } - case Operation::UINT: - { - outputDataObject->setInt(pl[i], *(unsigned int*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - outputDataObject->setInt(pl[i], *(unsigned long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - outputDataObject->setFloat(pl[i], *(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - outputDataObject->setDouble(pl[i], *(double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - outputDataObject->setDouble(pl[i], *(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - if(*(char**)operation.getReturnValue() != NULL) - { - outputDataObject->setCString(pl[i], *(char**)operation.getReturnValue()); - } - else - { - loginfo("Null return value, leaving property %s unset", pl[i].getName()); - } - break; - } - case Operation::STRING: - { - outputDataObject->setCString(pl[i], (*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - - if(*(DataObjectPtr*)operation.getReturnValue() != NULL) - { - outputDataObject->setDataObject(pl[i], *(DataObjectPtr*)operation.getReturnValue()); - } - else - { - loginfo("Null return value, leaving property %s unset", pl[i].getName()); - } - - break; - } - default: - { - break; - } - } - } - } - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.h deleted file mode 100644 index 387add3f35..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/RESTServiceProxy.h +++ /dev/null @@ -1,95 +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$ */ - -#ifndef tuscany_sca_extension_rest_restserviceproxy_h -#define tuscany_sca_extension_rest_restserviceproxy_h - -#include "commonj/sdo/SDO.h" - -#include "export.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "model/RESTReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - /** - * Holds a proxy for a given component and reference. - * The proxy which is held inside a ServiceProxy will be specific to the programming - * interface expected by the client. In this particular case the client is an Axis2 - * Web service skeleton. - */ - class RESTServiceProxy : public 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. - */ - RESTServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param reference The service on the target component. - * @param target The wrapper of the target service. - */ - RESTServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~RESTServiceProxy(); - - /** - * Invoke the specified operation - */ - SCA_REST_SERVICE_API commonj::sdo::DataObjectPtr invoke( - const tuscany::sca::model::WSDLOperation& wsdlOperation, - commonj::sdo::DataObjectPtr inputDataObject); - - private: - - void setOutputData(Operation& operation, - commonj::sdo::DataObjectPtr outputDataObject, commonj::sdo::DataFactoryPtr dataFactoryPtr); - - /** - * The target service wrapper - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_rest_restserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/export.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/export.h deleted file mode 100644 index 802218a2fe..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/export.h +++ /dev/null @@ -1,38 +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_rest_service_export_h -#define tuscany_sca_rest_service_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_REST_SERVICE_EXPORTS -#define SCA_REST_SERVICE_API __declspec(dllexport) -#else -#define SCA_REST_SERVICE_API __declspec(dllimport) -#endif - -#else -#define SCA_REST_SERVICE_API -#endif - -#endif // tuscany_sca_rest_service_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.cpp deleted file mode 100644 index 877ee01178..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.cpp +++ /dev/null @@ -1,66 +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$ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/rest/model/RESTReferenceBinding.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/rest/RESTServiceProxy.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace rest - { - - // Constructor - RESTReferenceBinding::RESTReferenceBinding(Reference* reference, const string& uri) - : ReferenceBinding(reference, uri) - { - logentry(); - } - - // Destructor - RESTReferenceBinding::~RESTReferenceBinding() - { - logentry(); - } - - void RESTReferenceBinding::configure(ServiceBinding *binding) - { - logentry(); - - setTargetServiceBinding(binding); - - serviceProxy = new RESTServiceProxy(getReference()); - } - - ServiceProxy* RESTReferenceBinding::getServiceProxy() - { - logentry(); - - return serviceProxy; - } - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.h deleted file mode 100644 index 22fc04c356..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/service/httpd/src/tuscany/sca/rest/model/RESTReferenceBinding.h +++ /dev/null @@ -1,80 +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$ */ - -#ifndef tuscany_sca_extension_rest_model_restreferencebinding_h -#define tuscany_sca_extension_rest_model_restreferencebinding_h - -#include <string> - -#include "tuscany/sca/model/ReferenceBinding.h" - -namespace tuscany -{ - namespace sca - { - namespace rest - { - /** - * Information about a web service binding for service or a reference. - */ - class RESTReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - */ - RESTReferenceBinding(tuscany::sca::model::Reference* reference, const std::string& uri); - - /** - * Destructor. - */ - virtual ~RESTReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RESTBinding"; }; - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual ServiceProxy* getServiceProxy(); - - private: - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - }; - - } // End namespace rest - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_rest_model_restreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-binding-rest.xsd b/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-binding-rest.xsd deleted file mode 100644 index ace4c54a39..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-binding-rest.xsd +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright 2006 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="binding.rest" type="sca:RESTBinding" substitutionGroup="sca:binding"/> - <complexType name="RESTBinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-interface-rest.xsd b/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-interface-rest.xsd deleted file mode 100644 index 30422ab038..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/rest/xsd/sca-interface-rest.xsd +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="interface.rest" type="sca:RESTInterface" substitutionGroup="sca:interface"/> - <complexType name="RESTInterface"> - <complexContent> - <extension base="sca:Interface"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ruby/Makefile.am deleted file mode 100644 index 08ba2f553f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/Makefile.am +++ /dev/null @@ -1,24 +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. - -SUBDIRS = src extension - -datadir=$(prefix)/extensions/ruby - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/Makefile.am deleted file mode 100644 index 41ce75925b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/Makefile.am +++ /dev/null @@ -1,34 +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. -SUBDIRS = - -libdir=$(prefix)/extensions/ruby/lib -BUILT_SOURCES = extension_build - -EXTRA_DIST = src - -extension_build: src/Extension.cpp src/extconf.rb - cd src; ruby extconf.rb; make - touch extension_build - -clean: - cd src;make clean - rm -f extension_build - -install-exec-hook: - cp src/tuscany_sca_ruby.* $(libdir) - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/Extension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/Extension.cpp deleted file mode 100644 index 458700e5f1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/Extension.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#define SCA_RUBYEXTENSION_API __declspec(dllexport) -#else -#define SCA_RUBYEXTENSION_API -#endif - -#include "tuscany/sca/ruby/Ruby.h" -#include "tuscany/sca/ruby/RubyCompositeContext.h" - -extern "C" -{ - - // Implement the Sca::locateService module function - SCA_RUBYEXTENSION_API VALUE tuscany_sca_ruby_locateService(VALUE module, VALUE value) - { - // Locate the service - const char* serviceName = rb_string_value_cstr(&value); - return tuscany::sca::ruby::RubyCompositeContext::locateService(serviceName); - } - - // Initialize the Ruby extension - SCA_RUBYEXTENSION_API void Init_tuscany_sca_ruby() - { - - // Define the Sca::locateService() function - VALUE module = rb_define_module("SCA"); - rb_define_module_function(module, "locateService", (VALUE(*)(ANYARGS))tuscany_sca_ruby_locateService, 1); - - } - - SCA_RUBYEXTENSION_API void Init_libtuscany_sca_ruby() - { - Init_tuscany_sca_ruby(); - } -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/extconf.rb b/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/extconf.rb deleted file mode 100644 index 9c41843d63..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/extension/src/extconf.rb +++ /dev/null @@ -1,25 +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. -# - - require 'mkmf' - CONFIG["CC"] = "g++" - $CPPFLAGS << " -I../../src " - $LIBPATH << "../../src/.libs" - $LIBS << " -ltuscany_sca_ruby_lang " - create_makefile 'tuscany_sca_ruby' diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/Makefile.am deleted file mode 100644 index d9310440b9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/Makefile.am +++ /dev/null @@ -1,53 +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. - -libdir=$(prefix)/extensions/ruby/lib -lib_LTLIBRARIES = libtuscany_sca_ruby_lang.la - -install-exec-hook: - -rootdir=$(prefix)/extensions/ruby - -noinst_HEADERS = \ -tuscany/sca/ruby/*.h \ -tuscany/sca/ruby/model/*.h - -libtuscany_sca_ruby_lang_la_SOURCES = \ -tuscany/sca/ruby/RubyExtension.cpp \ -tuscany/sca/ruby/RubyImplementationExtension.cpp \ -tuscany/sca/ruby/RubyServiceProxy.cpp \ -tuscany/sca/ruby/RubyServiceWrapper.cpp \ -tuscany/sca/ruby/model/RubyImplementation.cpp \ -tuscany/sca/ruby/model/RubyReferenceBinding.cpp \ -tuscany/sca/ruby/model/RubyServiceBinding.cpp \ -tuscany/sca/ruby/RubyCompositeContext.cpp - -libtuscany_sca_ruby_lang_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L${RUBY_LIB} -lruby -lpthread - -INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${RUBY_INCLUDE} - -moduledir=$(prefix)/extensions/ruby/module -extension = libtuscany_sca_ruby_lang$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/Ruby.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/Ruby.h deleted file mode 100644 index a6b8ee8ffa..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/Ruby.h +++ /dev/null @@ -1,39 +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_ruby_ruby_h -#define tuscany_sca_ruby_ruby_h - -// Ruby inists on MS VC6 ... we'll see about that! -#if defined(WIN32) || defined (_WINDOWS) -#define _REAL_MSC_VER _MSC_VER -#undef _MSC_VER -#define _MSC_VER 1200 -#endif - -#include <ruby.h> - -#if defined(WIN32) || defined (_WINDOWS) -#undef _MSC_VER -#define _MSC_VER _REAL_MSC_VER -#endif - -#endif // tuscany_sca_ruby_ruby_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.cpp deleted file mode 100644 index 5554ac6756..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.cpp +++ /dev/null @@ -1,70 +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/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ComponentType.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/ruby/RubyServiceProxy.h" -#include "tuscany/sca/ruby/RubyCompositeContext.h" - -using namespace std; -using namespace tuscany::sca::model; - - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - VALUE RubyCompositeContext::locateService(const char* serviceName) - { - // Get the default component - Component* defaultComponent = tuscany::sca::SCARuntime::getCurrentRuntime()->getDefaultComponent(); - Composite* composite = (Composite*)defaultComponent->getType(); - - // Locate the service - Service* service = composite->findComponentService(serviceName); - string msg; - if (!service) - { - string msg = "Service not found: "; - msg = msg + serviceName; - rb_raise(rb_eRuntimeError, msg.c_str()); - } - - // Get a Proxy for this service - tuscany::sca::ruby::RubyServiceProxy* serviceProxy = new tuscany::sca::ruby::RubyServiceProxy(service); - - // Return the Ruby proxy value object - return serviceProxy->getProxyValue(); - } - - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.h deleted file mode 100644 index 2414b66fb1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyCompositeContext.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#ifndef tuscany_sca_ruby_RubyCompositeContext_h -#define tuscany_sca_ruby_RubyCompositeContext_h - -#include "tuscany/sca/ruby/Ruby.h" -#include "tuscany/sca/ruby/export.h" - - - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - class RubyCompositeContext - { - public: - SCA_RUBY_API static VALUE locateService(const char* serviceName); - - }; - - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_RubyCompositeContext_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp deleted file mode 100644 index 5789517cfd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.cpp +++ /dev/null @@ -1,72 +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/ruby/RubyExtension.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/ruby/RubyImplementationExtension.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_ruby_lang_initialize() - { - tuscany::sca::ruby::RubyExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - // =================================================================== - // Constructor for the RubyExtension class. - // =================================================================== - RubyExtension::RubyExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the RubyExtension class. - // =================================================================== - RubyExtension::~RubyExtension() - { - logentry(); - } - - void RubyExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerImplementationExtension(new RubyImplementationExtension()); - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h deleted file mode 100644 index 232431ca1e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyExtension.h +++ /dev/null @@ -1,58 +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_ruby_rubyextension_h -#define tuscany_sca_ruby_rubyextension_h - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - class RubyExtension - { - public: - /** - * Default constructor - */ - RubyExtension(); - - /** - * Destructor - */ - virtual ~RubyExtension(); - - static void initialize(); - - private: - - }; - - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_rubyextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp deleted file mode 100644 index aa416f139a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.cpp +++ /dev/null @@ -1,74 +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/ruby/RubyImplementationExtension.h" -#include "tuscany/sca/ruby/model/RubyImplementation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - // =================================================================== - // Constructor for the RubyImplementationExtension class. - // =================================================================== - RubyImplementationExtension::RubyImplementationExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the RubyImplementationExtension class. - // =================================================================== - RubyImplementationExtension::~RubyImplementationExtension() - { - logentry(); - } - - const string RubyImplementationExtension::extensionName("ruby"); - const string RubyImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#RubyImplementation"); - - // =================================================================== - // loadModelElement - load the info from implementation.ruby - // =================================================================== - ComponentType* RubyImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation) - { - logentry(); - - string module = scdlImplementation->getCString("module"); - string className = scdlImplementation->getCString("class"); - string script = scdlImplementation->getCString("script"); - - RubyImplementation* rubyImpl = new RubyImplementation(composite, module, className, script); - - return rubyImpl; - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h deleted file mode 100644 index 79d9ed2dbe..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyImplementationExtension.h +++ /dev/null @@ -1,74 +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_ruby_rubyimplementationextension_h -#define tuscany_sca_ruby_rubyimplementationextension_h - -#include "tuscany/sca/extension/ImplementationExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - class RubyImplementationExtension : public ImplementationExtension - { - public: - /** - * Default constructor - */ - RubyImplementationExtension(); - - /** - * Destructor - */ - virtual ~RubyImplementationExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.ruby") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ComponentType* getImplementation( - tuscany::sca::model::Composite* composite, - commonj::sdo::DataObjectPtr scdlImplementation); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_rubyimplementationextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp deleted file mode 100644 index d830cd92de..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.cpp +++ /dev/null @@ -1,384 +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 <sstream> - -#include "tuscany/sca/ruby/RubyServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ComponentType.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/ruby/model/RubyImplementation.h" -#include "tuscany/sca/ruby/model/RubyReferenceBinding.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ - - // Initialize a Ruby proxy - SCA_RUBY_API VALUE tuscany_sca_ruby_proxy_initialize(VALUE self, VALUE serviceProxy) - { - rb_iv_set(self, "@cppProxy", serviceProxy); - return self; - } - - // Handle a method_missing message and dispatch to - // our C++ proxy - SCA_RUBY_API VALUE tuscany_sca_ruby_proxy_method_missing(int argc, VALUE* argv, VALUE self) - { - VALUE proxy = rb_iv_get(self, "@cppProxy"); - - // Get the target service wrapper - tuscany::sca::ruby::RubyServiceProxy *serviceProxy; - Data_Get_Struct(proxy, tuscany::sca::ruby::RubyServiceProxy, serviceProxy); - - // Handle the invocation - return serviceProxy->invoke(argc, argv); - - } - -} - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - VALUE RubyServiceProxy::proxyClass = Qnil; - - // ============================ - // Constructor: Create a proxy - // ============================ - RubyServiceProxy::RubyServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // ---------------------- - // Get the component - // ---------------------- - component = reference->getComponent(); - string name = reference->getType()->getName(); - - // Get the service wrapper - RubyReferenceBinding* referenceBinding = (RubyReferenceBinding*)reference->getBinding(); - - serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - - // Create the Ruby proxy - createProxy(); - } - - // ============================ - // Constructor: Create a proxy - // ============================ - RubyServiceProxy::RubyServiceProxy(Service* service) - : ServiceProxy(0) - { - logentry(); - - // ---------------------- - // Get the component - // ---------------------- - component = service->getComponent(); - string name = service->getType()->getName(); - - // Get the service wrapper - serviceWrapper = service->getBinding()->getServiceWrapper(); - - // Create the Ruby proxy - createProxy(); - } - - // ========== - // Destructor - // ========== - RubyServiceProxy::~RubyServiceProxy() - { - logentry(); - } - - void RubyServiceProxy::createProxy() - { - logentry(); - - // Create the Ruby proxy class - if (RubyServiceProxy::proxyClass == Qnil) - { - VALUE module = rb_define_module("Tuscany"); - proxyClass = rb_define_class_under(module, "ServiceProxy", rb_cObject); - rb_define_method(proxyClass, "initialize", (VALUE(*)(ANYARGS))tuscany_sca_ruby_proxy_initialize, 1); - rb_define_method(proxyClass, "method_missing", (VALUE(*)(ANYARGS))tuscany_sca_ruby_proxy_method_missing, -1); - } - - // Create the Ruby proxy instance, pass the service wrapper to it - VALUE* args = new VALUE[1]; - args[0] = Data_Wrap_Struct(rb_cObject, NULL, NULL, this); - proxyValue = rb_class_new_instance(1, args, proxyClass); - - // Mark proxyValue busy so that it doesn't get GC'ed by Ruby - rb_gc_register_address(&proxyValue); - } - - - VALUE RubyServiceProxy::invoke(int argc, VALUE* argv) - { - logentry(); - - // Get the method name - char* methodName = rb_id2name(SYM2ID(argv[0])); - - // Get the block passed by the caller - VALUE block =rb_block_given_p() ? rb_block_proc() : Qnil; - - // Create new Operation object - Operation operation(methodName); - - // Convert the Ruby parameters to C++ - for (int i = 1; i < argc; i++) - { - VALUE value = argv[i]; - - int valueType = TYPE(value); - - switch (valueType) - { - case T_FLOAT: - { - float* data = new float; - *data = rb_num2dbl(value); - operation.addParameter(data); - break; - } - case T_STRING: - { - string* data = new string(rb_string_value_cstr(&value)); - const char** cdata = new const char*; - *cdata = data->c_str(); - operation.addParameter(cdata); - break; - } - case T_FIXNUM: - { - long* data = new long; - *data = rb_num2long(value); - operation.addParameter(data); - break; - } - case T_BIGNUM: - { - long double* data = new long double; - *data = rb_num2dbl(value); - operation.addParameter(data); - break; - } - case T_TRUE: - { - bool* data = new bool; - *data = true; - operation.addParameter(data); - break; - } - case T_FALSE: - { - bool* data = new bool; - *data = false; - operation.addParameter(data); - break; - } - case T_OBJECT: - { - VALUE klass = rb_obj_class(value); - if (klass == RubyImplementation::getXMLDocumentClass()) - { - // Convert a REXML::Document to a DataObject - ID to_s = rb_intern("to_s"); - VALUE vstr = rb_funcall(value, to_s, 0); - string str = string(rb_string_value_cstr(&vstr)); - - loginfo("Converting Ruby Rexml document to SDO DataObject: %s", str.c_str()); - - Composite* composite = getReference()->getComponent()->getComposite(); - commonj::sdo::XMLHelperPtr xmlHelper = composite->getXMLHelper(); - commonj::sdo::XMLDocumentPtr xmlDoc = xmlHelper->load(str.c_str()); - - DataObjectPtr dob; - if (xmlDoc != NULL) - { - dob = xmlDoc->getRootDataObject(); - } - if (dob != NULL) - { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = dob; - operation.addParameter(dataObjectData); - } - else - { - string msg = "Document could not be converted to a DataObject"; - rb_raise(rb_eTypeError, msg.c_str()); - return Qnil; - } - } - else - { - string msg = "Ruby type not supported: " + valueType; - rb_raise(rb_eTypeError, msg.c_str()); - return Qnil; - } - break; - } - default:; - string msg = "Ruby type not supported: " + valueType; - rb_raise(rb_eTypeError, msg.c_str()); - return Qnil; - } - - } - - try - { - // Call into the target service wrapper - serviceWrapper->invoke(operation); - - // Convert the result to a Ruby value - VALUE value; - Operation::ParameterType resultType = operation.getReturnType(); - switch(resultType) - { - case Operation::BOOL: - { - if( *(bool*)operation.getReturnValue()) - { - //boolean true - value = rb_int2inum(1); - } - else - { - value = rb_int2inum(0); - } - break; - } - case Operation::SHORT: - { - value = rb_int2inum(*(short*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - value = rb_uint2inum(*(unsigned short*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - value = rb_int2inum(*(long*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - value = rb_uint2inum(*(unsigned long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - value = rb_float_new(*(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - value = rb_float_new(*(double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - value = rb_float_new(*(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - value = rb_str_new2(*(char**)operation.getReturnValue()); - break; - } - case Operation::STRING: - { - value = rb_str_new2((*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - DataObjectPtr dob = *(DataObjectPtr*)operation.getReturnValue(); - - // Convert a DataObject to a REXML Document object - Composite* composite = component->getComposite(); - commonj::sdo::XMLHelperPtr xmlHelper = composite->getXMLHelper(); - char* str = xmlHelper->save( - dob, - dob->getType().getURI(), - dob->getType().getName()); - - loginfo("Converting SDO DataObject to Ruby Rexml document: %s", str); - - VALUE vstr[1]; - vstr[0] = rb_str_new2(str); - - value = rb_class_new_instance(1, vstr, RubyImplementation::getXMLDocumentClass()); - break; - } - default: - { - value = Qnil; - break; - } - } - - return value; - - } - catch(TuscanyRuntimeException& ex) - { - string msg = "Exception while invoking a service: "; - msg += ex.getEClassName(); - msg += ": "; - msg += ex.getMessageText(); - rb_raise(rb_eRuntimeError, msg.c_str()); - return Qnil; - } - - return Qnil; - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h deleted file mode 100644 index e6c37cf1da..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceProxy.h +++ /dev/null @@ -1,114 +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_ruby_rubyserviceproxy_h -#define tuscany_sca_ruby_rubyserviceproxy_h - -#include "tuscany/sca/ruby/Ruby.h" -#include "tuscany/sca/ruby/export.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - /** - * 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 RubyServiceProxy : public 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. - */ - RubyServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param reference The service on the target component. - * @param target The wrapper of the target service. - */ - RubyServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~RubyServiceProxy(); - - /** - * Returns the Ruby value of the proxy - */ - VALUE getProxyValue() const { return proxyValue; }; - - /** - * Handles the invocation of a Ruby method. - */ - VALUE invoke(int argc, VALUE* argv); - - private: - - /** - * Create the Ruby proxy object - */ - void createProxy(); - - /** - * The target service wrapper - */ - ServiceWrapper* serviceWrapper; - - /** - * The Ruby value of the proxy - */ - VALUE proxyValue; - - /** - * The component owning the proxy - */ - tuscany::sca::model::Component* component; - - /** - * The Ruby proxy class - */ - static VALUE proxyClass; - - }; - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_rubyserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp deleted file mode 100644 index db6bc07b7e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.cpp +++ /dev/null @@ -1,794 +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 <sstream> - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/ruby/RubyServiceWrapper.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/ruby/model/RubyImplementation.h" -#include "tuscany/sca/ruby/model/RubyServiceBinding.h" -#include "tuscany/sca/ruby/RubyServiceProxy.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - class RubyServiceInvocation - { - public: - VALUE instance; - ID method; - int argc; - const VALUE* argv; - }; - } - } -} - -extern "C" -{ - - static VALUE safe_rb_funcall(VALUE value) - { - tuscany::sca::ruby::RubyServiceInvocation* call = (tuscany::sca::ruby::RubyServiceInvocation*)value; - if (call->argc == 0) - { - VALUE result = rb_funcall(call->instance, call->method, 0); - return result; - } - else - { - VALUE result = rb_funcall2(call->instance, call->method, call->argc, call->argv); - return result; - } - } - -} - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - // =========== - // Constructor - // =========== - RubyServiceWrapper::RubyServiceWrapper(Service* service) - : ServiceWrapper(service) - { - logentry(); - - component = service->getComponent(); - implementation = (RubyImplementation*)component->getType(); - interf = service->getType()->getInterface(); - } - - // ========== - // Destructor - // ========== - RubyServiceWrapper::~RubyServiceWrapper() - { - logentry(); - } - - // ====================================================================== - // invoke: wrapper call to service with setting the component context - // ====================================================================== - void RubyServiceWrapper::invoke(Operation& operation) - { - logentry(); - - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - runtime->setCurrentComponent(component); - - try - { - - // Create a new instance of the Ruby implementation class - VALUE instance = rb_class_new_instance(0, NULL, implementation->getImplementationClass()); - - // Set all the references - const Component::REFERENCE_MAP& references = component->getReferences(); - Component::REFERENCE_MAP::const_iterator refiter = references.begin(); - for (int ri=0; ri< references.size(); ri++) - { - Reference* reference = refiter->second; - RubyServiceProxy* proxy = (RubyServiceProxy*)reference->getBinding()->getServiceProxy(); - if (proxy != NULL) - { - VALUE proxyValue = proxy->getProxyValue(); - string varName = "@" + refiter->first; - rb_iv_set(instance, varName.c_str(), proxyValue); - } - refiter++; - } - - // Set all the configured properties - DataObjectPtr properties = component->getProperties(); - PropertyList pl = properties->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) - { - if (properties->isSet(pl[i])) - { - string varName = "@"; - varName += pl[i].getName(); - string cstr = properties->getCString(pl[i]); - VALUE propertyValue; - if (cstr == "true") - { - propertyValue = Qtrue; - } - else if (cstr == "false") - { - propertyValue = Qfalse; - } - else - { - //TODO use one of the rb_str_to_inum() functions - // to convert a numeric value to a Ruby numeric - propertyValue = rb_str_new2(cstr.c_str()); - } - rb_iv_set(instance, varName.c_str(), propertyValue); - } - } - - // Get the ID of the specified method - ID method = rb_intern(operation.getName().c_str()); - - // Convert C++ parameters to Ruby parameters - VALUE *args = NULL; - int n = operation.getNParms(); - if (n != 0) - { - args=new VALUE[n]; - - for(int i = 0; i < operation.getNParms(); i++) - { - VALUE value; - - const Operation::Parameter& parm = operation.getParameter(i); - Operation::ParameterType parmType = parm.getType(); - switch(parmType) - { - case Operation::BOOL: - { - if( *(bool*)parm.getValue()) - { - //boolean true - value = rb_int2inum(1); - } - else - { - value = rb_int2inum(0); - } - break; - } - case Operation::SHORT: - { - value = rb_int2inum(*(short*)parm.getValue()); - break; - } - case Operation::USHORT: - { - value = rb_uint2inum(*(unsigned short*)parm.getValue()); - break; - } - case Operation::LONG: - { - value = rb_int2inum(*(long*)parm.getValue()); - break; - } - case Operation::ULONG: - { - value = rb_uint2inum(*(unsigned long*)parm.getValue()); - break; - } - case Operation::FLOAT: - { - value = rb_float_new(*(float*)parm.getValue()); - break; - } - case Operation::DOUBLE: - { - value = rb_float_new(*(double*)parm.getValue()); - break; - } - case Operation::LONGDOUBLE: - { - value = rb_float_new(*(long double*)parm.getValue()); - break; - } - case Operation::CHARS: - { - value = rb_str_new2(*(char**)parm.getValue()); - break; - } - case Operation::STRING: - { - value = rb_str_new2((*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - DataObjectPtr dob = *(DataObjectPtr*)parm.getValue(); - - // Convert a DataObject to a REXML Document object - Composite* composite = component->getComposite(); - commonj::sdo::XMLHelperPtr xmlHelper = composite->getXMLHelper(); - char* str = xmlHelper->save( - dob, - dob->getType().getURI(), - dob->getType().getName()); - - loginfo("Converting SDO DataObject to Ruby Rexml document: %s", str); - - VALUE vstr[1]; - vstr[0] = rb_str_new2(str); - - value = rb_class_new_instance(1, vstr, RubyImplementation::getXMLDocumentClass()); - break; - } - default: - { - ostringstream msg; - msg << "Operation parameter type not supported: " << parmType; - throwException(ServiceDataException, msg.str().c_str()); - } - } - - args[i] = value; - } - } - - - // Invoke the specified method - RubyServiceInvocation call; - call.instance = instance; - call.method = method; - call.argc = n; - call.argv = args; - int error = 0; - VALUE result = rb_protect(safe_rb_funcall, (VALUE)&call, &error); - if (error) - { - // Convert a Ruby error to a C++ exception - VALUE lasterr = rb_gv_get("$!"); - ostringstream msg; - - // class - VALUE klass = rb_class_path(CLASS_OF(lasterr)); - msg << "Ruby Exception " << RSTRING(klass)->ptr << ": "; - - // message - VALUE message = rb_obj_as_string(lasterr); - msg << RSTRING(message)->ptr << endl; - - // backtrace - if(!NIL_P(ruby_errinfo)) { - VALUE ary = rb_funcall(ruby_errinfo, rb_intern("backtrace"), 0); - int c; - for (c=0; c<RARRAY(ary)->len; c++) { - msg << "from " << RSTRING(RARRAY(ary)->ptr[c])->ptr << endl; - } - } - throwException(ServiceInvocationException, msg.str().c_str()); - } - - // Convert the Ruby result value to a C++ result - int resultType = TYPE(result); - char buf[20]; - switch(resultType) - { - case T_FLOAT: - { - float* data = new float; - *data = rb_num2dbl(result); - - // Check if the return type has already been set for typed languages - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = (*data != 0.0); - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - sprintf(buf, "%f", *data); - *(char**)operation.getReturnValue() = buf; - break; - } - case Operation::STRING: - { - sprintf(buf, "%f", *data); - *(string*)operation.getReturnValue() = buf; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - break; - } - case T_STRING: - { - string* stringdata = new string(rb_string_value_cstr(&result)); - const char** data = new const char*; - *data = stringdata->c_str(); - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - // If the string is empty or "0" or "false" set to false, otherwise true - if(strlen(*data) == 0 || strcmp(*data, "0") == 0 || strcmp(*data, "false") == 0) - { - *(bool*)operation.getReturnValue() = false; - } - else - { - *(bool*)operation.getReturnValue() = true; - } - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)atoi(*data); - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)atoi(*data); - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)atoi(*data); - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)atoi(*data); - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)atol(*data); - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)atol(*data); - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)atof(*data); - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)atof(*data); - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)atof(*data); - break; - } - case Operation::CHARS: - { - *(const char**)operation.getReturnValue() = *data; - break; - } - case Operation::STRING: - { - *(string*)operation.getReturnValue() = *data; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - break; - } - case T_FIXNUM: - { - long* data = new long; - *data = rb_num2long(result); - - // Check if the return type has already been (set for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = (*data != 0); - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - sprintf(buf, "%d", *data); - *(char**)operation.getReturnValue() = buf; - break; - } - case Operation::STRING: - { - sprintf(buf, "%d", *data); - *(string*)operation.getReturnValue() = buf; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - - break; - } - case T_BIGNUM: - { - long double* data = new long double; - *data = rb_num2dbl(result); - - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = (*data != 0.0); - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - sprintf(buf, "%f", *data); - *(char**)operation.getReturnValue() = buf; - break; - } - case Operation::STRING: - { - sprintf(buf, "%f", *data); - *(string*)operation.getReturnValue() = buf; - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - break; - } - case T_TRUE: - case T_FALSE: - { - bool* data = new bool; - *data = (resultType == T_TRUE); - // Check if the return type has already been set (for typed languages) - switch(operation.getReturnType()) - { - case Operation::BOOL: - { - *(bool*)operation.getReturnValue() = *data; - break; - } - case Operation::SHORT: - { - *(short*)operation.getReturnValue() = (short)*data; - break; - } - case Operation::USHORT: - { - *(unsigned short*)operation.getReturnValue() = (unsigned short)*data; - break; - } - case Operation::INT: - { - *(int*)operation.getReturnValue() = (int)*data; - break; - } - case Operation::UINT: - { - *(unsigned int*)operation.getReturnValue() = (unsigned int)*data; - break; - } - case Operation::LONG: - { - *(long*)operation.getReturnValue() = (long)*data; - break; - } - case Operation::ULONG: - { - *(unsigned long*)operation.getReturnValue() = (unsigned long)*data; - break; - } - case Operation::FLOAT: - { - *(float*)operation.getReturnValue() = (float)*data; - break; - } - case Operation::DOUBLE: - { - *(double*)operation.getReturnValue() = (double)*data; - break; - } - case Operation::LONGDOUBLE: - { - *(long double*)operation.getReturnValue() = (long double)*data; - break; - } - case Operation::CHARS: - { - if(*data) - { - *(char**)operation.getReturnValue() = "true"; - } - else - { - *(char**)operation.getReturnValue() = "false"; - } - break; - } - case Operation::STRING: - { - if(*data) - { - *(string*)operation.getReturnValue() = "true"; - } - else - { - *(string*)operation.getReturnValue() = "false"; - } - break; - } - default: - { - // The type is set as something else or has not been set - operation.setReturnValue(data); - } - } - - break; - } - case T_OBJECT: - { - VALUE klass = rb_obj_class(result); - if (klass == RubyImplementation::getXMLDocumentClass()) - { - // Convert a REXML::Document to a DataObject - ID to_s = rb_intern("to_s"); - VALUE vstr = rb_funcall(result, to_s, 0); - string str = string(rb_string_value_cstr(&vstr)); - - loginfo("Converting Ruby Rexml document to SDO DataObject: %s", str.c_str()); - - Composite* composite = component->getComposite(); - commonj::sdo::XMLHelperPtr xmlHelper = composite->getXMLHelper(); - commonj::sdo::XMLDocumentPtr xmlDoc = xmlHelper->load(str.c_str()); - - DataObjectPtr* dataObjectData = new DataObjectPtr; - if (xmlDoc != NULL) - { - *dataObjectData = xmlDoc->getRootDataObject(); - } - else - { - *dataObjectData = NULL; - } - if (*dataObjectData != NULL) - { - operation.setReturnValue(dataObjectData); - } - else - { - string msg = "Document could not be converted to a DataObject"; - throwException(ServiceDataException, msg.c_str()); - } - } - else - { - string msg = "Ruby type not supported: " + resultType; - throwException(ServiceDataException, msg.c_str()); - } - break; - } - default: - { - string msg = "Ruby type not supported: " + resultType; - throwException(ServiceDataException, msg.c_str()); - } - } - - } - catch (...) - { - runtime->unsetCurrentComponent(); - throw; - } - - runtime->unsetCurrentComponent(); - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h deleted file mode 100644 index 2526084a72..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/RubyServiceWrapper.h +++ /dev/null @@ -1,94 +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_ruby_rubyservicewrapper_h -#define tuscany_sca_ruby_rubyservicewrapper_h - -#include "tuscany/sca/ruby/export.h" -#include "tuscany/sca/ruby/Ruby.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/ruby/model/RubyImplementation.h" - - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - class RubyInterface; - - /** - * 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 SCA_RUBY_API RubyServiceWrapper : public ServiceWrapper - { - public: - - /** - * Constructor. - * @param target The component service to which this wrapper refers. - */ - RubyServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~RubyServiceWrapper(); - - /** - * 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. - */ - virtual void invoke(Operation& operation); - - private: - - /** - * The component to which this wrapper refers. - */ - tuscany::sca::model::Component* component; - - /** - * A pointer to the interface which the service exposes. - */ - tuscany::sca::model::Interface* interf; - - /** - * The Ruby implementation - */ - RubyImplementation* implementation; - - }; - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_rubyservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/export.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/export.h deleted file mode 100644 index 5db72a1ebe..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/export.h +++ /dev/null @@ -1,38 +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_ruby_export_h -#define tuscany_sca_ruby_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_RUBY_LANG_EXPORTS -#define SCA_RUBY_API __declspec(dllexport) -#else -#define SCA_RUBY_API __declspec(dllimport) -#endif - -#else -#define SCA_RUBY_API -#endif - -#endif // tuscany_sca_ruby_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp deleted file mode 100644 index fa30642318..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.cpp +++ /dev/null @@ -1,171 +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/util/Logging.h" -#include "tuscany/sca/ruby/model/RubyImplementation.h" -#include "tuscany/sca/ruby/model/RubyServiceBinding.h" -#include "tuscany/sca/ruby/model/RubyReferenceBinding.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - - namespace ruby - { - - bool RubyImplementation::initialized = false; - VALUE RubyImplementation::xmlDocumentClass = 0; - - // Constructor - RubyImplementation::RubyImplementation(Composite* composite, const string& module, const string& className, const string& script) - : ComponentType(composite, script.substr(0, script.find_last_of('.'))), - module(module), className(className), script(script) - { - loadClass(); - } - - RubyImplementation::~RubyImplementation() - { - } - - VALUE RubyImplementation::getXMLDocumentClass() - { - logentry(); - - // Initialize the Ruby runtime - if (!initialized) - { - ruby_init(); - ruby_init_loadpath(); - - // Load the Rexml module. Rexml is used to handle XML documents. - //rb_require("rexml/document"); - // Use rb_eval_string for now as it provides better error reporting - rb_eval_string("require(\"rexml/document\")"); - - xmlDocumentClass = rb_path2class("REXML::Document"); - initialized = true; - } - - return xmlDocumentClass; - } - - void RubyImplementation::loadClass() - { - logentry(); - - // Ensure xmlDocumentClass is initialized - getXMLDocumentClass(); - - ID to_s = rb_intern("to_s"); - VALUE xstr = rb_funcall(xmlDocumentClass, to_s, 0); - loginfo("Got Ruby Rexml class: %s", rb_string_value_cstr(&xstr)); - - // Load the specified Ruby script - if (script != "") - { - // Convert any windows slashes \ in the root path to unix slashes / - string rootpath = getComposite()->getRoot(); - int pos = 0; - while((pos = rootpath.find('\\', pos)) != string::npos) - { - rootpath = rootpath.replace(pos, 1, "/"); - } - - // Use rb_eval_string for now as it provides better error reporting - string path = "require(\"" + rootpath + "/" + script +"\")"; - //rb_require((char *)path.c_str()); - rb_eval_string(path.c_str()); - } - - // Load the Ruby implementation class - implementationClass = rb_path2class(className.c_str()); - - // Create a default service - ServiceType* defaultServiceType = new ServiceType(this, "", NULL, NULL); - addServiceType(defaultServiceType); - - // Introspect the Ruby class and create references and properties for - // all public attributes - VALUE methods = rb_class_public_instance_methods(0, NULL, implementationClass); - int n = RARRAY(methods)->len; - for (int i = 0; i<n; i++) - { - VALUE method = rb_ary_entry(methods, i); - string methodName = string(rb_string_value_cstr(&method)); - - // Create a reference type for each setter method - int s = methodName.size(); - if (s > 1 && methodName[s-1] == '=' && methodName[0] != '=') - { - string variableName = methodName.substr(0, s-1); - ReferenceType* referenceType = new ReferenceType( - this, variableName, NULL, NULL, ReferenceType::ONE_ONE); - addReferenceType(referenceType); - - // Create a property type as well - addPropertyType(variableName, "http://www.w3.org/2001/XMLSchema#string", false, NULL); - - } - } - } - - void RubyImplementation::initializeComponent(Component* component) - { - ComponentType::initializeComponent(component); - - // Create Ruby bindings for all the services - const Component::SERVICE_MAP& services = component->getServices(); - Component::SERVICE_MAP::const_iterator iter = services.begin(); - for (int i=0; i< services.size(); i++) - { - Service *service = iter->second; - RubyServiceBinding* binding = new RubyServiceBinding(service); - service->setBinding(binding); - iter++; - } - - // Create Ruby bindings for all the references - const Component::REFERENCE_MAP& references = component->getReferences(); - Component::REFERENCE_MAP::const_iterator refiter = references.begin(); - for (int ri=0; ri< references.size(); ri++) - { - Reference *reference = refiter->second; - RubyReferenceBinding* binding = new RubyReferenceBinding(reference); - reference->setBinding(binding); - refiter++; - } - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h deleted file mode 100644 index c7bc851635..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyImplementation.h +++ /dev/null @@ -1,136 +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_ruby_model_rubyimplementation_h -#define tuscany_sca_ruby_model_rubyimplementation_h - -#include <string> - -#include "tuscany/sca/ruby/Ruby.h" -#include "tuscany/sca/model/ComponentType.h" - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - /** - * Holds information about an SCA implementation written in Ruby - */ - class RubyImplementation : public tuscany::sca::model::ComponentType - { - - public: - /** - * Constructor. - * @param composite The composite containing this implementation. - * @param module Name of the Ruby module. - * @param className Name of the Ruby implementation class. - * @param script Path of the Ruby script. - */ - RubyImplementation(tuscany::sca::model::Composite* composite, - const std::string& module, const std::string& className, const std::string& script); - - /** - * Destructor - */ - virtual ~RubyImplementation(); - - /** - * Initialize a component of this type. - * @param component The component to initialize. - */ - virtual void initializeComponent(tuscany::sca::model::Component* component); - - /** - * Returns the name of the Ruby module. - * @return The name of the Ruby module. - */ - const std::string& getModule() const { return module; } - - /** - * Returns the name of Ruby class. - * @return Name of the Ruby class. - */ - const std::string& getClass() const { return className; } - - /** - * Returns the path of the Ruby script. - * @return The path of the Ruby script. - */ - const std::string& getScript() const { return script; } - - /** - * Returns the Ruby implementation class - */ - VALUE getImplementationClass() const { return implementationClass; } - - /** - * Returns the Ruby REXML::Document class - */ - static VALUE getXMLDocumentClass(); - - private: - - /** - * Load the Ruby implementation class - */ - void loadClass(); - - /** - * Name of the Ruby module. - */ - std::string module; - - /** - * Name of the Ruby class. - */ - std::string className; - - /** - * Path of the Ruby script. - */ - std::string script; - - /** - * The Ruby implementation class - */ - VALUE implementationClass; - - /** - * True if the Ruby runtime has been initialized - */ - static bool initialized; - - /** - * The Ruby REXML::Document class. - */ - static VALUE xmlDocumentClass; - - }; - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_model_rubyimplementation_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp deleted file mode 100644 index 3187c07973..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.cpp +++ /dev/null @@ -1,60 +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/util/Logging.h" -#include "tuscany/sca/ruby/model/RubyReferenceBinding.h" -#include "tuscany/sca/ruby/RubyServiceProxy.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - // Constructor - RubyReferenceBinding::RubyReferenceBinding(Reference* reference) - : ReferenceBinding(reference, ""), serviceProxy(NULL) - { - } - - // Destructor - RubyReferenceBinding::~RubyReferenceBinding() - { - } - - ServiceProxy* RubyReferenceBinding::getServiceProxy() - { - return serviceProxy; - } - - void RubyReferenceBinding::configure(ServiceBinding* binding) - { - setTargetServiceBinding(binding); - - serviceProxy = new RubyServiceProxy(getReference()); - } - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h deleted file mode 100644 index 72d39b5639..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyReferenceBinding.h +++ /dev/null @@ -1,83 +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_ruby_model_rubyreferencebinding_h -#define tuscany_sca_ruby_model_rubyreferencebinding_h - -#include <string> - -#include "tuscany/sca/model/ReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - /** - * Information about a Ruby service binding for service or a reference. - */ - class RubyReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - */ - RubyReferenceBinding(tuscany::sca::model::Reference* reference); - - /** - * Destructor. - */ - virtual ~RubyReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RubyImplementationBinding"; }; - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual ServiceProxy* getServiceProxy(); - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - private: - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - }; - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_model_rubyreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp deleted file mode 100644 index 163f8a9d8b..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.cpp +++ /dev/null @@ -1,54 +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/util/Logging.h" -#include "tuscany/sca/ruby/model/RubyServiceBinding.h" -#include "tuscany/sca/ruby/RubyServiceWrapper.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - - // Constructor - RubyServiceBinding::RubyServiceBinding(Service* service) - : ServiceBinding(service, "") - { - serviceWrapper = new RubyServiceWrapper(service); - } - - // Destructor - RubyServiceBinding::~RubyServiceBinding() - { - } - - ServiceWrapper* RubyServiceBinding::getServiceWrapper() - { - return (ServiceWrapper*)serviceWrapper; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h deleted file mode 100644 index b772daf712..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/src/tuscany/sca/ruby/model/RubyServiceBinding.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - - -#ifndef tuscany_sca_ruby_model_rubyservicebinding_h -#define tuscany_sca_ruby_model_rubyservicebinding_h - -#include <string> - -#include "tuscany/sca/model/ServiceBinding.h" - -namespace tuscany -{ - namespace sca - { - namespace ruby - { - /** - * Information about a Ruby service binding for service or a reference. - */ - class RubyServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - */ - RubyServiceBinding(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~RubyServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#RubyImplementationBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - virtual ServiceWrapper* getServiceWrapper(); - - private: - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace ruby - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ruby_model_rubyservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd b/sca-cpp/trunk/contrib/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd deleted file mode 100644 index 5772019a4f..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ruby/xsd/sca-implementation-ruby.xsd +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="implementation.ruby" type="sca:RubyImplementation" substitutionGroup="sca:implementation"/> - <complexType name="RubyImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="script" type="NCName" use="optional"/> - <attribute name="module" type="NCName" use="optional"/> - <attribute name="class" type="Name" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/sca/Makefile.am deleted file mode 100644 index 50dfb45557..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/Makefile.am +++ /dev/null @@ -1,23 +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. - -SUBDIRS = reference service -datadir=$(prefix)/extensions/sca - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/Makefile.am deleted file mode 100644 index 2b9491ec1c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = src diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/Makefile.am deleted file mode 100644 index d5fdf775ca..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/Makefile.am +++ /dev/null @@ -1,42 +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. - -libdir=$(prefix)/extensions/sca/reference/lib -lib_LTLIBRARIES = libtuscany_sca_binding_reference.la - -noinst_HEADERS = \ -tuscany/sca/binding/*.h \ -tuscany/sca/binding/model/*.h - -libtuscany_sca_binding_reference_la_SOURCES = \ -tuscany/sca/binding/SCAServiceBindingExtension.cpp \ -tuscany/sca/binding/model/SCAServiceBinding.cpp - -libtuscany_sca_binding_reference_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include - -moduledir=$(prefix)/extensions/sca/reference/module -extension = libtuscany_sca_binding_reference$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp deleted file mode 100644 index 7d70f595cc..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.cpp +++ /dev/null @@ -1,103 +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 "SCAServiceBindingExtension.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/core/Exceptions.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_binding_reference_initialize() - { - tuscany::sca::binding::SCAServiceBindingExtension::initialize(); - } -} - - -namespace tuscany -{ - namespace sca - { - namespace binding - { - // =================================================================== - // Constructor for the SCAServiceBinding class. - // =================================================================== - SCAServiceBindingExtension::SCAServiceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the SCAServiceBindingExtension class. - // =================================================================== - SCAServiceBindingExtension::~SCAServiceBindingExtension() - { - logentry(); - } - - const string SCAServiceBindingExtension::extensionName("sca"); - const string SCAServiceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#SCABinding"); - - - // =================================================================== - // loadModelElement - load the info from binding.ws - // =================================================================== - ServiceBinding* SCAServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding) - { - logentry(); - - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - - ServiceBindingExtension* bindingExtension = NULL; // runtime->getServiceBindingExtension("http://www.osoa.org/xmlns/sca/1.0#RESTBinding"); - if (bindingExtension == NULL) - { - bindingExtension = runtime->getServiceBindingExtension("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"); - if (bindingExtension == NULL) - { - logerror("SCA default binding requires the REST or WS binding to be available"); - - string message = "SCA default binding requires the REST or WS binding to be available"; - throwException(SystemConfigurationException, message.c_str()); - } - } - - return bindingExtension->getServiceBinding(composite, service, scdlBinding); - } - - void SCAServiceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerServiceBindingExtension(new SCAServiceBindingExtension()); - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.h deleted file mode 100644 index 389541061a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/SCAServiceBindingExtension.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#ifndef tuscany_sca_extension_binding_scaservicebindingextension_h -#define tuscany_sca_extension_binding_scaservicebindingextension_h - -#include "tuscany/sca/extension/ServiceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace binding - { - - class SCAServiceBindingExtension : public ServiceBindingExtension - { - public: - /** - * Default constructor - */ - SCAServiceBindingExtension(); - - /** - * Destructor - */ - virtual ~SCAServiceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ServiceBinding* getServiceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Service* service, - commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany - -#endif //tuscany_sca_extension_binding_scaservicebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.cpp deleted file mode 100644 index 3b5564a765..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.cpp +++ /dev/null @@ -1,59 +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/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/binding/model/SCAServiceBinding.h" -#include "tuscany/sca/core/ServiceWrapper.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace binding - { - - // Constructor - SCAServiceBinding::SCAServiceBinding(Composite* composite, Service* service, const string& uri, DataObjectPtr scdlBinding) - : ServiceBinding(service, uri) - { - } - - // Destructor - SCAServiceBinding::~SCAServiceBinding() - { - } - - ServiceWrapper* SCAServiceBinding::getServiceWrapper() - { - logentry(); - - throwException(SystemConfigurationException, "Not supported"); - } - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.h deleted file mode 100644 index d73a10f202..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/reference/src/tuscany/sca/binding/model/SCAServiceBinding.h +++ /dev/null @@ -1,76 +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_extension_binding_model_scaservicebinding_h -#define tuscany_sca_extension_binding_model_scaservicebinding_h - -#include <string> - -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - namespace binding - { - /** - * Information about an SCA service binding for service or a reference. - */ - class SCAServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - */ - SCAServiceBinding(tuscany::sca::model::Composite* composite, tuscany::sca::model::Service* service, const std::string& uri, commonj::sdo::DataObjectPtr scdlBinding); - - /** - * Destructor. - */ - virtual ~SCAServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#SCABinding"; }; - - /** - * Create a service wrapper handling the interaction - * with the service configured with this binding. - */ - virtual tuscany::sca::ServiceWrapper* getServiceWrapper(); - - private: - - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_model_wsservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/Makefile.am deleted file mode 100644 index 2b9491ec1c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = src diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/Makefile.am deleted file mode 100644 index 1136dba677..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/Makefile.am +++ /dev/null @@ -1,42 +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. - -libdir=$(prefix)/extensions/sca/service/lib -lib_LTLIBRARIES = libtuscany_sca_binding_service.la - -noinst_HEADERS = \ -tuscany/sca/binding/*.h \ -tuscany/sca/binding/model/*.h - -libtuscany_sca_binding_service_la_SOURCES = \ -tuscany/sca/binding/SCAReferenceBindingExtension.cpp \ -tuscany/sca/binding/model/SCAReferenceBinding.cpp - -libtuscany_sca_binding_service_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include - -moduledir=$(prefix)/extensions/sca/service/module -extension = libtuscany_sca_binding_service$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp deleted file mode 100644 index 789d8794df..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.cpp +++ /dev/null @@ -1,103 +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 "SCAReferenceBindingExtension.h" -#include "model/SCAReferenceBinding.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/core/Exceptions.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_binding_service_initialize() - { - tuscany::sca::binding::SCAReferenceBindingExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace binding - { - // =================================================================== - // Constructor for the SCAReferenceBinding class. - // =================================================================== - SCAReferenceBindingExtension::SCAReferenceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the SCAReferenceBindingExtension class. - // =================================================================== - SCAReferenceBindingExtension::~SCAReferenceBindingExtension() - { - logentry(); - } - - const string SCAReferenceBindingExtension::extensionName("sca"); - const string SCAReferenceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#SCABinding"); - - // =================================================================== - // loadModelElement - load the info from binding.ws - // =================================================================== - ReferenceBinding* SCAReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding) - { - logentry(); - - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - - ReferenceBindingExtension* bindingExtension = NULL; // runtime->getReferenceBindingExtension("http://www.osoa.org/xmlns/sca/1.0#RESTBinding"); - if (bindingExtension == NULL) - { - bindingExtension = runtime->getReferenceBindingExtension("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"); - if (bindingExtension == NULL) - { - logerror("SCA default binding requires the REST or WS binding to be available"); - - string message = "SCA default binding requires the REST or WS binding to be available"; - throwException(SystemConfigurationException, message.c_str()); - } - } - - return bindingExtension->getReferenceBinding(composite, reference, scdlBinding); - } - - void SCAReferenceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerReferenceBindingExtension(new SCAReferenceBindingExtension()); - } - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.h deleted file mode 100644 index 8cde2fbef4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/SCAReferenceBindingExtension.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#ifndef tuscany_sca_extension_binding_scareferencebindingextension_h -#define tuscany_sca_extension_binding_scareferencebindingextension_h - -#include "tuscany/sca/extension/ReferenceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace binding - { - - class SCAReferenceBindingExtension : public ReferenceBindingExtension - { - public: - /** - * Default constructor - */ - SCAReferenceBindingExtension(); - - /** - * Destructor - */ - virtual ~SCAReferenceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ReferenceBinding* getReferenceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Reference *reference, - commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_binding_scareferencebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.cpp deleted file mode 100644 index b8eaaaa1f9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.cpp +++ /dev/null @@ -1,66 +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/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/binding/model/SCAReferenceBinding.h" -#include "tuscany/sca/core/ServiceProxy.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace binding - { - - // Constructor - SCAReferenceBinding::SCAReferenceBinding(Composite* composite, Reference* reference, const string& uri, DataObjectPtr scdlBinding) - : ReferenceBinding(reference, uri) - { - } - - // Destructor - SCAReferenceBinding::~SCAReferenceBinding() - { - } - - ServiceProxy* SCAReferenceBinding::getServiceProxy() - { - throwException(SystemConfigurationException, "Not supported"); - } - - void SCAReferenceBinding::configure(ServiceBinding* serviceBinding) - { - throwException(SystemConfigurationException, "Not supported"); - } - - void SCAReferenceBinding::configure(const std::string& uri) - { - throwException(SystemConfigurationException, "Not supported"); - } - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.h deleted file mode 100644 index f3e699e2ee..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/service/src/tuscany/sca/binding/model/SCAReferenceBinding.h +++ /dev/null @@ -1,85 +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_extension_binding_model_scareferencebinding_h -#define tuscany_sca_extension_binding_model_scareferencebinding_h - -#include <string> - -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ReferenceBinding.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/core/ServiceProxy.h" - -namespace tuscany -{ - namespace sca - { - namespace binding - { - /** - * Information about a web service binding for service or a reference. - */ - class SCAReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - */ - SCAReferenceBinding(tuscany::sca::model::Composite* composite, tuscany::sca::model::Reference* reference, const std::string&uri, commonj::sdo::DataObjectPtr scdlBinding); - - /** - * Destructor. - */ - virtual ~SCAReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#SCABinding"; }; - - /** - * Create a proxy representing the reference to the - * client component. - */ - virtual tuscany::sca::ServiceProxy* getServiceProxy(); - - /** - * Configure this binding from a service binding. - */ - virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - /** - * Configure this binding from a URI. - */ - virtual void configure(const std::string& uri); - - private: - - }; - - } // End namespace binding - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_binding_model_scareferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/sca/xsd/sca-binding-sca.xsd b/sca-cpp/trunk/contrib/runtime/extensions/sca/xsd/sca-binding-sca.xsd deleted file mode 100644 index 6ec18bd992..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/sca/xsd/sca-binding-sca.xsd +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="binding.sca" type="sca:SCABinding" substitutionGroup="sca:binding"/> - <complexType name="SCABinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/Makefile.am deleted file mode 100644 index 806786ce04..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/Makefile.am +++ /dev/null @@ -1,23 +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. - -SUBDIRS = reference service -datadir=$(prefix)/extensions/ws - -nobase_data_DATA = xsd/*.xsd - -EXTRA_DIST = xsd diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/Makefile.am deleted file mode 100644 index 18e9ba89b9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = axis2c diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/Makefile.am deleted file mode 100644 index 2b9491ec1c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = src diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/Makefile.am deleted file mode 100644 index fbf304f8c2..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/Makefile.am +++ /dev/null @@ -1,54 +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. - -libdir=$(prefix)/extensions/ws/reference/lib -lib_LTLIBRARIES = libtuscany_sca_ws_reference.la - -noinst_HEADERS = tuscany/sca/ws/*.h tuscany/sca/ws/model/*.h - -libtuscany_sca_ws_reference_la_SOURCES = \ -tuscany/sca/ws/WSServiceBindingExtension.cpp \ -tuscany/sca/ws/model/WSServiceBinding.cpp \ -tuscany/sca/ws/WSServiceWrapper.cpp \ -tuscany/sca/ws/Axis2Client.cpp - -libtuscany_sca_ws_reference_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(AXIS2C_HOME)/lib \ - -laxis2_util \ - -laxis2_axiom \ - -laxis2_wsdl \ - -laxis2_engine \ - -laxis2_parser \ - -laxis2_minizip \ - -lpthread \ - -lwoden \ - -laxis2_http_sender \ - -laxis2_http_receiver - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${AXIS2C_HOME}/include - -moduledir=$(prefix)/extensions/ws/reference/module -extension = libtuscany_sca_ws_reference$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp deleted file mode 100644 index fa55c049b7..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp +++ /dev/null @@ -1,820 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4091) -#pragma warning(disable: 4786) -#endif - -#include <sstream> - -#include <axis2_client.h> - -#include <axis2_error_default.h> -#include <axis2_log_default.h> -#include <axis2_defines.h> -#include <axiom_soap_const.h> -#include <platforms/axis2_platform_auto_sense.h> - -#include <sdo_axiom.h> - -#include "Axis2Client.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/SDOUtils.h" -#include "model/WSServiceBinding.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/WSDLDefinition.h" -#include "tuscany/sca/model/WSDLInterface.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "tuscany/sca/model/WSDLMessagePart.h" - -using namespace std; -using namespace commonj::sdo; -using namespace commonj::sdo_axiom; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - Axis2Client::Axis2Client(CompositeReference* compositeReference) - : compositeReference(compositeReference) - { - logentry(); - } - - Axis2Client::~Axis2Client() - { - logentry(); - } - - void Axis2Client::invoke(tuscany::sca::Operation& operation) - { - logentry(); - - // Initialize Axis2 stuff - axis2_env_t *env = axis2_env_create_all("tuscany_ws_reference.log",AXIS2_LOG_LEVEL_TRACE); - axis2_error_init(); - - // Get the WS service binding and WSDLOperation - Composite* composite=compositeReference->getComposite(); - Service* service = compositeReference->getService(); - WSServiceBinding* binding = (WSServiceBinding *)service->getBinding(); - const string& operationName = operation.getName(); - WSDLOperation wsdlOperation; - - // Get the WSDL namespace - string wsdlNamespace = binding->getWSDLNamespaceURL(); - if (wsdlNamespace != "") - { - - // Lookup the wsdl model from the composite, keyed on the namespace - // (the wsdl will have been loaded at startup) - WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace); - if (wsdlDefinition == 0) - { - string msg = "WSDL not found for " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - - // Match the operation in Operation to the operation in the wsdl port type. - try - { - wsdlOperation = wsdlDefinition->findOperation( - binding->getServiceName(), - binding->getEndpointName(), - operationName); - } - catch(SystemConfigurationException&) - { - throw; - } - } - else - { - Interface* iface = service->getType()->getInterface(); - if (iface != NULL && - iface->getInterfaceTypeQName() == WSDLInterface::typeQName) - { - WSDLInterface* wsdlInterface = (WSDLInterface*)iface; - wsdlNamespace = wsdlInterface->getNamespaceURI(); - - if (wsdlNamespace != "") - { - - WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace); - if (wsdl == 0) - { - string msg = "WSDL not found for " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - - try - { - wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), operationName); - } - catch(SystemConfigurationException&) - { - throw; - } - } - } - } - - if (wsdlNamespace == "") - { - - // Create a default document literal wrapped WSDL operation - WSDLMessagePart inputPart(operationName, "", "http://tempuri.org"); - WSDLMessagePart outputPart((operationName+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeReference->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(operationName); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +operationName); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(operationName, inputPart); - wsdlOperation.setOutputMessagePart((operationName+"Response"), outputPart); - } - else if (!wsdlOperation.isDocumentStyle() || !wsdlOperation.isWrappedStyle()) - { - throwException(ServiceInvocationException, - "Only wrapped document style WSDL operations are currentlysupported"); - } - - // The URI specified in the binding overrides the address specified in - // the WSDL - axis2_char_t* address; - - // Get the URI configured on the top level component - string bindingURI = ""; - SCARuntime* runtime = SCARuntime::getCurrentRuntime(); - Component* component = runtime->getDefaultComponent(); - Reference* reference = component->findReference(compositeReference->getName()); - if (reference != NULL) - { - ReferenceBinding* referenceBinding = reference->getBinding(); - if (referenceBinding != NULL && referenceBinding->getURI() != "") - { - bindingURI = referenceBinding->getURI(); - } - } - if (bindingURI == "") - { - // Get the URI configured on the binding - if (binding->getURI() != "") - { - bindingURI = binding->getURI(); - } - } - if (bindingURI != "") - { - // Prepend the default base URI if the URI is not absolute - if (bindingURI.find("://") == string::npos) - { - bindingURI = runtime->getDefaultBaseURI() + string("/axis2/services/") + bindingURI; - } - address = (axis2_char_t*)bindingURI.c_str(); - } - else - { - address = (axis2_char_t*)wsdlOperation.getEndpoint().c_str(); - } - - axis2_char_t* opName = (axis2_char_t*)operationName.c_str(); - axis2_char_t* soap_action = (axis2_char_t*)wsdlOperation.getSoapAction().c_str(); - - // create OM from Operation and wsdlOperation - axiom_node_t* payload = createPayload(operation, wsdlOperation, env); - /* Create EPR with given address */ - axis2_endpoint_ref_t* endpoint_ref = axis2_endpoint_ref_create(env, address); - - /* Setup options */ - axis2_options_t* options = axis2_options_create(env); - AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref); - int soap_version = AXIOM_SOAP11; - if (binding->getSOAPVersion() == "1.2") - { - soap_version = AXIOM_SOAP12; - } - else - { - if (wsdlOperation.getSoapVersion() == WSDLOperation::SOAP12) - { - soap_version = AXIOM_SOAP12; - } - } - - AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, soap_version); - AXIS2_OPTIONS_SET_ACTION(options, env, soap_action); - AXIS2_OPTIONS_SET_XML_PARSER_RESET(options, env, AXIS2_FALSE); - - loginfo("WS SOAP action: %s", soap_action); - loginfo("WS Endpoint address: %s", address); - if(soap_version == AXIOM_SOAP11) - { - // Only set the SOAP action when using SOAP1.1 - AXIS2_OPTIONS_SET_SOAP_ACTION(options, env, soap_action); - loginfo("Set soap version: 1.1"); - } - else if(soap_version == AXIOM_SOAP12) - { - loginfo("Set soap version: 1.2"); - } - else - { - loginfo("Set soap version: unset"); - } - /* Create service client */ - - axis2_char_t* client_home = AXIS2_GETENV("AXIS2C_HOME"); - if (!client_home) - { - throwException(SystemConfigurationException, "AXIS2C_HOME not set"); - } - axis2_svc_client_t* svc_client = axis2_svc_client_create(env, client_home); - if (!svc_client) - { - ostringstream msg; - msg << "Axis2 svc_client_create failed, error: " << env->error->error_number << - ", " << AXIS2_ERROR_GET_MESSAGE(env->error); - throwException(SystemConfigurationException, msg.str().c_str()); - } - - /* Set service client options */ - AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options); - - /* Engage addressing module */ - AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING); - - loginfo("Sending WS request"); - /* Send request */ - axiom_node_t* ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload); - if(ret_node) - { - setReturn(ret_node, operation, wsdlOperation, env); - - // Set return value - now need to detach the node from the Axiom document - // for clean-up - axiom_document_t *document = AXIOM_NODE_GET_DOCUMENT(ret_node, env); - if (document) - { - AXIOM_DOCUMENT_BUILD_ALL (document, env); - } - AXIOM_NODE_DETACH (ret_node, env); - } - else - { - ostringstream msg; - msg << "Axis2 client_send_received failed, error: " << env->error->error_number << - ", " << AXIS2_ERROR_GET_MESSAGE(env->error); - throwException(ServiceInvocationException, msg.str().c_str()); - } - - if (svc_client) - { - AXIS2_SVC_CLIENT_FREE(svc_client, env); - svc_client = NULL; - } - - if(env) - { - axis2_env_free((axis2_env_t *) env); - env = NULL; - } - loginfo("Freed env"); - - } - - axiom_node_t* Axis2Client::createPayload(Operation& operation, - const WSDLOperation& wsdlOperation, - axis2_env_t* env) - { - logentry(); - - axiom_node_t* request_node = NULL; - - // Build up the payload as an SDO - - // Get the data factory for the composite (it will already have the typecreates loaded for the xsds) - DataFactoryPtr dataFactory = compositeReference->getComposite()->getDataFactory(); - - DataObjectPtr inputDataObject; - string inputTypeUri; - string inputTypeName; - - try - { - // Since its Document wrapped, there will only be one part - std::list<std::string> partList = wsdlOperation.getInputMessagePartNames(); - const WSDLMessagePart &inputMessage = - wsdlOperation.getInputMessagePart(partList.front()); - inputTypeName = inputMessage.getPartType(); - inputTypeUri = inputMessage.getPartUri(); - - // Create the input wrapper - const Type& rootType = dataFactory->getType(inputTypeUri.c_str(), "RootType"); - const Property& prop = rootType.getProperty(inputTypeName.c_str()); - const Type& inputType = prop.getType(); - inputDataObject = dataFactory->create(inputType); - } - catch (SDORuntimeException&) - { - try - { - // Create the input wrapper - const Type& inputType = - dataFactory->getType(inputTypeUri.c_str(), inputTypeName.c_str()); - inputDataObject = dataFactory->create(inputType); - } - catch (SDORuntimeException&) - { - - // The input wrapper type is not known, create an open DataObject - //inputDataObject = dataFactory->create("http://tempuri.org", "Wrapper"); - inputDataObject = dataFactory->create(SDOUtils::sdoURI, "OpenDataObject"); - } - } - - // Go through data object to set the input parameters - PropertyList pl = inputDataObject->getType().getProperties(); - - if(pl.size() == 0) - { - if(inputDataObject->getType().isOpenType() && inputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with sending xsd:any elements - */ - for (unsigned int i=0; i<operation.getNParms(); i++) - { - ostringstream pname; - pname << "param" << (i+1); - DataObjectList& l = inputDataObject->getList(pname.str()); - - const Operation::Parameter& parm = operation.getParameter(i); - switch(parm.getType()) - { - case Operation::BOOL: - { - l.append(*(bool*)parm.getValue()); - break; - } - case Operation::SHORT: - { - l.append(*(short*)parm.getValue()); - break; - } - case Operation::INT: - { - l.append(*(long*)parm.getValue()); - break; - } - case Operation::LONG: - { - l.append(*(long*)parm.getValue()); - break; - } - case Operation::USHORT: - { - l.append(*(short*)parm.getValue()); - break; - } - case Operation::UINT: - { - l.append(*(long*)parm.getValue()); - break; - } - case Operation::ULONG: - { - l.append(*(long*)parm.getValue()); - break; - } - case Operation::FLOAT: - { - l.append(*(float*)parm.getValue()); - break; - } - case Operation::DOUBLE: - { - l.append(*(long double*)parm.getValue()); - break; - } - case Operation::LONGDOUBLE: - { - l.append(*(long double*)parm.getValue()); - break; - } - case Operation::CHARS: - { - l.append(*(char**)parm.getValue()); - break; - } - case Operation::STRING: - { - l.append((*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - l.append(*(DataObjectPtr*)parm.getValue()); - break; - } - default: - { - ostringstream msg; - msg << "Unsupported parameter type: " << parm.getType(); - throwException(ServiceDataException, msg.str().c_str()); - } - } - } - } - } - else { - - // Each parameter in the operation should be a property on the request dataobject - for (unsigned int i=0; i<operation.getNParms(); i++) - { - const Operation::Parameter& parm = operation.getParameter(i); - switch(parm.getType()) - { - case Operation::BOOL: - { - inputDataObject->setBoolean(i, *(bool*)parm.getValue()); - break; - } - case Operation::SHORT: - { - inputDataObject->setShort(i, *(short*)parm.getValue()); - break; - } - case Operation::INT: - { - inputDataObject->setInt(i, *(int*)parm.getValue()); - break; - } - case Operation::LONG: - { - inputDataObject->setLong(i, *(long*)parm.getValue()); - break; - } - case Operation::USHORT: - { - inputDataObject->setInt(i, *(unsigned short*)parm.getValue()); - break; - } - case Operation::UINT: - { - inputDataObject->setInt(i, *(unsigned int*)parm.getValue()); - break; - } - case Operation::ULONG: - { - inputDataObject->setInt(i, *(unsigned long*)parm.getValue()); - break; - } - case Operation::FLOAT: - { - inputDataObject->setFloat(i, *(float*)parm.getValue()); - break; - } - case Operation::DOUBLE: - { - inputDataObject->setDouble(i, *(double*)parm.getValue()); - break; - } - case Operation::LONGDOUBLE: - { - inputDataObject->setDouble(i, *(long double*)parm.getValue()); - break; - } - case Operation::CHARS: - { - inputDataObject->setCString(i, *(char**)parm.getValue()); - break; - } - case Operation::STRING: - { - inputDataObject->setCString(i, (*(string*)parm.getValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - inputDataObject->setDataObject(i, *(DataObjectPtr*)parm.getValue()); - break; - } - default: - ostringstream msg; - msg << "Unsupported parameter type: " << parm.getType(); - throwException(ServiceDataException, msg.str().c_str()); - } - } - } - - // Create the Axiom object from the request dataobject - AxiomHelper* axiomHelper = AxiomHelper::getHelper(); - request_node = axiomHelper->toAxiomNode(inputDataObject, - inputTypeUri.c_str(), inputTypeName.c_str()); - AxiomHelper::releaseHelper(axiomHelper); - - char* str = AXIOM_NODE_TO_STRING(request_node, env); - loginfo("Sending Axis2 OM: %s ", str); - - return request_node; - - } - - void Axis2Client::setReturn(axiom_node_t* ret_node, - Operation& operation, - const WSDLOperation& wsdlOperation, - axis2_env_t* env) - { - logentry(); - - DataFactoryPtr dataFactory = compositeReference->getComposite()->getDataFactory(); - - // Get the AXIOM node representing the SOAP Body - axiom_node_t* body = AXIOM_NODE_GET_PARENT(ret_node, env); - - // Convert the AXIOM node to an SDO DataObject - char* str = NULL; - str = AXIOM_NODE_TO_STRING(body, env); - if (str) - { - loginfo("Received Axis2 OM: %s ", str); - } - - // Convert the SOAP body to an SDO DataObject - AxiomHelper* axiomHelper = AxiomHelper::getHelper(); - DataObjectPtr outputBodyDataObject = axiomHelper->toSdo(body, dataFactory); - AxiomHelper::releaseHelper(axiomHelper); - - if(!outputBodyDataObject) - { - string msg = "Could not convert Axis2 OM node to SDO"; - throwException(ServiceInvocationException, msg.c_str()); - } - else - { - ostringstream os; - os << outputBodyDataObject; - loginfo("Converted Axis2 OM node to SDO: %s", os.str().c_str()); - } - - XMLHelperPtr xmlHelper = compositeReference->getComposite()->getXMLHelper(); - - // Get the first body part representing the doc-lit-wrapped wrapper element - DataObjectPtr outputDataObject = NULL; - PropertyList bpl = outputBodyDataObject->getInstanceProperties(); - if (bpl.size()!=0) - { - if (bpl[0].isMany()) - { - DataObjectList& parts = outputBodyDataObject->getList((unsigned int)0); - outputDataObject = parts[0]; - } - else - { - outputDataObject = outputBodyDataObject->getDataObject(bpl[0]); - } - } - if (outputDataObject == NULL) - { - string msg = "Could not convert Axis2 body part to SDO"; - throwException(ServiceInvocationException, msg.c_str()); - } - - PropertyList pl = outputDataObject->getType().getProperties(); - if (pl.size() == 0) - { - if (outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType()) - { - SequencePtr sequence = outputDataObject->getSequence(); - if (sequence != NULL && sequence->size() != 0) - { - // Return a text element - if (sequence->isText(0)) - { - string* stringData = new string(sequence->getCStringValue(0)); - operation.setReturnValue(stringData); - } - else - { - // Return a DataObject representing a complex element - DataObjectPtr *dataObjectData = new DataObjectPtr; - *dataObjectData = sequence->getDataObjectValue(0); - if(!*dataObjectData) - { - loginfo("Null DataObject return value"); - } - else - { - (*dataObjectData)->detach(); - } - operation.setReturnValue(dataObjectData); - } - } - } - } - else - { - const Property* p = &pl[0]; - - switch(pl[0].getTypeEnum()) - { - case Type::BooleanType: - { - bool* boolData = new bool; - *boolData = outputDataObject->getBoolean(pl[0]); - operation.setReturnValue(boolData); - } - break; - case Type::ByteType: - { - char* byteData = new char; - *byteData = outputDataObject->getByte(pl[0]); - operation.setReturnValue(byteData); - } - break; - case Type::BytesType: - { - int len = outputDataObject->getLength(pl[0]); - char** bytesData = new char*; - *bytesData = new char[len+1]; - int bytesWritten = outputDataObject->getBytes(pl[0], *bytesData, len); - // Ensure the bytes end with the null char. Not sure if this is neccessary - if(bytesWritten <= len) - { - (*bytesData)[bytesWritten] = 0; - } - else - { - (*bytesData)[len] = 0; - } - //printf("outputDataObject has BytesType named %s with length %d\n", name, bytesWritten); - operation.setReturnValue(bytesData); - } - break; - case Type::CharacterType: - { - // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType - wchar_t* charData = new wchar_t; - *charData = outputDataObject->getCharacter(pl[0]); - operation.setReturnValue(charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = new long double; - *doubleData = outputDataObject->getDouble(pl[0]); - operation.setReturnValue(doubleData); - } - break; - case Type::FloatType: - { - float* floatData = new float; - *floatData = outputDataObject->getFloat(pl[0]); - operation.setReturnValue(floatData); - } - break; - case Type::IntType: - { - long* intData = new long; - *intData = outputDataObject->getInt(pl[0]); - operation.setReturnValue(intData); - } - break; - case Type::ShortType: - { - short* shortData = new short; - *shortData = outputDataObject->getShort(pl[0]); - operation.setReturnValue(shortData); - } - break; - case Type::StringType: - { - string* stringData = new string(outputDataObject->getCString(pl[0])); - operation.setReturnValue(stringData); - } - break; - case Type::DataObjectType: - { - if (!strcmp(pl[0].getType().getURI(), SDOUtils::sdoURI) && - !strcmp(pl[0].getType().getName(), "OpenDataObject")) { - - /* - * This code deals with xsd:any element parameters - */ - - DataObjectList& dataObjectList = outputDataObject->getList(pl[0]); - - for(unsigned int j=0; j<dataObjectList.size(); j++) - { - DataObjectPtr dob = dataObjectList[j]; - if(!dob) - { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = NULL; - operation.setReturnValue(dataObjectData); - loginfo("Null OpenDataObject return value"); - } - else - { - - SequencePtr sequence = dob->getSequence(); - if (sequence->size()!=0) - { - // Return a text element - if (sequence->isText(0)) - { - string* stringData = new string(sequence->getCStringValue(0)); - operation.setReturnValue(stringData); - } - else - { - // Return a DataObject representing a complex element - DataObjectPtr *dataObjectData = new DataObjectPtr; - *dataObjectData = sequence->getDataObjectValue(0); - if(!*dataObjectData) - { - loginfo("Null DataObject return value"); - } - else - { - (*dataObjectData)->detach(); - } - operation.setReturnValue(dataObjectData); - } - } - else - { - // Empty content, add an empty string - loginfo("Null OpenDataObject return value"); - string *stringData = new string(""); - operation.setReturnValue(stringData); - } - } - } - } - else { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = outputDataObject->getDataObject(pl[0]); - if(!*dataObjectData) - { - loginfo("Null DataObject return value"); - } - else - { - (*dataObjectData)->detach(); - } - operation.setReturnValue(dataObjectData); - } - } - break; - default: - { - ostringstream msg; - msg << "Unsupported result type: " << pl[0].getTypeEnum(); - throwException(SystemConfigurationException, msg.str().c_str()); - } - } - } - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h deleted file mode 100644 index 397440dd5d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h +++ /dev/null @@ -1,65 +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_extension_ws_axis2client_h -#define tuscany_sca_extension_ws_axis2client_h - -#include <axiom.h> - -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/CompositeReference.h" -#include "tuscany/sca/model/WSDLOperation.h" - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - class Axis2Client - { - public: - Axis2Client(tuscany::sca::model::CompositeReference* compositeReference); - virtual ~Axis2Client(); - - virtual void invoke(Operation& operation); - - private: - tuscany::sca::model::CompositeReference* compositeReference; - - axiom_node_t* createPayload(Operation& operation, - const tuscany::sca::model::WSDLOperation& wsdlOp, - axis2_env_t* env); - - void setReturn(axiom_node_t* returnNode, - Operation& operation, - const tuscany::sca::model::WSDLOperation& wsdlOp, - axis2_env_t* env); - - }; - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_axis2client_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp deleted file mode 100644 index 53d6075bbd..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp +++ /dev/null @@ -1,118 +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 "WSServiceBindingExtension.h" -#include "model/WSServiceBinding.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_ws_reference_initialize() - { - tuscany::sca::ws::WSServiceBindingExtension::initialize(); - } -} - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - // =================================================================== - // Constructor for the WSServiceBinding class. - // =================================================================== - WSServiceBindingExtension::WSServiceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the WSServiceBindingExtension class. - // =================================================================== - WSServiceBindingExtension::~WSServiceBindingExtension() - { - logentry(); - } - - const string WSServiceBindingExtension::extensionName("ws"); - const string WSServiceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"); - - - // =================================================================== - // loadModelElement - load the info from binding.ws - // =================================================================== - ServiceBinding* WSServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding) - { - logentry(); - - string uri = scdlBinding->getCString("uri"); - string endpoint; - try - { - endpoint = scdlBinding->getCString("endpoint"); - } - catch (SDORuntimeException&) - { - endpoint = ""; - } - string version; - try - { - commonj::sdo::DataObjectList& soap = scdlBinding->getList("soapbinding"); - if (soap.size()!=0) - { - version = soap.getCString(0); - } - else - { - version = ""; - } - } - catch (SDORuntimeException&) - { - version = ""; - } - - WSServiceBinding* serviceBinding = new WSServiceBinding(service, uri, endpoint, version); - - return serviceBinding; - } - - void WSServiceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerServiceBindingExtension(new WSServiceBindingExtension()); - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h deleted file mode 100644 index 68dd657657..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h +++ /dev/null @@ -1,78 +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_extension_ws_wsservicebindingextension_h -#define tuscany_sca_extension_ws_wsservicebindingextension_h - -#include "tuscany/sca/extension/ServiceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - class WSServiceBindingExtension : public ServiceBindingExtension - { - public: - /** - * Default constructor - */ - WSServiceBindingExtension(); - - /** - * Destructor - */ - virtual ~WSServiceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ServiceBinding* getServiceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Service* service, - commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif //tuscany_sca_extension_ws_wsservicebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp deleted file mode 100644 index 4adcd5b4ff..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4091) -#endif - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/util/Logging.h" -#include "Axis2Client.h" -#include "WSServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceType.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - WSServiceWrapper::WSServiceWrapper(Service* service) : ServiceWrapper(service) - { - logentry(); - - // Define the SOAP Body type and element to allow a SOAP body to - // be loaded in a DataObject - DataFactoryPtr dataFactory = service->getComponent()->getComposite()->getDataFactory(); - try { - const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body"); - } catch (SDORuntimeException&) - { - dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "RootType", false, false, false); - dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "Body", false, true, false); - dataFactory->addPropertyToType( - "http://www.w3.org/2003/05/soap-envelope", "RootType", - "Body", - "http://www.w3.org/2003/05/soap-envelope", "Body", - false, false, true); - - dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "RootType", false, false, false); - dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "Body", false, true, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/soap/envelope/", "RootType", - "Body", - "http://schemas.xmlsoap.org/soap/envelope/", "Body", - false, false, true); - } - - try { - const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType"); - } catch (SDORuntimeException&) - { - dataFactory->addType("http://tempuri.org", "RootType", false, false, false); - dataFactory->addType("http://tempuri.org", "Wrapper", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Wrapper", - "http://tempuri.org", "Wrapper", - false, false, true); - dataFactory->addType("http://tempuri.org", "Part", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Part", - "http://tempuri.org", "Part", - false, false, true); - } - } - - WSServiceWrapper::~WSServiceWrapper() - { - logentry(); - } - - /// - /// This method will be called when a web service call needs to be made. - /// - void WSServiceWrapper::invoke(Operation& operation) - { - logentry(); - - const string& operationName = operation.getName(); - - loginfo("Service: %s, operation: %s", getService()->getType()->getName().c_str() , operationName.c_str()); - - for (unsigned int i=0; i<operation.getNParms(); i++) - { - loginfo("Parameter: %p, type: %u", operation.getParameterValue(i),(int) operation.getParameterType(i)); - } - - // Create the Axis2 client that will handle the Web Service invocation - Service* service = getService(); - CompositeReference* compositeReference = (CompositeReference*)service->getComponent(); - - Axis2Client client(compositeReference); - client.invoke(operation); - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - - - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h deleted file mode 100644 index f7aebbb575..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h +++ /dev/null @@ -1,65 +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_extension_ws_wsservicewrapper_h -#define tuscany_sca_extension_ws_wsservicewrapper_h - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/Service.h" - - -namespace tuscany -{ - namespace sca - { - - namespace ws - { - - class WSServiceWrapper : public ServiceWrapper - { - public: - - /** - * Constructor. - * @param target The service wrapper represents a Web service. - */ - WSServiceWrapper(tuscany::sca::model::Service* service); - - /** - * Destructor - */ - virtual ~WSServiceWrapper(); - - /** - * 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); - }; - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ws_wsservicewrapper_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/export.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/export.h deleted file mode 100644 index d0e708f1a1..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/export.h +++ /dev/null @@ -1,38 +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_ws_reference_export_h -#define tuscany_sca_ws_reference_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_WS_REFERENCE_EXPORTS -#define SCA_WS_REFERENCE_API __declspec(dllexport) -#else -#define SCA_WS_REFERENCE_API __declspec(dllimport) -#endif - -#else -#define SCA_WS_REFERENCE_API -#endif - -#endif // tuscany_sca_ws_reference_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp deleted file mode 100644 index 26d8dffc45..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp +++ /dev/null @@ -1,144 +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/util/Logging.h" -#include "tuscany/sca/ws/model/WSServiceBinding.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/ws/WSServiceWrapper.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - // Constructor - WSServiceBinding::WSServiceBinding(Service* service, const string& uri, const string& endpoint, const string& version) - : ServiceBinding(service, uri), endpoint(endpoint), soapVersion(version) - { - logentry(); - - parseEndpoint(); - - serviceWrapper = new WSServiceWrapper(service); - } - - void WSServiceBinding::parseEndpoint() - { - logentry(); - - // Endpoint is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<endpoint-name>) - string::size_type hash = endpoint.find("#"); - if (hash != string::npos) - { - // Found a hash - - // Namepace is the part before the # - wsdlNamespaceURL = endpoint.substr(0, hash); - - - if ( (hash+1) < endpoint.length()) - { - // Check the next part is wsdl.endpoint( - int ending = hash+15; - string check = endpoint.substr(hash+1, 14); - if (check.compare("wsdl.endpoint(") == 0) - { - // Find the matching ) - int endBracket = endpoint.find(")",ending); - if (endBracket-1 > ending+1) - { - string serviceAndEndpoint = endpoint.substr(ending, endBracket-ending); - // Look for a '/' - string::size_type slash = serviceAndEndpoint.find("/"); - if (slash != string::npos) - { - serviceName = serviceAndEndpoint.substr(0, slash); - - if ( (slash+1) < serviceAndEndpoint.length()) - { - endpointName = serviceAndEndpoint.substr(slash+1); - } - else - { - endpointName = ""; - } - - } - else - { - // No '/' so all of it is the service name - serviceName = serviceAndEndpoint; - endpointName = ""; - - } - } - else - { - // Nothing between the () - serviceName = ""; - endpointName = ""; - } - } - else - { - // not the correct characters after the #, ignore the rest - serviceName = ""; - endpointName = ""; - } - - } - else - { - // Nothing after the hash - serviceName = ""; - endpointName = ""; - } - } - else - { - // No hash at all - wsdlNamespaceURL = endpoint; - serviceName = ""; - endpointName = ""; - } - } - - // Destructor - WSServiceBinding::~WSServiceBinding() - { - logentry(); - } - - ServiceWrapper* WSServiceBinding::getServiceWrapper() - { - logentry(); - - return serviceWrapper; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h deleted file mode 100644 index 3c8c5eb12d..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h +++ /dev/null @@ -1,137 +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_extension_ws_model_wsservicebinding_h -#define tuscany_sca_extension_ws_model_wsservicebinding_h - -#include <string> - -#include "tuscany/sca/ws/export.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/Service.h" - -namespace tuscany -{ - namespace sca - { - namespace ws - { - /** - * Information about a web service binding for service or a reference. - */ - class WSServiceBinding : public tuscany::sca::model::ServiceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param endpoint The definition of the endpoint to which the service - * or reference is to be bound. This is of the form - * "namespace"#endpoint("service"/"endpoint") - */ - SCA_WS_REFERENCE_API WSServiceBinding(tuscany::sca::model::Service* service, const std::string& uri, const std::string& endpoint, const std::string& version); - - /** - * Destructor. - */ - SCA_WS_REFERENCE_API virtual ~WSServiceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; }; - - /** - * Create a wrapper for the service configured by this - * binding. - */ - SCA_WS_REFERENCE_API virtual ServiceWrapper* getServiceWrapper(); - - /** - * Return the part of the endpoint definition describing the wsdl - * namespace. - * @return The wsdl namespace. - */ - std::string getWSDLNamespaceURL() const { return wsdlNamespaceURL; }; - - /** - * Return the service part of the endpoint definition. - * @return The service to use. - */ - std::string getServiceName() const { return serviceName; }; - - /** - * Return the endpoint name part of the endpoint definition. - * @return The endpoint name to use. - */ - std::string getEndpointName() const { return endpointName; }; - - /** - * Return the SOAP version. - * @return The SOAP version to use. - */ - std::string getSOAPVersion() const { return soapVersion; }; - - private: - - /** - * Parse the endpoint specification. - */ - void parseEndpoint(); - - /** - * The full endpoint string. - */ - std::string endpoint; - - /** - * Namespace from the endpoint. - */ - std::string wsdlNamespaceURL; - - /** - * Service name from the endpoint. - */ - std::string serviceName; - - /** - * WSDL Endpoint name. - */ - std::string endpointName; - - /** - * SOAP version. - */ - std::string soapVersion; - - /** - * The wrapper for the service configured by this binding. - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_model_wsservicebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/Makefile.am deleted file mode 100644 index 18e9ba89b9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = axis2c diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/Makefile.am deleted file mode 100644 index feadf9e317..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/Makefile.am +++ /dev/null @@ -1,18 +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. - -SUBDIRS = src
\ No newline at end of file diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/Makefile.am deleted file mode 100644 index 88f7fc1a9e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/Makefile.am +++ /dev/null @@ -1,94 +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. - -libdir=$(prefix)/extensions/ws/service/lib -lib_LTLIBRARIES = \ -libtuscany_sca_ws_service.la \ -libtuscany_sca_ws_dispatcher.la - -noinst_HEADERS = \ -tuscany/sca/ws/*.h \ -tuscany/sca/ws/model/*.h - -libtuscany_sca_ws_service_la_SOURCES = \ -tuscany/sca/ws/WSReferenceBindingExtension.cpp \ -tuscany/sca/ws/model/WSReferenceBinding.cpp \ -tuscany/sca/ws/WSServiceProxy.cpp \ -tuscany/sca/ws/Axis2Service.cpp \ -tuscany/sca/ws/Axis2Utils.cpp - -libtuscany_sca_ws_service_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(AXIS2C_HOME)/lib \ - -laxis2_util \ - -laxis2_axiom \ - -laxis2_wsdl \ - -laxis2_engine \ - -laxis2_parser \ - -laxis2_minizip \ - -lpthread \ - -lwoden \ - -laxis2_http_sender \ - -laxis2_http_receiver - -rootdir=$(prefix)/extensions/ws/service -root_DATA = axis2.xml -root_SCRIPTS = deploy.sh - -libtuscany_sca_ws_dispatcher_la_SOURCES = \ -tuscany/sca/ws/Axis2Dispatcher.cpp \ -tuscany/sca/ws/Axis2DispatcherModule.cpp - -libtuscany_sca_ws_dispatcher_la_LIBADD = \ - -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \ - -L$(top_builddir)/runtime/core/src -ltuscany_sca \ - -L$(AXIS2C_HOME)/lib \ - -laxis2_util \ - -laxis2_axiom \ - -laxis2_wsdl \ - -laxis2_engine \ - -laxis2_parser \ - -laxis2_minizip \ - -lpthread \ - -lwoden \ - -laxis2_http_sender \ - -laxis2_http_receiver - -servicedir=$(rootdir)/services/tuscany -service_DATA = services.xml - -modulesdir=$(rootdir)/modules/tuscany -modules_DATA = module.xml - -EXTRA_DIST = axis2.xml services.xml module.xml deploy.sh - -install-data-hook: - cd $(servicedir); ln -s -f ../../lib/libtuscany_sca_ws_service.so libtuscany_sca_ws_service.so - cd $(modulesdir); ln -s -f ../../lib/libtuscany_sca_ws_dispatcher.so libtuscany_sca_ws_dispatcher.so - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include \ - -I${AXIS2C_HOME}/include - -moduledir=$(prefix)/extensions/ws/service/module -extension = libtuscany_sca_ws_service$(libsuffix) - -install-exec-hook: - test -z $(moduledir) || $(mkdir_p) $(moduledir); - -rm -f $(moduledir)/$(extension) - $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/axis2.xml b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/axis2.xml deleted file mode 100644 index 641085466e..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/axis2.xml +++ /dev/null @@ -1,181 +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. ---> -<axisconfig name="Axis2/C"> - <!-- ================================================= --> - <!-- Parameters --> - <!-- ================================================= --> - <parameter name="hotdeployment" locked="false">false</parameter> - <parameter name="hotupdate" locked="false">false</parameter> - <parameter name="enableMTOM" locked="false">false</parameter> - <parameter name="enableREST" locked="false">true</parameter> - - <parameter name="userName" locked="false">admin</parameter> - <parameter name="password" locked="false">axis2</parameter> - - <parameter name="seralizeLocation" locked="false">.</parameter> - <hostConfiguration> - <ip>127.0.0.1</ip> - <port>5555</port> - </hostConfiguration> - - - <!--if you want to extract the service archive file and work with that please uncomment this--> - <!--else , it wont extract archive file or does not take into consideration if someone drop--> - <!--exploded directory into /service directory--> - <!--<parameter name="extractServiceArchive" locked="false">true</parameter>--> - - - <!-- The way of adding listener to the system--> - <!-- <listener class="org.apache.axis2.ObserverIMPL">--> - <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>--> - <!-- </listener>--> - - <!-- ================================================= --> - <!-- Message Receivers --> - <!-- ================================================= --> - <!-- This is the Deafult Message Receiver for the Request Response style Operations --> - <!--messageReceiver mep="INOUT" class="axis2_receivers"/--> - - <!-- ================================================= --> - <!-- Transport Ins --> - <!-- ================================================= --> - <transportReceiver name="http" class="axis2_http_receiver"> - <parameter name="port" locked="false">6060</parameter> - </transportReceiver> - - <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver - <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener"> - <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter> - <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter> - <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter> - <parameter name="transport.mail.pop3.port" locked="false">110</parameter> - <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter> - </transportReceiver> --> - - <!-- - <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> - <parameter name="port" locked="false">6060</parameter> - </transportReceiver> - --> - <!-- ================================================= --> - <!-- Transport Outs --> - <!-- ================================================= --> - - <!-- - <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> - <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/> - --> - <transportSender name="http" class="axis2_http_sender"> - <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> - <!--parameter name="Transfer-Encoding">chunked</parameter--> - <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/--> - </transportSender> - <!-- - <transportSender name="https" class="axis2_http_sender"> - <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> - </transportSender> - --> - <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver - <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> - <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter> - <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter> - <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter> - <parameter name="transport.mail.smtp.port" locked="false">25</parameter> - </transportSender> - --> - - <!-- ================================================= --> - <!-- Global Modules --> - <!-- ================================================= --> - <!-- Comment this to disable Addressing --> - <module ref="addressing"/> - - <module ref="tuscany"/> - - <!--Configuring module , providing paramters for modules whether they refer or not--> - <!--<moduleConfig name="addressing">--> - <!--<parameter name="addressingPara" locked="false">N/A</parameter>--> - <!--</moduleConfig>--> - - <!-- ================================================= --> - <!-- Phases --> - <!-- ================================================= --> - <phaseOrder type="inflow"> - <!-- System pre defined phases --> - <phase name="TransportIn"/> - <phase name="PreDispatch"/> - <phase name="Dispatch"> - <handler name="AddressingBasedDispatcher" - class="axis2_engine"> - <order phase="Dispatch"/> - </handler> - <handler name="RequestURIBasedDispatcher" - class="axis2_engine"> - <order phase="Dispatch"/> - </handler> - <handler name="SOAPActionBasedDispatcher" - class="axis2_engine"> - <order phase="Dispatch"/> - </handler> - <handler name="SOAPMessageBodyBasedDispatcher" - class="axis2_engine"> - <order phase="Dispatch"/> - </handler> - </phase> - <phase name="PostDispatch"> - <handler name="DispatchPostConditionsEvaluator" - class="axis2_engine"> - <order phase="PostDispatch"/> - </handler> - <handler name="InstanceDispatcher" - class="axis2_engine"> - <order phase="PostDispatch"/> - </handler> - <handler name="SOAPProcessingModelChecker" - class="axis2_engine"> - <order phase="PostDispatch"/> - </handler> - </phase> - <!-- System pre defined phases --> - <!-- After Postdispatch phase module author or or service author can add any phase he want --> - <!--phase name="userphase1"/--> - </phaseOrder> - <phaseOrder type="outflow"> - <!-- user can add his own phases to this area --> - <!--phase name="RMPhase"/--> - <!--phase name="userphase1"/--> - <!--system predefined phase--> - <!--these phase will run irrespective of the service--> - <!--phase name="PolicyDetermination"/--> - <!--phase name="MessageOut"/--> - </phaseOrder> - <phaseOrder type="INfaultflow"> - <!-- user can add his own phases to this area --> - <!--phase name="userphase1"/--> - <!--phase name="RMPhase"/--> - </phaseOrder> - <phaseOrder type="Outfaultflow"> - <!-- user can add his own phases to this area --> - <!--phase name="RMPhase"/--> - <!--phase name="userphase1"/--> - <!--phase name="PolicyDetermination"/--> - <phase name="MessageOut"/> - </phaseOrder> -</axisconfig> - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.bat b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.bat deleted file mode 100644 index 6493e1cec9..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.bat +++ /dev/null @@ -1,39 +0,0 @@ -@echo off
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-
-
-rem Will deploy the Tuscany SCA WS service Axis2C service and module
-rem to the correct places within the AXIS2C_HOME directory
-setlocal
-set currentPath=%~d0%~p0
-
-if "%AXIS2C_HOME%" == "" (
-echo "AXIS2C_HOME not set"
-goto end
-)
-echo Deploying to Axis2C installed at %AXIS2C_HOME%
-
-if not exist %AXIS2C_HOME%\services\tuscany mkdir %AXIS2C_HOME%\services\tuscany
-if not exist %AXIS2C_HOME%\modules\tuscany mkdir %AXIS2C_HOME%\modules\tuscany
-
-copy %currentPath%\services\tuscany\* %AXIS2C_HOME%\services\tuscany
-copy %currentPath%\modules\tuscany\* %AXIS2C_HOME%\modules\tuscany
-copy %currentPath%\axis2.xml %AXIS2C_HOME%\axis2.xml
-
-:end
-endlocal
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.sh b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.sh deleted file mode 100755 index ffe571b0ee..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/deploy.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# 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. - -APFULLDIR=`pwd` - -if [ x$AXIS2C_HOME = x ]; then -echo "AXIS2C_HOME not set" -exit; -fi -echo "Deploying to Axis2C installed at $AXIS2C_HOME" - -if ! [ -d $AXIS2C_HOME/services/tuscany ]; then - mkdir $AXIS2C_HOME/services/tuscany -fi - -if ! [ -d $AXIS2C_HOME/modules/tuscany ]; then - mkdir $AXIS2C_HOME/modules/tuscany -fi - -cp $APFULLDIR/services/tuscany/services.xml $AXIS2C_HOME/services/tuscany - -if ! [ -f $AXIS2C_HOME/services/tuscany/libtuscany_sca_ws_service.so ]; then - ln -s $APFULLDIR/services/tuscany/libtuscany_sca_ws_service.so $AXIS2C_HOME/services/tuscany/libtuscany_sca_ws_service.so -fi - -cp $APFULLDIR/modules/tuscany/module.xml $AXIS2C_HOME/modules/tuscany -if ! [ -f $AXIS2C_HOME/modules/tuscany/libtuscany_sca_ws_dispatcher.so ]; then - ln -s $APFULLDIR/modules/tuscany/libtuscany_sca_ws_dispatcher.so $AXIS2C_HOME/modules/tuscany/libtuscany_sca_ws_dispatcher.so -fi - -cp $APFULLDIR/axis2.xml $AXIS2C_HOME/axis2.xml diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/module.xml b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/module.xml deleted file mode 100644 index 97d4d43a86..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/module.xml +++ /dev/null @@ -1,25 +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. ---> -<module name="tuscany" class="tuscany_sca_ws_dispatcher"> - <inflow> - <handler name="TuscanyDispatcher" class="tuscany_sca_ws_dispatcher"> - <order phase="Dispatch"/> - </handler> - </inflow> -</module> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/services.xml b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/services.xml deleted file mode 100644 index 335d4d96be..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/services.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<serviceGroup> -<service name="TuscanyService"> - <parameter name="ServiceClass" locked="xsd:false">tuscany_sca_ws_service</parameter> - <operation name="execute"/> -</service> -</serviceGroup> diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp deleted file mode 100644 index b6d2ac9225..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#pragma warning(disable: 4091) -#endif - -#include <axis2_handler_desc.h> -#include <axis2_qname.h> -#include <axis2_relates_to.h> -#include <axis2_svc.h> -#include <axis2_const.h> -#include <axis2_conf_ctx.h> -#include <axis2_addr.h> -#include <axis2_utils.h> -#include <axiom_soap_envelope.h> -#include <axiom_soap_body.h> - -#include "tuscany/sca/util/Logging.h" - -extern "C" -{ - -axis2_status_t AXIS2_CALL -Axis2Dispatcher_invoke ( - axis2_handler_t * handler, - const axis2_env_t *env, - struct axis2_msg_ctx *msg_ctx); - -axis2_svc_t *AXIS2_CALL -Axis2Dispatcher_find_svc( - axis2_msg_ctx_t *msg_ctx, - const axis2_env_t *env); - -axis2_op_t *AXIS2_CALL -Axis2Dispatcher_find_op( - axis2_msg_ctx_t *msg_ctx, - const axis2_env_t *env, - axis2_svc_t *svc); - - -AXIS2_EXPORT axis2_handler_t* AXIS2_CALL -Axis2Dispatcher_create(const axis2_env_t *env, - axis2_qname_t *qname) -{ - axis2_handler_t *handler = NULL; - - handler = axis2_handler_create(env); - if (!handler) - { - return NULL; - } - - /* handler init is handled by conf loading, so no need to do it here */ - - /* set the base struct's invoke op */ - if (handler->ops) - handler->ops->invoke = Axis2Dispatcher_invoke; - - return handler; -} - -axis2_svc_t *AXIS2_CALL -Axis2Dispatcher_find_svc( - axis2_msg_ctx_t *msg_ctx, - const axis2_env_t *env) -{ - axis2_svc_t *svc = NULL; - - AXIS2_ENV_CHECK(env, NULL); - - axis2_conf_ctx_t *conf_ctx = NULL; - conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env); - if (conf_ctx) - { - axis2_conf_t *conf = NULL; - conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env); - if (conf) - { - axis2_char_t* service_name = "TuscanyService"; - svc = AXIS2_CONF_GET_SVC(conf, env, service_name); - if (svc) - { - loginfo("Service found using target endpoint address"); - } - } - } - - return svc; -} - -axis2_op_t *AXIS2_CALL -Axis2Dispatcher_find_op( - axis2_msg_ctx_t *msg_ctx, - const axis2_env_t *env, - axis2_svc_t *svc) -{ - axis2_op_t *op = NULL; - - AXIS2_ENV_CHECK(env, NULL); - - axis2_qname_t *op_qname = NULL; - axis2_char_t* execute_op_name = "execute"; - op_qname = axis2_qname_create(env, execute_op_name, NULL, NULL); - - op = AXIS2_SVC_GET_OP_WITH_NAME(svc, env, AXIS2_QNAME_GET_LOCALPART(op_qname, env)); - - AXIS2_QNAME_FREE(op_qname, env); - if (op) - { - loginfo("TuscanyService execute operation found"); - } - return op; -} - -axis2_status_t AXIS2_CALL -Axis2Dispatcher_invoke( - axis2_handler_t * handler, - const axis2_env_t *env, - struct axis2_msg_ctx *msg_ctx) -{ - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - - if (!(AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env))) - return AXIS2_SUCCESS; - - msg_ctx->ops->find_svc = Axis2Dispatcher_find_svc; - msg_ctx->ops->find_op = Axis2Dispatcher_find_op; - - axis2_svc_t *axis_service = NULL; - axis2_op_t *op = NULL; - - axis_service = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env); - - if (!axis_service) - { - axis_service = AXIS2_MSG_CTX_FIND_SVC(msg_ctx, env); - if (axis_service) - { - AXIS2_MSG_CTX_SET_SVC(msg_ctx, env, axis_service); - /*TODO Set the Service Group Context to the message Context*/ - } - } - op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env); - if (!op) - { - op = AXIS2_MSG_CTX_FIND_OP(msg_ctx, env, axis_service); - - if (op) - { - AXIS2_MSG_CTX_SET_OP(msg_ctx, env, op); - } - } - - return AXIS2_SUCCESS; -} - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp deleted file mode 100644 index 0dc8f3358a..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#pragma warning(disable: 4091) -#endif - -#include <axis2_module.h> -#include <axis2_addr_mod.h> -#include <axis2_conf_ctx.h> -#include <axis2_disp.h> - -extern "C" -{ - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_shutdown(axis2_module_t *module, - const axis2_env_t *env); - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_init( - axis2_module_t *module, - const axis2_env_t *env, - axis2_conf_ctx_t *conf_ctx, - axis2_module_desc_t *module_desc); - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_fill_handler_create_func_map(axis2_module_t *module, - const axis2_env_t *env); - -AXIS2_EXTERN axis2_handler_t* AXIS2_CALL -Axis2Dispatcher_create(const axis2_env_t *env, - axis2_qname_t *qname); - -axis2_module_t * -Axis2DispatcherModule_create(const axis2_env_t *env) -{ - axis2_module_t *module = NULL; - module = (axis2_module_t*)AXIS2_MALLOC(env->allocator, - sizeof(axis2_module_t)); - - - module->ops = (axis2_module_ops_t*)AXIS2_MALLOC( - env->allocator, sizeof(axis2_module_ops_t)); - - module->ops->shutdown = Axis2DispatcherModule_shutdown; - module->ops->init = Axis2DispatcherModule_init; - module->ops->fill_handler_create_func_map = - Axis2DispatcherModule_fill_handler_create_func_map; - - return module; -} - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_init( - axis2_module_t *module, - const axis2_env_t *env, - axis2_conf_ctx_t *conf_ctx, - axis2_module_desc_t *module_desc) -{ - return AXIS2_SUCCESS; -} - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_shutdown(axis2_module_t *module, - const axis2_env_t *env) -{ - if(module->ops) - { - AXIS2_FREE(env->allocator, module->ops); - module->ops = NULL; - } - - if(module->handler_create_func_map) - { - axis2_hash_free(module->handler_create_func_map, env); - module->handler_create_func_map = NULL; - } - - if(module) - { - AXIS2_FREE(env->allocator, module); - module = NULL; - } - return AXIS2_SUCCESS; -} - -axis2_status_t AXIS2_CALL -Axis2DispatcherModule_fill_handler_create_func_map(axis2_module_t *module, - const axis2_env_t *env) -{ - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - - module->handler_create_func_map = axis2_hash_make(env); - axis2_hash_set(module->handler_create_func_map, "TuscanyDispatcher", - (axis2_ssize_t)AXIS2_HASH_KEY_STRING, (const void *)Axis2Dispatcher_create); - - return AXIS2_SUCCESS; -} - -/** - * Following block distinguish the exposed part of the dll. - */ - -AXIS2_EXPORT int -axis2_get_instance(axis2_module_t **inst, - const axis2_env_t *env) -{ - *inst = Axis2DispatcherModule_create(env); - if(!(*inst)) - { - return AXIS2_FAILURE; - } - - return AXIS2_SUCCESS; -} - -AXIS2_EXPORT int -axis2_remove_instance(axis2_module_t *inst, - const axis2_env_t *env) -{ - axis2_status_t status = AXIS2_FAILURE; - if (inst) - { - status = Axis2DispatcherModule_shutdown(inst, env); - } - return status; -} - -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp deleted file mode 100644 index 9f1207dce8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#pragma warning(disable: 4091) -#endif - -#include <sstream> - -#include <axis2_svc_skeleton.h> -#include <axis2_array_list.h> -#include <axis2_log_default.h> -#include <axis2_error_default.h> -#include <axiom.h> - -#include <sdo_axiom.h> - -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "WSServiceProxy.h" -#include "model/WSReferenceBinding.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/CompositeService.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/WSDLDefinition.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "tuscany/sca/model/WSDLMessagePart.h" -#include "tuscany/sca/model/WSDLInterface.h" -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/util/Utils.h" -#include "Axis2Utils.h" - -using namespace std; -using namespace commonj::sdo; -using namespace commonj::sdo_axiom; -using namespace tuscany::sca; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - int AXIS2_CALL - Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env); - - axiom_node_t* AXIS2_CALL - Axis2Service_invoke(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env, - axiom_node_t *node, - axis2_msg_ctx_t *msg_ctx); - - int AXIS2_CALL - Axis2Service_init(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env); - - axis2_svc_skeleton_t* - axis2_Axis2Service_create(axis2_env_t *env) - { - axis2_svc_skeleton_t *svc_skeleton = NULL; - svc_skeleton = (axis2_svc_skeleton_t *) AXIS2_MALLOC((env)->allocator, - sizeof(axis2_svc_skeleton_t)); - - - svc_skeleton->ops = (axis2_svc_skeleton_ops_t *) AXIS2_MALLOC( - (env)->allocator, sizeof(axis2_svc_skeleton_ops_t)); - - svc_skeleton->func_array = NULL; - - svc_skeleton->ops->free = Axis2Service_free; - svc_skeleton->ops->init = Axis2Service_init; - svc_skeleton->ops->invoke = Axis2Service_invoke; - /*svc_skeleton->ops->on_fault = Axis2Service_on_fault;*/ - - return svc_skeleton; - } - - int AXIS2_CALL - Axis2Service_init(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env) - { - // This method never seems to be called - an old Axis2C artifact? - - svc_skeleton->func_array = axis2_array_list_create(env, 0); - return AXIS2_SUCCESS; - } - - int AXIS2_CALL - Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env) - { - if(svc_skeleton->ops) - { - AXIS2_FREE((env)->allocator, svc_skeleton->ops); - svc_skeleton->ops = NULL; - } - - if(svc_skeleton) - { - AXIS2_FREE((env)->allocator, svc_skeleton); - svc_skeleton = NULL; - } - return AXIS2_SUCCESS; - } - - - /** - * Initialize the SCA runtime - */ - CompositeService* initializeSCARuntime(const char*home, const char* root, - const char* path, const char* baseURI, const char *component, const char* service) - { - logentry(); - loginfo("Home: %s", home); - loginfo("Root: %s", root); - loginfo("Path: %s", path); - loginfo("Base URI: %s", baseURI); - loginfo("Component: %s", component); - loginfo("Service: %s", service); - - try - { - SCARuntime* runtime = SCARuntime::initializeSharedRuntime(home, root, path, baseURI); - - string componentName; - if (strlen(component)) - { - componentName = component; - } - else - { - componentName = runtime->getDefaultComponentName(); - } - string serviceName = service; - - loginfo("Resolving composite: %s, service: %s", componentName.c_str(), serviceName.c_str()); - Component* compositeComponent = runtime->getSystem()->findComponent(componentName); - if (compositeComponent == NULL) - { - string msg = "Component not found " + componentName; - throwException(SystemConfigurationException, msg.c_str()); - } - runtime->setDefaultComponent(compositeComponent); - - Composite* composite = (Composite*)compositeComponent->getType(); - CompositeService* compositeService = (CompositeService*)composite->findComponent(serviceName); - if (compositeService == NULL) - { - string msg = "Composite service not found " + serviceName; - throwException(SystemConfigurationException, msg.c_str()); - } - - return compositeService; - } - catch(TuscanyRuntimeException &ex) - { - ostringstream msg; - msg << ex; - logerror("Failed to initialize SCA runtime: %s", msg.str().c_str()); - throw; - } - } - - - /* - * This method invokes the target service method - */ - axiom_node_t* AXIS2_CALL - Axis2Service_invoke(axis2_svc_skeleton_t *svc_skeleton, - const axis2_env_t *env, - axiom_node_t *node, - axis2_msg_ctx_t *msg_ctx) - { - logentry(); - - try - { - if (node) - { - if (AXIOM_NODE_GET_NODE_TYPE(node, env) == AXIOM_ELEMENT) - { - axiom_element_t *element = NULL; - element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(node, env); - if (element) - { - string op_name = ""; - - axis2_bool_t rest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env); - if (rest) - { - axis2_endpoint_ref_t *endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env); - if (endpoint_ref) - { - const axis2_char_t *addr = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env); - if (addr) - { - // REST request, the op name is the last segment of the path - string raddress = addr; - string path; - string query; - Utils::tokeniseString("?", raddress, path, query); - string uri; - Utils::rTokeniseString("/", path, uri, op_name); - } - } - } - else - { - // SOAP request - // Get the operation name from the root element name, this is correct for DocLit Wrapped style - op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env); - } - - if (op_name != "") - { - CompositeService* compositeService; - - // Get the Tuscany home, system root, path and composite service name from the Axis2 - // service parameters - char* homeParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyHome"); - if (homeParam == NULL) - homeParam = ""; - - char* rootParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyRoot"); - if (rootParam == NULL) - rootParam = ""; - - char* pathParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyPath"); - if (pathParam == NULL) - pathParam = ""; - - char* baseURIParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyBaseURI"); - if (baseURIParam == NULL) - baseURIParam = ""; - - char* serviceParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyService"); - if (serviceParam != NULL) - { - loginfo("System root: %s, service name: %s, operation name: %s", rootParam, serviceParam, op_name.c_str()); - - // Service is of the form "component name"/"composite service name" - string component, service; - Utils::rTokeniseString("/", serviceParam, component, service); - - compositeService = initializeSCARuntime(homeParam, rootParam, pathParam, baseURIParam, component.c_str(), service.c_str()); - } - else { - - // Use the default home, system root and component, the service is - // derived from the target address - axis2_endpoint_ref_t *endpoint_ref = NULL; - endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env); - string address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env); - - axis2_bool_t isrest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env); - string path; - if (isrest) - { - string op; - Utils::rTokeniseString("/", address, path, op); - } - else - { - path = address; - } - - string path2; - string service; - Utils::rTokeniseString("/", path, path2, service); - - string path3; - string component; - Utils::rTokeniseString("/", path2, path3, component); - if (component == "services") - { - component = ""; - } - - loginfo("System root: %s, component name: %s, service name: %s, operation name: %s", - rootParam, component.c_str(), service.c_str(), op_name.c_str()); - - compositeService = initializeSCARuntime(homeParam, rootParam, pathParam, baseURIParam, component.c_str(), service.c_str()); - } - - if(!compositeService) - { - throwException(SystemConfigurationException, - "Failed to initialize SCA runtime, could not initialize CompositeService"); - } - - DataFactoryPtr dataFactory = compositeService->getComposite()->getDataFactory(); - if (dataFactory == 0) - { - throwException(SystemConfigurationException, - "Failed to initialize SCA runtime, could not get DataFactory"); - } - - // Get the WS binding and the WSDL operation - Composite* composite = compositeService->getComposite(); - Reference* reference = compositeService->getReference(); - WSReferenceBinding* binding = (WSReferenceBinding*)reference->getBinding(); - WSDLOperation wsdlOperation; - - // First use the WSDL definition specified in the binding - string wsdlNamespace = binding->getWSDLNamespaceURL(); - if (wsdlNamespace != "") - { - WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace); - if (wsdlDefinition == 0) - { - string msg = "WSDL not found for: " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - - // Find the target operation in the WSDL port type. - try { - wsdlOperation = wsdlDefinition->findOperation( - binding->getServiceName(), - binding->getEndpointName(), - op_name.c_str()); - } - catch(SystemConfigurationException&) - { - throw; - } - - } - else - { - // Then use the WSDL definition specified in the WSDL interface, if any - Interface* iface = reference->getType()->getInterface(); - if (iface != NULL && - iface->getInterfaceTypeQName() == WSDLInterface::typeQName) - { - WSDLInterface* wsdlInterface = (WSDLInterface*)iface; - wsdlNamespace = wsdlInterface->getNamespaceURI(); - - if (wsdlNamespace != "") - { - - WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace); - if (wsdl == 0) - { - string msg = "WSDL not found for: " + wsdlNamespace; - throwException(SystemConfigurationException, msg.c_str()); - } - - try - { - wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str()); - } - catch(SystemConfigurationException&) - { - throw; - } - } - } - } - - // No WSDL definition was specified in the binding or interface - // Create a default document literal wrapped WSDL operation - if (wsdlNamespace == "") - { - WSDLMessagePart inPart(op_name, "", "http://tempuri.org"); - WSDLMessagePart outPart((op_name+"Response"), "", "http://tempuri.org"); - wsdlNamespace = compositeService->getName(); - wsdlOperation = WSDLOperation(); - wsdlOperation.setOperationName(op_name.c_str()); - wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name); - wsdlOperation.setEndpoint(""); - wsdlOperation.setSoapVersion(WSDLOperation::SOAP11); - wsdlOperation.setDocumentStyle(true); - wsdlOperation.setWrappedStyle(true); - wsdlOperation.setInputEncoded(false); - wsdlOperation.setOutputEncoded(false); - wsdlOperation.setInputMessagePart(op_name, inPart); - wsdlOperation.setOutputMessagePart((op_name+"Response"), outPart); - } - else if (!wsdlOperation.isDocumentStyle() || !wsdlOperation.isWrappedStyle()) - { - throwException(ServiceInvocationException, - "Only wrapped document style WSDL operations are currentlysupported"); - } - - // Convert the input AXIOM node to an SDO DataObject - axiom_node_t* body = AXIOM_NODE_GET_PARENT(node, env); - char* str = NULL; - str = AXIOM_NODE_TO_STRING(body, env); - if (str) - { - loginfo("Received request Axis2 OM: %s", str); - } - - // Convert the SOAP body to an SDO DataObject - DataObjectPtr inputBodyDataObject = NULL; - DataObjectPtr inputDataObject = NULL; - - AxiomHelper* axiomHelper = AxiomHelper::getHelper(); - - try - { - inputBodyDataObject = axiomHelper->toSdo(body, dataFactory); - if(!inputBodyDataObject) - { - string msg = "Could not convert request Axis2 OM to SDO"; - throwException(ServiceInvocationException, msg.c_str()); - } - else - { - ostringstream os; - os << inputBodyDataObject; - loginfo("Converted Axis2 OM node to SDO: %s", os.str().c_str()); - } - - // Get the first body part representing the doc-lit-wrapped wrapper element - PropertyList bpl = inputBodyDataObject->getInstanceProperties(); - if (bpl.size()!=0) - { - if (bpl[0].isMany()) - { - DataObjectList& parts = inputBodyDataObject->getList((unsigned int)0); - inputDataObject = parts[0]; - } - else - { - inputDataObject = inputBodyDataObject->getDataObject(bpl[0]); - } - } - if (inputDataObject == NULL) - { - string msg = "Could not convert Axis2 body part to SDO"; - throwException(ServiceInvocationException, msg.c_str()); - } - } - catch(SDORuntimeException &ex) - { - throwException(ServiceDataException, ex); - } - - // Dispatch to the WS proxy - WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy(); - - DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject); - - if(!outputDataObject) - { - return 0; - } - - try - { - std::list<std::string> partList = - wsdlOperation.getOutputMessagePartNames(); - const WSDLMessagePart &outPart = - wsdlOperation.getOutputMessagePart(partList.front()); - // Convert the output DataObject to an Axiom node - axiom_node_t* outputNode = - axiomHelper->toAxiomNode(outputDataObject, - outPart.getPartUri().c_str(), - outPart.getPartName().c_str()); - - AxiomHelper::releaseHelper(axiomHelper); - - str = AXIOM_NODE_TO_STRING(outputNode, env); - if (str) - { - loginfo("Sending response Axis2 OM : %s", str); - } - - return outputNode; - } - catch(SDORuntimeException &ex) - { - throwException(ServiceDataException, ex); - } - } - } - } - } - - string msg = "Invalid parameters in Axis2 request OM"; - throwException(ServiceInvocationException, msg.c_str()); - - } - catch(TuscanyRuntimeException& ex) - { - ostringstream msg; - msg << ex; - logerror("Failed to process Web service invocation: %s", msg.str().c_str()); - } - return 0; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -extern "C" -{ - - /** - * Following block distinguish the exposed part of the dll. - */ - - AXIS2_EXPORT int axis2_get_instance(axis2_svc_skeleton **inst, - axis2_env_t *env) - { - *inst = tuscany::sca::ws::axis2_Axis2Service_create(env); - if(!(*inst)) - { - return AXIS2_FAILURE; - } - - return AXIS2_SUCCESS; - } - - AXIS2_EXPORT int axis2_remove_instance(axis2_svc_skeleton_t *inst, - axis2_env_t *env) - { - axis2_status_t status = AXIS2_FAILURE; - if (inst) - { - status = AXIS2_SVC_SKELETON_FREE(inst, env); - } - return status; - } -} diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp deleted file mode 100644 index 09c3862590..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#pragma warning(disable: 4091) -#endif - -#include <axis2_svc_ctx.h> -#include <axis2_defines.h> - -#include "tuscany/sca/util/Logging.h" -#include "Axis2Utils.h" - -using namespace tuscany::sca; -using namespace tuscany::sca::ws; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - char* Axis2Utils::getAxisServiceParameterValue(const axis2_env_t *env, axis2_msg_ctx_t *msg_ctx, char* parameterName) - { - logentry(); - - struct axis2_svc *svc = NULL; - struct axis2_op_ctx *op_ctx = NULL; - struct axis2_svc_ctx *svc_ctx = NULL; - axis2_param_t *param = NULL; - char* paramValue = NULL; - - op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env); - svc_ctx = AXIS2_OP_CTX_GET_PARENT(op_ctx, env); - svc = AXIS2_SVC_CTX_GET_SVC(svc_ctx, env); - if(NULL == svc) - { - return NULL; - } - - param = AXIS2_SVC_GET_PARAM(svc, env, parameterName); - if(!param) - { - logwarning("Axis parameter %s cannot be found", parameterName); - } - else - { - paramValue = (char*) AXIS2_PARAM_GET_VALUE(param, env); - } - - return paramValue; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h deleted file mode 100644 index 4e8b069010..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h +++ /dev/null @@ -1,46 +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_extension_ws_axis2utils_h -#define tuscany_sca_extension_ws_axis2utils_h - -#include <axis2_env.h> -#include <axis2_msg_ctx.h> - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - class Axis2Utils - { - public: - static char* getAxisServiceParameterValue(const axis2_env_t *env, axis2_msg_ctx_t *msg_ctx, char* parameterName); - }; - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_axis2utils_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp deleted file mode 100644 index 24a7552bc4..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp +++ /dev/null @@ -1,119 +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 "WSReferenceBindingExtension.h" -#include "model/WSReferenceBinding.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace std; -using namespace tuscany::sca::model; -using namespace commonj::sdo; - -extern "C" -{ -#if defined(WIN32) || defined(_WINDOWS) - __declspec(dllexport) -#endif - void tuscany_sca_ws_service_initialize() - { - tuscany::sca::ws::WSReferenceBindingExtension::initialize(); - } -} - -namespace tuscany -{ - namespace sca - { - namespace ws - { - // =================================================================== - // Constructor for the WSReferenceBinding class. - // =================================================================== - WSReferenceBindingExtension::WSReferenceBindingExtension() - { - logentry(); - } - - // =================================================================== - // Destructor for the WSReferenceBindingExtension class. - // =================================================================== - WSReferenceBindingExtension::~WSReferenceBindingExtension() - { - logentry(); - } - - const string WSReferenceBindingExtension::extensionName("ws"); - const string WSReferenceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"); - - // =================================================================== - // loadModelElement - load the info from binding.ws - // =================================================================== - ReferenceBinding* WSReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding) - { - logentry(); - - string uri = scdlBinding->getCString("uri"); - - string endpoint; - try - { - endpoint = scdlBinding->getCString("endpoint"); - } - catch (SDORuntimeException&) - { - endpoint = ""; - } - - string version; - try - { - commonj::sdo::DataObjectList& soap = scdlBinding->getList("soapbinding"); - if (soap.size()!=0) - { - version = soap.getCString(0); - } - else - { - version = ""; - } - } - catch (SDORuntimeException&) - { - version = ""; - } - - WSReferenceBinding* serviceBinding = new WSReferenceBinding(reference, uri, endpoint, version); - - return serviceBinding; - } - - void WSReferenceBindingExtension::initialize() - { - logentry(); - SCARuntime::getCurrentRuntime()->registerReferenceBindingExtension(new WSReferenceBindingExtension()); - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h deleted file mode 100644 index 712e7d2646..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h +++ /dev/null @@ -1,76 +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_extension_ws_wsreferencebindingextension_h -#define tuscany_sca_extension_ws_wsreferencebindingextension_h - -#include "tuscany/sca/extension/ReferenceBindingExtension.h" - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - class WSReferenceBindingExtension : public ReferenceBindingExtension - { - public: - /** - * Default constructor - */ - WSReferenceBindingExtension(); - - /** - * Destructor - */ - virtual ~WSReferenceBindingExtension(); - - /** - * return the name of the extension - */ - virtual const std::string& getExtensionName() {return extensionName;} - - /** - * return the QName of schema elemant for this implementation extension - * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws") - */ - virtual const std::string& getExtensionTypeQName() {return typeQName;} - - virtual tuscany::sca::model::ReferenceBinding* getReferenceBinding( - tuscany::sca::model::Composite* composite, - tuscany::sca::model::Reference *reference, commonj::sdo::DataObjectPtr scdlBinding); - - static void initialize(); - - private: - static const std::string extensionName; - static const std::string typeQName; - - }; - - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_wsreferencebindingextension_h - diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp deleted file mode 100644 index bea4168984..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp +++ /dev/null @@ -1,579 +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 <sstream> - -#include "commonj/sdo/SDO.h" - -#include "WSServiceProxy.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/SDOUtils.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/ReferenceType.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/ServiceType.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ComponentType.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Composite.h" -#include "tuscany/sca/model/ServiceBinding.h" -#include "tuscany/sca/model/WSDLDefinition.h" -#include "tuscany/sca/model/WSDLInterface.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "model/WSReferenceBinding.h" - -using namespace std; -using namespace commonj::sdo; -using namespace tuscany::sca::model; -using namespace tuscany::sca::util; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - // ============================ - // Constructor: Create a proxy - // ============================ - WSServiceProxy::WSServiceProxy(Reference* reference) - : ServiceProxy(reference) - { - logentry(); - - // Get the target service wrapper - WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding(); - serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper(); - - // Define the SOAP Body type and element to allow a SOAP body to - // be loaded in a DataObject - DataFactoryPtr dataFactory = reference->getComponent()->getComposite()->getDataFactory(); - try { - const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body"); - } catch (SDORuntimeException&) - { - - // Define the SOAP 1.2 Body type - dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "RootType", false, false, false); - dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "Body", false, true, false); - dataFactory->addPropertyToType( - "http://www.w3.org/2003/05/soap-envelope", "RootType", - "Body", - "http://www.w3.org/2003/05/soap-envelope", "Body", - false, false, true); - - // Define the SOAP 1.1 Body type - dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "RootType", false, false, false); - dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "Body", false, true, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/soap/envelope/", "RootType", - "Body", - "http://schemas.xmlsoap.org/soap/envelope/", "Body", - false, false, true); - } - - try { - const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType"); - } catch (SDORuntimeException&) - { - dataFactory->addType("http://tempuri.org", "RootType", false, false, false); - dataFactory->addType("http://tempuri.org", "Wrapper", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Wrapper", - "http://tempuri.org", "Wrapper", - false, false, true); - dataFactory->addType("http://tempuri.org", "Part", false, true, false); - dataFactory->addPropertyToType( - "http://tempuri.org", "RootType", - "Part", - "http://tempuri.org", "Part", - false, false, true); - } - } - - // ========== - // Destructor - // ========== - WSServiceProxy::~WSServiceProxy() - { - logentry(); - } - - /// - /// This method will be called to process an operation invocation. - /// - DataObjectPtr WSServiceProxy::invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject) - { - logentry(); - - Reference* reference = getReference(); - Component* component = reference->getComponent(); - Composite* composite = component ->getComposite(); - - WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding(); - DataFactoryPtr dataFactoryPtr = reference->getComponent()->getComposite()->getDataFactory(); - - // Since its Document wrapped, there will only be one message part - std::list<std::string> partList = wsdlOperation.getOutputMessagePartNames(); - const WSDLMessagePart &part = wsdlOperation.getOutputMessagePart(partList.front()); - const char* outputTypeURI = part.getPartUri().c_str(); - const char* outputTypeName = part.getPartName().c_str(); - - loginfo("WSDLOperation input message Type: %s#%s", - wsdlOperation.getInputMessageUri().c_str(), - wsdlOperation.getInputMessageName().c_str()); - loginfo("WSDLOperation outputType: %s#%s", - outputTypeURI, - outputTypeName); - - try - { - - // Create new Operation object and set parameters and return value - Operation operation(wsdlOperation.getOperationName().c_str()); - - // Go through the input data object to set the operation parameters - PropertyList pl = inputDataObject->getInstanceProperties(); - - for(unsigned int i=0; i<pl.size(); i++) - { - const char* name = pl[i].getName(); - - switch (pl[i].getTypeEnum()) - { - case Type::BooleanType: - { - bool* boolData = new bool; - *boolData = inputDataObject->getBoolean(pl[i]); - operation.addParameter(boolData); - } - break; - case Type::ByteType: - { - char* byteData = new char; - *byteData = inputDataObject->getByte(pl[i]); - operation.addParameter(byteData); - } - break; - case Type::BytesType: - { - int len = inputDataObject->getLength(pl[i]); - char** bytesData = new char*; - *bytesData = new char[len+1]; - int bytesWritten = inputDataObject->getBytes(pl[i], *bytesData, len); - // Ensure the bytes end with the null char. Not sure if this is neccessary - if(bytesWritten <= len) - { - (*bytesData)[bytesWritten] = 0; - } - else - { - (*bytesData)[len] = 0; - } - operation.addParameter(bytesData); - } - break; - case Type::CharacterType: - { - // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType - wchar_t* charData = new wchar_t; - *charData = inputDataObject->getCharacter(pl[i]); - operation.addParameter(charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = new long double; - *doubleData = inputDataObject->getDouble(pl[i]); - operation.addParameter(doubleData); - } - break; - case Type::FloatType: - { - float* floatData = new float; - *floatData = inputDataObject->getFloat(pl[i]); - operation.addParameter(floatData); - } - break; - case Type::IntType: - { - long* intData = new long; - *intData = inputDataObject->getInt(pl[i]); - operation.addParameter(intData); - } - break; - case Type::ShortType: - { - short* shortData = new short; - *shortData = inputDataObject->getShort(pl[i]); - operation.addParameter(shortData); - } - break; - case Type::StringType: - { - string* stringData; - if(inputDataObject->isSet(pl[i])) - { - stringData = new string(inputDataObject->getCString(pl[i])); - } - else - { - // The data is not set, so pass an empty string as the parameter - stringData = new string(); - } - operation.addParameter(stringData); - } - break; - case Type::DataObjectType: - { - if (!strcmp(pl[i].getType().getURI(), SDOUtils::sdoURI) && - !strcmp(pl[i].getType().getName(), "OpenDataObject")) { - - /* - * This code deals with xsd:any element parameters - * Get each element as a DataObject and add in to the parameter list - */ - - DataObjectList& dataObjectList = inputDataObject->getList(pl[i]); - - for(unsigned int j=0; j<dataObjectList.size(); j++) - { - DataObjectPtr dob = dataObjectList[j]; - if(!dob) - { - - // Add a null DataObject ptr - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = NULL; - loginfo("Null OpenDataObject parameter named %s[%d]", name, j); - operation.addParameter(dataObjectData); - } - else - { - - SequencePtr sequence = dob->getSequence(); - if (sequence->size()!=0) - { - // Add a text element - if (sequence->isText(0)) - { - string* stringData = new string(sequence->getCStringValue(0)); - operation.addParameter(stringData); - } - else - { - // Add a complex element DataObject - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = sequence->getDataObjectValue(0); - if(!*dataObjectData) - { - loginfo("Null DataObject parameter named %s", name); - } - else - { - (*dataObjectData)->detach(); - } - operation.addParameter(dataObjectData); - } - } - else - { - // Empty content, add an empty string - loginfo("Empty OpenDataObject parameter named %s[%d]", name, j); - string* stringData = new string(""); - operation.addParameter(stringData); - } - } - } - } - else { - DataObjectPtr* dataObjectData = new DataObjectPtr; - *dataObjectData = inputDataObject->getDataObject(pl[i]); - if(!*dataObjectData) - { - loginfo("Null DataObject parameter named %s", name); - } - else - { - (*dataObjectData)->detach(); - } - operation.addParameter(dataObjectData); - } - } - break; - default: - { - ostringstream msg; - msg << "Unsupported param type: " << pl[i].getTypeEnum(); - throwException(SystemConfigurationException, msg.str().c_str()); - } - } - } - - // Call into the target service wrapper - serviceWrapper->invoke(operation); - - // Set the data in the outputDataObject to be returned - DataObjectPtr outputDataObject; - try - { - // Create the output wrapper - const Type& rootType = dataFactoryPtr->getType(outputTypeURI, "RootType"); - const Property& prop = rootType.getProperty(outputTypeName); - const Type& outputType = prop.getType(); - outputDataObject = dataFactoryPtr->create(outputType); - } - catch (SDORuntimeException&) - { - try - { - // Create the output wrapper - const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName); - outputDataObject = dataFactoryPtr->create(outputType); - } - catch (SDORuntimeException&) - { - // The output wrapper type is not known, create an open DataObject - //outputDataObject = dataFactoryPtr->create("http://tempuri.org", "Wrapper"); - outputDataObject = dataFactoryPtr->create(SDOUtils::sdoURI, "OpenDataObject"); - } - } - - setOutputData(operation, outputDataObject, dataFactoryPtr); - - return outputDataObject; - - } - catch(SDORuntimeException& ex) - { - throwException(ServiceInvocationException, ex); - } - catch(TuscanyRuntimeException&) - { - throw; - } - } - - - void WSServiceProxy::setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr) - { - logentry(); - - // Go through data object to set the return value - PropertyList pl = outputDataObject->getType().getProperties(); - - if(pl.size() == 0) - { - if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with returning xsd:any elements - */ - DataObjectList& l = outputDataObject->getList("return"); - Operation::ParameterType resultType = operation.getReturnType(); - switch(resultType) - { - case Operation::BOOL: - { - l.append(*(bool*)operation.getReturnValue()); - break; - } - case Operation::SHORT: - { - l.append(*(short*)operation.getReturnValue()); - break; - } - case Operation::INT: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - l.append(*(short*)operation.getReturnValue()); - break; - } - case Operation::UINT: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - l.append(*(long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - l.append(*(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - l.append(*(long double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - l.append(*(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - l.append(*(char**)operation.getReturnValue()); - break; - } - case Operation::STRING: - { - l.append((*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - l.append(*(DataObjectPtr*)operation.getReturnValue()); - break; - } - default: - { - // One way operation, no return value - break; - } - } - } - else - { - loginfo("No return values defined"); - } - } - else { - - // Should only be one return value.. This goes through all return values - for(unsigned int i=0; i<pl.size(); i++) - { - const char* name = pl[i].getName(); - - Operation::ParameterType resultType = operation.getReturnType(); - switch(resultType) - { - case Operation::BOOL: - { - outputDataObject->setBoolean(pl[i], *(bool*)operation.getReturnValue()); - break; - } - case Operation::SHORT: - { - outputDataObject->setShort(pl[i], *(short*)operation.getReturnValue()); - break; - } - case Operation::INT: - { - outputDataObject->setInt(pl[i], *(int*)operation.getReturnValue()); - break; - } - case Operation::LONG: - { - outputDataObject->setInt(pl[i], *(long*)operation.getReturnValue()); - break; - } - case Operation::USHORT: - { - outputDataObject->setInt(pl[i], *(unsigned short*)operation.getReturnValue()); - break; - } - case Operation::UINT: - { - outputDataObject->setInt(pl[i], *(unsigned int*)operation.getReturnValue()); - break; - } - case Operation::ULONG: - { - outputDataObject->setInt(pl[i], *(unsigned long*)operation.getReturnValue()); - break; - } - case Operation::FLOAT: - { - outputDataObject->setFloat(pl[i], *(float*)operation.getReturnValue()); - break; - } - case Operation::DOUBLE: - { - outputDataObject->setDouble(pl[i], *(double*)operation.getReturnValue()); - break; - } - case Operation::LONGDOUBLE: - { - outputDataObject->setDouble(pl[i], *(long double*)operation.getReturnValue()); - break; - } - case Operation::CHARS: - { - if(*(char**)operation.getReturnValue() != NULL) - { - outputDataObject->setCString(pl[i], *(char**)operation.getReturnValue()); - } - else - { - loginfo("Null return value, leaving property %s unset", pl[i].getName()); - } - break; - } - case Operation::STRING: - { - outputDataObject->setCString(pl[i], (*(string*)operation.getReturnValue()).c_str()); - break; - } - case Operation::DATAOBJECT: - { - - if(*(DataObjectPtr*)operation.getReturnValue() != NULL) - { - outputDataObject->setDataObject(pl[i], *(DataObjectPtr*)operation.getReturnValue()); - } - else - { - loginfo("Null return value, leaving property %s unset", pl[i].getName()); - } - - break; - } - default: - { - // One way operation, no return value - break; - } - } - } - } - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h deleted file mode 100644 index 4d57514688..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.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_extension_ws_wsserviceproxy_h -#define tuscany_sca_extension_ws_wsserviceproxy_h - -#include "commonj/sdo/SDO.h" - -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/Reference.h" -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/WSDLOperation.h" -#include "model/WSReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - /** - * Holds a proxy for a given component and reference. - * The proxy which is held inside a ServiceProxy will be specific to the programming - * interface expected by the client. In this particular case the client is an Axis2 - * Web service skeleton. - */ - class WSServiceProxy : public 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. - */ - WSServiceProxy(tuscany::sca::model::Reference* reference); - - /** - * Create a new service proxy for a service. The proxy will contain a pointer to - * the target ServiceWrapper. - * @param reference The service on the target component. - * @param target The wrapper of the target service. - */ - WSServiceProxy(tuscany::sca::model::Service* service); - - /** - * Destructor. - */ - virtual ~WSServiceProxy(); - - /** - * Invoke the specified operation - */ - commonj::sdo::DataObjectPtr invoke(const tuscany::sca::model::WSDLOperation& wsdlOperation, - commonj::sdo::DataObjectPtr inputDataObject); - - private: - - void setOutputData(Operation& operation, - commonj::sdo::DataObjectPtr outputDataObject, commonj::sdo::DataFactoryPtr dataFactoryPtr); - - /** - * The target service wrapper - */ - ServiceWrapper* serviceWrapper; - - }; - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_wsserviceproxy_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/export.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/export.h deleted file mode 100644 index e52adf4db0..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/export.h +++ /dev/null @@ -1,38 +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_ws_service_export_h -#define tuscany_sca_ws_service_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef TUSCANY_SCA_WS_SERVICE_EXPORTS -#define SCA_WS_SERVICE_API __declspec(dllexport) -#else -#define SCA_WS_SERVICE_API __declspec(dllimport) -#endif - -#else -#define SCA_WS_SERVICE_API -#endif - -#endif // tuscany_sca_ws_service_export_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp deleted file mode 100644 index 4f170ebf52..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp +++ /dev/null @@ -1,151 +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/util/Logging.h" -#include "tuscany/sca/ws/model/WSReferenceBinding.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/ws/WSServiceProxy.h" - -using namespace std; -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - // Constructor - WSReferenceBinding::WSReferenceBinding(Reference* reference, const string& uri, const string& endpoint, const string&version) - : ReferenceBinding(reference, uri), endpoint(endpoint), soapVersion(version) - { - logentry(); - - parseEndpoint(); - } - - void WSReferenceBinding::parseEndpoint() - { - logentry(); - - // Endpoint is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<endpoint-name>) - string::size_type hash = endpoint.find("#"); - if (hash != string::npos) - { - // Found a hash - - // Namepace is the part before the # - wsdlNamespaceURL = endpoint.substr(0, hash); - - - if ( (hash+1) < endpoint.length()) - { - // Check the next part is wsdl.endpoint( - int ending = hash+15; - string check = endpoint.substr(hash+1, 14); - if (check.compare("wsdl.endpoint(") == 0) - { - // Find the matching ) - int endBracket = endpoint.find(")",ending); - if (endBracket-1 > ending+1) - { - string serviceAndEndpoint = endpoint.substr(ending, endBracket-ending); - // Look for a '/' - string::size_type slash = serviceAndEndpoint.find("/"); - if (slash != string::npos) - { - serviceName = serviceAndEndpoint.substr(0, slash); - - if ( (slash+1) < serviceAndEndpoint.length()) - { - endpointName = serviceAndEndpoint.substr(slash+1); - } - else - { - endpointName = ""; - } - - } - else - { - // No '/' so all of it is the service name - serviceName = serviceAndEndpoint; - endpointName = ""; - - } - } - else - { - // Nothing between the () - serviceName = ""; - endpointName = ""; - } - } - else - { - // not the correct characters after the #, ignore the rest - serviceName = ""; - endpointName = ""; - } - - } - else - { - // Nothing after the hash - serviceName = ""; - endpointName = ""; - } - } - else - { - // No hash at all - wsdlNamespaceURL = endpoint; - serviceName = ""; - endpointName = ""; - } - } - - // Destructor - WSReferenceBinding::~WSReferenceBinding() - { - logentry(); - } - - void WSReferenceBinding::configure(ServiceBinding *binding) - { - logentry(); - - setTargetServiceBinding(binding); - - serviceProxy = new WSServiceProxy(getReference()); - } - - ServiceProxy* WSReferenceBinding::getServiceProxy() - { - logentry(); - - return serviceProxy; - } - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h b/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h deleted file mode 100644 index 14f17dbc3c..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h +++ /dev/null @@ -1,143 +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_extension_ws_model_wsreferencebinding_h -#define tuscany_sca_extension_ws_model_wsreferencebinding_h - -#include <string> - -#include "tuscany/sca/ws/export.h" -#include "tuscany/sca/model/ReferenceBinding.h" - - -namespace tuscany -{ - namespace sca - { - namespace ws - { - /** - * Information about a web service binding for service or a reference. - */ - class WSReferenceBinding : public tuscany::sca::model::ReferenceBinding - { - public: - - /** - * Constructor. - * @param uri The uri of the binding. - * @param endpoint The definition of the endpoint to which the entrypoint - * or external service is to be bound. This is of the form - * "namespace"#endpoint("service"/"endpoint") - */ - SCA_WS_SERVICE_API WSReferenceBinding(tuscany::sca::model::Reference* reference, - const std::string&uri, const std::string& endpoint, const std::string& version); - - /** - * Destructor. - */ - SCA_WS_SERVICE_API virtual ~WSReferenceBinding(); - - /** - * Returns the type of binding. - */ - virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; }; - - /** - * Configure this binding from a service binding. - */ - SCA_WS_SERVICE_API virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding); - - /** - * Create a proxy representing the reference to the - * client component. - */ - SCA_WS_SERVICE_API virtual ServiceProxy* getServiceProxy(); - - /** - * Return the part of the endpoint definition describing the wsdl - * namespace. - * @return The wsdl namespace. - */ - std::string getWSDLNamespaceURL() const { return wsdlNamespaceURL; }; - - /** - * Return the service part of the endpoint definition. - * @return The service to use. - */ - std::string getServiceName() const { return serviceName; }; - - /** - * Return the endpoint name part of the endpoint definition. - * @return The endpoint name to use. - */ - std::string getEndpointName() const { return endpointName; }; - - /** - * Return the SOAP version. - * @return The SOAP version to use. - */ - std::string getSOAPVersion() const { return soapVersion; }; - - private: - - /** - * Parse the endpoint specification. - */ - void parseEndpoint(); - - /** - * The full endpoint string. - */ - std::string endpoint; - - /** - * Namespace from the endpoint. - */ - std::string wsdlNamespaceURL; - - /** - * Service name from the endpoint. - */ - std::string serviceName; - - /** - * Endpoint name from the endpoint. - */ - std::string endpointName; - - /** - * SOAP version. - */ - std::string soapVersion; - - /** - * The proxy representing the reference to the client - * component. - */ - ServiceProxy* serviceProxy; - }; - - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_extension_ws_model_wsreferencebinding_h diff --git a/sca-cpp/trunk/contrib/runtime/extensions/ws/xsd/sca-binding-webservice.xsd b/sca-cpp/trunk/contrib/runtime/extensions/ws/xsd/sca-binding-webservice.xsd deleted file mode 100644 index 680dd809a8..0000000000 --- a/sca-cpp/trunk/contrib/runtime/extensions/ws/xsd/sca-binding-webservice.xsd +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" - elementFormDefault="qualified"> - - <include schemaLocation="../../../xsd/sca-core.xsd"/> - - <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding"/> - <complexType name="WebServiceBinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <element name="soapbinding" type="sca:SOAPBinding" minOccurs="0" maxOccurs="unbounded"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="endpoint" type="anyURI" use="optional" /> - <attribute name="location" type="anyURI" use="optional" /> - <attribute name="conformanceURIs" type="sca:ConformanceURIList" use="optional" /> - <attribute name="interfaceMapping" type="string" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> - - <complexType name="SOAPBinding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="name" type="NCName" use="optional" /> - <attribute name="version" type="string" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </complexType> - - <simpleType name="ConformanceURIList"> - <list itemType="anyURI"/> - </simpleType> -</schema> |