diff options
Diffstat (limited to 'sca-cpp/trunk/contrib/runtime/extensions/cpp')
229 files changed, 21229 insertions, 0 deletions
diff --git a/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am b/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am new file mode 100644 index 0000000000..3ef2b728b3 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/Makefile.am @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f234261f5b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/Makefile.am @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d686c4c09f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.cpp @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2c305c5161 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ComponentContext.h @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3f06e1b12 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.cpp @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a047f82e46 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/CompositeContext.h @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6d64a32dd6 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/ServiceRuntimeException.h @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..8a69913be4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/export.h @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6cce9453d7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/osoa/sca/sca.h @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..74a30fb772 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.cpp @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d6c872629d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPExtension.h @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b5312ab243 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.cpp @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..8eb7b88691 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..7bb84a7673 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..04ac9f6970 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cc45ea9fb8 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.cpp @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..8406e9bc44 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceProxy.h @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..1304ab92a0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.cpp @@ -0,0 +1,194 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..899deca07a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPServiceWrapper.h @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3de0cb968c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.cpp @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..412c276d8c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/ComponentContextImpl.h @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ae8183231e --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ed0bb8b51c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f8aad90f7a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.cpp @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b4cf31220a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/TuscanyRuntime.h @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..56098ced93 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2dfdac616e --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2322d1bdf5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..fdbf314d3d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..0c12b7af43 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9860f14765 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..45afea8375 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..13b88a84dd --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3a97f02513 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/Makefile.am @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f433b1a53f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/LICENSE @@ -0,0 +1,177 @@ + + 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 new file mode 100644 index 0000000000..44befbee63 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/NOTICE @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000000..2831dadd94 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/META-INF/README @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000000..59b4d2095f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/Makefile.am @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..23e825a1b4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/build.xml @@ -0,0 +1,151 @@ +<?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 new file mode 100644 index 0000000000..13c1273983 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/CalculatorTest.java @@ -0,0 +1,33 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..48d415dd8e --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/EnvHandlerTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ca7d50ae48 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceButNotInClassAttrTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e019873489 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/ImplClassWithNameSpaceTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..11cab070b2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceButNotInClassAttrTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a26321d2a3 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/IntfClassWithNameSpaceTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e529af0dd0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/MissingCompositeAndFragmentTest.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3743a1f1f9 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/SimplePublicPrivateProtectedTest.java @@ -0,0 +1,49 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..1f1d2108e5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestAllCompositesTest.java @@ -0,0 +1,89 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..0d845e1b1e --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TestDeployAssistTool.java @@ -0,0 +1,97 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..5d1fa568d1 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/org/apache/tuscany/sca/cpp/tools/junit/TuscanyTestCase.java @@ -0,0 +1,341 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..99c4158d1a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/Calculator.h @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a1accb0fda --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.componentType @@ -0,0 +1,25 @@ +<?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 new file mode 100644 index 0000000000..3f97eacef2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/CalculatorImpl.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f2a8e56c58 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorCompositeAndComponent/sca.composite @@ -0,0 +1,28 @@ +<?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 new file mode 100644 index 0000000000..bc14167841 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorBack.h @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..af140f9575 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/otherSubFolder/CalculatorForward.h @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b3c5778b36 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/sca.composite @@ -0,0 +1,31 @@ +<?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 new file mode 100644 index 0000000000..715a4dfc6c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.componentType @@ -0,0 +1,26 @@ +<?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 new file mode 100644 index 0000000000..d10bfb4b1a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorBackImpl.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..0000086167 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.componentType @@ -0,0 +1,25 @@ +<?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 new file mode 100644 index 0000000000..182d9d89f2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CalculatorSlashDirectionTest/subFolder/CalculatorForwardImpl.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..733b4700e7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.fragment @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..d1a634999c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfo.h @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..c325a90b1e --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplMultiParamDiffTypesTest/CustomerInfoImpl.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cb63dd1f06 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.fragment @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..85fac59da8 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfo.h @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..95b70c3017 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/CustomerInfoImplSingleParamDiffTypesTest/CustomerInfoImpl.h @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..5c5cb78b87 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.fragment @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..7bd355b3ab --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfo.h @@ -0,0 +1,36 @@ +/* + * + * 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..540873174b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/CustomerInfoImpl.h @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..4334c82eca --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValue.h @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c4e3b35675 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.componentType @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..98a342fcb0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl.hpp @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3f9feeed30 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6a8fd51534 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/StockQuoteService.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9a5cfd8da5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceComposite/sca.composite @@ -0,0 +1,60 @@ +<?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 new file mode 100644 index 0000000000..48d34f7957 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.fragment @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..928480df1f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfo.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..8d2f810db0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/CustomerInfoImpl.h @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..4334c82eca --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValue.h @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c4e3b35675 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.componentType @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..98a342fcb0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl.hpp @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3f9feeed30 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6a8fd51534 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/StockQuoteService.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9a5cfd8da5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespace/sca.composite @@ -0,0 +1,60 @@ +<?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 new file mode 100644 index 0000000000..90835ca4af --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValue.h @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..785be08b72 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType @@ -0,0 +1,30 @@ +<?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 new file mode 100644 index 0000000000..04a785cd26 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3e3c22a07b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/sca.composite @@ -0,0 +1,48 @@ +<?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 new file mode 100644 index 0000000000..bbfcf15ed1 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValue.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..42cc4e9827 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.componentType @@ -0,0 +1,29 @@ +<?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 new file mode 100644 index 0000000000..98a342fcb0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/MyValueImpl.hpp @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..510bf36337 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespace/sca.composite @@ -0,0 +1,49 @@ +<?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 new file mode 100644 index 0000000000..10c59480a8 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValue.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ddb463e3d7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.componentType @@ -0,0 +1,29 @@ +<?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 new file mode 100644 index 0000000000..98a342fcb0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/MyValueImpl.hpp @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..510bf36337 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/sca.composite @@ -0,0 +1,49 @@ +<?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 new file mode 100644 index 0000000000..717ce02ede --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/CustomerInfo.fragmentX @@ -0,0 +1,38 @@ +<?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 new file mode 100644 index 0000000000..bbda577c28 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeMissingScaComposite/sca.compositeX @@ -0,0 +1,60 @@ +<?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 new file mode 100644 index 0000000000..5c5cb78b87 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.fragment @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..928480df1f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfo.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..c275383ab4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/CustomerInfoImpl.h @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..4334c82eca --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValue.h @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c4e3b35675 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.componentType @@ -0,0 +1,39 @@ +<?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 new file mode 100644 index 0000000000..98a342fcb0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl.hpp @@ -0,0 +1,43 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3f9feeed30 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6a8fd51534 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/StockQuoteService.h @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9a5cfd8da5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/MyValueServiceCompositeTwoClasses/sca.composite @@ -0,0 +1,60 @@ +<?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 new file mode 100644 index 0000000000..27d28368f5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.fragment @@ -0,0 +1,40 @@ +<?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 new file mode 100644 index 0000000000..32bf7572dc --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfo.h @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c2cfd3b399 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.componentType @@ -0,0 +1,33 @@ +<?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 new file mode 100644 index 0000000000..55f5813303 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testinput/composites/SimplePublicPrivateProtectedTest/CustomerInfoImpl.h @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..14bafd9ce7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.cpp @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..00b163ba76 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b6e5c8a9f0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.cpp @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..63bae2f75c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorCompositeAndComponent/expected_output/CalculatorImpl_CalculatorService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..79bfdbedbb --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.cpp @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..277a3afb06 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Proxy.h @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..09dd09c01c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.cpp @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..bfa203598c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorBackImpl_CalculatorService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..19056e836d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.cpp @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9213ec625b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Proxy.h @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..7b1cad7770 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.cpp @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..0cb8404ca3 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CalculatorSlashDirectionTest/expected_output/CalculatorForwardImpl_CalculatorService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..85291cd069 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp @@ -0,0 +1,594 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cb9e4e6e2a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..be09a57919 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,872 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..94b1d5cb4d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplMultiParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f3b2540ba8 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp @@ -0,0 +1,504 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..75f912d3ae --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..896a129145 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,760 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..94b1d5cb4d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/CustomerInfoImplSingleParamDiffTypesTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6f2c95f45b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..594f404d13 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..57add811a2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b85533cfd4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b0d9424ad4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d61c806e44 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..7f38178f9c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3eef80e8f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e6800aa311 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3d1d279b7c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_customerInfo_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3fd4fbaf0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ad5cee3ca7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceComposite/expected_output/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..95c63da613 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2bf1b90e87 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b32cf3863a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..82995c96b0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b0d9424ad4 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d61c806e44 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ac104f9aaf --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..df388bf43d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e6800aa311 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3d1d279b7c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_customerInfo_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3fd4fbaf0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ad5cee3ca7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespace/expected_output/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..21d956f547 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..bb92aa0556 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..de0f0a0563 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cfc7c4c07a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeImplClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..21d956f547 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..210da9a64c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f84fcf496b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3eef80e8f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespace/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..21d956f547 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..210da9a64c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f84fcf496b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d3eef80e8f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeIntfClassWithNamespaceButNotInClassAttr/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..543b370282 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..594f404d13 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..191dd3eed2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a57f5c4613 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/CustomerInfoImpl2_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..fe996eabdb --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.cpp @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d61c806e44 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Proxy.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..5bbd07a72a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.cpp @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cfc7c4c07a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_MyValueService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ffcc1d0003 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3d1d279b7c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_customerInfo_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6e4d0600bd --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.cpp @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ad5cee3ca7 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/MyValueServiceCompositeTwoClasses/expected_output/MyValueImpl_stockQuote_Proxy.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..4c3d626bfb --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.cpp @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a9b56bdb5c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Proxy.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2aa9fcbdf2 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.cpp @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..94b1d5cb4d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/junit/testoutput/SimplePublicPrivateProtectedTest/expected_output/CustomerInfoImpl_CustomerInfoService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d99c666c6a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/lib/readme.txt @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000000..8ab5e4abdf --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.bat @@ -0,0 +1,19 @@ +@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 new file mode 100755 index 0000000000..c50f28b98f --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/scagen.sh @@ -0,0 +1,21 @@ +#!/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 new file mode 100644 index 0000000000..4ccbe0c750 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/BodyPart.java @@ -0,0 +1,96 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..669901b4b5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/CParsingTool.java @@ -0,0 +1,124 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..246a489c9c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Configuration.java @@ -0,0 +1,132 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..36d0af18b3 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/DirectoryTree.java @@ -0,0 +1,105 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a2bb4ba858 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FileActor.java @@ -0,0 +1,37 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..b6bdf92878 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/FilePart.java @@ -0,0 +1,80 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..533e1fd14a --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Headers.java @@ -0,0 +1,167 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..225909e1d1 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java @@ -0,0 +1,425 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..317ad2fc44 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MacroPart.java @@ -0,0 +1,87 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..a25610c1f9 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/MethodPart.java @@ -0,0 +1,133 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6e951f03de --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Options.java @@ -0,0 +1,164 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2d98e0a836 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Parameter.java @@ -0,0 +1,216 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..876d2dc3e0 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/ParsingException.java @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e51b2d781c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/PrototypePart.java @@ -0,0 +1,56 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d7052b7843 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Signature.java @@ -0,0 +1,506 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..d26c5ec5ae --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java @@ -0,0 +1,556 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c423477193 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/package.html @@ -0,0 +1,58 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..28974b41a6 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentDomNodeHandler.java @@ -0,0 +1,366 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..6c86fa25b5 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ComponentTypeFileHandler.java @@ -0,0 +1,130 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3eb8dc7d98 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/CompositeOrFragmentFileHandler.java @@ -0,0 +1,91 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..9cf7952afa --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DirectoryScanner.java @@ -0,0 +1,93 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..0756b5fc3b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomHandler.java @@ -0,0 +1,83 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..37c2a1a81c --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/DomNodeHandler.java @@ -0,0 +1,46 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..1ec393959d --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/GenericDomNodeHandler.java @@ -0,0 +1,220 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..e7036037c6 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/LittleClass.java @@ -0,0 +1,33 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..5631249769 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ReferenceDomNodeHandler.java @@ -0,0 +1,75 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..19e983c6b1 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/Scagen.java @@ -0,0 +1,176 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..cedb4bdb54 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServiceDomNodeHandler.java @@ -0,0 +1,71 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..956db364a1 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/ServicesGenerator.java @@ -0,0 +1,831 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..dd260c9787 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/XMLFileActor.java @@ -0,0 +1,208 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ea15ca587b --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/package.html @@ -0,0 +1,159 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..3d9dafa103 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl @@ -0,0 +1,278 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..2f5edb3a93 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl @@ -0,0 +1,228 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..f983917e36 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl @@ -0,0 +1,290 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..c8157fe2f6 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl @@ -0,0 +1,191 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT 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 new file mode 100644 index 0000000000..ac2004bd73 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-implementation-cpp.xsd @@ -0,0 +1,51 @@ +<?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 new file mode 100644 index 0000000000..a8493fe726 --- /dev/null +++ b/sca-cpp/trunk/contrib/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd @@ -0,0 +1,45 @@ +<?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> |