From 7b15f577d88f43cf32c0b7386554584ecc87b291 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 19 Nov 2009 17:58:20 +0000 Subject: Removing obsolete release candidate tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@882222 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/runtime/core/src/Makefile.am | 103 -- .../runtime/core/src/osoa/sca/ComponentContext.cpp | 132 -- .../runtime/core/src/osoa/sca/ComponentContext.h | 105 -- .../core/src/osoa/sca/ComponentContextImpl.cpp | 270 ---- .../core/src/osoa/sca/ComponentContextImpl.h | 120 -- .../runtime/core/src/osoa/sca/ModuleContext.cpp | 93 -- .../sca/runtime/core/src/osoa/sca/ModuleContext.h | 80 - .../core/src/osoa/sca/ModuleContextImpl.cpp | 102 -- .../runtime/core/src/osoa/sca/ModuleContextImpl.h | 71 - .../sca/runtime/core/src/osoa/sca/SCA.cpp | 21 - .../sca/runtime/core/src/osoa/sca/ServiceList.cpp | 105 -- .../sca/runtime/core/src/osoa/sca/ServiceList.h | 84 - .../core/src/osoa/sca/ServiceRuntimeException.cpp | 208 --- .../core/src/osoa/sca/ServiceRuntimeException.h | 236 --- .../sca/runtime/core/src/osoa/sca/export.h | 39 - .../sca/runtime/core/src/osoa/sca/sca.h | 29 - .../tuscany/sca/core/ComponentServiceWrapper.cpp | 204 --- .../src/tuscany/sca/core/ComponentServiceWrapper.h | 156 -- .../tuscany/sca/core/ExternalServiceWrapper.cpp | 102 -- .../src/tuscany/sca/core/ExternalServiceWrapper.h | 81 - .../core/src/tuscany/sca/core/Operation.cpp | 266 --- .../runtime/core/src/tuscany/sca/core/Operation.h | 177 -- .../core/src/tuscany/sca/core/SCAEntryPoint.cpp | 210 --- .../core/src/tuscany/sca/core/SCAEntryPoint.h | 122 -- .../core/src/tuscany/sca/core/SCARuntime.cpp | 355 ---- .../runtime/core/src/tuscany/sca/core/SCARuntime.h | 195 --- .../core/src/tuscany/sca/core/ServiceProxy.cpp | 121 -- .../core/src/tuscany/sca/core/ServiceProxy.h | 89 - .../core/src/tuscany/sca/core/ServiceWrapper.cpp | 55 - .../core/src/tuscany/sca/core/ServiceWrapper.h | 73 - .../core/src/tuscany/sca/core/TuscanyRuntime.cpp | 100 -- .../core/src/tuscany/sca/core/TuscanyRuntime.h | 85 - .../runtime/core/src/tuscany/sca/model/Binding.cpp | 44 - .../runtime/core/src/tuscany/sca/model/Binding.h | 85 - .../src/tuscany/sca/model/CPPImplementation.cpp | 54 - .../core/src/tuscany/sca/model/CPPImplementation.h | 125 -- .../core/src/tuscany/sca/model/CPPInterface.cpp | 67 - .../core/src/tuscany/sca/model/CPPInterface.h | 143 -- .../core/src/tuscany/sca/model/Component.cpp | 305 ---- .../runtime/core/src/tuscany/sca/model/Component.h | 202 --- .../core/src/tuscany/sca/model/EntryPoint.cpp | 101 -- .../core/src/tuscany/sca/model/EntryPoint.h | 158 -- .../core/src/tuscany/sca/model/ExternalService.cpp | 55 - .../core/src/tuscany/sca/model/ExternalService.h | 97 -- .../core/src/tuscany/sca/model/Implementation.cpp | 44 - .../core/src/tuscany/sca/model/Implementation.h | 66 - .../core/src/tuscany/sca/model/Interface.cpp | 44 - .../runtime/core/src/tuscany/sca/model/Interface.h | 65 - .../core/src/tuscany/sca/model/ModelLoader.cpp | 1702 -------------------- .../core/src/tuscany/sca/model/ModelLoader.h | 105 -- .../runtime/core/src/tuscany/sca/model/Module.cpp | 235 --- .../runtime/core/src/tuscany/sca/model/Module.h | 235 --- .../runtime/core/src/tuscany/sca/model/Service.cpp | 47 - .../runtime/core/src/tuscany/sca/model/Service.h | 81 - .../src/tuscany/sca/model/ServiceReference.cpp | 89 - .../core/src/tuscany/sca/model/ServiceReference.h | 136 -- .../core/src/tuscany/sca/model/Subsystem.cpp | 122 -- .../runtime/core/src/tuscany/sca/model/Subsystem.h | 131 -- .../runtime/core/src/tuscany/sca/model/System.cpp | 118 -- .../runtime/core/src/tuscany/sca/model/System.h | 89 - .../core/src/tuscany/sca/model/WSBinding.cpp | 127 -- .../runtime/core/src/tuscany/sca/model/WSBinding.h | 106 -- .../runtime/core/src/tuscany/sca/model/Wire.cpp | 46 - .../sca/runtime/core/src/tuscany/sca/model/Wire.h | 91 -- .../core/src/tuscany/sca/model/WireTarget.cpp | 49 - .../core/src/tuscany/sca/model/WireTarget.h | 106 -- .../runtime/core/src/tuscany/sca/model/Wsdl.cpp | 356 ---- .../sca/runtime/core/src/tuscany/sca/model/Wsdl.h | 129 -- .../core/src/tuscany/sca/model/WsdlOperation.cpp | 56 - .../core/src/tuscany/sca/model/WsdlOperation.h | 141 -- .../core/src/tuscany/sca/util/DefaultLogWriter.cpp | 43 - .../core/src/tuscany/sca/util/DefaultLogWriter.h | 46 - .../runtime/core/src/tuscany/sca/util/Exceptions.h | 48 - .../sca/runtime/core/src/tuscany/sca/util/File.cpp | 221 --- .../sca/runtime/core/src/tuscany/sca/util/File.h | 133 -- .../core/src/tuscany/sca/util/FileLogWriter.cpp | 49 - .../core/src/tuscany/sca/util/FileLogWriter.h | 53 - .../runtime/core/src/tuscany/sca/util/Library.cpp | 122 -- .../runtime/core/src/tuscany/sca/util/Library.h | 97 -- .../core/src/tuscany/sca/util/LogWriter.cpp | 32 - .../runtime/core/src/tuscany/sca/util/LogWriter.h | 47 - .../runtime/core/src/tuscany/sca/util/Logger.cpp | 107 -- .../sca/runtime/core/src/tuscany/sca/util/Logger.h | 89 - .../runtime/core/src/tuscany/sca/util/Logging.h | 57 - .../runtime/core/src/tuscany/sca/util/Utils.cpp | 215 --- .../sca/runtime/core/src/tuscany/sca/util/Utils.h | 61 - .../core/src/tuscany/sca/ws/EntryPointProxy.cpp | 677 -------- .../core/src/tuscany/sca/ws/EntryPointProxy.h | 63 - .../core/src/tuscany/sca/ws/WSServiceWrapper.h | 47 - 89 files changed, 12348 deletions(-) delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/Makefile.am delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/SCA.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceList.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceList.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceRuntimeException.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceRuntimeException.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/export.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/sca.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Exceptions.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/File.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/File.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/FileLogWriter.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/FileLogWriter.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logging.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Utils.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Utils.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.cpp delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.h delete mode 100644 tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/WSServiceWrapper.h (limited to 'tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src') diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/Makefile.am b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/Makefile.am deleted file mode 100644 index 305bbe5504..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/Makefile.am +++ /dev/null @@ -1,103 +0,0 @@ -lib_LTLIBRARIES = libtuscany_sca.la - -nobase_include_HEADERS = \ -osoa/sca/ComponentContext.h \ -osoa/sca/ComponentContextImpl.h \ -osoa/sca/export.h \ -osoa/sca/ModuleContext.h \ -osoa/sca/ModuleContextImpl.h \ -osoa/sca/sca.h \ -osoa/sca/ServiceList.h \ -osoa/sca/ServiceRuntimeException.h \ -tuscany/sca/core/ComponentServiceWrapper.h \ -tuscany/sca/core/ExternalServiceWrapper.h \ -tuscany/sca/core/Operation.h \ -tuscany/sca/core/SCAEntryPoint.h \ -tuscany/sca/core/SCARuntime.h \ -tuscany/sca/core/ServiceProxy.h \ -tuscany/sca/core/ServiceWrapper.h \ -tuscany/sca/core/TuscanyRuntime.h \ -tuscany/sca/model/Binding.h \ -tuscany/sca/model/Component.h \ -tuscany/sca/model/CPPImplementation.h \ -tuscany/sca/model/CPPInterface.h \ -tuscany/sca/model/EntryPoint.h \ -tuscany/sca/model/ExternalService.h \ -tuscany/sca/model/Implementation.h \ -tuscany/sca/model/Interface.h \ -tuscany/sca/model/ModelLoader.h \ -tuscany/sca/model/Module.h \ -tuscany/sca/model/Service.h \ -tuscany/sca/model/ServiceReference.h \ -tuscany/sca/model/Subsystem.h \ -tuscany/sca/model/System.h \ -tuscany/sca/model/Wire.h \ -tuscany/sca/model/WireTarget.h \ -tuscany/sca/model/WSBinding.h \ -tuscany/sca/model/Wsdl.h \ -tuscany/sca/model/WsdlOperation.h \ -tuscany/sca/util/DefaultLogWriter.h \ -tuscany/sca/util/Exceptions.h \ -tuscany/sca/util/File.h \ -tuscany/sca/util/FileLogWriter.h \ -tuscany/sca/util/Library.h \ -tuscany/sca/util/Logger.h \ -tuscany/sca/util/Logging.h \ -tuscany/sca/util/LogWriter.h \ -tuscany/sca/util/Utils.h \ -tuscany/sca/ws/WSServiceWrapper.h \ -tuscany/sca/ws/EntryPointProxy.h - - -libtuscany_sca_la_SOURCES = \ -osoa/sca/ComponentContext.cpp \ -osoa/sca/ComponentContextImpl.cpp \ -osoa/sca/ModuleContext.cpp \ -osoa/sca/ModuleContextImpl.cpp \ -osoa/sca/SCA.cpp \ -osoa/sca/ServiceList.cpp \ -osoa/sca/ServiceRuntimeException.cpp \ -tuscany/sca/util/DefaultLogWriter.cpp \ -tuscany/sca/util/File.cpp \ -tuscany/sca/util/FileLogWriter.cpp \ -tuscany/sca/util/Library.cpp \ -tuscany/sca/util/Logger.cpp \ -tuscany/sca/util/LogWriter.cpp \ -tuscany/sca/util/Utils.cpp \ -tuscany/sca/model/Binding.cpp \ -tuscany/sca/model/Component.cpp \ -tuscany/sca/model/CPPImplementation.cpp \ -tuscany/sca/model/CPPInterface.cpp \ -tuscany/sca/model/EntryPoint.cpp \ -tuscany/sca/model/ExternalService.cpp \ -tuscany/sca/model/Implementation.cpp \ -tuscany/sca/model/Interface.cpp \ -tuscany/sca/model/ModelLoader.cpp \ -tuscany/sca/model/Module.cpp \ -tuscany/sca/model/Service.cpp \ -tuscany/sca/model/ServiceReference.cpp \ -tuscany/sca/model/Subsystem.cpp \ -tuscany/sca/model/System.cpp \ -tuscany/sca/model/Wire.cpp \ -tuscany/sca/model/WireTarget.cpp \ -tuscany/sca/model/WSBinding.cpp \ -tuscany/sca/model/Wsdl.cpp \ -tuscany/sca/model/WsdlOperation.cpp \ -tuscany/sca/core/ComponentServiceWrapper.cpp \ -tuscany/sca/core/ExternalServiceWrapper.cpp \ -tuscany/sca/core/Operation.cpp \ -tuscany/sca/core/SCAEntryPoint.cpp \ -tuscany/sca/core/SCARuntime.cpp \ -tuscany/sca/core/ServiceProxy.cpp \ -tuscany/sca/core/ServiceWrapper.cpp \ -tuscany/sca/core/TuscanyRuntime.cpp \ -tuscany/sca/ws/EntryPointProxy.cpp - -libtuscany_sca_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \ - -L$(top_builddir)/runtime/ws_reference/axis2c/src -ltuscany_sca_ws_reference - -AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I${TUSCANY_SDOCPP}/include - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.cpp deleted file mode 100644 index 73c3ed2e36..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "osoa/sca/ComponentContext.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "osoa/sca/ComponentContextImpl.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace tuscany::sca; - -namespace osoa -{ - namespace sca - { - - // ======================================================= - // getCurrent: create a context from the current component - // ======================================================= - ComponentContext ComponentContext::getCurrent() - { - LOGENTRY(1, "ComponentContext::getCurrent"); - Component* component = SCARuntime::getInstance()->getCurrentComponent(); - if (!component) - { - throw ComponentContextException("No current component"); - } - ComponentContextImpl* cci = new ComponentContextImpl(component); - LOGEXIT(1, "ComponentContext::constructor"); - return ComponentContext(cci); - } - - // =========== - // Constructor - // =========== - ComponentContext::ComponentContext(ComponentContextImpl* implementation) - : impl(implementation) - { - LOGENTRY(1, "ComponentContext::constructor"); - LOGEXIT(1, "ComponentContext::constructor"); - } - - // ========== - // Destructor - // ========== - ComponentContext::~ComponentContext() - { - LOGENTRY(1, "ComponentContext::destructor"); - delete impl; - LOGEXIT(1, "ComponentContext::destructor"); - } - - // =================================== - // Copy constructor: create a new impl - // =================================== - ComponentContext::ComponentContext(const ComponentContext& ctx) - { - impl = new ComponentContextImpl(impl->getComponent()); - } - - // ============================= - // operator= : create a new impl - // ============================= - ComponentContext& ComponentContext::operator=(const ComponentContext& ctx) - { - if (this != &ctx) - { - impl = new ComponentContextImpl(impl->getComponent()); - } - return *this; - } - - // ========== - // getService - // ========== - void* ComponentContext::getService(const char* referenceName) - { - LOGENTRY(1, "ComponentContext::getService"); - void* service = impl->getService(referenceName); - LOGEXIT(1, "ComponentContext::getService"); - return service; - } - - // =========== - // getServices - // =========== - ServiceList ComponentContext::getServices(const char* referenceName) - { - return impl->getServices(referenceName); - } - - // ============ - // getProperties - // ============= - DataObjectPtr ComponentContext::getProperties() - { - LOGENTRY(1, "ComponentContext::getProperties"); - DataObjectPtr properties = impl->getProperties(); - LOGEXIT(1, "ComponentContext::getProperties"); - return properties; - } - - // ============ - // getDataFactory - // ============= - DataFactoryPtr ComponentContext::getDataFactory() - { - LOGENTRY(1, "ComponentContext::getDataFactory"); - DataFactoryPtr dataFactory = impl->getDataFactory(); - LOGEXIT(1, "ComponentContext::getDataFactory"); - return dataFactory; - } - - - } // End namespace sca -} // End namespace osoa diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.h deleted file mode 100644 index 10d334a936..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContext.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_componentcontext_h -#define osoa_sca_componentcontext_h - -#include "osoa/sca/export.h" -#include "osoa/sca/ServiceList.h" -#include "commonj/sdo/SDO.h" -namespace osoa -{ - namespace sca - { - class ComponentContextImpl; - - /** - * An SCA component implementation uses the ComponentContext class to - * retrieve information about the configured SCA component. - */ - class SCA_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. - */ - void* getService(const char* 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. - */ - ServiceList getServices(const char* referenceName); - - /** - * Get the configured properties for the component. - * @return A data object representing all the properties that - * are configured for this component. - */ - 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. - */ - commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Destructor - */ - virtual ~ComponentContext(); - - - ComponentContext(const ComponentContext&); - ComponentContext& operator=(const ComponentContext&); - - private: - /** - * Constructor to create an interface class from the contained - * implementation. - * @param implementation the actual implementation class - */ - ComponentContext(ComponentContextImpl* implementation); - - /** - * Pointer to the class which provides the actual implementation. - */ - ComponentContextImpl* impl; - - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_componentcontext_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.cpp deleted file mode 100644 index 436e44d5e1..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "osoa/sca/ComponentContextImpl.h" -#include "tuscany/sca/model/WireTarget.h" -#include "tuscany/sca/core/ComponentServiceWrapper.h" -#include "tuscany/sca/core/ExternalServiceWrapper.h" -#include "tuscany/sca/model/CPPImplementation.h" -#include "tuscany/sca/model/Module.h" - -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -namespace osoa -{ - namespace sca - { - // =========== - // Constructor - // =========== - ComponentContextImpl::ComponentContextImpl(Component* comp) - : component(comp) - { - LOGENTRY(1, "ComponentContextImpl::constructor"); - LOGEXIT(1, "ComponentContextImpl::constructor"); - } - - // ========== - // Destructor - // ========== - ComponentContextImpl::~ComponentContextImpl() - { - // -------------------------------------------- - // Delete the proxies served up by this context - // -------------------------------------------- - for (PROXIES::iterator iter = proxies.begin(); iter != proxies.end(); iter++) - { - delete (ServiceProxy*)*iter; - } - } - - - // ========================================================================== - // getServices: return a list of Proxies for services wired to this reference - // ========================================================================== - ServiceList ComponentContextImpl::getServices(const char* referenceName) - { - LOGENTRY(1, "ComponentContextImpl::getServices"); - - string message; - - // -------------------------------------------------------------- - // locate reference in the current component and determine target - // -------------------------------------------------------------- - ServiceReference* serviceReference = component->findReference(referenceName); - if (!serviceReference) - { - message = "Reference not defined: "; - message = message + referenceName; - throw ServiceNotFoundException(message.c_str()); - } - - // Get the target services from the ServiceReference - const ServiceReference::TARGETS& targets = serviceReference->getTargets(); - - // -------------------- - // Validate the request - // -------------------- - switch (serviceReference->getMultiplicity()) - { - case ServiceReference::ONE_MANY: - case ServiceReference::ONE_ONE: - { - if (targets.size() == 0) - { - message = "Reference "; - message = message + referenceName + " not wired"; - throw ServiceNotFoundException(message.c_str()); - } - } - default: - { - } - } // end switch - - // ------------------------------ - // Create a proxy for each target - // ------------------------------ - ServiceList services(targets.size()); - for (ServiceReference::TARGETS::const_iterator iter = targets.begin(); - iter!=targets.end(); - iter++) - { - services.addService(getServiceProxy(serviceReference, *iter)); - } - - return services; - - } // End getServices() - - - // =================================================================== - // getService: return a Proxy for the services wired to this reference - // =================================================================== - void* ComponentContextImpl::getService(const char* referenceName) - { - LOGENTRY(1, "ComponentContextImpl::getService"); - - string message; - - // -------------------------------------------------------------- - // locate reference in the current component and determine target - // -------------------------------------------------------------- - ServiceReference* serviceReference = component->findReference(referenceName); - if (!serviceReference) - { - message = "Reference not defined: "; - message = message + referenceName; - throw ServiceNotFoundException(message.c_str()); - } - - // Get the target service from the ServiceReference - const ServiceReference::TARGETS& targets = serviceReference->getTargets(); - - // -------------------- - // Validate the request - // -------------------- - switch (serviceReference->getMultiplicity()) - { - case ServiceReference::ZERO_MANY: - case ServiceReference::ONE_MANY: - { - message = "getService() called for reference with multiplicity >1 :"; - message = message + referenceName; - throw ServiceNotFoundException(message.c_str()); - } - case ServiceReference::ONE_ONE: - { - if (targets.size() == 0) - { - message = "Reference "; - message = message + referenceName + " not wired"; - throw ServiceNotFoundException(message.c_str()); - } - } - default: - { - } - } // end switch - - // Return the proxy - return getServiceProxy(serviceReference, *targets.begin()); - - } // End getService() - - - // ================================================================== - // getServiceProxy: Create and return an instance of the ServiceProxy - // ================================================================== - void* ComponentContextImpl::getServiceProxy( - ServiceReference* serviceReference, - WireTarget* target) - { - // ----------------------------------- - // Get a ServiceWrapper for the target - // ----------------------------------- - ServiceWrapper* serviceWrapper = getServiceWrapper(target); - - // ------------------------------ - // Get a Proxy for this reference - // ------------------------------ - try - { - ServiceProxy* serviceProxy = new ServiceProxy(component, serviceReference->getName(), serviceWrapper); - void* service = serviceProxy->getProxy(); - // service MUST be set here or an exception will have been thrown - proxies.push_back(serviceProxy); - return service; - } - catch (ServiceRuntimeException&) - { - delete serviceWrapper; - throw ; - } - } - - - // ====================================================================== - // getServiceWrapper: Create and return an instance of the ServiceWrapper - // ====================================================================== - ServiceWrapper* ComponentContextImpl::getServiceWrapper(WireTarget* target) - { - // ------------------------- - // Determine type of Service - // ------------------------- - switch (target->getServiceType()) - { - case WireTarget::ExternalServiceType: - { - // ---------------- - // External Service - // ---------------- - return ExternalServiceWrapper::createServiceWrapper((ExternalService*)target); - } - - case WireTarget::ComponentServiceType: - { - // ----------------- - // Component Service - // ----------------- - return ComponentServiceWrapper::createServiceWrapper((Service*)target); - } - - default: - { - string message = "Undefined wire target type for : "; - message = message + target->getName(); - throw ServiceNotFoundException(message.c_str()); - } - } // end switch - } - - - - // ============================================== - // getProperties: return the component properties - // ============================================== - DataObjectPtr ComponentContextImpl::getProperties() - { - LOGENTRY(1, "ComponentContextImpl::getProperties"); - DataObjectPtr properties = component->getProperties(); - - LOGEXIT(1, "ComponentContextImpl::getProperties"); - return properties; - } - - // ============================================== - // getDataFactory: return the data factory for the module in which - // this component resides - // ============================================== - DataFactoryPtr ComponentContextImpl::getDataFactory() - { - LOGENTRY(1, "ComponentContextImpl::getProperties"); - DataFactoryPtr dataFactory = component->getModule()->getDataFactory(); - - LOGEXIT(1, "ComponentContextImpl::getDataFactory"); - return dataFactory; - } - - - } // End namespace sca -} // End namespace osoa diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.h deleted file mode 100644 index bd3a0d106a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ComponentContextImpl.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_componentcontextimpl_h -#define osoa_sca_componentcontextimpl_h - -#include "osoa/sca/ServiceList.h" - -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/ServiceProxy.h" -#include "tuscany/sca/model/Service.h" - -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -namespace osoa -{ - namespace sca - { - /** - * Contains the actual implementation of a ComponentContext interface. - */ - class ComponentContextImpl - { - - public: - /** - * Constructor that takes a Component which represents the runtime - * model for this context. - */ - ComponentContextImpl(Component* component); - - /** - * Default constructor. - */ - virtual ~ComponentContextImpl(); - - /** - * See ComponentContext. - */ - void* getService(const char* referenceName); - - /** - * See ComponentContext. - */ - ServiceList getServices(const char* referenceName); - - /** - * See ComponentContext. - */ - DataObjectPtr getProperties(); - - /** - * See ComponentContext. - */ - commonj::sdo::DataFactoryPtr getDataFactory(); - - /** - * Returns the contained Component. - * @return The Component to which this context refers. - */ - Component* getComponent() {return component;} - - private: - ComponentContextImpl(const ComponentContextImpl&); - ComponentContextImpl& operator=(const ComponentContextImpl&); - - /** - * Pointer to the runtime model Component to which this - * context refers. - */ - 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( - ServiceReference* serviceReference, - WireTarget* 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(WireTarget* target); - - - typedef vector PROXIES; - /** - * A vector of the proxies created by this ComponentContext. The - * proxies will be destroyed when the ComponentContext is destroyed. - */ - PROXIES proxies; - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_componentcontextimpl_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.cpp deleted file mode 100644 index 93e36b297f..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "osoa/sca/ModuleContext.h" -#include "tuscany/sca/util/Logging.h" -#include "osoa/sca/ModuleContextImpl.h" -#include "tuscany/sca/core/SCARuntime.h" - -using namespace tuscany::sca; - -namespace osoa -{ - namespace sca - { - // =========== - // Constructor - // =========== - ModuleContext::ModuleContext(ModuleContextImpl* implementation) - : impl(implementation) - { - } - - // =================================== - // Copy constructor: create a new impl - // =================================== - ModuleContext::ModuleContext(const ModuleContext& ctx) - { - impl = new ModuleContextImpl(SCARuntime::getInstance()->getCurrentModule()); - } - - // ============================= - // operator= : create a new impl - // ============================= - ModuleContext& ModuleContext::operator=(const ModuleContext& ctx) - { - if (this != &ctx) - { - impl = new ModuleContextImpl(SCARuntime::getInstance()->getCurrentModule()); - } - return *this; - } - - // ========== - // Destructor - // ========== - ModuleContext::~ModuleContext() - { - LOGENTRY(1, "ModuleContext::destructor"); - delete impl; - LOGEXIT(1, "ModuleContext::destructor"); - } - - // ==================================================== - // getCurrent: create a context from the current module - // ==================================================== - ModuleContext ModuleContext::getCurrent() - { - LOGENTRY(1, "ModuleContext::getCurrent"); - ModuleContextImpl* mci = new ModuleContextImpl(SCARuntime::getInstance()->getCurrentModule()); - LOGEXIT(1, "ModuleContext::getCurrent"); - return ModuleContext(mci); - } - - // ============= - // locateService - // ============= - void* ModuleContext::locateService(const char* serviceName) - { - LOGENTRY(1, "ModuleContext::locateService"); - void* sp = impl->locateService(serviceName); - LOGEXIT(1, "ModuleContext::locateService"); - return sp; - } - - - } // End namespace sca -} // End namespace osoa diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.h deleted file mode 100644 index 7aacb00123..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContext.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_modulecontext_h -#define osoa_sca_modulecontext_h - -#include "osoa/sca/export.h" - -namespace osoa -{ - namespace sca - { - class ModuleContextImpl; - - /** - * An SCA component implementation, or a non-SCA client, uses the - * ModuleContext class to retrieve information about the configured - * SCA module. - */ - class SCA_API ModuleContext - { - - public: - /** - * Return a new ModuleContext for the current Component. - */ - static ModuleContext 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. - */ - void* locateService(const char* serviceName); - - /** - * Destructor. - */ - virtual ~ModuleContext(); - - ModuleContext(const ModuleContext&); - ModuleContext& operator=(const ModuleContext&); - - private: - /** - * Constructor to create an interface class from the contained - * implementation. - * @param implementation The actual implementation class. - */ - ModuleContext(ModuleContextImpl* implementation); - - /** - * Pointer to the class which provides the actual implementation. - */ - ModuleContextImpl* impl; - - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_modulecontext_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.cpp deleted file mode 100644 index 4d96ee336d..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/CPPImplementation.h" -#include "osoa/sca/ModuleContextImpl.h" -#include "tuscany/sca/core/ComponentServiceWrapper.h" - -using namespace tuscany::sca; -using namespace tuscany::sca::model; - -namespace osoa -{ - namespace sca - { - // =========== - // Constructor - // =========== - ModuleContextImpl::ModuleContextImpl(Module* mod) - : module(mod) - { - } - - // ========== - // Destructor - // ========== - ModuleContextImpl::~ModuleContextImpl() - { - // -------------------------------------------- - // Delete the proxies served up by this context - // -------------------------------------------- - for (PROXIES::iterator iter = proxies.begin(); iter != proxies.end(); iter++) - { - delete (ServiceProxy*)*iter; - } - } - - // =========================================================================== - // locateService: return a proxy connected to a wrapper for the target service - // =========================================================================== - void* ModuleContextImpl::locateService(const char* serviceName) - { - LOGENTRY(1, "ModuleContextImpl::locateService"); - - - // ---------------------------- - // Locate the component service - // ---------------------------- - Service* service = module->findComponentService(serviceName); - string msg; - if (!service) - { - msg = "Service not found: "; - msg = msg + serviceName; - throw ServiceNotFoundException(msg.c_str()); - } - - // ------------------------- - // Create the ServiceWrapper - // ------------------------- - ComponentServiceWrapper* serviceWrapper = ComponentServiceWrapper::createServiceWrapper(service); - - // ---------------------------- - // Get a Proxy for this service - // ---------------------------- - try - { - ServiceProxy* serviceProxy = new ServiceProxy(service->getComponent(), service->getName(), serviceWrapper); - proxies.push_back(serviceProxy); - LOGEXIT(1, "ModuleContextImpl::locateService"); - return serviceProxy->getProxy(); - } - catch (ServiceRuntimeException&) - { - delete serviceWrapper; - throw ; - } - - } - - - - } // End namespace sca -} // End namespace osoa diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.h deleted file mode 100644 index 5950313a06..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ModuleContextImpl.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_modulecontextimpl_h -#define osoa_sca_modulecontextimpl_h -#include "tuscany/sca/model/Module.h" -#include "tuscany/sca/core/ServiceProxy.h" - -namespace osoa -{ - namespace sca - { - /** - * Contains the actual implementation of a ModuleContext interface. - */ - class ModuleContextImpl - { - - public: - /** - * Constructor that takes a Module which represents the runtime - * model for this context. - */ - ModuleContextImpl(tuscany::sca::model::Module* module); - - /** - * See ModuleContext#locateService. - */ - void* locateService(const char* serviceName); - - /** - * Destructor. - */ - virtual ~ModuleContextImpl(); - private: - ModuleContextImpl(const ModuleContextImpl&); - ModuleContextImpl& operator=(const ModuleContextImpl&); - - /** - * Pointer to the runtime model Module object to which this - * context refers. - */ - tuscany::sca::model::Module* module; - - typedef vector PROXIES; - /** - * Vector of proxies created from calls to the locateService - * method. - */ - PROXIES proxies; - }; - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_modulecontextimpl_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/SCA.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/SCA.cpp deleted file mode 100644 index bcca254028..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/SCA.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev: $ $Date: $ */ - -#include "osoa/sca/sca.h" - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceList.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceList.cpp deleted file mode 100644 index ba2b418a7c..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/ServiceList.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "osoa/sca/ServiceList.h" - -#include "osoa/sca/ServiceRuntimeException.h" - -namespace osoa -{ - namespace sca - { - // =========== - // Constructor - // =========== - ServiceList::ServiceList(unsigned int numTargets) - : maxServices(numTargets), numServices(0) - { - services = new void*[numTargets]; - } - - // ========================================== - // Copy comstructor: create new service array - // ========================================== - ServiceList::ServiceList(const ServiceList& sl) - : maxServices(sl.maxServices), numServices(sl.numServices) - { - services = new void*[maxServices]; - for (unsigned int i=0; i - -namespace osoa -{ - namespace sca - { - - /** - * Top level exception to represent all the exceptions that may be - * thrown by an SCA runtime implementation. - */ - class SCA_API ServiceRuntimeException - { - public: - /** - * Represents the possible severity levels for an exception. - */ - enum severity_level - { - Normal, - Warning, - Error, - Severe - }; - - /** - * Constructor. - * @param name Class name of the exception. - * @param sev Severity level. - * @param msg_text Detailed description of the exception. - */ - ServiceRuntimeException( - const char *name="ServiceRuntimeException", - severity_level sev=Severe, - const char* msg_text=""); - - ServiceRuntimeException(const ServiceRuntimeException& c); - - // Destructor - virtual ~ServiceRuntimeException(); - - /** - * Return class name of this exception. - */ - const char* getEClassName() const; - - /** - * Return severity. - */ - severity_level getSeverity() const; - - /** - * Return message text associated with exception. - */ - const char* getMessageText() const; - - /* - * Return file name where the exception was raised. - */ - const char* getFileName() const; - - /** - * Return line number where the exception was raised. - */ - unsigned long getLineNumber() const; - - /** - * Return function name where the exception was raised. - */ - const char* getFunctionName() const; - - /** - * Set the exception severity. - */ - void setSeverity(severity_level sev); - - /** - * Set the message text associated with exception. - */ - void setMessageText(const char* msg_text); - - /** - * Set the location where the exception was raised. - * @param file Name of the file. - * @param line Line number in the file. - * @param function Name of the function. - */ - void setLocation(const char* file, - unsigned long line, - const char* function=""); - - /** - * Append exception details to ostream. - */ - virtual std::ostream& PrintSelf(std::ostream &os) const; - - /** - * Operator to send exceptions details to a stream. - */ - SCA_API friend std::ostream& operator<< (std::ostream &os, const ServiceRuntimeException &except); - protected: - - private: - /** - * Class name of the exception. - */ - char* class_name; - - /** - * Severity level of the exception. - */ - severity_level severity; - - /** - * Description of the exception. - */ - char* message_text; // Description of exception - - /** - * Location where the exception was thrown or handled and thrown. - */ - class location - { - public: - char* file; // File name (from __FILE__) - unsigned long line; // Line number (from __LINE__) - char* function; // Function name - }; - - - enum {num_locations=5}; - /** - * Array of locations where the exception has been handled and thrown. - */ - location locations[num_locations]; - - /** - * The current location (index into ServiceRuntimeException#location). - */ - int location_set; - - - }; // End ServiceRuntimeException class definition - - - /** - * A remotable service is currently unavailable. It is possible that a retry - * may resolve this exception. - */ - class SCA_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_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_API ComponentContextException: public ServiceRuntimeException - { - public: - ComponentContextException(const char* msg) - : ServiceRuntimeException("ComponentContextException", Error, - msg) - { - } - private: - }; // End ComponentContextException class definition - - /** - * Unable to find the specified entry point in the module. - */ - class SCA_API EntryPointNotFoundException: public ServiceRuntimeException - { - public: - EntryPointNotFoundException(const char* msg) - : ServiceRuntimeException("EntryPointNotFoundException", Error, - msg) - { - } - private: - }; // End EntryPointNotFoundException class definition - - - - } // End namespace sca -} // End namespace osoa - -#endif // osoa_sca_serviceruntimeexception_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/export.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/export.h deleted file mode 100644 index 6ef7960284..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/export.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_export_h -#define osoa_sca_export_h - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) - -#ifdef SCA_EXPORTS -#define SCA_API __declspec(dllexport) -#else -#define SCA_API __declspec(dllimport) -#endif - -#else -#include -#include -#include -#define SCA_API -#endif - -#endif // osoa_sca_export_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/sca.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/sca.h deleted file mode 100644 index 528bd91c4a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/osoa/sca/sca.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef osoa_sca_sca_h -#define osoa_sca_sca_h - -#include "osoa/sca/export.h" -#include "osoa/sca/ModuleContext.h" -#include "osoa/sca/ComponentContext.h" -#include "osoa/sca/ServiceList.h" -#include "osoa/sca/ServiceRuntimeException.h" - -#endif // osoa_sca_sca_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp deleted file mode 100644 index 65d218dc86..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/ComponentServiceWrapper.h" - -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/CPPImplementation.h" -using namespace osoa::sca; - -namespace tuscany -{ - namespace sca - { - // =================== - // Static data members - // =================== - void* ComponentServiceWrapper::staticImpl = 0; - - // =========== - // Constructor - // =========== - ComponentServiceWrapper::ComponentServiceWrapper(Service* target) - : ServiceWrapper(target), service(target) - { - LOGENTRY(1,"ComponentServiceWrapper::constructor"); - if (target->getServiceType() != WireTarget::ComponentServiceType) - { - throw ServiceRuntimeException("ComponentServiceWrapper: target is not a component service"); - } - - component = target->getComponent(); - interf = (CPPInterface*)target->getInterface(); - - remotable = interf->getRemotable(); - - - LOGEXIT(1,"ComponentServiceWrapper::constructor"); - - } - - // ========== - // Destructor - // ========== - ComponentServiceWrapper::~ComponentServiceWrapper() - { - LOGENTRY(1,"ComponentServiceWrapper::destructor"); - LOGEXIT(1,"ComponentServiceWrapper::destructor"); - } - - - // ====================================================================== - // getImplementation: get an implementation for this scope - // ====================================================================== - void* ComponentServiceWrapper::getImplementation() - { - CPPInterface::SCOPE scope = interf->getScope(); - if (scope == CPPInterface::MODULE) - { - if (!staticImpl) - { - staticImpl = newImplementation(); - } - return staticImpl; - } - else // (scope == CPPInterface::STATELESS) - { - return newImplementation(); - } - } - - // ====================================================================== - // releaseImplementation: release the implementation for this scope - // ====================================================================== - void ComponentServiceWrapper::releaseImplementation() - { - CPPInterface::SCOPE scope = interf->getScope(); - if (scope == CPPInterface::STATELESS) - { - deleteImplementation(); - } - } - - // ====================================================================== - // invoke: wrapper call to service with setting the component context - // ====================================================================== - void ComponentServiceWrapper::invoke(Operation& operation) - { - LOGENTRY(1,"ComponentServiceWrapper::invoke"); - - SCARuntime* runtime = SCARuntime::getInstance(); - runtime->setCurrentComponent(component); - - try - { - invokeService(operation); - } - catch (...) - { - runtime->unsetCurrentComponent(); - throw; - } - runtime->unsetCurrentComponent(); - LOGEXIT(1,"ComponentServiceWrapper::invoke"); - - } - - void ComponentServiceWrapper::setLibrary(Library* lib) - { - wrapperLibrary = lib; - } - - // ====================================================================== - // createServiceWrapper: create a wrapper for the target ComponentService - // ====================================================================== - ComponentServiceWrapper* ComponentServiceWrapper::createServiceWrapper(Service* service) - { - string msg; - ComponentServiceWrapper* serviceWrapper = 0; - - // ----------------------------------------------- - // Get the implementation for the target component - // ----------------------------------------------- - Component* targetComponent = service->getComponent(); - Implementation* impl = targetComponent->getImplementation(); - if (!impl) - { - msg = "Component " + targetComponent->getName() + " has no implementation defined"; - throw ServiceNotFoundException(msg.c_str()); - } - - // TODO: This only handle CPP implementation for now - if (impl->getImplementationType() == Implementation::CPP) - { - // ---------------------------------------------------- - // Get implementation dll name and wrapper factory name - // ---------------------------------------------------- - string dllName = ((CPPImplementation*)impl)->getDll(); - string wrapperFactoryName = ((CPPImplementation*)impl)->getHeaderStub() - + "_" + service->getName() + "_Wrapper_Factory"; - - // ------------ - // Load the dll - // ------------ - string fullDllName = targetComponent->getModule()->getRoot() + "/" + dllName; - typedef ComponentServiceWrapper* (* WRAPPERFACTORY) (Service*); - Library* wrapperLib = new Library(fullDllName); - - // ------------------------- - // Locate the factory method - // ------------------------- - WRAPPERFACTORY wrapperFactory = (WRAPPERFACTORY)wrapperLib->getSymbol(wrapperFactoryName); - if (!wrapperFactory) - { - LOGERROR_2(1, "ComponentServiceWrapper::createServiceWrapper: Unable to locate %s in library %s", - wrapperFactoryName.c_str(), fullDllName.c_str()); - msg = "Unable to locate " + wrapperFactoryName + " in library " + fullDllName; - throw ServiceNotFoundException(msg.c_str()); - } - - // ------------------------------------- - // Now create an instance of the wrapper - // ------------------------------------- - serviceWrapper = wrapperFactory(service); - if (!serviceWrapper) - { - LOGERROR_2(1, "ComponentServiceWrapper::createServiceWrapper: Factory method %s in library %s returned null", - wrapperFactoryName.c_str(), fullDllName.c_str()); - msg = "Factory method " + wrapperFactoryName + " in library " + fullDllName + " returned null"; - throw ServiceNotFoundException(msg.c_str()); - } - serviceWrapper->setLibrary(wrapperLib); - } - else - { - // ---------------------- - // Non CPP Implementation - // ---------------------- - msg = "Unsupported implementation type for service: " + service->getName(); - throw ServiceNotFoundException(msg.c_str()); - } - - return serviceWrapper; - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h deleted file mode 100644 index 3a5e990bf0..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ComponentServiceWrapper.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_componentservicewrapper_h -#define tuscany_sca_core_componentservicewrapper_h - -#include "osoa/sca/export.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/CPPInterface.h" -#include "tuscany/sca/util/Library.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - /** - * Wraps the service on a component implementation. - * This abstract class is extended by generated code which provides - * the implementation of some of the methods. - * An instance of this class wraps the actual component implementation which - * has been written by a developer of an SCA application. - */ - class ComponentServiceWrapper : public ServiceWrapper - { - public: - /** - * Factory method to create a new ComponentServiceWrapper for a given target - * service. This method will provide all the loading of dlls required to - * create the target component. - * @param target The service on the component for which this wrapper is to be - * created. - * @return A wrapper that references the given target. - */ - static SCA_API ComponentServiceWrapper* createServiceWrapper(Service* target); - - /** - * Constructor. - * @param target The component service to which this wrapper refers. - */ - SCA_API ComponentServiceWrapper(Service* target); - - /** - * Destructor. - */ - SCA_API virtual ~ComponentServiceWrapper(); - - /** - * All business method calls to the target component go through the invoke method. - * @param operation The details of the method, paramaters and return value for the - * business method to be called on the target component. - */ - SCA_API virtual void invoke(Operation& operation); - - /** - * Return the loaded shared library for the target component. - */ - Library* getLibrary() {return wrapperLibrary;} - protected: - /** - * Delegated method to invoke the correct method on the target component. - * Implemented by the subtype. - */ - SCA_API virtual void invokeService(Operation& operation) = 0; - - /** - * Delegated method to create a new component implementation. - * Implemented by the subtype. - * @return A pointer to an instance of the component implementation class. - */ - SCA_API virtual void* newImplementation() = 0; - - /** - * Delegated method to delete the current instance of the component - * implementation. - * Implemented by the subtype. - */ - SCA_API virtual void deleteImplementation() = 0; - - /** - * Return the current instance of the component implementation. - * @return A pointer to an instance of the component implementation class. - */ - SCA_API virtual void* getImplementation(); - - /** - * Indicates that the current instance of the component implementation - * has been finished with. - * Will call ComponentServiceWrapper#deleteImplementation if the - * implementation is stateless (so that a new instance is returned - * for each call). - */ - SCA_API virtual void releaseImplementation(); - - private: - /** - * Holds an implementation instance if the scope is set to module. - */ - static void* staticImpl; - - /** - * The component to which this wrapper refers. - */ - Component* component; - - /** - * The service on the component to which this wrapper refers. - */ - Service* service; - - /** - * A pointer to the interface which the service exposes. - */ - CPPInterface* interf; - - /** - * Set to true if the service is remotable. - */ - bool remotable; - - /** - * Pointer to the loaded library which contains the component - * implementation. - */ - Library* wrapperLibrary; - - /** - * Set the loaded library which contains the component - * implementation. - * @param lib The library. - */ - void setLibrary(Library* lib); - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_componentservicewrapper_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp deleted file mode 100644 index 2838bbe4d4..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/ExternalServiceWrapper.h" -#include - -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" - -#include "tuscany/sca/ws/WSServiceWrapper.h" -using tuscany::sca::ws::WSServiceWrapper; - -using namespace osoa::sca; - - -namespace tuscany -{ - namespace sca - { - - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// - - ExternalServiceWrapper::ExternalServiceWrapper(tuscany::sca::model::WireTarget* target) - : ServiceWrapper(target) - { - LOGENTRY(1,"ExternalServiceWrapper::constructor"); - if (target->getServiceType() != WireTarget::ExternalServiceType) - { - throw ServiceRuntimeException("ExternalServiceWrapper: target is not an ExternalService"); - } - - LOGEXIT(1,"ExternalServiceWrapper::constructor"); - - } - - ExternalServiceWrapper::~ExternalServiceWrapper() - { - LOGENTRY(1,"ExternalServiceWrapper::destructor"); - LOGEXIT(1,"ExternalServiceWrapper::destructor"); - } - - // ====================================================================== - // createServiceWrapper: create a wrapper for the target ExternalService - // ====================================================================== - ExternalServiceWrapper* ExternalServiceWrapper::createServiceWrapper(ExternalService* service) - { - string msg; - ExternalServiceWrapper* serviceWrapper = 0; - - // ----------------------------------------------- - // Get the binding for the target component - // ----------------------------------------------- - Binding* targetBinding = service->getBinding(); - if (!targetBinding) - { - msg = "External service " + service->getName() + " has no binding defined"; - throw ServiceNotFoundException(msg.c_str()); - } - - // TODO: This only handles ws implementation for now - if (targetBinding->getBindingType() == Binding::WS) - { - // ------------------------------------- - // Create an instance of the wrapper - // ------------------------------------- - serviceWrapper = new WSServiceWrapper(service); - - } - else - { - // ---------------------- - // Non WS Binding - // ---------------------- - msg = "Unsupported binding type for externalService: " + service->getName(); - throw ServiceNotFoundException(msg.c_str()); - } - - return serviceWrapper; - } - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h deleted file mode 100644 index b2dcfb3a6b..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ExternalServiceWrapper.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_externalservicewrapper_h -#define tuscany_sca_core_externalservicewrapper_h - -#include "osoa/sca/export.h" -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/ExternalService.h" -using tuscany::sca::model::ExternalService; - -namespace tuscany -{ - namespace sca - { - - /** - * Wraps an SCA external service so that it can be called by a - * proxy. - * This abstract class will be extended by a class which supports - * a specific external service binding (for example, the web services binding). - */ - class SCA_API ExternalServiceWrapper : public ServiceWrapper - { - public: - /** - * Factory method to create a new ExternaServiceWrapper for a given - * external service described in the SCA module. - */ - static ExternalServiceWrapper* createServiceWrapper(ExternalService* service); - - /** - * Constructor. - * @param target The target external service for which this wrapper is to be - * created. - * @return A wrapper that references the given target. - */ - ExternalServiceWrapper(tuscany::sca::model::WireTarget* target); - - /** - * Destructor. - */ - virtual ~ExternalServiceWrapper(); - - /** - * Return the external service (in the runtime model) that is wrapped by - * the instance of this class. - */ - virtual ExternalService* getExternalService() {return (ExternalService*)getTarget();}; - - /** - * All business method calls to the external service go through the invoke method. - * This is a delegated method which will be implemented by the subclass. - * @param operation The details of the method, paramaters and return value for the - * business method to be called on the external service. - */ - virtual void invoke(Operation& operation) = 0; - private: - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_externalservicewrapper_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.cpp deleted file mode 100644 index 981f4e6d9e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/Operation.h" -#include - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" - - - -namespace tuscany -{ - namespace sca - { - // =========== - // Constructor - // =========== - Operation::Operation(const char* operationName) - { - LOGENTRY(1,"Operation::constructor"); - - if (operationName != 0) - { - name = operationName; - } - - LOGEXIT(1,"Operation::constructor"); - } - - // ========== - // Destructor - // ========== - Operation::~Operation() - { - LOGENTRY(1,"Operation::destructor"); - LOGEXIT(1,"Operation::destructor"); - } - - - // ============================================== - // getParameter: return parameter at position pos - // ============================================== - void* Operation::getParameterValue(unsigned int pos) - { - if (pos < parameters.size()) - { - return parameters[pos].getValue(); - } - - return 0; - } - - // ============================================== - // getParameter: return of parameter - // ============================================== - Operation::Parameter& Operation::getParameter(unsigned int pos) - { - if (pos < parameters.size()) - { - return parameters[pos]; - } - - throw "index out of range"; - } - - - // ============================================== - // getParameterType: return type of parameter - // ============================================== - Operation::ParameterType Operation::getParameterType(unsigned int pos) - { - if (pos < parameters.size()) - { - return parameters[pos].getType(); - } - - return VOID_TYPE; - } - - // =========================================== - // addParameter: set parameter at position pos - // =========================================== - void Operation::addParameter(const void *parm) - { - LOGINFO(4, "Operation::addParameter(void*)"); - parameters.insert(parameters.end(), Parameter((void*)parm, VOID_TYPE)); - } - - void Operation::addParameter(const bool *parm) - { - LOGINFO(4, "Operation::addParameter(bool)"); - parameters.insert(parameters.end(), Parameter((void*)parm, BOOL)); - } - - void Operation::addParameter(const short *parm) - { - LOGINFO(4, "Operation::addParameter(short)"); - parameters.insert(parameters.end(), Parameter((void*)parm, SHORT)); - } - - void Operation::addParameter(const long *parm) - { - LOGINFO(4, "Operation::addParameter(long)"); - parameters.insert(parameters.end(), Parameter((void*)parm, LONG)); - } - - void Operation::addParameter(const unsigned short *parm) - { - LOGINFO(4, "Operation::addParameter(unsigned short)"); - parameters.insert(parameters.end(), Parameter((void*)parm, USHORT)); - } - - void Operation::addParameter(const unsigned long *parm) - { - LOGINFO(4, "Operation::addParameter(unsigned long)"); - parameters.insert(parameters.end(), Parameter((void*)parm, ULONG)); - } - - void Operation::addParameter(const float *parm) - { - LOGINFO(4, "Operation::addParameter(float)"); - parameters.insert(parameters.end(), Parameter((void*)parm, FLOAT)); - } - - void Operation::addParameter(const double *parm) - { - LOGINFO(4, "Operation::addParameter(double)"); - parameters.insert(parameters.end(), Parameter((void*)parm, DOUBLE)); - } - - void Operation::addParameter(const long double *parm) - { - LOGINFO(4, "Operation::addParameter(long double)"); - parameters.insert(parameters.end(), Parameter((void*)parm, LONGDOUBLE)); - } - - void Operation::addParameter(const char* *parm) - { - LOGINFO(4, "Operation::addParameter(char*)"); - parameters.insert(parameters.end(), Parameter((void*)parm, CHARS)); - } - - void Operation::addParameter(const char *parm) - { - LOGINFO(4, "Operation::addParameter(char)"); - parameters.insert(parameters.end(), Parameter((void*)parm, CHAR)); - } - - void Operation::addParameter(const string *parm) - { - LOGINFO(4, "Operation::addParameter(string)"); - parameters.insert(parameters.end(), Parameter((void*)parm, STRING)); - } - - void Operation::addParameter(const DataObjectPtr *parm) - { - LOGINFO(4, "Operation::addParameter(DataObjectPtr)"); - parameters.insert(parameters.end(), Parameter((void*)parm, DATAOBJECT)); - } - - Operation::Parameter::Parameter(void* val, Operation::ParameterType typ) - : value(val), type(typ) - { - } - - // =========================================== - // setReturnValue - // =========================================== - void Operation::setReturnValue(const void *parm) - { - LOGINFO(4, "Operation::setReturnValue(void*)"); - returnValue = Parameter((void*)parm, VOID_TYPE); - } - - void Operation::setReturnValue(const bool *parm) - { - LOGINFO(4, "Operation::setReturnValue(bool*)"); - returnValue = Parameter((void*)parm, BOOL); - } - - void Operation::setReturnValue(const short *parm) - { - LOGINFO(4, "Operation::setReturnValue(short*)"); - returnValue = Parameter((void*)parm, SHORT); - } - - void Operation::setReturnValue(const long *parm) - { - LOGINFO(4, "Operation::setReturnValue(long*)"); - returnValue = Parameter((void*)parm, LONG); - } - - void Operation::setReturnValue(const unsigned short *parm) - { - LOGINFO(4, "Operation::setReturnValue(unsigned short*)"); - returnValue = Parameter((void*)parm, USHORT); - } - - void Operation::setReturnValue(const unsigned long *parm) - { - LOGINFO(4, "Operation::setReturnValue(unsigned long*)"); - returnValue = Parameter((void*)parm, ULONG); - } - - void Operation::setReturnValue(const float *parm) - { - LOGINFO(4, "Operation::setReturnValue(float*)"); - returnValue = Parameter((void*)parm, FLOAT); - } - - void Operation::setReturnValue(const double *parm) - { - LOGINFO(4, "Operation::setReturnValue(double*)"); - returnValue = Parameter((void*)parm, DOUBLE); - } - - void Operation::setReturnValue(const long double *parm) - { - LOGINFO(4, "Operation::setReturnValue(long double*)"); - returnValue = Parameter((void*)parm, LONGDOUBLE); - } - - void Operation::setReturnValue(const char *parm) - { - LOGINFO(4, "Operation::setReturnValue(char)"); - returnValue = Parameter((void*)parm, CHAR); - } - - void Operation::setReturnValue(const char* *parm) - { - LOGINFO(4, "Operation::setReturnValue(char*)"); - returnValue = Parameter((void*)parm, CHARS); - } - - void Operation::setReturnValue(const string *parm) - { - LOGINFO(4, "Operation::setReturnValue(string*)"); - returnValue = Parameter((void*)parm, STRING); - } - - void Operation::setReturnValue(const DataObjectPtr *parm) - { - LOGINFO(4, "Operation::setReturnValue(DataObjectPtr*)"); - returnValue = Parameter((void*)parm, DATAOBJECT); - } - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.h deleted file mode 100644 index e562dca3c1..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/Operation.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_operation_h -#define tuscany_sca_core_operation_h -#include "osoa/sca/export.h" -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; -#include -using std::string; -#include -using std::vector; - -namespace tuscany -{ - namespace sca - { - /** - * Holds the details of a single invocation of a business method. - * This class is used to pass the parameters and operation name from the - * client to a service. It will also hold the return value on the - * return from the business method. - */ - class Operation - { - public: - /** - * Create a new operation. - * @param operationName The method name of the business method to be invoked. - * @param numParameters The number of parameters to be passed. - */ - SCA_API Operation(const char* operationName = 0); - - /** - * Destructor. - */ - SCA_API virtual ~Operation(); - - /** - * Return the operation name. - * @return The name of the operation. - */ - SCA_API const string& getName() {return name;} - - - enum ParameterType - { - UNSET = 0, - VOID_TYPE, - BOOL, - SHORT, - LONG, - USHORT, - ULONG, - FLOAT, - DOUBLE, - LONGDOUBLE, - CHARS, - CHAR, - STRING, - DATAOBJECT - }; - - class Parameter - { - public: - SCA_API Parameter(void* value = NULL, ParameterType type = VOID_TYPE); - SCA_API void* getValue() {return value;} - SCA_API ParameterType getType() {return type;} - - private: - void* value; - ParameterType type; - }; - - /** - * Set a return value for the operation. - * @param retVal Pointer to the return value. - */ - SCA_API void setReturnValue(const void *retVal); - SCA_API void setReturnValue(const bool *retVal); - SCA_API void setReturnValue(const short *retVal); - SCA_API void setReturnValue(const long *retVal); - SCA_API void setReturnValue(const unsigned short *retVal); - SCA_API void setReturnValue(const unsigned long *retVal); - SCA_API void setReturnValue(const float *retVal); - SCA_API void setReturnValue(const double *retVal); - SCA_API void setReturnValue(const long double *retVal); - SCA_API void setReturnValue(const char *retVal); - SCA_API void setReturnValue(const char* *retVal); - SCA_API void setReturnValue(const string *retVal); - SCA_API void setReturnValue(const DataObjectPtr *retVal); - - /** - * Set a parameter on the operation. - * @param pos The position of the parameter in the parameter list. - * @param parm Pointer to the parameter to be passed. - */ - SCA_API void addParameter(const void *parm); - SCA_API void addParameter(const bool *parm); - SCA_API void addParameter(const short *parm); - SCA_API void addParameter(const long *parm); - SCA_API void addParameter(const unsigned short *parm); - SCA_API void addParameter(const unsigned long *parm); - SCA_API void addParameter(const float *parm); - SCA_API void addParameter(const double *parm); - SCA_API void addParameter(const long double *parm); - SCA_API void addParameter(const char *parm); - SCA_API void addParameter(const char* *parm); - SCA_API void addParameter(const string *parm); - SCA_API void addParameter(const DataObjectPtr *parm); - - SCA_API unsigned int getNParms() {return parameters.size();} - - /** - * Get a parameter from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Pointer to the paramter at the given postion. Should be - * cast to the appropriate type. - */ - SCA_API Parameter& getParameter(unsigned int pos); - - /** - * Get a parameter type from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Pointer to the paramter at the given postion. Should be - * cast to the appropriate type. - */ - SCA_API ParameterType getParameterType(unsigned int pos); - - /** - * Get a parameter from the operation. - * @param pos The position of the parameter in the parameter list. - * @return Pointer to the paramter at the given postion. Should be - * cast to the appropriate type. - */ - SCA_API void* getParameterValue(unsigned int pos); - - SCA_API ParameterType getReturnType() {return returnValue.getType();} - SCA_API void* getReturnValue() {return returnValue.getValue();} - - private: - /** - * Operation name (method name). - */ - string name; - - /** - * Array of parameters. - */ - typedef std::vector PARAMETER_VECTOR; - - PARAMETER_VECTOR parameters; - - Parameter returnValue; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_operation_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp deleted file mode 100644 index 63a7d52e7a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/SCAEntryPoint.h" - -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/core/ComponentServiceWrapper.h" -#include "tuscany/sca/core/ExternalServiceWrapper.h" -using namespace osoa::sca; - -namespace tuscany -{ - namespace sca - { - // =========== - // Constructor - // =========== - SCAEntryPoint::SCAEntryPoint(const char* epName) - : subsystem(0), entrypoint(0), module(0) - { - LOGENTRY(1,"SCAEntryPoint::constructor"); - string message; - - // initialize the system if necessary - System* system = SCARuntime::getInstance()->getSystem(); - - string subsystemName; - string entrypointName; - - Utils::tokeniseUri(epName, subsystemName, entrypointName); - - // -------------------- - // locate the Subsystem - // -------------------- - subsystem = system->findSubsystem(subsystemName); - if (!subsystem) - { - throw EntryPointNotFoundException(epName); - } - - // --------------------- - // locate the EntryPoint - // --------------------- - entrypoint = subsystem->findEntryPoint(entrypointName); - if (entrypoint) - { - // found Subsystem EntryPoint - throw EntryPointNotFoundException("Subsystem EntryPoint not yet supported"); - } - else - { - // ----------------------------------- - // locate the EntryPoint in the Module - // ----------------------------------- - string moduleComponentName; - Utils::tokeniseUri(entrypointName, moduleComponentName, entrypointName); - module = subsystem->findModuleByComponentName(moduleComponentName); - if (module) - { - dataFactory = module->getDataFactory(); - entrypoint = module->findEntryPoint(entrypointName); - } - } - - if (!entrypoint) - { - throw EntryPointNotFoundException(epName); - } - - // --------------------------------- - // Get Wrappers for each wire target - // --------------------------------- - - // Get the target services from the EntryPoint - const EntryPoint::TARGETS& targets = entrypoint->getTargets(); - - // -------------------- - // Validate the request - // -------------------- - switch (entrypoint->getMultiplicity()) - { - case EntryPoint::ONE_MANY: - case EntryPoint::ONE_ONE: - { - if (targets.size() == 0) - { - message = "EntryPoint " + entrypoint->getName() + " not wired"; - throw ServiceNotFoundException(message.c_str()); - } - } - default: - { - } - } // end switch - - for (EntryPoint::TARGETS::const_iterator iter = targets.begin(); - iter!=targets.end(); - iter++) - { - ServiceWrapper* service = getServiceWrapper(*iter); - if (service) - { - services.push_back(service); - } - } - - LOGEXIT(1,"SCAEntryPoint::constructor"); - } - - // ========== - // Destructor - // ========== - SCAEntryPoint::~SCAEntryPoint() - { - LOGENTRY(1,"SCAEntryPoint::destructor"); - - // Delete any ServiceWrappers - for (SERVICES::iterator iter = services.begin(); iter < services.end(); iter++) - { - delete (*iter); - } - LOGEXIT(1,"SCAEntryPoint::destructor"); - } - - - // ====================================================================== - // invoke: - // ====================================================================== - SCA_API void SCAEntryPoint::invoke(Operation& operation) - { - LOGENTRY(1,"SCAEntryPoint::invoke"); - string message; - - // -------------------- - // Validate the request - // -------------------- - if (services.size() == 0) - { - message = "EntryPoint " + entrypoint->getName() + " not wired"; - throw ServiceNotFoundException(message.c_str()); - } - - // ------------------- - // Invoke each target - // ------------------- - for (SERVICES::iterator iter = services.begin(); iter < services.end(); iter++) - { - (*iter)->invoke(operation); - } - LOGEXIT(1,"SCAEntryPoint::invoke"); - } - - - // ====================================================================== - // getServiceWrapper: Create and return an instance of the ServiceWrapper - // ====================================================================== - ServiceWrapper* SCAEntryPoint::getServiceWrapper(WireTarget* target) - { - // ------------------------- - // Determine type of Service - // ------------------------- - switch (target->getServiceType()) - { - case WireTarget::ExternalServiceType: - { - // ---------------- - // External Service - // ---------------- - return ExternalServiceWrapper::createServiceWrapper((ExternalService*)target); - } - - case WireTarget::ComponentServiceType: - { - // ----------------- - // Component Service - // ----------------- - return ComponentServiceWrapper::createServiceWrapper((Service*)target); - } - - default: - { - string message = "Undefined wire target type for : "; - message = message + target->getName(); - throw ServiceNotFoundException(message.c_str()); - } - } // end switch - } - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h deleted file mode 100644 index 6c1df3e28e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_scaentrypoint_h -#define tuscany_sca_core_scaentrypoint_h - -#include "osoa/sca/export.h" - -#include -using std::vector; -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/WireTarget.h" -#include "tuscany/sca/model/Subsystem.h" -#include "tuscany/sca/model/EntryPoint.h" -#include "tuscany/sca/model/Module.h" -using namespace tuscany::sca::model; -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; -using commonj::sdo::DataFactoryPtr; - -namespace tuscany -{ - namespace sca - { - /** - * A runtime class which is used by external bindings to provide the entry - * point into the SCA runtime. An entry point will be defined in an SCA - * module, and a binding class will be provided to service the - * communication between the external binding (e.g. for web services the - * SOAP/HTTP communication) and the SCA runtime. The binding class will - * use SCAEntryPoint to call into the SCA runtime. - */ - class SCAEntryPoint - { - public: - /** - * Constructor to create a new instance which will be associated with - * a given entry point in an SCA module. - * @param entryPointName The qualified name of the entry point in an - * SCA module. It is of the form - * "subsystem name"/"module component name"/"entry point name". - */ - SCA_API SCAEntryPoint(const char* entryPointName); - - /** - * Destructor. - */ - SCA_API virtual ~SCAEntryPoint(); - - /** - * Invokes an operation on the component to which the SCA entry point - * is wired in the SCA module. - * @param operation. The operation request - */ - SCA_API virtual void invoke(Operation& operation); - - /** - * Returns a SDO data factory from which all the types associated with the entry point - * and module can be created. - */ - SCA_API DataFactoryPtr getDataFactory() {return dataFactory;} - - protected: - - private: - /** - * The subsystem in which this entry point is found. - */ - Subsystem* subsystem; - - /** - * The entry point in the module. - */ - EntryPoint* entrypoint; - - /** - * The module component in the subsystem. - */ - Module* module; - - /** - * Cached data factory which has all the types defined for the module in which - * this entry point is found. - */ - DataFactoryPtr dataFactory; - - typedef vector SERVICES; - /** - * Vector of all the service wrappers created for this entry point. - * Used to destroy the wrappers when this class is destroyed. - */ - SERVICES services; - - /** - * Creates and returns the service wrapper for a given target. - * @param target The target of the wire for which a service wrapper is - * to be created. - * @return A service wrapper to be used for invoking the target implementation. - */ - ServiceWrapper* getServiceWrapper(WireTarget* target); - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_scaentrypoint_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp deleted file mode 100644 index 9da3e547e9..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/core/ComponentServiceWrapper.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" - -#include "tuscany/sca/model/System.h" -#include "tuscany/sca/model/Subsystem.h" -#include "tuscany/sca/model/ModelLoader.h" - -#if defined(WIN32) || defined (_WINDOWS) -#include -#endif - -namespace tuscany -{ - namespace sca - { - /** - * Environment variable names - */ - static const char* TUSCANY_SCACPP = "TUSCANY_SCACPP"; - static const char* TUSCANY_SCACPP_SYSTEM_ROOT = "TUSCANY_SCACPP_SYSTEM_ROOT"; - static const char* TUSCANY_SCACPP_DEFAULT_MODULE = "TUSCANY_SCACPP_DEFAULT_MODULE"; - - - // ========================================================== - // Initialize static class member to not pointing at anything - // ========================================================== - SCARuntime* SCARuntime::instance = 0; - string SCARuntime::systemRoot = ""; - string SCARuntime::defaultModuleName = ""; - - - // ========================================================== - // Set the system configuration root - // ========================================================== - void SCARuntime::setSystemRoot(const string& root) - { - LOGENTRY(1, "SCARuntime::"); - systemRoot = root; - LOGINFO_1(3, "SCARuntime::setSystemRoot - set to %s", root.c_str()); - LOGEXIT(1, "SCARuntime::setSystemRoot"); - } - - // ========================================================== - // Set the default ModuleComponent name - // ========================================================== - void SCARuntime::setDefaultModuleComponent(const string& moduleComponent) - { - LOGENTRY(1, "SCARuntime::setDefaultModuleComponent"); - defaultModuleName = moduleComponent; - LOGINFO_1(3, "SCARuntime::setDefaultModuleComponent - set to %s", moduleComponent.c_str()); - LOGEXIT(1, "SCARuntime::setDefaultModuleComponent"); - } - - // =================================================================== - // Constructor for the SCARuntime class. This will be a singleton that - // holds all the information about the current runtime. - // =================================================================== - SCARuntime::SCARuntime() : system(new System()), defaultModule(0) - { - LOGENTRY(1, "SCARuntime::constructor"); - - // Locate the SCA install root - char* root = 0; - root = getenv(TUSCANY_SCACPP); - if (root == 0) - { - string msg = TUSCANY_SCACPP; - msg += " environment variable not set"; - throw SystemConfigurationException(msg.c_str()); - } - else - { - SCARoot = root; - } - - LOGEXIT(1, "SCARuntime::constructor"); - } - - // =================================================================== - // Destructor for the SCARuntime class. - // =================================================================== - SCARuntime::~SCARuntime() - { - LOGENTRY(1, "SCARuntime::destructor"); - - if (system) - { - delete system; - } - - LOGEXIT(1, "SCARuntime::destructor"); - } - - // ============================================================= - // Get the instance of the runtime, creates it if does not exist - // static method - // ============================================================= - SCARuntime* SCARuntime::getInstance() - { - LOGENTRY(1, "SCARuntime::getInstance"); - - if (instance == NULL) - { - instance = new SCARuntime(); - - if (systemRoot == "") - { - - // Load the runtime - // Get root from environment variable TUSCANY_SCACPP_SYSTEM_ROOT - char* systemRootEnv = getenv(TUSCANY_SCACPP_SYSTEM_ROOT); - if (systemRootEnv == 0) - { - string msg = TUSCANY_SCACPP_SYSTEM_ROOT; - msg += " environment variable not set"; - throw SystemConfigurationException(msg.c_str()); - } - - systemRoot = systemRootEnv; - } - - instance->load(systemRoot); - } - - LOGEXIT(1, "SCARuntime::getInstance"); - - return instance; - - } - - - // ============================================================= - // Release the instance of the runtime. - // ============================================================= - void SCARuntime::releaseInstance() - { - LOGENTRY(1, "SCARuntime::releaseInstance"); - - if (instance) - { - delete instance; - instance = 0; - systemRoot = ""; - defaultModuleName = ""; - } - - LOGEXIT(1, "SCARuntime::releaseInstance"); - } - - // ====================================== - // Load up all the details of the runtime - // ====================================== - void SCARuntime::load(const string& configurationRoot) - { - LOGENTRY(1, "SCARuntime::load"); - - LOGINFO_1(2,"configuration root: %s", configurationRoot.c_str()); - - ModelLoader loader(system); - // Load details of the module - loader.load(configurationRoot); - - LOGEXIT(1, "SCARuntime::load"); - } - - - // =================================== - // Return the top of the runtime model - // =================================== - System* SCARuntime::getSystem() - { - return system; - } - - - // =================================================== - // setCurrentComponent: push component for this thread - // =================================================== - void SCARuntime::setCurrentComponent(Component* component) - { - -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter == components.end()) - { - components[currentThreadId] = COMPONENT_STACK(); - iter = components.find(currentThreadId); - } - - COMPONENT_STACK& compStack = iter->second; - compStack.push(component); - } - - - // ==================================================== - // unsetCurrentComponent: pop component for this thread - // ==================================================== - Component* SCARuntime::unsetCurrentComponent() - { -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter != components.end()) - { - COMPONENT_STACK& compStack = iter->second; - if (compStack.size() > 0) - { - Component* component = compStack.top(); - compStack.pop(); - return component; - } - } - - return 0; - } - - // ============================================================= - // getCurrentComponent: return current component for this thread - // ============================================================= - Component* SCARuntime::getCurrentComponent() - { -#if defined(WIN32) || defined (_WINDOWS) - DWORD currentThreadId = GetCurrentThreadId(); -#else - pthread_t currentThreadId = pthread_self(); -#endif - - COMPONENTS_MAP::iterator iter = components.find(currentThreadId); - if (iter == components.end()) - { - components[currentThreadId] = COMPONENT_STACK(); - iter = components.find(currentThreadId); - } - - COMPONENT_STACK& compStack = iter->second; - if (compStack.size() > 0) - { - return compStack.top(); - } - else - { - return 0; - } - - } - - - // =========================================== - // getCurrentModule: return the current module - // =========================================== - Module* SCARuntime::getCurrentModule() - { - // --------------------------------------------- - // Get module from current component if possible - // --------------------------------------------- - Component* comp = getCurrentComponent(); - if (comp != 0) - { - return comp->getModule(); - } - - // ---------------------- - // Get the default Module - // ---------------------- - string message; - if (!defaultModule) - { - // ------------------------------------------- - // Get the default module from the environment - // ------------------------------------------- - if (defaultModuleName == "") - { - const char* defMod = getenv(TUSCANY_SCACPP_DEFAULT_MODULE); - if (!defMod) - { - message = TUSCANY_SCACPP_DEFAULT_MODULE; - message += " environment variable not set"; - throw SystemConfigurationException(message.c_str()); - } - defaultModuleName = defMod; - } - string subsystemName, moduleName; - Utils::tokeniseUri(defaultModuleName, subsystemName, moduleName); - - // --------------------------- - // Subsystem must be specified - // --------------------------- - Subsystem* subsystem = system->findSubsystem(subsystemName); - if (!subsystem) - { - message = "Default subsystem \'" + subsystemName + "\' not found"; - throw SystemConfigurationException(message.c_str()); - } - - // -------------------------------------------------------------------------- - // If module is not specified then get the default module for this subsystem. - // This will be the ONLY module for this subsystem - // -------------------------------------------------------------------------- - if (moduleName == "") - { - defaultModule = subsystem->getDefaultModule(); - if (!defaultModule) - { - message = "Default module not found for subsystem \'" + subsystemName + "\'"; - throw SystemConfigurationException(message.c_str()); - } - } - else - { - // ----------------------------- - // get the named ModuleComponent - // ----------------------------- - defaultModule = subsystem->findModuleByComponentName(moduleName); - if (!defaultModule) - { - message = "Default module \'" + moduleName + "\' not found in subsystem \'" + subsystemName +"\'"; - throw SystemConfigurationException(message.c_str()); - } - } - } - return defaultModule; - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h deleted file mode 100644 index 2b81b2cbcd..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/SCARuntime.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_scaruntime_h -#define tuscany_sca_core_scaruntime_h - -#include "osoa/sca/export.h" - -#include "osoa/sca/ComponentContext.h" -using osoa::sca::ComponentContext; - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/System.h" -using namespace tuscany::sca::model; - -#if defined(WIN32) || defined (_WINDOWS) -#include -#else -#include -#endif - -#include -#include -#include -using namespace std; - -namespace tuscany -{ - namespace sca - { - - /** - * A singleton which represents the executing SCA runtime. - */ - class SCARuntime { - public: - /** - * Get the single instance. - * @return The single instance of the runtime. - */ - SCA_API static SCARuntime* getInstance(); - - /** - * Release the single instance. - */ - SCA_API static void releaseInstance(); - - /** - * Set the system root - * @param root The path to the deployed system. - */ - static void setSystemRoot(const string& root); - - /** - * Set the default ModuleComponent for the system - * @param moduleComponent The name of the default moduleComponent. - */ - static void setDefaultModuleComponent(const string& moduleComponent); - - /** - * Set the current component for the current thread. - * @param component The current component. - */ - SCA_API void setCurrentComponent(Component* component); - - /** - * Remove the current component from this thread, and return - * to the previous component (if there was one). - * @return The previous component. - */ - SCA_API Component* unsetCurrentComponent(); - - /** - * Get a pointer to the configured SCA system which this - * SCA runtime represents. - * The rest of the SCA configuration can be navigated from - * the System. - * @return The configured SCA system. - */ - System* getSystem(); - - /** - * The directory in which the Tuscany runtime has been installed. - */ - const string& getInstallRoot() {return SCARoot;} - - /** - * Return the current component for this thread. - * @return The current component for this thread. - */ - Component* getCurrentComponent(); - - /** - * Get the current module. The current module will either - * be the module in which the current component for this thread - * is defined, or it will be the default module if there is no current - * component. There will not be a current component if a client of - * the SCA runtime is making a call into the SCA runtime. - */ - Module* getCurrentModule(); - - private: - /** - * Default constructor is private to prevent more than one instance. - */ - SCARuntime(); - - virtual ~SCARuntime(); - - /** - * Load the SCA configuration from the scdl files (sca.module, - * *.fragment, etc). - * This will create the runtime model from which the SCA runtime - * will operate. - * @param configurationRoot The path to the configuration of the - * SCA runtime. Under this root will be the subsystems and modules - * directories. - */ - void load(const string& configurationRoot); - - /** - * The single instance of this class. - */ - static SCARuntime* instance; - - /** - * Pointer to the top of the runtime model. - */ - System* system; - - /** - * The installed path of the Tuscany runtime. - */ - string SCARoot; - - /** - * The path to the system root - */ - static string systemRoot; - - /** - * The default ModuleComponent. - */ - static string defaultModuleName; - - /** - * Get the default module set for this runtime. - * @return The default module. - */ - Module* getDefaultModule() {return defaultModule;} - - /** - * The default module set for this runtime. - */ - Module* defaultModule; - - - typedef stack COMPONENT_STACK; -#if defined(WIN32) || defined (_WINDOWS) - typedef map COMPONENTS_MAP; -#else - typedef map COMPONENTS_MAP; -#endif - - /** - * A map of threads to components. - */ - COMPONENTS_MAP components; - }; - - - } // End namespace sca -} // End namespace tuscany - - - - -#endif // tuscany_sca_core_scaruntime_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp deleted file mode 100644 index ef2f2744eb..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/ServiceProxy.h" - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/CPPImplementation.h" - -using namespace osoa::sca; - -namespace tuscany -{ - namespace sca - { - // ============================ - // Constructor: Create a proxy - // ============================ - ServiceProxy::ServiceProxy(Component* component, const string& name, ServiceWrapper* target) - { - LOGENTRY(1,"ServiceProxy::constructor"); - string msg; - - // ---------------------- - // Get the implementation - // ---------------------- - Implementation* impl = component->getImplementation(); - if (!impl) - { - msg = "Component " + component->getName() + " has no implementation defined"; - throw ServiceNotFoundException(msg.c_str()); - } - - // TODO: This only handle CPP implementation for now - if (impl->getImplementationType() == Implementation::CPP) - { - // ---------------------------------------------------- - // Get implementation dll name and service factory name - // ---------------------------------------------------- - string dllName = ((CPPImplementation*)impl)->getDll(); - string headerStub = ((CPPImplementation*)impl)->getHeaderStub(); - - string fullDllName = component->getModule()->getRoot() + "/" + dllName; - string proxyFactoryName = headerStub + "_" + name + "_Proxy_Factory"; - string proxyDestructorName = headerStub + "_" + name + "_Proxy_Destructor"; - typedef void* (* PROXYFACTORY) (ServiceWrapper*); - - // ------------ - // Load the dll - // ------------ - proxyLibrary = Library(fullDllName); - - // ------------------------- - // Locate the factory method - // ------------------------- - PROXYFACTORY proxyFactory = (PROXYFACTORY)proxyLibrary.getSymbol(proxyFactoryName); - if (!proxyFactory) - { - LOGERROR_2(1, "ComponentContextImpl::getServiceProxy: Unable to locate %s in library %s", - proxyFactoryName.c_str(), fullDllName.c_str()); - msg = "Unable to locate " + proxyFactoryName + " in library " + fullDllName; - throw ServiceNotFoundException(msg.c_str()); - } - - // ----------------------------------- - // Now create an instance of the proxy - // ----------------------------------- - proxy = proxyFactory(target); - if (!proxy) - { - LOGERROR_2(1, "ComponentContextImpl::getServiceProxy: Factory method %s in library %s returned null", - proxyFactoryName.c_str(), fullDllName.c_str()); - msg = "Factory method " + proxyFactoryName + " in library " + fullDllName + " returned null"; - throw ServiceNotFoundException(msg.c_str()); - } - - // ------------------------- - // Get the destructor method - // ------------------------- - destructor = (PROXYDESTRUCTOR)proxyLibrary.getSymbol(proxyDestructorName); - } - - LOGEXIT(1,"ServiceProxy::constructor"); - - } - - // ========== - // Destructor - // ========== - ServiceProxy::~ServiceProxy() - { - LOGENTRY(1,"ServiceProxy::destructor"); - - // Delete the proxy - if (destructor) - { - destructor(proxy); - } - LOGEXIT(1,"ServiceProxy::destructor"); - } - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h deleted file mode 100644 index 073b379cd7..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceProxy.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_serviceproxy_h -#define tuscany_sca_core_serviceproxy_h - -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/ServiceWrapper.h" -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/util/Library.h" - -using namespace tuscany::sca::model; - -namespace tuscany -{ - namespace sca - { - /** - * Holds a proxy for a given component and reference. - * The proxy which is held inside a ServiceProxy will be specific to the component - * and reference and will have been code generated and be contained in a dll - * created by a developer of an SCA application. - */ - class ServiceProxy - { - public: - /** - * Create a new service proxy for a given component and reference name. The - * create proxy will contain a pointer to the target ServiceWrapper. - * @param component The component for which this proxy will be created (the - * source component). - * @param name The name of the reference on the component. - * @param target The wrapper of the component which is wired to this component and - * reference. - */ - ServiceProxy(Component* component, const string& name, ServiceWrapper* target); - - /** - * Destructor. - */ - virtual ~ServiceProxy(); - - /** - * Return an instance of the proxy created for this particular component and reference. - * @return The proxy. - */ - void* getProxy() {return proxy;} - - - private: - /** - * Holds the instance of the code generated proxy. - */ - void* proxy; - - typedef void (* PROXYDESTRUCTOR) (void*); - - /** - * A function pointer to the destructor of the proxy. - */ - PROXYDESTRUCTOR destructor; - - /** - * The library which contains the code for the proxy. - */ - Library proxyLibrary; - - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_serviceproxy_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp deleted file mode 100644 index 5936f526f1..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/ServiceWrapper.h" -#include - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/core/SCARuntime.h" - - - -namespace tuscany -{ - namespace sca - { - - // =========== - // Constructor - // =========== - ServiceWrapper::ServiceWrapper(WireTarget* targ) - : target(targ) - { - LOGENTRY(1,"ServiceWrapper::constructor"); - - LOGEXIT(1,"ServiceWrapper::constructor"); - - } - - // ========== - // Destructor - // ========== - ServiceWrapper::~ServiceWrapper() - { - LOGENTRY(1,"ServiceWrapper::destructor"); - LOGEXIT(1,"ServiceWrapper::destructor"); - } - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h deleted file mode 100644 index 21c162d77f..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/ServiceWrapper.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_servicewrapper_h -#define tuscany_sca_core_servicewrapper_h - -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/Operation.h" -#include "tuscany/sca/model/WireTarget.h" -using tuscany::sca::model::WireTarget; - -namespace tuscany -{ - namespace sca - { - /** - * An abstract class that wraps a component implementation or an external - * service. - */ - class SCA_API ServiceWrapper - { - public: - /** - * Constructor. - * @param target The service wrapper wraps the target of a wire. - */ - ServiceWrapper(WireTarget* target); - - /** - * Destructor. - */ - virtual ~ServiceWrapper(); - - /** - * Get the target represented by this wrapper. - * @return The target represented by this wrapper. - */ - virtual WireTarget* getTarget() {return target;} - - /** - * All business method calls on the target service are performed through - * this invoke method. - * @param operation The details of the method, paramaters and return value for the - * business method to be called on the target service. - */ - virtual void invoke(Operation& operation) = 0; - private: - /** - * The target represented by this wrapper. - */ - WireTarget* target; - }; - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_core_servicewrapper_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp deleted file mode 100644 index 810f810132..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/core/TuscanyRuntime.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/core/SCARuntime.h" - -#include "tuscany/sca/model/System.h" - -namespace tuscany -{ - namespace sca - { - - // ========================================================== - // Set the default ModuleComponent name - // ========================================================== - void TuscanyRuntime::setSystemRoot(const string& root) - { - LOGENTRY(1, "TuscanyRuntime::setSystemRoot"); - systemRoot = root; - LOGINFO_1(3, "TuscanyRuntime::setSystemRoot - set to %s", root.c_str()); - LOGEXIT(1, "TuscanyRuntime::setSystemRoot"); - } - - // ========================================================== - // Set the default ModuleComponent name - // ========================================================== - void TuscanyRuntime::setDefaultModuleComponent(const string& moduleComponent) - { - LOGENTRY(1, "TuscanyRuntime::setDefaultModuleComponent"); - defaultModuleComponent = moduleComponent; - LOGINFO_1(3, "TuscanyRuntime::setDefaultModuleComponent - set to %s", moduleComponent.c_str()); - LOGEXIT(1, "TuscanyRuntime::setDefaultModuleComponent"); - } - - // =================================================================== - // Constructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::TuscanyRuntime(const string& moduleComponent, const string& root) - { - LOGENTRY(1, "TuscanyRuntime::constructor"); - setSystemRoot(root); - setDefaultModuleComponent(moduleComponent); - LOGEXIT(1, "TuscanyRuntime::constructor"); - } - - // =================================================================== - // Destructor for the TuscanyRuntime class. - // =================================================================== - TuscanyRuntime::~TuscanyRuntime() - { - LOGENTRY(1, "TuscanyRuntime::destructor");; - LOGEXIT(1, "TuscanyRuntime::destructor"); - } - - // =================================================================== - // Start the runtime. - // =================================================================== - void TuscanyRuntime::start() - { - LOGENTRY(1, "TuscanyRuntime::start"); - SCARuntime::setSystemRoot(systemRoot); - SCARuntime::setDefaultModuleComponent(defaultModuleComponent); - SCARuntime::getInstance(); - LOGEXIT(1, "TuscanyRuntime::start"); - } - - // =================================================================== - // Stop the runtime. - // =================================================================== - void TuscanyRuntime::stop() - { - LOGENTRY(1, "TuscanyRuntime::stop"); - SCARuntime::releaseInstance(); - LOGEXIT(1, "TuscanyRuntime::stop"); - } - - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h deleted file mode 100644 index 92da737416..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/core/TuscanyRuntime.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_core_tuscanyruntime_h -#define tuscany_sca_core_tuscanyruntime_h - -#include "osoa/sca/export.h" -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - - /** - * A singleton which represents the executing SCA runtime. - */ - class SCA_API TuscanyRuntime - { - public: - /** - * Default constructor - */ - TuscanyRuntime(const string& moduleComponent = "", const string& root = ""); - - /** - * Destructor - */ - virtual ~TuscanyRuntime(); - - - /** - * Set the system root - * @param root The path to the deployed system. - */ - void setSystemRoot(const string& root); - - /** - * Set the default ModuleComponent for the system - * @param moduleComponent The name of the default moduleComponent. - */ - void setDefaultModuleComponent(const string& moduleComponent); - - /** - * start the runtime - */ - void start(); - - /** - * stop the runtime - */ - void stop(); - - - private: - string systemRoot; - string defaultModuleComponent; - }; - - - } // End namespace sca -} // End namespace tuscany - - - - -#endif // tuscany_sca_core_tuscanyruntime_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.cpp deleted file mode 100644 index c312d7a077..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/Binding.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - Binding::Binding(const string& uri) : uri(uri) - { - } - - Binding::~Binding() - { - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.h deleted file mode 100644 index ff97990dc6..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Binding.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_binding_h -#define tuscany_sca_model_binding_h -#include -using std::string; - - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about the binding for EntryPoint and ExternalService. An - * abstract class which will be extended by classes that hold specific - * information for each type of binding. - */ - class Binding - { - - public: - /** - * Supported binding types. - */ - enum Type - { - WS, - SCA - }; - - /** - * Constructor to create a new binding. - * @param uri The uri specified in the scdl file. - */ - Binding(const string& uri); - - /** - * Destructor. - */ - virtual ~Binding(); - - /** - * Return the enumerated type of binding. - * @return The type of the binding (see Binding#Type). - */ - virtual Type getBindingType() = 0; - - /** - * Return the uri of the binding. - * @return The uri of the binding. - */ - string getUri() {return uri;}; - - private: - /** - * The uri of the binding. - */ - string uri; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_binding_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp deleted file mode 100644 index 7212e777b1..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/CPPImplementation.h" -#include "tuscany/sca/util/Utils.h" - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - CPPImplementation::CPPImplementation(const string& dllName, const string& head, const string& classN) - : dll(dllName), header(head), className(classN) - { - // Separate any path element - Utils::rTokeniseString("/", head, headerPath, headerStub); - if (headerPath != "") - { - headerPath += "/"; - } - - // Determine the header stub name - string tmp; - Utils::rTokeniseString(".h", headerStub, headerStub, tmp); - } - - CPPImplementation::~CPPImplementation() - { - } - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h deleted file mode 100644 index 0294649af7..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_cppimplementation_h -#define tuscany_sca_model_cppimplementation_h -#include "tuscany/sca/model/Implementation.h" - -#include -using std::map; -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Holds informatio about an SCA implementation written in C++ - */ - class CPPImplementation : public Implementation - { - - public: - /** - * 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(const string& dllName, const string& header, const string& className); - - /** - * Destructor - */ - virtual ~CPPImplementation(); - - /** - * Return the implementation type. - * @return Always returns CPP. - */ - virtual Type getImplementationType() {return CPP;} - - /** - * Returns the name of the shared library. - * @return The name of the shared library. - */ - const string& getDll() {return dll;} - - /** - * Get the name of the header file. - * @return Name of the header file. - */ - const string& getHeader() {return header;} - - /** - * Get the header file name without the extension. - * @return The name of the header file without any extension. - */ - const string& getHeaderStub() {return headerStub;} - - /** - * Get the header path. - * @return The pathe element of the header. - */ - const string& getHeaderPath() {return headerPath;} - - /** - * Get the name of the class. - * @return The class name if specified. - */ - const string& getClass() {return className;} - private: - /** - * Name of the shared library. - */ - string dll; - - /** - * Name of the header file describing the interface. - */ - string header; - - /** - * Name of the header file without the extension. - */ - string headerStub; - - /** - * Path element of the header. - */ - 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. - */ - string className; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_cppimplementation_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.cpp deleted file mode 100644 index 015b54c259..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/CPPInterface.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - CPPInterface::CPPInterface( - const string& head, - const string& classN, - const string& scop, - bool remote) - : header(head), className(classN), remotable(remote) - { - string::size_type dot = header.rfind(".h"); // this will also find .hpp - if (dot != string::npos) - { - headerStub = header.substr(0, dot); - } - else - { - headerStub = header; - } - - if (scop == "module") - { - scope = MODULE; - } - else - { - scope = STATELESS; - } - } - - CPPInterface::~CPPInterface() - { - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.h deleted file mode 100644 index 7b37b1892e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/CPPInterface.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_cppinterface_h -#define tuscany_sca_model_cppinterface_h - -#include "tuscany/sca/model/Interface.h" - - -#include -using std::map; -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Holds information about an interface described using a C++ - * header file. - */ - class CPPInterface : public 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 module). - * @param remotable True if the interface is remotable. - */ - CPPInterface( - const string& header, - const string& className, - const string& scope, - bool remotable); - - /** - * Destructor. - */ - virtual ~CPPInterface(); - - /** - * Return the type of the interface. - * @return Always returns CPP. - */ - virtual Type getInterfaceType() {return CPP;} - - /** - * Get the name of the header file. - * @return The name of the header file containing the definition of the - * interface. - */ - const string& getHeader() {return header;} - - /** - * Return the name of the header file without the extension. - * @return Header file name without any extension. - */ - const string& getHeaderStub() {return headerStub;} - - /** - * Get the name of the class. - * @return The name of the class defining the interface. - */ - const string& getClass() {return className;} - - /** - * Scope of interface. - */ - enum SCOPE - { - MODULE, - STATELESS - }; - - /** - * Get the scope of the interface. - * @return The scope of the interface. - */ - SCOPE getScope() {return scope;} - - /** - * Return whether the interface is remotable or local. - * @return True if the interface is remotable, otherwise false. - */ - bool getRemotable() {return remotable;} - - private: - /** - * Name of the header file containing the definition of the interface. - */ - string header; - - /** - * Name of the header file without the extension. - */ - string headerStub; - - /** - * Name of the class in the header file. - */ - string className; - - /** - * Scope of the interface. - */ - SCOPE scope; - - /** - * Remotable interface or not. - */ - bool remotable; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_cppinterface_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.cpp deleted file mode 100644 index 4e0cf81c61..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -// Component.cpp : Represent a loaded Component -// -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/Component.h" - -using namespace commonj::sdo; - -namespace tuscany -{ - namespace sca - { - namespace model - { - // Constructor - Component::Component(const std::string& componentName, Module* module) - : name(componentName), containingModule(module), implementation(0) - { - LOGENTRY(1, "Component::constructor"); - LOGINFO_1(3, "Component::constructor: Component name: %s", name.c_str()); - LOGEXIT(1, "Component::constructor"); - } - - Component::~Component() - { - } - - Service* Component::addService(const std::string& serviceName) - { - Service* service = new Service(serviceName, this); - services[serviceName] = service; - return service; - } - - Service* Component::findService(const std::string& serviceName) - { - // If serviceName is null then return the ONLY service - if (serviceName == "" - && services.size() == 1) - { - return services.begin()->second; - } - else - { - return services[serviceName]; - } - } - - ServiceReference* Component::findReference(const std::string& referenceName) - { - return references[referenceName]; - } - - ServiceReference* Component::addReference(const std::string& referenceName) - { - ServiceReference* serviceReference = references[referenceName]; - if (!serviceReference) - { - references[referenceName] = new ServiceReference(referenceName); - } - return references[referenceName]; - } - - void Component::setImplementation(Implementation* impl) - { - implementation = impl; - } - - void Component::addProperty(const string& name, - const string& type, - bool many, - bool required, - const char* defaultValue) - { - // Create a Type in the Properties dataFactory - DataFactoryPtr factory = getPropertyDataFactory(); - - string typeUri, typeName; - Utils::tokeniseQName(type, typeUri, typeName); - - if (typeUri == "http://www.w3.org/2001/XMLSchema") - { - typeUri = Type::SDOTypeNamespaceURI; - if (typeName == "string") - { - typeName = "String"; - } - else if (typeName == "anyType") - { - typeName = "DataObject"; - } - else if (typeName == "int") - { - typeName = "Integer"; - } - else if (typeName == "integer") - { - typeName = "Integer"; - } - else if (typeName == "negativeInteger") - { - typeName = "Integer"; - } - else if (typeName == "nonNegativeInteger") - { - typeName = "Integer"; - } - else if (typeName == "positiveInteger") - { - typeName = "Integer"; - } - else if (typeName == "nonPositiveInteger") - { - typeName = "Integer"; - } - else if (typeName == "unsignedLong") - { - typeName = "Integer"; - } - else if (typeName == "unsignedShort") - { - typeName = "Integer"; - } - else if (typeName == "unsignedInt") - { - typeName = "Long"; - } - else if (typeName == "long") - { - typeName = "Long"; - } - else if (typeName == "double") - { - typeName = "Double"; - } - else if (typeName == "short") - { - typeName = "Short"; - } - else if (typeName == "unsignedByte") - { - typeName = "Short"; - } - else if (typeName == "float") - { - typeName = "Float"; - } - else if (typeName == "boolean") - { - typeName = "Boolean"; - } - else if (typeName == "byte") - { - typeName = "Byte"; - } - else if (typeName == "base64Binary") - { - typeName = "Bytes"; - } - else if (typeName == "hexBinary") - { - typeName = "Bytes"; - } - else if (typeName == "anyURI") - { - typeName = "URI"; - } - else if (typeName == "QName") - { - typeName = "URI"; - } - else - { - // Default unknown xs: types to string?? - typeName = "String"; - } - } - else - { - // It's not an XML type - } - - - factory->addPropertyToType( - "org/osoa/sca", - "Properties", - name.c_str(), - typeUri.c_str(), - typeName.c_str(), - many, - false, - true); - - // Set the default - - - // Add to list of required properties - if (required) - { - } - } - - DataFactoryPtr Component::getPropertyDataFactory() - { - if (!propertyFactory) - { - propertyFactory = DataFactory::getDataFactory(); - // Add the root type - propertyFactory->addType("org/osoa/sca", "Properties", false, false, false, false); - } - return propertyFactory; - } - - DataObjectPtr Component::getProperties() - { - if (!properties) - { - properties = getPropertyDataFactory()->create("org/osoa/sca", "Properties"); - } - return properties; - } - - void Component::addProperties(DataObjectPtr values) - { - if (!values) - { - return; - } - - DataObjectPtr props = getProperties(); - - PropertyList pl = values->getInstanceProperties(); - for (int i=0; i < pl.size(); i++) - { - if (!values->isSet(i)) - { - continue; - } - - // Add the property value to the component to be resolved later - string propName = pl[i].getName(); - - // Get the property's type - try - { - const Property& propProperty = props->getProperty(pl[i].getName()); - const Type& propType = propProperty.getType(); - - DataObjectList& proplist = values->getList(pl[i]); - for (int proplistI=0; proplistIgetSequence()->getCStringValue(0); - if (propType.isDataType()) - { - if (propProperty.isMany()) - { - DataObjectList& dol = props->getList(propProperty); - dol.append(propValue.c_str()); - } - else - { - props->setCString(propProperty, propValue.c_str()); - } - } - else - { - // Create a new instance of the DO - // iterate over properties setting each one - } - } - } - catch (SDOPropertyNotFoundException&) - { - // Configuration error: property is not defined - string message = "Undefined property: " + propName; - throw SystemConfigurationException(message.c_str()); - } - - } - } - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.h deleted file mode 100644 index f40690c859..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Component.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_component_h -#define tuscany_sca_model_component_h - -#include -using std::string; - -#include - -#include "tuscany/sca/model/Service.h" -#include "tuscany/sca/model/Implementation.h" -#include "tuscany/sca/model/ServiceReference.h" - -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; -using commonj::sdo::DataFactoryPtr; - -namespace tuscany -{ - namespace sca - { - namespace model - { - - class Module; - - /** - * Information about an SCA component. - */ - class Component - { - public: - /** - * Constructor - * @param name The name of the component. - * @param module The module containing this component. - */ - Component(const std::string& name, Module* module); - - /** - * Destructor. - */ - virtual ~Component(); - - /** - * Returns the name of the component. - * @return The name of the component. - */ - const string& getName() {return name;} - - /** - * Get the module containing this component. - * @return The containing module. - */ - Module* getModule() {return containingModule;} - - /** - * Add a new service to this component. - * @param serviceName The name of the service to add. - * @return The newly added service. - */ - Service* addService(const std::string& serviceName); - - /** - * Find an existing service on this component. - * @param serviceName The name of the service to find. - * If the serviceName is the zero length string then if there is - * only one service it will be returned. - * @return The found service, or 0 if not found. - */ - Service* findService(const std::string& serviceName); - - /** - * Add a new reference to this component. - * @param referenceName The name of the reference to add. - * @return The newly added reference. - */ - ServiceReference* addReference(const std::string& referenceName); - - /** - * Find an existing reference on this component. - * @param referenceName The name of the reference to find. - * @return The found reference, or 0 if not found. - */ - ServiceReference* findReference(const std::string& referenceName); - - /** - * Set the details of the implementation of this component. - * @param impl The details of the implementation. - */ - void setImplementation(Implementation* impl); - - /** - * Returns the details of the implementation of this component. - * @return The details of the implementation. - */ - Implementation* getImplementation() {return implementation;} - - /** - * Add a new property to this component. Properties are - * added one at a time. The property definitions come from the component - * type file. - * @param name The name of the property. - * @param type The full name of the type (including uri and local name). - * @param many True if this is a many valued property. - * @param required True if this property must have a value set. - * @param defaultValue The default value if the property does not have a - * value set. - */ - void addProperty(const string& name, - const string& type, - bool many, - bool required, - const char* defaultValue = 0); - - /** - * Add the property values to the properties defined on this - * component. The values will come from the sca.module file. - * @param properties A data object representing all the values set - * for this component. - */ - void addProperties(DataObjectPtr properties); - - /** - * Returns a data object from which all the properties and their - * values can be accessed. - * @return A data object holding the property values. - */ - DataObjectPtr getProperties(); - private: - /** - * Name of the component. - */ - string name; - - /** - * Module containing this component for navigating up the tree. - */ - Module* containingModule; - - /** - * Information about the implementation of this component. - */ - Implementation* implementation; - - typedef std::map SERVICE_MAP; - /** - * Map of all the services defined on this component. - */ - SERVICE_MAP services; - - typedef std::map REFERENCE_MAP; - /** - * Map of all the references defined on this component. - */ - REFERENCE_MAP references; - - /** - * SDO data factory which has all the property types defined from - * the component type file - */ - DataFactoryPtr propertyFactory; - - /** - * Return the SDO data factory which has the property types defined - * in it. - * @return The data factory. - */ - DataFactoryPtr getPropertyDataFactory(); - - /** - * The properties and their values for this component. - */ - DataObjectPtr properties; - - }; - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_component_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.cpp deleted file mode 100644 index 1c38e31469..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/EntryPoint.h" -#include "tuscany/sca/util/Exceptions.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - EntryPoint::EntryPoint(const std::string& epName) - : name(epName) - { - LOGENTRY(1, "EntryPoint::constructor"); - LOGINFO_1(2, "EntryPoint::constructor: EntryPoint name: %s", name.c_str()); - LOGEXIT(1, "EntryPoint::constructor"); - } - - EntryPoint::~EntryPoint() - { - } - - void EntryPoint::addTarget(WireTarget* targ) - { - if (multiplicity == ONE_ONE || multiplicity == ZERO_ONE) - { - if (targets.size() > 0) - { - // throw exception - string message = "Duplicate wire for reference: " + name; - throw SystemConfigurationException(message.c_str()); - } - } - - // TODO - must be remotable - - targets.push_back(targ); - } - - void EntryPoint::setMultiplicity(const std::string& multip) - { - if (multip == "0..1") - { - multiplicity = ZERO_ONE; - } - else if (multip == "1..1") - { - multiplicity = ONE_ONE; - } - else if (multip == "0..n") - { - multiplicity = ZERO_MANY; - } - else if (multip == "1..n") - { - multiplicity = ONE_MANY; - } - else - { - string msg = "Invalid multiplicity specified, " + multip + ", for reference: " +name; - throw SystemConfigurationException(msg.c_str()); - } - } - - void EntryPoint::setInterface(Interface* interf) - { - iface = interf; - } - - void EntryPoint::setBinding(Binding* bind) - { - binding = bind; - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.h deleted file mode 100644 index 9b80a1049f..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/EntryPoint.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_entrypoint_h -#define tuscany_sca_model_entrypoint_h - -#include -using std::string; -#include -using std::vector; - -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/model/Binding.h" -#include "tuscany/sca/model/WireTarget.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Represents the information about an entry point. - */ - class EntryPoint - { - - public: - /** - * Constructor. - * @param name The name of the entry point. - */ - EntryPoint(const std::string& name); - - /** - * Destructor. - */ - virtual ~EntryPoint(); - - /** - * Return the name of the entry point. - * @return The name of the entry point. - */ - const string& getName() {return name;} - - /** - * How many wires can be wired from this entry point. - */ - enum Multiplicity - { - ZERO_ONE, - ONE_ONE, - ZERO_MANY, - ONE_MANY - }; - - /** - * Set the multiplicity of this entry point. - * @param multiplicity One of 0..1, 1..1, 0..n, 1..n - */ - void setMultiplicity(const std::string& multiplicity); - - /** - * Return the multiplicity of this entry point (how - * many wires can be wired from this entry point). - * @return The multiplicity. - */ - Multiplicity getMultiplicity() {return multiplicity;} - - /** - * Set the interface describing this entry point. - * @param iface The interface. - */ - void setInterface(Interface* iface); - - /** - * Get the interface describing this entry point. Use - * Interface#getType to find out the type of interface - * describing this entry point. - * @return iface The interface. - */ - Interface* getInterface() {return iface;} - - /** - * Set the binding connecting this entry point. - * @param binding The Binding. - */ - void setBinding(Binding* binding); - - /** - * Get the binding connecting this entry point. Use - * Binding#getType to find out the type of binding - * connecting this entry point. - * @return binding The binding. - */ - Binding* getBinding() {return binding;} - - /** - * Add a target to the entry point. - * @param target Add a target (derived from a wire) to - * the entry point. - */ - void addTarget(WireTarget* target); - typedef vector TARGETS; - - /** - * Get a vector of targets added to this entry point. - */ - const TARGETS& getTargets() {return targets;} - private: - /** - * Name of the entry point. - */ - string name; - - /** - * The interface describing this entry point. - */ - Interface* iface; - - /** - * The binding connecting this entry point. - */ - Binding* binding; - - /** - * The multiplicity of this entry point.. - */ - Multiplicity multiplicity; - - /** - * The vector of targets added to this entry point. - */ - TARGETS targets; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_entrypoint_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.cpp deleted file mode 100644 index c848c3aafb..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/ExternalService.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - ExternalService::ExternalService(const std::string& serviceName, Module *module) - : WireTarget(serviceName), containingModule(module) - { - LOGENTRY(1, "ExternalService::constructor"); - LOGINFO_1(2, "ExternalService::constructor: ExternalService name: %s", getName().c_str()); - LOGEXIT(1, "ExternalService::constructor"); - } - - ExternalService::~ExternalService() - { - delete binding; - } - - void ExternalService::setBinding(Binding* bind) - { - binding = bind; - } - - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.h deleted file mode 100644 index fe9640d1b8..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ExternalService.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_externalservice_h -#define tuscany_sca_model_externalservice_h - -#include - -#include "tuscany/sca/model/WireTarget.h" -#include "tuscany/sca/model/Binding.h" - -namespace tuscany -{ - namespace sca - { - - namespace model - { - class Module; - - /** - * Information about an external service. - */ - class ExternalService : public WireTarget - { - public: - /** - * Constructor. - * @param name The name of the external service. - * @param module The module containing this external service. - */ - ExternalService(const std::string& name, Module *module); - - /** - * Destructor. - */ - virtual ~ExternalService(); - - /** - * Return the type of service. - * @return Always returns ExternalServiceType - */ - virtual Type getServiceType() {return ExternalServiceType;} - - /** - * Set the binding for this external service. - * @param binding The binding to set. - */ - virtual void setBinding(Binding* binding); - - /** - * Get the binding set for this external service. - * @return The binding. - */ - virtual Binding* getBinding() {return binding;}; - - /** - * Get the module containing this external service. - * @return The containing module. - */ - Module* getContainingModule() {return containingModule;}; - - private: - /** - * The binding for this external service. - */ - Binding* binding; - - /** - * The module containing this external service. - */ - Module* containingModule; - - - }; - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_externalservice_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.cpp deleted file mode 100644 index 9703d1bab3..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/Implementation.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - Implementation::Implementation() - { - } - - Implementation::~Implementation() - { - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.h deleted file mode 100644 index 17414c359b..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Implementation.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_implementation_h -#define tuscany_sca_model_implementation_h - -#include - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Abstract class representing information about an implementation - * of a component. The subtypes will hold information specific to - * the type of implementation. - */ - class Implementation - { - - public: - /** - * Supported types of implementation. - */ - enum Type - { - CPP, - JAVA - }; - - Implementation(); - virtual ~Implementation(); - - /** - * Return the type of the implementation. - * @return Will depend on the subtype. - */ - virtual Type getImplementationType() = 0; - - private: - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_implementation_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.cpp deleted file mode 100644 index 9e0aa45889..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/Interface.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - Interface::Interface() - { - } - - Interface::~Interface() - { - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.h deleted file mode 100644 index 24bb43224b..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Interface.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_interface_h -#define tuscany_sca_model_interface_h - -#include - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about an interface. Subtypes will hold information - * specific to a type of interface. - */ - class Interface - { - - public: - /** - * The supported types of interface. - */ - enum Type - { - CPP, - JAVA - }; - - Interface(); - virtual ~Interface(); - - /** - * Returns the type of the interface. - * @return Will depend on the subtype. - */ - virtual Type getInterfaceType() = 0; - - private: - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_interface_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp deleted file mode 100644 index 32a3ad8d26..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp +++ /dev/null @@ -1,1702 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "osoa/sca/export.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/ModelLoader.h" -#include "tuscany/sca/model/CPPImplementation.h" -#include "tuscany/sca/model/CPPInterface.h" -#include "tuscany/sca/core/SCARuntime.h" -#include "tuscany/sca/model/WSBinding.h" -#include "commonj/sdo/TypeDefinitions.h" - - -using namespace commonj::sdo; - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - // =========== - // Constructor - // =========== - ModelLoader::ModelLoader(System* system) : system(system) - { - LOGENTRY(1, "ModelLoader::constructor"); - - - LOGEXIT(1, "ModelLoader::constructor"); - } - - // ========== - // Destructor - // ========== - ModelLoader::~ModelLoader() - { - } - - // ========================================================= - // load: Load the runtime model from the deployed xml files - // This class has the responsibility for translating from - // the SCA scdl files to the SCA runtime's in memory model. - // ========================================================= - void ModelLoader::load(const string& configurationRoot) - { - LOGENTRY(1, "ModelLoader::load"); - LOGINFO_1(2,"configuration root: %s", configurationRoot.c_str()); - - // The configuration root path will point to a directory structure: - // root/ - // The sca.subsystem files can be located anywhere under this directory - // structure. - loadSubsystems(configurationRoot); - - // sca.module files represent the root of a module, and can occur anywhere - // under the directory structure - loadModules(configurationRoot); - - system->resolveWires(); - LOGEXIT(1, "ModelLoader::load"); - } - - // ======================================================================== - // loadSubsystems: - // Load all the subsystems from any directory below the configuration root. - // Translate the subsystem information to the runtime information - // ======================================================================== - void ModelLoader::loadSubsystems(const string& configurationRoot) - { - // Get all the sca.subsystem files in the module - LOGENTRY(1, "ModelLoader::loadSubsystems"); - Files files(configurationRoot, "sca.subsystem", true); - for (unsigned int i=0; i < files.size(); i++) - { - loadSubsystemFile(files[i]); - } - LOGEXIT(1, "ModelLoader::loadSubsystems"); - } - - - // ===================================================================== - // loadSubsystemFile: - // This method is called for each sca.subsystem file found in the module - // folder structure - // ===================================================================== - void ModelLoader::loadSubsystemFile(const File& file) - { - LOGENTRY(1, "ModelLoader::loadSubsystemFile"); - LOGINFO_1(2, "subsystem filename: %s", file.getFileName().c_str()); - - try - { - string filename = file.getDirectory() + "/" + file.getFileName(); - XMLDocumentPtr subsystemFile = getXMLHelper()->loadFile(filename.c_str()); - if (subsystemFile->getRootDataObject() == 0) - { - LOGERROR_1(0, "ModelLoader::loadSubsystemFile: Unable to load file: %s", filename.c_str()); - } - else - { - //Utils::printDO(subsystemFile->getRootDataObject()); - mapSubsystem(subsystemFile->getRootDataObject()); - } - } catch (SDORuntimeException ex) - { - LOGERROR_1(0, "ModelLoader::loadSubsytemFile: Exception caught: %s", ex.getMessageText()); - } - - LOGEXIT(1, "ModelLoader::loadSubsystemFile"); - } - - // =============== - // mapSubsystem: - // =============== - void ModelLoader::mapSubsystem(DataObjectPtr root) - { - LOGENTRY(1, "ModelLoader::mapSubsystem"); - - LOGINFO_1(2, "ModelLoader::mapSubsystem: Loaded subsystem: %s", root->getCString("name")); - - Subsystem* subsystem; - subsystem = system->addSubsystem(root->getCString("name")); - - DataObjectList& Modules = root->getList("moduleComponent"); - LOGINFO_1(2, "ModelLoader::mapSubsystem: number of module components: %d", Modules.size()); - - // Iterate over module components - for (int i=0; iaddModuleComponent(Modules[i]->getCString("name"), Modules[i]->getCString("module")); - } - - - /// @todo Add external services and entry points - - - LOGEXIT(1, "ModelLoader::mapSubsystem"); - } - - - // ===================================================================== - // loadModules: - // Load all the modules from any directory below the configuration root. - // Translate the module information to the runtime information - // ===================================================================== - void ModelLoader::loadModules(const string& configurationRoot) - { - // Get all the sca.module files in the module - LOGENTRY(1, "ModelLoader::loadModules"); - Files files(configurationRoot, "sca.module", true); - for (unsigned int i=0; i < files.size(); i++) - { - loadModuleFile(files[i]); - } - LOGEXIT(1, "ModelLoader::loadModules"); - } - - - // ==================================================================== - // loadModuleFile: - // This method is called for each sca.module file found in the module - // folder structure - // The location of this module file will indicate the root of a module - // ==================================================================== - void ModelLoader::loadModuleFile(const File& file) - { - LOGENTRY(1, "ModelLoader::loadModuleFile"); - LOGINFO_1(2, "module filename: %s", file.getFileName().c_str()); - - try - { - string filename = file.getDirectory() + "/" + file.getFileName(); - - XMLDocumentPtr moduleFile = getXMLHelper()->loadFile(filename.c_str()); - if (moduleFile->getRootDataObject() == 0) - { - LOGERROR_1(0, "ModelLoader::loadModuleFile: Unable to load file: %s", filename.c_str()); - } - else - { - string moduleName = moduleFile->getRootDataObject()->getCString("name"); - mapModule(moduleName, moduleFile->getRootDataObject(), file.getDirectory()); - - // -------------------------------------------------------------- - // Load any module Fragments in the same folder as the sca.module - // -------------------------------------------------------------- - Files files(file.getDirectory(), "*.fragment", false); - for (unsigned int i=0; i < files.size(); i++) - { - filename = file.getDirectory() + "/" + files[i].getFileName(); - moduleFile = getXMLHelper()->loadFile(filename.c_str()); - if (moduleFile->getRootDataObject() == 0) - { - LOGERROR_1(0, "ModelLoader::loadModuleFile: Unable to load file: %s", filename.c_str()); - } - else - { - mapModule(moduleName, moduleFile->getRootDataObject(), file.getDirectory()); - } - } - - // Load the xsd types and wsdl files in the module - loadModuleConfig(file.getDirectory(), moduleName); - } - - } catch (SDORuntimeException ex) - { - LOGERROR_1(0, "ModelLoader::loadModuleFile: Exception caught: %s", ex.getMessageText()); - } - - LOGEXIT(1, "ModelLoader::loadModuleFile"); - } - - // =========== - // mapModule - // =========== - void ModelLoader::mapModule(const string& moduleName, DataObjectPtr root, string moduleRootDir) - { - LOGENTRY(1, "ModelLoader::mapModule"); - - LOGINFO_2(2, "ModelLoader::mapModule: Loading module: %s, root Dir: %s", moduleName.c_str(), moduleRootDir.c_str()); - - // Find the ModuleComponent(s) that refer to this module. If a ModuleComponent does not refer to this - // module then ignore it - MODULE_LIST moduleList = system->findModules(moduleName); - MODULE_LIST::iterator moduleIter; - - for (moduleIter = moduleList.begin(); - moduleIter != moduleList.end(); - moduleIter++ ) - { - LOGINFO_1(2, "ModelLoader::mapModule: Loading module details for module component: %s", (*moduleIter)->getName().c_str()); - - string message; // for exceptions - // Set module root - (*moduleIter)->setRoot(moduleRootDir); - - // ---------------------------- - // Add components to the module - // ---------------------------- - DataObjectList& componentList = root->getList("component"); - int i; - for (i=0; i < componentList.size(); i++) - { - addComponent(*moduleIter, componentList[i]); - } - - // ------------ - // Entry points - // ------------ - DataObjectList& entryPointList = root->getList("entryPoint"); - for (i=0; i < entryPointList.size(); i++) - { - addEntryPoint(*moduleIter, entryPointList[i]); - } - - - // ----------------- - // External services - // ----------------- - DataObjectList& externalServiceList = root->getList("externalService"); - for (i=0; i < externalServiceList.size(); i++) - { - addExternalService(*moduleIter, externalServiceList[i]); - } - - // ----- - // Wires - // ----- - DataObjectList& wireList = root->getList("wire"); - for (int l=0; l < wireList.size(); l++) - { - string source = wireList[l]->getCString("sourceUri"); - string target = wireList[l]->getCString("targetUri"); - (*moduleIter)->addWire(source, target); - } - - } - - LOGEXIT(1, "ModelLoader::mapModule"); - } - - // ================================= - // addComponent: - // ================================= - void ModelLoader::addComponent(Module* module, DataObjectPtr componentDO) - { - Component* component = module->addComponent(componentDO->getCString("name")); - - string message; - - // ------------------- - // Implementation type - // ------------------- - DataObjectPtr impl = componentDO->getDataObject("implementation"); - if (!impl) - { - message = "No implementation for component: "; - message = message + componentDO->getCString("name"); - throw SystemConfigurationException(message.c_str()); - } - // Determine the type - string componentTypeName; - string componentTypePath; - string implType = impl->getType().getName(); - if (implType == "CPPImplementation") - { - string dll = impl->getCString("dll"); - string header = impl->getCString("header"); - string className = impl->getCString("class"); - CPPImplementation* cppImpl = new CPPImplementation(dll, header, className); - componentTypePath = cppImpl->getHeaderPath(); - componentTypeName = cppImpl->getHeaderStub(); - component->setImplementation(cppImpl); - - } - else if (implType == "JavaImplementation") - { - } - - // ----------------------- - // Load the .componentType - // ----------------------- - string typeFileName = module->getRoot() + "/" + componentTypePath + componentTypeName + ".componentType"; - try - { - XMLDocumentPtr componentTypeFile = getXMLHelper()->loadFile(typeFileName.c_str()); - if (componentTypeFile->getRootDataObject() == 0) - { - LOGERROR_1(0, "ModelLoader::mapModule: Unable to load file: %s", typeFileName.c_str()); - } - else - { - //Utils::printDO(componentTypeFile->getRootDataObject()); - //commonj::sdo::SDOUtils::printDataObject(componentTypeFile->getRootDataObject()); - addServices(component, componentTypeFile->getRootDataObject()); - addReferences(component, componentTypeFile->getRootDataObject()); - addProperties(component, componentTypeFile->getRootDataObject()); - } - } catch (SDORuntimeException& ex) - { - LOGERROR_1(0, "ModelLoader::mapModule: Exception caught: %s", ex.getMessageText()); - throw SystemConfigurationException(ex.getMessageText()); - } - - // ---------- - // Properties - // ---------- - DataObjectPtr props = componentDO->getDataObject("properties"); - component->addProperties(props); - - // ---------- - // References - // ---------- - DataObjectPtr refs = componentDO->getDataObject("references"); - if (refs) - { - PropertyList pl = refs->getInstanceProperties(); - for (int refI=0; refI < pl.size(); refI++) - { - // ---------------------------------------------------------- - // Add the reference to the module wires to be resolved later - // ---------------------------------------------------------- - string refName = pl[refI].getName(); - if (!component->findReference(pl[refI].getName())) - { - // Configuration error: reference is not defined - message = "Undefined reference: " + refName; - throw SystemConfigurationException(message.c_str()); - } - - string src = component->getName() + "/" + refName; - - // The reflist below is a list of open data objects - DataObjectList& reflist = refs->getList(pl[refI]); - for (int refslistI=0; refslistIgetSequence()->getCStringValue(0); - module->addWire(src, refValue); - } - } - } - } - - - // ===================================================================== - // addServices: add the services from the componentType to the component - // ===================================================================== - void ModelLoader::addServices(Component* component, DataObjectPtr componentType) - { - DataObjectList& services = componentType->getList("service"); - for (int i=0; iaddService(services[i]->getCString("name")); - service->setInterface(getInterface(services[i])); - } - } - - // =================================================== - // addReferences: add the references to the component - // =================================================== - void ModelLoader::addReferences(Component* component, DataObjectPtr componentType) - { - DataObjectList& refs = componentType->getList("reference"); - for (int i=0; iaddReference(refs[i]->getCString("name")); - string multiplicity = "1..1"; - if (refs[i]->isSet("multiplicity")) - { - multiplicity = refs[i]->getCString("multiplicity"); - } - serviceRef->setMultiplicity(multiplicity); - serviceRef->setInterface(getInterface(refs[i])); - } - } - - - // ============== - // getInterface - // ============== - Interface* ModelLoader::getInterface(DataObjectPtr obj) - { - // ----------------- - // get the interface - // ----------------- - DataObjectPtr iface = obj->getDataObject("interface"); - if (!iface) - { - string message = "No interface for: "; - message = message + obj->getCString("name"); - throw SystemConfigurationException(message.c_str()); - } - - // Determine the type - string componentTypeName; - string ifType = iface->getType().getName(); - if (ifType == "CPPInterface") - { - string header = iface->getCString("header"); - string className = iface->getCString("class"); - string scope = iface->getCString("scope"); - bool remotable = iface->getBoolean("remotable"); - - return new CPPInterface(header, className, scope, remotable); - } - else - { - // Error? - return 0; - } - } - - // ============================================== - // addProperties: add Properties to the component - // ============================================== - void ModelLoader::addProperties(Component* component, DataObjectPtr componentType) - { - DataObjectList& props = componentType->getList("property"); - for (int i=0; igetCString("name"); - string type = props[i]->getCString("type"); - bool many=false; - if (props[i]->isSet("many")) - { - many = props[i]->getBoolean("many"); - } - - bool required=false; - if (props[i]->isSet("required")) - { - many = props[i]->getBoolean("required"); - } - - const char* defaultValue = 0; - if (props[i]->isSet("default")) - { - defaultValue = props[i]->getCString("default"); - } - - component->addProperty(name, type, many, required, defaultValue); - } - } - - // =============================================== - // addEntryPoint: add an EntryPoint to the module - // =============================================== - void ModelLoader::addEntryPoint(Module* module, DataObjectPtr entryPointDO) - { - string message; - - //Utils::printDO(entryPointDO); - EntryPoint* entryPoint = module->addEntryPoint(entryPointDO->getCString("name")); - - string multiplicity = "1..1"; - if (entryPointDO->isSet("multiplicity")) - { - multiplicity = entryPointDO->getCString("multiplicity"); - } - - entryPoint->setMultiplicity(multiplicity); - entryPoint->setInterface(getInterface(entryPointDO)); - - DataObjectList& refs = entryPointDO->getList("reference"); - for (int i=0; iaddWire(entryPoint->getName(), targ); - } - - // Get binding, it will be the first and only binding - DataObjectPtr binding = entryPointDO->getList("binding")[0]; - if (!binding) - { - message = "No binding for entryPoint: "; - message = message + entryPointDO->getCString("name"); - throw SystemConfigurationException(message.c_str()); - } - - // Utils::printDO(binding); - - string uri = binding->getCString("uri"); - - // Determine the binding type - string bindingType = binding->getType().getName(); - if (bindingType == "WebServiceBinding") - { - string port = binding->getCString("port"); - - WSBinding* wsBinding = new WSBinding(uri,port); - - entryPoint->setBinding(wsBinding); - - } - else if (bindingType == "SCABinding") - { - message = "SCA binding not yet implemented. Binding is for entryPoint: "; - message = message + entryPointDO->getCString("name"); - throw SystemConfigurationException(message.c_str()); - } - } - - - // ========================================================= - // addExternalService: add an ExternalService to the module - // ========================================================= - void ModelLoader::addExternalService(Module* module, DataObjectPtr externalServiceDO) - { - string message; - - ExternalService* externalService = module->addExternalService(externalServiceDO->getCString("name")); - // Add the interface - externalService->setInterface(getInterface(externalServiceDO)); - - // Get binding, it will be the first and only binding - DataObjectPtr binding = externalServiceDO->getList("binding")[0]; - if (!binding) - { - message = "No binding for externalService: "; - message = message + externalServiceDO->getCString("name"); - throw SystemConfigurationException(message.c_str()); - } - - //Utils::printDO(binding); - - string uri = binding->getCString("uri"); - - // Determine the binding type - string bindingType = binding->getType().getName(); - if (bindingType == "WebServiceBinding") - { - string port = binding->getCString("port"); - - WSBinding* wsBinding = new WSBinding(uri,port); - - externalService->setBinding(wsBinding); - - } - else if (bindingType == "SCABinding") - { - } - } - - - - /// - /// Use the Tuscany-model.config file in the module root directory to - /// determine which xsds and wsdls to load into a dataFactory. - /// - void ModelLoader::loadModuleConfig(const string &moduleRootDir, const string &moduleName) - { - LOGENTRY(1, "ModelLoader::loadModuleConfig"); - - // Load the "Tuscany-model.config" file, if it exists - Files files(moduleRootDir, "Tuscany-model.config", false); - for (unsigned int i=0; i < files.size(); i++) - { - string filename = moduleRootDir + "/" + files[i].getFileName(); - XMLDocumentPtr moduleConfigFile = getXMLHelper()->loadFile(filename.c_str()); - if (moduleConfigFile->getRootDataObject() == 0) - { - LOGERROR_1(0, "ModelLoader::loadModuleConfig: Unable to load file: %s", filename.c_str()); - } - else - { - LOGINFO_2(2, "ModelLoader::loadModuleConfig: Loading module config for: %s, root Dir: %s", moduleName.c_str(), moduleRootDir.c_str()); - - if(moduleConfigFile->getRootDataObject()->isSet("xsd")) - { - DataObjectList& xsds = moduleConfigFile->getRootDataObject()->getList("xsd/file"); - - for (int i=0; iisSet("name")) - { - // Load a xsd file -> set the types in the moduleComponents data factory file - string xsdName = moduleRootDir + "/" +xsds[i]->getCString("name"); - loadTypes(xsdName.c_str(), moduleName); - } - } - } - - - if( moduleConfigFile->getRootDataObject()->isSet("wsdl")) - { - DataObjectList& wsdls = moduleConfigFile->getRootDataObject()->getList("wsdl/file"); - for (int j=0; jisSet("name")) - { - string wsdlName = moduleRootDir + "/" +wsdls[j]->getCString("name"); - // Load a wsdl file -> get the types, then the contents of the wsdl - loadTypes(wsdlName.c_str(), moduleName); - - // Load the contents of the wsdl files - loadWsdl(wsdlName.c_str(), moduleName); - } - } - } - } - } - - - LOGEXIT(1, "ModelLoader::loadModuleConfig"); - } - - - /// - /// Use the types from an xsd or wsdl file - /// - void ModelLoader::loadTypes(const char *fileName, const string &moduleName) - { - LOGENTRY(1, "ModelLoader::loadTypes"); - - // Load a xsd file -> set the types in the moduleComponents data factory file - - MODULE_LIST moduleList = system->findModules(moduleName); - MODULE_LIST::iterator moduleIter; - - for (moduleIter = moduleList.begin(); - moduleIter != moduleList.end(); - moduleIter++ ) - { - try { - (*moduleIter)->getXSDHelper()->defineFile(fileName); - //Utils::printTypes((*moduleIter)->getXSDHelper()->getDataFactory()); - - } catch (SDOTypeNotFoundException ex) - { - LOGERROR_1(0, "ModuleLoader: Exception caught: %s", ex.getMessageText()); - throw ex; - } - } - LOGEXIT(1, "ModelLoader::loadTypes"); - } - - /// - /// Load the web services definition from a wsdl - /// - void ModelLoader::loadWsdl(const char *fileName, const string &moduleName) - { - LOGENTRY(1, "ModelLoader::loadWsdl"); - - try { - // Load the wsdl file - XMLDocumentPtr doc = getXMLHelper()->loadFile(fileName); - - if (doc!=0 && doc->getRootDataObject()!=0) - { - //Utils::printDO(doc->getRootDataObject()); - MODULE_LIST moduleList = system->findModules(moduleName); - MODULE_LIST::iterator moduleIter; - - for (moduleIter = moduleList.begin(); - moduleIter != moduleList.end(); - moduleIter++ ) - { - // Add the root object to the module - (*moduleIter)->addWsdl(doc->getRootDataObject()); - - } - - } - else - { - LOGERROR_1(0, "ModuleLoader: Unable to load or parse WSDL %s", fileName); - } - - } catch (SDOTypeNotFoundException ex) - { - LOGERROR_1(0, "ModelLoader: SDOTypeNotFoundException caught: %s", ex.getMessageText()); - throw ex; - } - catch (SDONullPointerException ex) - { - LOGERROR_1(0, "ModelLoader: SDONullPointerException caught: %s", ex.getMessageText()); - throw ex; - } - LOGEXIT(1, "ModelLoader::loadWsdl"); - - } - - ////////////////////////////////////////////////////////////////////////////// - // Methods used to load the model into memory - ////////////////////////////////////////////////////////////////////////////// - - /// - /// Get an XSDHelper that has the appropriate XSDs already loaded - /// - const XSDHelperPtr ModelLoader::getXSDHelper() - { - if (myXSDHelper == 0) - { - - // Create an xsd helper - myXSDHelper = HelperProvider::getXSDHelper(); - - // Now add to it some xsd files - try { - string root = SCARuntime::getInstance()->getInstallRoot(); - string filename = root + "/xsd/sca.xsd"; - - myXSDHelper->defineFile(filename.c_str()); - - // Tuscany specific xsd for config files - filename = root + "/xsd/tuscany.xsd"; - myXSDHelper->defineFile(filename.c_str()); - - loadWSDLTypes(myXSDHelper); - - } catch (SDOTypeNotFoundException ex) - { - LOGERROR_1(0, "ModuleLoader: Exception caught: %s", ex.getMessageText()); - throw ex; - } - } - - - return myXSDHelper; - } - - - /// - /// Get an XMLHelper to load files - /// - const XMLHelperPtr ModelLoader::getXMLHelper() - { - if (myXMLHelper == 0) { - - // Create an xml helper - myXMLHelper = HelperProvider::getXMLHelper(getXSDHelper()->getDataFactory()); - - } - - return myXMLHelper; - } - - void ModelLoader::loadWSDLTypes(XSDHelperPtr xsdHelper) - { - DataFactoryPtr dataFactory = xsdHelper->getDataFactory(); - - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - false, true, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationFault", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationMessage", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tDocumentation", - true, true, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tDocumented", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement", - false, false, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented", - false, true, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented", - false, true, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tFault", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tImport", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, false); - - - TypeDefinition tpart; - tpart.setUri("http://schemas.xmlsoap.org/wsdl/"); - tpart.setName("tPart"); - tpart.setParentType("http://schemas.xmlsoap.org/wsdl/", - "tExtensibleAttributesDocumented", false); - PropertyDefinition propdef; - propdef.setName("name"); - propdef.setLocalName("name"); - propdef.setType("commonj.sdo", "String"); - propdef.setIsContainment(true); - tpart.addPropertyDefinition(propdef); - propdef.setName("element"); - propdef.setLocalName("element"); - propdef.setIsQName(true); - tpart.addPropertyDefinition(propdef); - propdef.setName("type"); - propdef.setLocalName("type"); - tpart.addPropertyDefinition(propdef); - TypeDefinitions typedefs; - typedefs.addTypeDefinition(tpart); - xsdHelper->defineTypes(typedefs); - - //Utils::printTypes(dataFactory); - /*dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tPart", - false, false, false);*/ - - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tPort", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tService", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/", "tTypes", - false, false, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "definitions", - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "import", - "http://schemas.xmlsoap.org/wsdl/", "tImport", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "types", - "http://schemas.xmlsoap.org/wsdl/", "tTypes", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "message", - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "portType", - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "binding", - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "service", - "http://schemas.xmlsoap.org/wsdl/", "tService", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "input", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "output", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "fault", - "http://schemas.xmlsoap.org/wsdl/", "tFault", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "output", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "input", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "fault", - "http://schemas.xmlsoap.org/wsdl/", "tFault", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "arrayType", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "RootType", - "required", - "commonj.sdo", "Boolean", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - "operation", - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - "type", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - "input", - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationMessage", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - "output", - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationMessage", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - "fault", - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationFault", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperation", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationFault", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationFault", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationMessage", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tBindingOperationMessage", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "import", - "http://schemas.xmlsoap.org/wsdl/", "tImport", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "types", - "http://schemas.xmlsoap.org/wsdl/", "tTypes", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "message", - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "portType", - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "binding", - "http://schemas.xmlsoap.org/wsdl/", "tBinding", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "service", - "http://schemas.xmlsoap.org/wsdl/", "tService", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "targetNamespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDefinitions", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tDocumented", - "documentation", - "http://schemas.xmlsoap.org/wsdl/", "tDocumentation", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement", - "required", - "commonj.sdo", "Boolean", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented", - "http://schemas.xmlsoap.org/wsdl/", "tDocumented"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented", - "http://schemas.xmlsoap.org/wsdl/", "tDocumented"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tFault", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tFault", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tFault", - "message", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tImport", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tImport", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tImport", - "location", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - "part", - "http://schemas.xmlsoap.org/wsdl/", "tPart", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tMessage", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "input", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "output", - "http://schemas.xmlsoap.org/wsdl/", "tParam", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "fault", - "http://schemas.xmlsoap.org/wsdl/", "tFault", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - "parameterOrder", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tParam", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tParam", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tParam", - "message", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tPart", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented"); - /*dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPart", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPart", - "element", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPart", - "type", - "commonj.sdo", "URI", - false, false, true);*/ - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tPort", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPort", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPort", - "binding", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - "operation", - "http://schemas.xmlsoap.org/wsdl/", "tOperation", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tPortType", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tService", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tService", - "port", - "http://schemas.xmlsoap.org/wsdl/", "tPort", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/", "tService", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/", "tTypes", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented"); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tAddress", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBinding", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFault", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - false, false, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tOperation", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tStyleChoice", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "binding", - "http://schemas.xmlsoap.org/wsdl/soap/", "tBinding", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "operation", - "http://schemas.xmlsoap.org/wsdl/soap/", "tOperation", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "body", - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "fault", - "http://schemas.xmlsoap.org/wsdl/soap/", "tFault", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "header", - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "message", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "part", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "headerfault", - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "RootType", - "address", - "http://schemas.xmlsoap.org/wsdl/soap/", "tAddress", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tAddress", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tAddress", - "location", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBinding", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBinding", - "transport", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBinding", - "style", - "http://schemas.xmlsoap.org/wsdl/soap/", "tStyleChoice", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - "parts", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFault", - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFault", - "name", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "http://schemas.xmlsoap.org/wsdl/soap/", "tBody"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "required", - "commonj.sdo", "Boolean", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "parts", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tFaultRes", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "headerfault", - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - true, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "message", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "part", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeader", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - "message", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - "part", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - "use", - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - "encodingStyle", - "http://schemas.xmlsoap.org/wsdl/soap/", "encodingStyle", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tHeaderFault", - "namespace", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tOperation", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tOperation", - "soapAction", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tOperation", - "style", - "http://schemas.xmlsoap.org/wsdl/soap/", "tStyleChoice", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "tStyleChoice", - "commonj.sdo", "String"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap/", "useChoice", - "commonj.sdo", "String"); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "addressType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "bindingType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "operationType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "urlEncoded", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/http/", "urlReplacement", - false, false, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - "address", - "http://schemas.xmlsoap.org/wsdl/http/", "addressType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - "binding", - "http://schemas.xmlsoap.org/wsdl/http/", "bindingType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - "operation", - "http://schemas.xmlsoap.org/wsdl/http/", "operationType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - "urlEncoded", - "http://schemas.xmlsoap.org/wsdl/http/", "urlEncoded", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "RootType", - "urlReplacement", - "http://schemas.xmlsoap.org/wsdl/http/", "urlReplacement", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/http/", "addressType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "addressType", - "location", - "commonj.sdo", "URI", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/http/", "bindingType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "bindingType", - "verb", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/http/", "operationType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/http/", "operationType", - "location", - "commonj.sdo", "URI", - false, false, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/mime/", "RootType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/mime/", "contentType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/mime/", "multipartRelatedType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/mime/", "tMimeXml", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/mime/", "tPart", - false, true, false); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "RootType", - "content", - "http://schemas.xmlsoap.org/wsdl/mime/", "contentType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "RootType", - "multipartRelated", - "http://schemas.xmlsoap.org/wsdl/mime/", "multipartRelatedType", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "RootType", - "mimeXml", - "http://schemas.xmlsoap.org/wsdl/mime/", "tMimeXml", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/mime/", "contentType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "contentType", - "type", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "contentType", - "part", - "commonj.sdo", "String", - false, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/mime/", "multipartRelatedType", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "multipartRelatedType", - "part", - "http://schemas.xmlsoap.org/wsdl/mime/", "tPart", - true, false, true); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/mime/", "tMimeXml", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "tMimeXml", - "part", - "commonj.sdo", "String", - false, false, true); - dataFactory->addPropertyToType( - "http://schemas.xmlsoap.org/wsdl/mime/", "tPart", - "name", - "commonj.sdo", "String", - false, false, true); - - - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "RootType", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tAddress", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tBinding", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tBody", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs", - false, true, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tFault", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tFaultRes", - false, false, true); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tHeader", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tHeaderFault", - false, true, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tOperation", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tParts", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tStyleChoice", - false, false, false); - dataFactory->addType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "useChoice", - false, false, false); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tAddress", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tBinding", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tBody", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs", - "http://schemas.xmlsoap.org/wsdl/", "tExtensibilityElement"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tFault", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tFaultRes"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tFaultRes", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tBody"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tHeader", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tOperation", - "http://schemas.xmlsoap.org/wsdl/soap12/", "tExtensibilityElementOpenAttrs"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "tStyleChoice", - "commonj.sdo", "String"); - dataFactory->setBaseType( - "http://schemas.xmlsoap.org/wsdl/soap12/", "useChoice", - "commonj.sdo", "String"); - } - - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h deleted file mode 100644 index 97478748e9..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_modelloader_h -#define tuscany_sca_model_modelloader_h - -#include "osoa/sca/export.h" -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; -using commonj::sdo::DataFactoryPtr; -using commonj::sdo::XSDHelperPtr; - -#include "tuscany/sca/model/System.h" -#include "tuscany/sca/model/Subsystem.h" - -#include "tuscany/sca/util/File.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Provides methods to load the runtime model from the SCDL file. - */ - class ModelLoader { - public: - /** - * Constructor. - * @param system The SCA system to load. - */ - ModelLoader(System* system); - - /** - * Destructor. - */ - virtual ~ModelLoader(); - - /** - * Load the model from the configuration information. - * @param configurationRoot The location of the deployed SCA - * modules and subsystems. - */ - void load(const string& configurationRoot); - - private: - System* system; - void loadModule(const char *moduleRoot); - - - commonj::sdo::XMLHelperPtr myXMLHelper; // Used to load scdl files - commonj::sdo::XSDHelperPtr myXSDHelper; // Used to load xsds - const commonj::sdo::XSDHelperPtr getXSDHelper(void); - const commonj::sdo::XMLHelperPtr getXMLHelper(void); - - void loadSubsystems(const string& configurationRoot); - void loadSubsystemFile(const File& file); - void mapSubsystem(commonj::sdo::DataObjectPtr rootDO); - - void loadModules(const string& configurationRoot); - void loadModuleFile(const File& file); - void mapModule(const string& moduleName, commonj::sdo::DataObjectPtr rootDO, std::string moduleRootDir); - - void addComponent(Module* module, DataObjectPtr componentDO); - void addEntryPoint(Module* module, DataObjectPtr entryPointDO); - void addExternalService(Module* module, DataObjectPtr externalServiceDO); - - void addServices(Component* component, DataObjectPtr componentType); - void addReferences(Component* component, DataObjectPtr componentType); - void addProperties(Component* component, DataObjectPtr componentType); - - - void loadModuleConfig(const string &moduleRootDir, const string &moduleName); - void loadTypes(const char *fileName, const string &moduleName); - void loadWsdl(const char *fileName, const string &moduleName); - - void loadWSDLTypes(XSDHelperPtr xsdHelper); - - Interface* getInterface(DataObjectPtr obj); - - - }; - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_modelloader_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.cpp deleted file mode 100644 index fc8b6b1eb8..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/Module.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - Module::Module(const std::string& moduleName) - : name(moduleName) - { - LOGENTRY(1, "Module::constructor"); - LOGEXIT(1, "Module::constructor"); - } - - Module::~Module() - { - } - - void Module::setRoot(const std::string& rootDirectory) - { - moduleRoot = rootDirectory; - } - - - /// - /// Add a new component to the module component - /// - Component* Module::addComponent(const std::string& name) - { - LOGENTRY(1, "Module::addComponent"); - Component* newComponent = new Component(name, this); - components[name] = newComponent; - LOGEXIT(1, "Module::addComponent"); - return newComponent; - } - - Component* Module::findComponent(const std::string& name) - { - LOGENTRY(1, "Module::findComponent"); - Component* foundComponent = components[name]; - LOGEXIT(1, "Module::findComponent"); - return foundComponent; - } - - Service* Module::findComponentService(const std::string& name) - { - LOGENTRY(1, "Module::findComponentService"); - - Service* service = 0; - - string componentName; - string serviceName; - Utils::tokeniseUri(name, componentName, serviceName); - - // Locate the component - Component* foundComponent = components[componentName]; - if (foundComponent) - { - // Locate the service - service = foundComponent->findService(serviceName); - } - LOGEXIT(1, "Module::findComponentService"); - return service; - } - - ExternalService* Module::findExternalService(const std::string& name) - { - LOGENTRY(1, "Module::findExternalService"); - ExternalService* foundService = externalServices[name]; - LOGEXIT(1, "Module::findExternalService"); - return foundService; - } - - - EntryPoint* Module::addEntryPoint(const std::string& name) - { - LOGENTRY(1, "Module::addEntryPoint"); - EntryPoint* ep = new EntryPoint(name); - entryPoints[name] = ep; - LOGEXIT(1, "Module::addEntryPoint"); - return findEntryPoint(name); - } - - EntryPoint* Module::findEntryPoint(const std::string& name) - { - return entryPoints[name]; - } - - - ExternalService* Module::addExternalService(const std::string& name) - { - LOGENTRY(1, "Module::addExternalService"); - ExternalService* es = new ExternalService(name, this); - externalServices[name] = es; - LOGEXIT(1, "Module::addExternalService"); - return es; - } - - void Module::addWire(const std::string& source, const std::string& target) - { - LOGENTRY(1, "Module::addWire"); - wires.push_back(Wire(source, target)); - LOGEXIT(1, "Module::addWire"); - } - - - void Module::resolveWires() - { - LOGENTRY(1, "Module::resolveWires"); - for (WIRES::iterator iter = wires.begin(); - iter != wires.end(); - iter++) - { - // ----------------- - // Locate the target - // ----------------- - WireTarget* target = findComponentService(iter->getTarget()); - if (!target) - { - target = findExternalService(iter->getTarget()); - } - if (!target) - { - LOGERROR_1(0, "Module::resolveWires: Wire target %s not found", iter->getTarget().c_str()); - } - else - { - EntryPoint* entrypoint = findEntryPoint(iter->getSourceComponent()); - if (entrypoint) - { - entrypoint->addTarget(target); - } - else - { - Component* component = findComponent(iter->getSourceComponent()); - if (component) - { - ServiceReference* serviceReference = component->findReference(iter->getSourceReference()); - if (serviceReference) - { - serviceReference->addTarget(target); - } - else - { - LOGERROR_1(0, "Module::resolveWires: Wire source reference %s not found", iter->getSourceReference().c_str()); - } - } - else - { - LOGERROR_1(0, "Module::resolveWires: Wire source %s not found", iter->getSourceComponent().c_str()); - } - } - } - } - - LOGEXIT(1, "Module::resolveWires"); - } - - - - void Module::addWsdl(commonj::sdo::DataObjectPtr wsdlModel) - { - LOGENTRY(1, "Module::addWsdl"); - Wsdl* wsdl = new Wsdl(wsdlModel); - wsdls[wsdl->getNamespace()] = wsdl; - LOGEXIT(1, "Module::addWsdl"); - - } - - Wsdl* Module::findWsdl(const std::string& wsdlNamespace ) - { - return wsdls[wsdlNamespace]; - - } - - - // Get an XSDHelper - one will be created for each module - commonj::sdo::XSDHelperPtr Module::getXSDHelper() - { - if (xsdHelper == 0) - { - xsdHelper = commonj::sdo::HelperProvider::getXSDHelper(); - } - - return xsdHelper; - } - - // Get an XMLHelper - one will be created for each module - commonj::sdo::XMLHelperPtr Module::getXMLHelper() - { - if (xmlHelper == 0) - { - xmlHelper = commonj::sdo::HelperProvider::getXMLHelper(getXSDHelper()->getDataFactory()); - } - - return xmlHelper; - } - - - // Get a data factory - the one in the xsd/xml helper - commonj::sdo::DataFactoryPtr Module::getDataFactory() - { - return getXSDHelper()->getDataFactory(); - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.h deleted file mode 100644 index f73f1d36bc..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Module.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_module_h -#define tuscany_sca_model_module_h - -#include -using std::string; - -#include -using std::map; -#include -using std::vector; - -#include "commonj/sdo/SDO.h" - - -#include "tuscany/sca/model/Component.h" -#include "tuscany/sca/model/ExternalService.h" -#include "tuscany/sca/model/EntryPoint.h" -#include "tuscany/sca/model/Wire.h" -#include "tuscany/sca/model/Wsdl.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - /** - * Information about a module. - */ - class Module - { - public: - /** - * Constructor. - * @param name the name of the module. - */ - Module(const std::string& name); - - /** - * Destructor. - */ - virtual ~Module(); - - /** - * Set the root directory of the module information. - * @param rootDirectory The root of the module in the file system. - */ - void setRoot(const std::string& rootDirectory); - - /** - * Get the root directory of the module. - * @return The root of the module in the file system. - */ - const std::string& getRoot() {return moduleRoot;} - - /** - * Return the name of the module. - * @return Name of the module. - */ - const std::string& getName() {return name;} - - /** - * Add a new component to the module. - * @param componentName The name of the new component. - * @return The Component added to the module. - */ - Component* addComponent(const std::string& componentName); - - /** - * Add a new entry point to the module. - * @param name The name of the new entry point. - * @return The entry point added to the module. - */ - EntryPoint* addEntryPoint(const std::string& name); - - /** - * Find an entry point by name. - * @param name The name of the entry point to be found. - * @return The entry point that was found, or 0 if not found. - */ - EntryPoint* findEntryPoint(const std::string& name); - - /** - * Add a new external service to the module. - * @param name The name of the new external service. - * @return The external service added to the module. - */ - ExternalService* addExternalService(const std::string& name); - - /** - * Add a wire to the model. - * @param source The source location. Either the source component and - * reference (optional), or an entry point. - * @param target The target location. Either the target component and - * service (optional), or an external service. - */ - void addWire(const std::string& source, const std::string& target); - - /** - * Find a component by name. - * @param componentName The name of the component to be found. - * @return The component that was found, or 0 if not found. - */ - Component* findComponent(const std::string& componentName); - - /** - * Find a component and service by name. - * @param componentServiceName A string of the form - * "componentName"/"serviceName" where the service name is optional - * if there is only one service on the component. - * @return The Service that was found, or 0 if not found. - */ - Service* findComponentService(const std::string& componentServiceName); - - /** - * Find an external service by name. - * @param serviceName The name of the external service to be found. - * @return The external service that was found, or 0 if not found. - */ - ExternalService* findExternalService(const std::string& serviceName); - - /** - * Add a WSDL definition to the module. - * @param wsdlModel A data object holding all the information about - * the WSDL definition from a WSDL file. - */ - void addWsdl(commonj::sdo::DataObjectPtr wsdlModel); - - /** - * Find a WSDL definition by target namespace. - * @param wsdlNamespace The namespace of the WSDL definitions to find. - */ - Wsdl* findWsdl(const std::string& wsdlNamespace); - - /** - * Return a cached SDO XSDHelper. - */ - commonj::sdo::XSDHelperPtr getXSDHelper(void); - - /** - * Return a cached SDO XMLHelper. - */ - commonj::sdo::XMLHelperPtr getXMLHelper(void); - - /** - * Return a data factory which has all the types defined in XSDs and - * WSDL files configured for this module. - * @return The data factory for this module. - */ - commonj::sdo::DataFactoryPtr getDataFactory(void); - - /** - * Work through the list of wires and connect the source and target uris. - */ - void resolveWires(); - - private: - /** - * Name of the module. - */ - string name; - - /** - * Directory of the root of the module. - */ - string moduleRoot; - - /** - * Cached XSDHelper. - */ - commonj::sdo::XSDHelperPtr xsdHelper; - - /** - * Cached XMLHelper. - */ - commonj::sdo::XMLHelperPtr xmlHelper; - - typedef map COMPONENT_MAP; - /** - * Map (by name) of all the components in this module. - */ - COMPONENT_MAP components; - - typedef map EXTERNALSERVICE_MAP; - /** - * Map (by name) of all the external services in this module. - */ - EXTERNALSERVICE_MAP externalServices; - - typedef map ENTRYPOINT_MAP; - /** - * Map (by name) of all the entry points in this module. - */ - ENTRYPOINT_MAP entryPoints; - - typedef vector WIRES; - /** - * Vector of all the wires in this module. - */ - WIRES wires; - - typedef map WSDL_MAP; - /** - * Map by namespace of all the wsdl definitions in this module. - */ - WSDL_MAP wsdls; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // SCA_ModuleComponent_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.cpp deleted file mode 100644 index 42ccecbc99..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/Service.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - - // Constructor - Service::Service(const std::string& serviceName, Component* comp) - : WireTarget(serviceName), - component(comp) - { - LOGENTRY(1, "Service::constructor (Component)"); - LOGINFO_1(3, "Service::constructor: Service name: %s", serviceName.c_str()); - LOGEXIT(1, "Service::constructor"); - } - - Service::~Service() - { - } - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.h deleted file mode 100644 index 6c37dabb3e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Service.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_service_h -#define tuscany_sca_model_service_h - -#include -using std::string; - -#include "tuscany/sca/model/WireTarget.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - class Component; - - /** - * Information about a service defined on a component. - */ - class Service : public WireTarget - { - public: - /** - * Destructor. - */ - virtual ~Service(); - - /** - * Return the type of the wire target. - * @return Always returns ComponentServiceType. - */ - virtual Type getServiceType() {return ComponentServiceType;} - - /** - * Get the component on which this service is defined. - * @return The component on which this service is defined. - */ - Component* getComponent() {return component;} - - - private: - friend class Component; - /** - * Constructor. - * @param name The name of the service. - * @param component The component on which this service is defined. - */ - Service(const std::string& name, Component* component); - - /** - * The component on which this service is defined. - */ - Component* component; - - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_service_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.cpp deleted file mode 100644 index cada38dec2..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/model/ServiceReference.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - - // Constructor - ServiceReference::ServiceReference(const std::string& referenceName) - : name(referenceName), multiplicity(ONE_ONE) - { - } - - ServiceReference::~ServiceReference() - { - } - - void ServiceReference::addTarget(WireTarget* targ) - { - if (multiplicity == ONE_ONE || multiplicity == ZERO_ONE) - { - if (targets.size() > 0) - { - // throw exception - string message = "Duplicate wire for reference: " + name; - throw SystemConfigurationException(message.c_str()); - } - } - - targets.push_back(targ); - } - - void ServiceReference::setMultiplicity(const std::string& multip) - { - if (multip == "0..1") - { - multiplicity = ZERO_ONE; - } - else if (multip == "1..1") - { - multiplicity = ONE_ONE; - } - else if (multip == "0..n") - { - multiplicity = ZERO_MANY; - } - else if (multip == "1..n") - { - multiplicity = ONE_MANY; - } - else - { - string msg = "Invalid multiplicity specified, " + multip + ", for reference: " +name; - throw SystemConfigurationException(msg.c_str()); - } - } - - void ServiceReference::setInterface(Interface* interf) - { - iface = interf; - } - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.h deleted file mode 100644 index 062d7a4c19..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/ServiceReference.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_servicereference_h -#define tuscany_sca_model_servicereference_h - -#include -using std::string; -#include -using std::vector; - -#include "tuscany/sca/model/Interface.h" -#include "tuscany/sca/model/WireTarget.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about a reference on a serivce. - */ - class ServiceReference - { - public: - /** - * Constructor. - * @param name The name of the reference. - */ - ServiceReference(const std::string& name) - - /** - * Destructor. - */; - virtual ~ServiceReference(); - - /** - * Get the name of the service. - * @return The name of the service. - */ - const std::string& getName() {return name;} - - /** - * Multiplicity (how many wires can be attached to this - * reference as their source) - */ - enum Multiplicity - { - ZERO_ONE, - ONE_ONE, - ZERO_MANY, - ONE_MANY - }; - - /** - * Set the multiplicity of this reference. - * @param multiplicity One of "0..1", "1..1", "0..n", "1..n" - */ - void setMultiplicity(const std::string& multiplicity); - - /** - * Get the multiplicity of this reference. - * @return The multiplicity. - */ - Multiplicity getMultiplicity() {return multiplicity;} - - /** - * Set the interface required by this reference. - * @param iface The interface. - */ - void setInterface(Interface* iface); - - /** - * Get the interface. - * @return The interface. - */ - Interface* getInterface() {return iface;} - - /** - * Add a target for a reference. There may be more than - * one if the multiplicity is 0..n or 1..n. - * @param target The target for a wire. - */ - void addTarget(WireTarget* target); - typedef vector TARGETS; - - /** - * Get a vector of all the targets from this reference. - * @return The targets of this reference. - */ - const TARGETS& getTargets() {return targets;} - private: - /** - * Name of this reference. - */ - string name; - - /** - * The interface defining this reference. - */ - Interface* iface; - - /** - * The multiplicity of this reference. - */ - Multiplicity multiplicity; - - /** - * Vector of all the targets wired from this reference. - */ - TARGETS targets; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_servicereference_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.cpp deleted file mode 100644 index 08ef0dde49..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/Subsystem.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - // Constructor - Subsystem::Subsystem(const std::string& subsystemName) : name(subsystemName) - { - LOGENTRY(1, "Subsystem::constructor"); - - - LOGEXIT(1, "Subsystem::constructor"); - } - - Subsystem::~Subsystem() - { - } - - /// - /// Add a new module component - /// - Module* Subsystem::addModuleComponent(const std::string& name, const std::string& moduleName) - { - LOGENTRY(1, "Subsystem::addModuleComponent"); - - Module* newModule = new Module(moduleName); - - // TODO: Should check for duplicates and throw exception - moduleComponents[name] = newModule; - - LOGEXIT(1, "Subsystem::addModuleComponent"); - - return newModule; - } - - Module* Subsystem::findModule(const std::string& moduleName) - { - for (MODULECOMPONENT_MAP::iterator moduleComponentIter = moduleComponents.begin(); - moduleComponentIter != moduleComponents.end(); - moduleComponentIter++) - { - if (moduleName == moduleComponentIter->second->getName()) - { - return (Module*)moduleComponentIter->second; - } - } - return 0; - } - - Module* Subsystem::findModuleByComponentName(const std::string& moduleComponentName) - { - return moduleComponents[moduleComponentName]; - } - - Module* Subsystem::getDefaultModule() - { - if (moduleComponents.size() == 1) - { - MODULECOMPONENT_MAP::iterator moduleComponentIter = moduleComponents.begin(); - return moduleComponentIter->second; - } - return 0; - } - - /// - /// Add a new entrypoint - /// - EntryPoint* Subsystem::addEntryPoint(const std::string& name) - { - LOGENTRY(1, "Subsystem::addEntryPoint"); - - EntryPoint* newEntryPoint = new EntryPoint(name); - entryPoints[name] = newEntryPoint; - LOGEXIT(1, "Subsystem::addEntryPoint"); - return findEntryPoint(name); - } - - EntryPoint* Subsystem::findEntryPoint(const std::string& name) - { - return entryPoints[name]; - } - - void Subsystem::resolveWires() - { - for (MODULECOMPONENT_MAP::iterator moduleComponentIter = moduleComponents.begin(); - moduleComponentIter != moduleComponents.end(); - moduleComponentIter++) - { - moduleComponentIter->second->resolveWires(); - } - - // Resolve EntryPoint wires - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.h deleted file mode 100644 index b3c59898eb..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Subsystem.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_h -#define tuscany_sca_model_h - -#include -using std::string; -#include -using std::map; - -#include "tuscany/sca/model/Module.h" -#include "tuscany/sca/model/EntryPoint.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about a subsystem. - */ - class Subsystem { - public: - /** - * Constructor. - * @param name The name of the subsystem. - */ - Subsystem(const std::string& name); - - /** - * Destructor. - */ - virtual ~Subsystem(); - - /** - * Add a new module component to the subsystem. - * @param name The name of the module component. - * @param moduleName The name of the module. - * @return The new Module added to the subsystem. - */ - Module* addModuleComponent(const std::string& name, const std::string& moduleName); - - /** - * Find a module by module name. - * @param moduleName The name of the module to be found. - * @return The Module that was found, or 0 if not found. - */ - Module* findModule(const std::string& moduleName); - - /** - * Find a module by the module component name. - * @param moduleComponentName The module component name to be used to find - * the module. - * @return The Module that was found, or 0 if not found. - */ - Module* findModuleByComponentName(const std::string& moduleComponentName); - - /** - * Get the default module set for this subsystem. - * @return The default module. - */ - Module* getDefaultModule(); - - /** - * Add an new entry point to the subsystem. - * @param name The name of the entry point. - * @return The new EntryPoint added to the subsystem. - */ - EntryPoint* addEntryPoint(const std::string& name); - - /** - * Find an entry point by name. - * @param name The name of the entry point to be found. - * @return The EntryPoint that was found, or 0 if not found. - */ - EntryPoint* findEntryPoint(const std::string& name); - - /** - * Return the name of the subsystem. - * @return The name. - */ - const std::string& getName() {return name;} - - /** - * Resolve all the wires configured in all the modules in this - * subsystem. - */ - void resolveWires(); - - private: - /** - * The name of the subsystem. - */ - std::string name; - - typedef std::map MODULECOMPONENT_MAP; - /** - * A map by module component name of modules. - */ - MODULECOMPONENT_MAP moduleComponents; - - typedef map ENTRYPOINT_MAP; - /** - * A map of entry points defined in this subsystem. - */ - ENTRYPOINT_MAP entryPoints; - }; - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.cpp deleted file mode 100644 index dfc4a21b1c..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/System.h" - - -namespace tuscany -{ - namespace sca - { - namespace model - { - - // ============ - // Constructor - // ============ - System::System() - { - LOGENTRY(1, "System::constructor"); - - - LOGEXIT(1, "System::constructor"); - } - - System::~System() - { - SUBSYSTEM_MAP::iterator subsystemsIter; - for (subsystemsIter = subsystemMap.begin(); - subsystemsIter != subsystemMap.end(); - subsystemsIter++ ) - { - delete subsystemsIter->second; - } - } - - // ================================= - // Add a new subsystem to the system - // ================================= - Subsystem* System::addSubsystem(const std::string& name) - { - LOGENTRY(1, "System::addSubsystem"); - - Subsystem* newSubsystem = new Subsystem(name); - - subsystemMap[name] = newSubsystem; - - LOGEXIT(1, "System::addSubsystem"); - - return newSubsystem; - } - - // ==================================================================== - // Get a map of all the moduleComponents that use a particular module - // ==================================================================== - MODULE_LIST System::findModules(const std::string& name) - { - LOGENTRY(1, "System::findModules"); - MODULE_LIST foundModules; - - SUBSYSTEM_MAP::iterator subsystemsIter; - for (subsystemsIter = subsystemMap.begin(); - subsystemsIter != subsystemMap.end(); subsystemsIter++ ) { - LOGINFO_1(2, "System::findModules: Found subsystem: %s", subsystemsIter->second->getName().c_str()); - // In each subsystem, find module components with this module defined - - Module* module = subsystemsIter->second->findModule(name); - if (module) - { - LOGINFO_1(2, "System::findModules: Found module: %s", module->getName().c_str()); - foundModules.push_back(module); - } - } - LOGEXIT(1, "System::findModules"); - - return foundModules; - } - - - // ==================================================================== - // Get a map of all the moduleComponents that use a particular module - // ==================================================================== - Subsystem* System::findSubsystem(const std::string& subsystem) - { - return subsystemMap[subsystem]; - } - - void System::resolveWires() - { - SUBSYSTEM_MAP::iterator subsystemsIter; - for (subsystemsIter = subsystemMap.begin(); - subsystemsIter != subsystemMap.end(); - subsystemsIter++ ) - { - subsystemsIter->second->resolveWires(); - } - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.h deleted file mode 100644 index a0f62ce67a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/System.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_system_h -#define tuscany_sca_model_system_h - -#include -#include -#include - -#include "tuscany/sca/model/Subsystem.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - typedef std::vector MODULE_LIST; - - /** - * The root of the runtime model supported by a Tuscany runtime. - */ - class System { - public: - System(); - virtual ~System(); - - /** - * Add a new subsystem to the system. - * @param subsystemName The name of the new subsystem to add. - * @return The new Subsystem added to the system. - */ - Subsystem* addSubsystem(const std::string& subsystemName); - - /** - * Find subsystem by name. - * @param subsystemName The name of the subsystem to be found. - * @return The Subsystem found, or 0 if not found. - */ - Subsystem* findSubsystem(const std::string& subsystemName); - - typedef std::vector MODULE_LIST; - - /** - * Return a vector of all the modules with a given module name. - * @param moduleName The name of the module to find - * @return A vector of all the times the module appears in the - * system. It can be more than once because the same module name - * is used by more than one module component. - */ - MODULE_LIST findModules(const std::string& moduleName); - - /** - * Resolve all the wires defined in the system. - */ - void resolveWires(); - - private: - - typedef std::map SUBSYSTEM_MAP; - - /** - * Map by name of subsystems. - */ - SUBSYSTEM_MAP subsystemMap; - }; - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_system_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.cpp deleted file mode 100644 index 85cb7482bd..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/WSBinding.h" - - -namespace tuscany -{ - namespace sca - { - - namespace model - { - - // Constructor - WSBinding::WSBinding(const string& uri, const string& port) - : Binding(uri), port(port) - { - - // Port is of the form: #wsdl.endpoint(/) - string::size_type hash = port.find("#"); - if (hash != string::npos) - { - // Found a hash - - // Namepace is the part before the # - wsdlNamespaceURL = port.substr(0, hash); - - - if ( (hash+1) < port.length()) - { - // Check the next part is wsdl.endpoint( - int ending = hash+15; - string check = port.substr(hash+1, 14); - if (check.compare("wsdl.endpoint(") == 0) - { - // Find the matching ) - int endBracket = port.find(")",ending); - if (endBracket-1 > ending+1) - { - string serviceAndPort = port.substr(ending, endBracket-ending); - // Look for a '/' - string::size_type slash = serviceAndPort.find("/"); - if (slash != string::npos) - { - serviceName = serviceAndPort.substr(0, slash); - - if ( (slash+1) < serviceAndPort.length()) - { - portName = serviceAndPort.substr(slash+1); - } - else - { - portName = ""; - } - - } - else - { - // No '/' so all of it is the service name - serviceName = serviceAndPort; - portName = ""; - - } - } - else - { - // Nothing between the () - serviceName = ""; - portName = ""; - } - } - else - { - // not the correct characters after the #, ignore the rest - serviceName = ""; - portName = ""; - } - - } - else - { - // Nothing after the hash - serviceName = ""; - portName = ""; - } - } - else - { - // No hash at all - wsdlNamespaceURL = port; - serviceName = ""; - portName = ""; - } - - - - - - - } - - WSBinding::~WSBinding() - { - } - - } // End namespace model - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.h deleted file mode 100644 index e7963d205b..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WSBinding.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_wsbinding_h -#define tuscany_sca_model_wsbinding_h - -#include "tuscany/sca/model/Binding.h" - -#include - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about a web service binding for an entry point or an - * external service. - */ - class WSBinding : public Binding - { - 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") - */ - WSBinding(const string&uri, const string& port); - - /** - * Destructor. - */ - virtual ~WSBinding(); - - /** - * Return the type of the binding. - * @return Always returns WS. - */ - virtual Type getBindingType() {return WS;}; - - /** - * Return the part of the port definition describing the wsdl - * namespace. - * @return The wsdl namespace. - */ - string getWSDLNamespaceURL() {return wsdlNamespaceURL;}; - - /** - * Return the service part of the port definition. - * @return The service to use. - */ - string getServiceName() {return serviceName;}; - - /** - * Return the port name part of the port definition. - * @return The port name to use. - */ - string getPortName() {return portName;}; - - private: - /** - * The full port string. - */ - string port; - - /** - * Namespace from the port. - */ - string wsdlNamespaceURL; - - /** - * Service name from the port. - */ - string serviceName; - - /** - * Port name from the port. - */ - string portName; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_wsbinding_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.cpp deleted file mode 100644 index 6c1b14940f..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/model/Wire.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - // Constructor - Wire::Wire(const std::string& source, const std::string& targ) - { - Utils::tokeniseUri(source, sourceComponent, sourceReference); - target = targ; - } - - Wire::~Wire() - { - } - - } // End namespace model - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.h deleted file mode 100644 index b126137118..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wire.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_wire_h -#define tuscany_sca_model_wire_h - -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Information about a wire in the model. - */ - class Wire - { - public: - /** - * Constructor. - * @param source The source of the wire. Either the component and - * reference name (optional) or an entry point. - * @param target The target of the wire. Either a component and service - * service name (optional) or an external sevice. - */ - Wire(const std::string& source, const std::string& target); - - /** - * Destructor. - */ - virtual ~Wire(); - - /** - * Get the component name defined by the source of the wire. - * @return The component name which is the source of the wire. - */ - const std::string& getSourceComponent() {return sourceComponent;} - - /** - * Get the reference name defined by the source of the wire. - * @return The reference name which is the source of the wire. - */ - const std::string& getSourceReference() {return sourceReference;} - - /** - * Get the target uri defined by the target of the wire. - * @return The target uri which is the source of the wire. - */ - const std::string& getTarget() {return target;} - private: - /** - * The source component of the wire. - */ - string sourceComponent; - - /** - * The source reference of the wire. - */ - string sourceReference; - - /** - * The target uri of the wire. - */ - string target; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_wire_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.cpp deleted file mode 100644 index a35b07f5fe..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/model/WireTarget.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - // Constructor - WireTarget::WireTarget(const std::string& targetName) - : name(targetName) - { - } - - WireTarget::~WireTarget() - { - } - - void WireTarget::setInterface(Interface* interf) - { - iface = interf; - } - - } // End namespace model - - - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.h deleted file mode 100644 index 312d20a704..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WireTarget.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_wiretarget_h -#define tuscany_sca_model_wiretarget_h - -#include -using std::string; - -#include "tuscany/sca/model/Interface.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - /** - * Represents the target of a wire. This could be a service on a - * component or an external service. - */ - class WireTarget - { - public: - /** - * Supported types of wire target. - */ - enum Type - { - ComponentServiceType, - ExternalServiceType - }; - - /** - * Constructor. - * @param name The name of the wire target. - */ - WireTarget(const std::string& name); - - /** - * Destructor. - */ - virtual ~WireTarget(); - - /** - * Return the name of the wire target. - */ - string getName() {return name;} - - /** - * Get the type of the wire target. - * @return Depends on the type of the wire target. - */ - virtual Type getServiceType() = 0; - - /** - * Set the interface describing the wire target. - * @param iface The interface. - */ - void setInterface(Interface* iface); - - /** - * Get the interface describing the wire target. - * @return The interface. - */ - Interface* getInterface() {return iface;} - - private: - /** - * Name of the wire target (service name or external service name) - */ - string name; - - /** - * Type of the service. - */ - Type serviceType; - - /** - * Interface describing the wire target. - */ - Interface* iface; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_wiretarget_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp deleted file mode 100644 index d2ca9e96c1..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/model/Wsdl.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" - -using namespace tuscany::sca; - -using namespace commonj::sdo; - -namespace tuscany -{ - namespace sca - { - namespace model - { - - - // Constructor - Wsdl::Wsdl(DataObjectPtr wsdlModel) - : wsdlModel(wsdlModel) - { - LOGENTRY(1, "Wsdl::constructor"); - - // Trace - //Utils::printDO(wsdlModel); - - - - LOGEXIT(1, "Wsdl::constructor"); - } - - Wsdl::~Wsdl() - { - } - - - /// - /// The namespace of the service and other definitions defined in this wsdl definition - string Wsdl::getNamespace() - { - - return wsdlModel->getCString("targetNamespace"); - - } - - /// - /// Find the operation defined in this wsdl - /// - const WsdlOperation& Wsdl::findOperation(const string& serviceName, - const string& portName, - const string& operationName) - { - string message; - - string operationKey = serviceName+"#"+portName+"#"+operationName; - OperationMap::iterator iter = operationMap.find(operationKey); - if (iter != operationMap.end()) - { - return iter->second; - } - - // Find the service - DataObjectPtr service = findService(serviceName); - if (!service) - { - // Service not found - message = "Unable to find service "; - message = message + serviceName; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - else - { - - - // Found the service - DataObjectList& portList = service->getList("port"); - for (int j=0; jgetCString("name")); - if (portListName.compare(portName) == 0) - { - // found port - // Add address at this point - string targetAddress(portList[j]->getCString("address/location")); - - // find operation by traversing the binding, portType then operation - string wsBindingName(portList[j]->getCString("binding")); - - DataObjectPtr wsBinding = findBinding(wsBindingName); - if (!wsBinding) - { - message = "Unable to find binding "; - message = message + wsBindingName; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - - - string soapAction; - bool documentStyle = false; - bool useEncoded = false; - WsdlOperation::soapVersion soapVer = WsdlOperation::SOAP11; - - // Find the binding operation - DataObjectList& bindingOperationList = wsBinding->getList("operation"); - for (int i=0; igetCString("name")); - - if (name.compare(operationName) == 0) - { - DataObjectPtr op = bindingOperationList[i]->getDataObject("operation"); - string opType = op->getType().getURI(); - if (opType == "http://schemas.xmlsoap.org/wsdl/soap12/") - { - soapVer = WsdlOperation::SOAP12; - } - // Get the soapAction - soapAction = bindingOperationList[i]->getCString("operation/soapAction"); - - // Get the style - string style = bindingOperationList[i]->getCString("operation/style"); - if (style == "") - { - style = wsBinding->getCString("binding/style"); - } - if (style == "document") - { - documentStyle = true; - } - - // get the use - string use = bindingOperationList[i]->getCString("input/body/use"); - if (style == "encoded") - { - useEncoded = true; - } - } - } - - - // TODO - get the style from the binding or operation???? - - // Found the binding, get the portType - string wsPortTypeName(wsBinding->getCString("type")); - DataObjectPtr wsPortType = findPortType(wsPortTypeName); - if (!wsPortType) - { - message = "Unable to find PortType "; - message = message + wsPortTypeName; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - - //Utils::printDO(wsPortType); - - // Found the portType, find the operation - DataObjectList& operationList = wsPortType->getList("operation"); - for (int k=0; k< operationList.size(); k++) - { - string opName(operationList[k]->getCString("name")); - if( opName.compare(operationName) == 0) - { - // Found the operation - - // Find the type of the request message - string inputMessageType = string(operationList[k]->getCString("input/message")); - - DataObjectPtr wsMessageIn = findMessage(inputMessageType); - if (!wsMessageIn) - { - message = "Unable to find message "; - message = message + inputMessageType; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - - string requestType(wsMessageIn->getList("part")[0]->getCString("element")); - - // Find the type of the response message - string outputMessageType = string(operationList[k]->getCString("output/message")); - - DataObjectPtr wsMessageOut = findMessage(outputMessageType); - if (!wsMessageOut) - { - message = "Unable to find message "; - message = message + outputMessageType; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - - string responseType(wsMessageOut->getList("part")[0]->getCString("element")); - - WsdlOperation& wsdlOp = operationMap[operationKey]; - wsdlOp.setOperationName(operationName); - wsdlOp.setSoapAction(soapAction); - wsdlOp.setEndpoint(targetAddress); - wsdlOp.setSoapVersion(soapVer); - wsdlOp.setDocumentStyle(documentStyle); - wsdlOp.setEncoded(useEncoded); - wsdlOp.setInputType(requestType); - wsdlOp.setOutputType(responseType); - return wsdlOp; - } - - } - - message = "Unable to find Operation "; - message = message + operationName; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - } - // cannot find the port - message = "Unable to find port "; - message = message + portName; - message = message + " in the WSDL definition"; - throw SystemConfigurationException(message.c_str()); - } - - } - - /// - /// Find a service - /// - DataObjectPtr Wsdl::findService(const string& serviceName) - { - DataObjectPtr service = 0; - - - // Find the binding - DataObjectList& serviceList = wsdlModel->getList("service"); - for (int i=0; igetCString("name")); - - if (name.compare(serviceName) == 0) - { - return serviceList[i]; - } - } - - return service; - } - - - /// - /// Find a named binding - /// - DataObjectPtr Wsdl::findBinding(const string& bindingName) - { - DataObjectPtr binding = 0; - string uri; - string name; - - - //Utils::tokeniseQName(bindingName, uri, name); - Utils::rTokeniseString(":", bindingName, uri, name); - - - // Find the binding - DataObjectList& bindingList = wsdlModel->getList("binding"); - for (int i=0; igetCString("name")); - - if (nameBinding.compare(name) == 0) - { - return bindingList[i]; - } - } - - return binding; - } - - /// - /// Find a named portType - /// - DataObjectPtr Wsdl::findPortType(const string& portTypeName) - { - DataObjectPtr portType = 0; - string uri; - string name; - - - // Utils::tokeniseQName(portTypeName, uri, name); - Utils::rTokeniseString(":", portTypeName, uri, name); - - - // Find the binding - DataObjectList& portTypeList = wsdlModel->getList("portType"); - for (int i=0; igetCString("name")); - - if (namePortType.compare(name) == 0) - { - return portTypeList[i]; - } - } - - return portType; - } - - /// - /// Find a named message - /// - DataObjectPtr Wsdl::findMessage(const string& messageName) - { - DataObjectPtr message = 0; - string uri; - string name; - - - // Utils::tokeniseQName(messageName, uri, name); - Utils::rTokeniseString(":", messageName, uri, name); - - - // Find the binding - DataObjectList& messageList = wsdlModel->getList("message"); - for (int i=0; igetCString("name")); - - if (nameMessage.compare(name) == 0) - { - return messageList[i]; - } - } - - return message; - } - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.h deleted file mode 100644 index 70a07996cc..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/Wsdl.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_wsdl_h -#define tuscany_sca_model_wsdl_h - -#include "osoa/sca/export.h" -#include -using std::string; - -#include "tuscany/sca/model/WsdlOperation.h" - -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; - -#include -using std::map; - -namespace tuscany -{ - namespace sca - { - namespace model - { - - /** - * Holds information about a WSDL definition loaded into the runtime. - */ - class Wsdl - { - public: - /** - * Constructor. - * @param wsdlModel The data object representing the WSDL document - * defining a web service. - */ - Wsdl(DataObjectPtr wsdlModel); - - /** - * Destructor. - */ - ~Wsdl(); - - - /** - * Returns the target namespace of the WSDL definitions. - * @return The target namespace. - */ - string getNamespace(void); - - /** - * Find an operation in the WSDL definitions. - * @param serviceName The name of the service on which this - * operation is defined. - * @param portName The name of the port in the service to - * use. - * @param operationName The name of the operation to find. - * @return The operation if found. Exception thrown if not found. - */ - const WsdlOperation& findOperation(const string& serviceName, - const string& portName, - const string& operationName); - - private: - - /** - * Find a service in the wsdl definition. - * @param serviceName The name of the service. - * @return A data object describing the service if found, otherwise - * a 0 if not found. - */ - DataObjectPtr findService(const string& serviceName); - - /** - * Find a binding in the wsdl definition. - * @param bindingName The name of the binding to find. - * @return A data object describing the binding if found, otherwise - * a 0 if not found. - */ - DataObjectPtr findBinding(const string& bindingName); - - /** - * Find a portType in the wsdl definition. - * @param portTypeName The name of the portType. - * @return A data object describing the portType if found, otherwise - * a 0 if not found. - */ - DataObjectPtr findPortType(const string& portTypeName); - - /** - * Find a message in the wsdl definition. - * @param messageName The name of the message. - * @return A data object describing the message if found, otherwise - * a 0 if not found. - */ - DataObjectPtr findMessage(const string& messageName); - - - /** - * The data object representation of the WSDL document. - */ - DataObjectPtr wsdlModel; - - typedef map OperationMap; - OperationMap operationMap; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_wsdl_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp deleted file mode 100644 index 40964ea20e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/model/WsdlOperation.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" - -namespace tuscany -{ - namespace sca - { - namespace model - { - - - // Constructor - WsdlOperation::WsdlOperation() - { - LOGENTRY(1, "WsdlOperation::constructor"); - LOGEXIT(1, "WsdlOperation::constructor"); - } - - WsdlOperation::~WsdlOperation() - { - } - - - void WsdlOperation::setInputType(const string& inputType) - { - Utils::tokeniseQName(inputType, inputTypeUri, inputTypeName); - } - - void WsdlOperation::setOutputType(const string& outputType) - { - Utils::tokeniseQName(outputType, outputTypeUri, outputTypeName); - } - - } // End namespace model - } // End namespace sca -} // End namespace tuscany diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h deleted file mode 100644 index 9fe22b6f57..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_model_wsdlOperation_h -#define tuscany_sca_model_wsdlOperation_h -#include "osoa/sca/export.h" -#include -using std::string; - - -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; - -namespace tuscany -{ - namespace sca - { - namespace model - { - - /** - * Represents a single.,bound WSDL defined operation. - * This class includes information from the soapBinding - * in addition to the WSDL definition of the operation. - */ - class WsdlOperation - { - public: - /** - * Constructor. - * @param operation The name of the operation. - * @param soapAction The soapAction associated with this operation - * in the SOAP binding of the operation. - * @param endpoint The endpoint address of the operation. - * @param responseName The name of the response message. - */ - WsdlOperation(); - - /** - * Destructor. - */ - ~WsdlOperation(); - - /** - * Return the name of the operation for use when serializing an - * outgoing message. - * @return The name of the element in the request message. - */ - const string& getOperationName() const {return operationName;} - void setOperationName(const string& opName) {operationName = opName;} - - /** - * The soap action string for this operation. - * @return The soap action. - */ - const string& getSoapAction() const {return soapAction;} - void setSoapAction(const string& soapAct) {soapAction = soapAct;} - - /** - * Return the endpoint address for the target web service. - * @return The endpoint address. - */ - const string& getEndpoint() const {return endpoint;} - void setEndpoint(const string& ep) {endpoint = ep;} - - enum soapVersion - { - SOAP11, - SOAP12 - }; - - void setSoapVersion(soapVersion ver) {soapVer = ver;} - soapVersion getSoapVersion() const {return soapVer;} - - void setDocumentStyle(bool docStyle) {documentStyle = docStyle;} - bool isDocumentStyle() const {return documentStyle;} - - void setEncoded(bool enc) {encoded = enc;} - bool isEncoded() const {return encoded;} - - - void setInputType(const string& inputType); - const string& getInputTypeUri() const {return inputTypeUri;} - const string& getInputTypeName() const {return inputTypeName;} - void setOutputType(const string& outputType); - const string& getOutputTypeUri() const {return outputTypeUri;} - const string& getOutputTypeName() const {return outputTypeName;} - - private: - /** - * The name of the operation for use when serializing an - * outgoing message. - */ - string operationName; - - /** - * The soap action string for this operation. - */ - string soapAction; - - /** - * The endpoint address of the target web service. - */ - string endpoint; - - bool documentStyle; - bool encoded; - soapVersion soapVer; - - string inputTypeUri; - string inputTypeName; - - string outputTypeUri; - string outputTypeName; - - DataObjectPtr inputMessage; - DataObjectPtr outputMessage; - }; - - } // End namespace model - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_model_wsdlOperation_h - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp deleted file mode 100644 index 3ea2212f7c..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/DefaultLogWriter.h" -#include -using namespace std; - -namespace tuscany -{ - namespace sca - { - DefaultLogWriter::~DefaultLogWriter() - { - } - - void DefaultLogWriter::log(int level, const char* msg) - { - for (int i=0; i < level; i++) - { - cout << " "; - } - cout << msg < - -#include -#include -using namespace std; - -#if defined(WIN32) || defined (_WINDOWS) -#include -#else -#include -#include -#include -#endif - -namespace tuscany -{ - namespace sca - { - File::File(const string& dir, const string& file) - : directory(dir), fileName(file) - { - } - File::~File() - { - } - - - Files::Files(const string& rootDir, const string& pattern, bool subdirectories) - : rootDirectory(rootDir) - { - findFiles(rootDirectory, pattern, subdirectories); - } - - Files::~Files() - { - } - - unsigned int Files::size() - { - return files.size(); - } - - const File& Files::operator[] (unsigned int index) - { - if (size() <= index) - { - throw ServiceRuntimeException("Files::operator[] index out of bounds"); - } - - FILES::iterator iter = files.begin(); - for (unsigned int i=0; id_name; - struct stat statbuf; - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) - continue; - if (stat(entryName.c_str(), &statbuf) != 0) - { - perror("stat"); - } - else - { - if (S_ISDIR(statbuf.st_mode)) - { - if (subdirectories) - { - findFiles(entryName, pattern, subdirectories); - } - } - else if (S_ISREG(statbuf.st_mode)) - { - string filename = entry->d_name; - - if ((exactMatch && filename == pattern) || - (!exactMatch && - ((filename.find(token1) == 0) - && (filename.length() >= token2.length()) - && (filename.rfind(token2) == (filename.length() - token2.length())) ))) - { - // Add the file to our list - files.push_back(File(rootDir, filename)); - } - } - } - } - closedir(root); -#endif - } - - - } // End namespace sca -} // End namespace tuscany - - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/File.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/File.h deleted file mode 100644 index f177401442..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/File.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_util_file_h -#define tuscany_sca_util_file_h - -#include -using std::string; -#include -using std::vector; - -namespace tuscany -{ - namespace sca - { - /** - * File access methods. Provides platform independent - * access to files. - */ - class File - { - public: - /** - * Constructor. - * @param directory Name of the directory in which this file is located. - * Either / or \ can be used interchangeably for separating directory elements. - * @param fileName Name of the file in the dirctory. - */ - File(const string& directory, const string& fileName); - - /** - * Destructor. - */ - virtual ~File(); - - /** - * Return the directory in which this file is located. - * @return Name of the directory. - */ - const string& getDirectory() const {return directory;} - - /** - * Name of the file. - * @return Name of the file. - */ - const string& getFileName() const {return fileName;} - private: - /** - * Name of the directory. - */ - string directory; - - /** - * Name of the file. - */ - string fileName; - }; - - /** - * Collection of File to provide platform independent access - * to files and directories. - */ - class Files - { - public: - /** - * Constructor which will search a given directory with a pattern and return a - * new instance of this collection class. - * @param rootDirectory The directory in which to search. - * @param pattern A pattern for matching file names. Can include * and ?. - * @param subdirectories Whether subdirectories should be searched too. - */ - Files(const string& rootDirectory, const string& pattern, bool subdirectories = false); - - /** - * Destructor. - */ - virtual ~Files(); - - /** - * Return the number of files found. - * @return The number of files found. - */ - unsigned int size(); - - /** - * Return a File at this position in the collection. - * @param index The index into the collection. - * @return The File at this index in the collection. - */ - const File& operator[] (unsigned int index); - - private: - /** - * Search the given directory and pattern for matching files. - * @param rootDirectory The directory in which to search. - * @param pattern A pattern for matching file names. Can include * and ?. - * @param subdirectories Whether subdirectories should be searched too. - */ - void findFiles(const string& rootDirectory, const string& pattern, bool subdirectories); - - /** - * The top level directory to search. - */ - string rootDirectory; - - typedef vector FILES; - - /** - * Vector of File. - */ - FILES files; - }; - - } // End namespace sca -} // End namespace tuscany -#endif // tuscany_sca_util_file_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/FileLogWriter.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/FileLogWriter.cpp deleted file mode 100644 index c3749c1be2..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/FileLogWriter.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date$ */ - -#include "tuscany/sca/util/FileLogWriter.h" -#include -using namespace std; - -namespace tuscany -{ - namespace sca - { - FileLogWriter::FileLogWriter(const char* logfile) - { - logFile.open(logfile, ios_base::app); - } - - FileLogWriter::~FileLogWriter() - { - logFile.close(); - } - - void FileLogWriter::log(int level, const char* msg) - { - for (int i=0; i < level; i++) - { - logFile << " "; - } - logFile << msg < -#include -using std::ofstream; - -namespace tuscany -{ - namespace sca - { - /** - * Log writer to write out to standard out. - */ - class FileLogWriter : public LogWriter - { - public: - FileLogWriter(const char* logfile); - - virtual ~FileLogWriter(); - - /** - * Will write to the console. - * See LogWriter#log. - */ - virtual void log(int level, const char* msg); - private: - ofstream logFile; - }; - - } // End namespace sca -} // End namespace tuscany -#endif // tuscany_sca_util_defaultlogwriter_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.cpp deleted file mode 100644 index 0a50f396c7..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "tuscany/sca/util/Library.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -using namespace osoa::sca; - -namespace tuscany -{ - namespace sca - { - Library::Library() - : hDLL(NULL) - { - } - - Library::Library(const string& libraryName) - : name(libraryName), hDLL(NULL) - { - LOGINFO_1(3, "Library::construcor : %s", name.c_str()); - load(); - } - - Library::Library(const Library& lib) - : name(lib.name), hDLL(NULL) - { - LOGINFO_1(3, "Library::copy constructor : %s", name.c_str()); - if (lib.hDLL) - { - load(); - } - } - - Library& Library::operator=(const Library& lib) - { - LOGINFO_1(3, "Library::operator= : %s", name.c_str()); - if (&lib != this) - { - unload(); - name = lib.name; - load(); - } - return *this; - } - - Library::~Library() - { - LOGINFO_1(3, "Library::destructor: %s", name.c_str()); - unload(); - } - - - void Library::load() - { - LOGINFO_1(3, "Library::load : %s", name.c_str()); - string msg; -#if defined(WIN32) || defined (_WINDOWS) - hDLL = LoadLibrary(name.c_str()); -#else - hDLL = dlopen(name.c_str(), RTLD_NOW); -#endif - if (hDLL == NULL) - { - LOGERROR_1(1, "Library::load: Unable to load library %s", name.c_str()); - msg = "Unable to load dll: " + name; - throw ServiceRuntimeException(msg.c_str()); - } - } - - void Library::unload() - { - if (hDLL != NULL) - { - LOGINFO_1(3, "Library::unload : %s", name.c_str()); -#if defined(WIN32) || defined (_WINDOWS) - FreeLibrary(hDLL); -#else - dlclose(hDLL); -#endif - hDLL = NULL; - } - } - - void* Library::getSymbol(const string& symbol) - { - LOGINFO_1(3, "Library::getSymbol : %s", symbol.c_str()); - if (!hDLL) - { - return 0; - } -#if defined(WIN32) || defined (_WINDOWS) - return GetProcAddress(hDLL, symbol.c_str()); -#else - return dlsym(hDLL, symbol.c_str()); -#endif - } - - } // End namespace sca -} // End namespace tuscany - - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.h deleted file mode 100644 index 69b2f5352a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Library.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_util_library_h -#define tuscany_sca_util_library_h - - -#if defined(WIN32) || defined (_WINDOWS) -#include -#else -#include -#include -#endif - -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - /** - * Information about shared libraries and methods to - * access these shared libraries. - */ - class Library - { - public: - Library(); - - /** - * Constructor. Will load the library. - * @param libraryName Fully qualified name of the library. - */ - Library(const string& libraryName); - - /** - * Destructor. Will unload the library. - */ - virtual ~Library(); - - Library(const Library& lib); - Library& operator=(const Library& lib); - - /** - * Find an externalized symbol in the library. - * @param symbol The name of the symbol to be found. - * @return The pointer to the symbol if found, otherwise 0. - */ - void* getSymbol(const string& symbol); - private: - /** - * Name of the library. - */ - string name; - - /** - * Handle to the loaded library. - */ -#if defined(WIN32) || defined (_WINDOWS) - HINSTANCE hDLL; -#else - void* hDLL; -#endif - - /** - * Load the library. - */ - void load(); - - /** - * Unload the library, if successfully loaded. - */ - void unload(); - - }; - - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_util_library_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp deleted file mode 100644 index d77d1e4bfd..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include "tuscany/sca/util/LogWriter.h" - -namespace tuscany -{ - namespace sca - { - LogWriter::~LogWriter() - { - } - - } // End namespace sca -} // End namespace tuscany - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.h deleted file mode 100644 index edb07c3684..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/LogWriter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_util_logwriter_h -#define tuscany_sca_util_logwriter_h - -#include "osoa/sca/export.h" - -namespace tuscany -{ - namespace sca - { - /** - * Abstract class for extending logging to other destinations. - */ - class SCA_API LogWriter - { - public: - virtual ~LogWriter(); - - /** - * Log a message. - * @param level The level of logging for this message. - * @param msg The message to log. - */ - virtual void log(int level, const char* msg) = 0; - }; - - } // End namespace sca -} // End namespace tuscany -#endif // tuscany_sca_util_logwriter_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.cpp deleted file mode 100644 index 0a888a69ef..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#include -#include - -#include "tuscany/sca/util/Logger.h" -#include "tuscany/sca/util/DefaultLogWriter.h" -#include "tuscany/sca/util/FileLogWriter.h" - -using namespace std; - -namespace tuscany -{ - namespace sca - { - LogWriter* Logger::logWriter = getLogWriter(); - - LogWriter* Logger::getLogWriter() - { - if (logWriter == 0) - { - setLogWriter(0); - } - return logWriter; - } - - void Logger::setLogWriter(LogWriter* writer) - { - if (logWriter != writer - && logWriter != 0) - { - delete logWriter; - } - - if (writer == 0) - { - char* loggingVar = 0; - loggingVar = getenv("TUSCANY_SCACPP_LOG"); - if (loggingVar == 0) - logWriter = new DefaultLogWriter; - else - logWriter = new FileLogWriter(loggingVar); - } - else - { - logWriter = writer; - } - } - - int Logger::loggingLevel = setLogging(); - - int Logger::setLogging() - { - char* loggingVar = 0; - loggingVar = getenv("TUSCANY_SCACPP_LOGGING"); - if (loggingVar == 0) - return 0; - else - return atoi(loggingVar); - } - - void Logger::setLogging(int level) - { - loggingLevel = level; - } - - void Logger::log(int level, const char* msg) - { - if (level <= loggingLevel) - { - logWriter->log(level, msg); - } - } - - void Logger::logArgs(int level, const char* msg, ...) - { - if (level <= loggingLevel) - { - va_list variableArguments; - va_start(variableArguments, msg); - char messageBuffer[1024]; - vsprintf(messageBuffer, msg, variableArguments); - logWriter->log(level, messageBuffer); - va_end(variableArguments); - } - } - - } // End namespace sca -} // End namespace tuscany - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.h deleted file mode 100644 index be5e47e02a..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logger.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_util_logger_h -#define tuscany_sca_util_logger_h - -#include "osoa/sca/export.h" -#include "tuscany/sca/util/LogWriter.h" -namespace tuscany -{ - namespace sca - { - /** - * Provide a logging interface. - */ - class Logger { - - public: - /** - * Set the log writer to use. - * @param writer The writer to use for all subsequent logging. - */ - SCA_API static void setLogWriter(LogWriter* writer); - - /** - * Set or reset the logging level. Any message with a higher logging - * level than this value will be filtered (i.e. not shown). - * @param level The level of logging to use for all subsequent logging. - */ - SCA_API static void setLogging(int level); - - /** - * Log a message. - * @param level The log level of this message. - * @param msg The message to be logged. - */ - SCA_API static void log(int level, const char* msg); - - /** - * Log a message with variable arguments. - * @param level The log level of this message. - * @param msg The message to be logged. Must include template - * characters as described in printf. - * @param ... Variable arguments. - */ - SCA_API static void logArgs(int level, const char* msg, ...); - - /** - * The currently set logging level - */ - SCA_API static int loggingLevel; - - private: - /** - * The current log writer. - */ - static LogWriter* logWriter; - - /** - * Get the current log writer. - * @return The current log writer. - */ - static LogWriter* getLogWriter(); - - /** - * Retrieves the logging level set as an environment variable. - */ - static int setLogging(); - }; - - } // End namespace sca -} // End namespace tuscany -#endif // tuscany_sca_util_logger_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logging.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logging.h deleted file mode 100644 index 7e3a1a84ab..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Logging.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_util_logging_h -#define tuscany_sca_util_logging_h - -#include "tuscany/sca/util/Logger.h" - -#define LOGENTRY(level, methodName) \ -if (Logger::loggingLevel >= level) \ -Logger::log(level, "Entering: " methodName); - -#define LOGEXIT(level, methodName) \ -if (Logger::loggingLevel >= level) \ -Logger::log(level, "Exiting: " methodName); - -#define LOGINFO(level, message) \ -if (Logger::loggingLevel >= level) \ -Logger::log(level, message); - -#define LOGINFO_1(level, message, arg1) \ -if (Logger::loggingLevel >= level) \ -Logger::logArgs(level, message, arg1); - -#define LOGINFO_2(level, message, arg1, arg2) \ -if (Logger::loggingLevel >= level) \ -Logger::logArgs(level, message, arg1, arg2); - -#define LOGERROR(level, message) \ -if (Logger::loggingLevel >= level) \ -Logger::log(level, message); - -#define LOGERROR_1(level, message, arg1) \ -if (Logger::loggingLevel >= level) \ -Logger::logArgs(level, message, arg1); - -#define LOGERROR_2(level, message, arg1, arg2) \ -if (Logger::loggingLevel >= level) \ -Logger::logArgs(level, message, arg1, arg2); - -#endif // tuscany_sca_util_logging_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Utils.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Utils.cpp deleted file mode 100644 index 6417ed3da4..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/util/Utils.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "tuscany/sca/util/Utils.h" - -using namespace std; -using namespace commonj::sdo; -namespace tuscany -{ - namespace sca - { - void Utils::tokeniseUri(const string& uri, string& token1, string& token2) - { - tokeniseString("/", uri, token1, token2); - } - - void Utils::tokeniseQName(const string& qname, string& uri, string& name) - { - tokeniseString("#", qname, uri, name); - if (name == "") - { - name = uri; - uri = ""; - } - } - - void Utils::tokeniseString( - const string& separator, - const string& str, - string& token1, - string& token2) - { - string::size_type sep = str.find(separator); - if (sep != string::npos) - { - token1 = str.substr(0, sep); - if ( (sep+1) < str.length()) - { - token2 = str.substr(sep+1); - } - else - { - token2 = ""; - } - } - else - { - token1 = str; - token2 = ""; - } - } - - void Utils::rTokeniseString( - const string& separator, - const string& str, - string& token1, - string& token2) - { - string::size_type sep = str.rfind(separator); - if (sep != string::npos) - { - token1 = str.substr(0, sep); - if ( (sep+1) < str.length()) - { - token2 = str.substr(sep+1); - } - else - { - token2 = ""; - } - } - else - { - token1 = ""; - token2 = str; - } - } - - ////////////////////////////////////////////////////////////////////////// - // Print a DatObject tree - ////////////////////////////////////////////////////////////////////////// - void Utils::tabs(int inc) - { - for (int ind=0; ind getType(); - tabs(inc); - cout << "DataObject type: " << dataObjectType.getURI()<< "#" << dataObjectType.getName() << endl; - inc++; - - ////////////////////////////////////////////////////////////////////////// - // Iterate over all the properties - ////////////////////////////////////////////////////////////////////////// - PropertyList pl = dataObject->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) - { - tabs(inc); - cout << "Property: " << pl[i].getName() << endl; - - const Type& propertyType = pl[i].getType(); - - tabs(inc); - cout << "Property Type: " << propertyType.getURI()<< "#" << propertyType.getName() << endl; - - if (dataObject->isSet(pl[i])) - { - - ////////////////////////////////////////////////////////////////////// - // For a many-valued property get the list of values - ////////////////////////////////////////////////////////////////////// - if (pl[i].isMany()) - { - inc++; - DataObjectList& dol = dataObject->getList(pl[i]); - for (int j = 0; j getCString(pl[i]) <getDataObject(pl[i]), inc); - inc--; - } - } - else - { - tabs(inc); - cout<< "Property Value: not set" <getTypes(); - for (int i = 0; i < tl.size(); i++) - { - cout << "Type: " << tl[i].getURI()<< "#" << tl[i].getName() << endl; - PropertyList pl = tl[i].getProperties(); - for (int j = 0; j < pl.size(); j++) - { - cout << "\tProperty: " << pl[j].getName() - << " type: " < -using std::string; -#include "commonj/sdo/SDO.h" - -#include "osoa/sca/export.h" - -namespace tuscany -{ - namespace sca - { - /** - * Utility methods to parse strings and provide debugging information. - */ - class Utils { - - public: - static void tokeniseUri(const string& uri, string& token1, string& token2); - static void tokeniseQName(const string& sdoname, string& uri, string& name); - static void tokeniseString( - const string& separator, - const string& str, - string& token1, - string& token2); - - static void rTokeniseString( - const string& separator, - const string& str, - string& token1, - string& token2); - - SCA_API static void printDO(commonj::sdo::DataObjectPtr dataObject, int increment=0); - SCA_API static void printTypes(commonj::sdo::DataFactoryPtr df); - - private: - static void tabs(int increment=0); - }; - - } // End namespace sca -} // End namespace tuscany -#endif // tuscany_sca_util_utils_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.cpp b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.cpp deleted file mode 100644 index dcf974623d..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright 2006 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "tuscany/sca/ws/EntryPointProxy.h" - -using namespace tuscany::sca; - -#include "tuscany/sca/util/Exceptions.h" -#include "tuscany/sca/util/Logging.h" -#include "tuscany/sca/util/Utils.h" -#include "tuscany/sca/core/SCARuntime.h" - -#include "tuscany/sca/model/WSBinding.h" - -#include "commonj/sdo/SDO.h" -using namespace commonj::sdo; - -using namespace tuscany::sca::ws; - - -// Singleton pattern -EntryPointProxy* EntryPointProxy::entryPointProxyInstance = new EntryPointProxy(); - -EntryPointProxy* EntryPointProxy::getInstance() -{ - return entryPointProxyInstance; -} - -EntryPointProxy::EntryPointProxy() -{ - LOGENTRY(1,"EntryPointProxy::constructor"); - tuscanyRuntime = NULL; - scaEntryPoint = NULL; - entryPointName = ""; - systemRoot = ""; - moduleComponent = ""; - LOGEXIT(1,"EntryPointProxy::constructor"); -} - -EntryPointProxy::~EntryPointProxy() -{ - LOGENTRY(1,"EntryPointProxy::destructor"); - - if(tuscanyRuntime != NULL) - { - tuscanyRuntime->stop(); - delete tuscanyRuntime; - tuscanyRuntime = NULL; - } - if(scaEntryPoint != NULL) - { - delete scaEntryPoint; - } - LOGEXIT(1,"EntryPointProxy::destructor"); -} - -void EntryPointProxy::init(const char* systemRootPath, const char* fullEntryPointName) -{ - LOGENTRY(1,"EntryPointProxy::init"); - - try - { - - // fullEntryPointName is of the form "subsystem name"/"module component name"/"entry point name" - // Get the "subsystem name"/"module component name" part for setDefaultModuleComponent - // Keep the "entry point name" part for use in invoke - string subsystemAndComponentName, epName; - Utils::rTokeniseString("/", fullEntryPointName, subsystemAndComponentName, epName); - - bool newInitParams = false; - - if(systemRoot.length() != 0 && systemRoot != systemRootPath) - { - systemRoot = systemRootPath; - newInitParams = true; - } - - if(moduleComponent.length() != 0 && moduleComponent != subsystemAndComponentName) - { - moduleComponent = subsystemAndComponentName; - newInitParams = true; - } - - if(entryPointName.length() != 0 && entryPointName != epName) - { - entryPointName = epName; - newInitParams = true; - } - - - if(tuscanyRuntime == NULL) - { - LOGINFO(4, "Creating new TuscanyRuntime"); - moduleComponent = subsystemAndComponentName; - systemRoot = systemRootPath; - entryPointName = epName; - tuscanyRuntime = new TuscanyRuntime(moduleComponent, systemRoot); - tuscanyRuntime->start(); - } - else if(tuscanyRuntime != NULL && newInitParams) - { - LOGINFO(4, "Restarting TuscanyRuntime with new SystemRoot or DefaultModule"); - tuscanyRuntime->stop(); - tuscanyRuntime->setDefaultModuleComponent(moduleComponent); - tuscanyRuntime->setSystemRoot(systemRoot); - tuscanyRuntime->start(); - } - - if(scaEntryPoint == NULL) - { - scaEntryPoint = new SCAEntryPoint(fullEntryPointName); - } - else - { - if(newInitParams) - { - delete scaEntryPoint; - scaEntryPoint = NULL; - scaEntryPoint = new SCAEntryPoint(fullEntryPointName); - } - } - } - catch(SystemConfigurationException &ex) - { - LOGERROR_1(0, "SystemConfigurationException has been caught: %s\n", ex.getMessageText()); - scaEntryPoint = 0; - } - catch(ServiceRuntimeException &ex) - { - LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText()); - scaEntryPoint = 0; - } - LOGEXIT(1,"EntryPointProxy::init"); -} - -DataFactoryPtr EntryPointProxy::getDataFactory() -{ - if (scaEntryPoint == 0) return 0; - return scaEntryPoint->getDataFactory(); -} - -/// -/// This method will be called when an EntryPoint needs to be invoked. -/// -DataObjectPtr EntryPointProxy::invoke(const char* operationName, DataObjectPtr inputDataObject) -{ - LOGENTRY(1,"EntryPointProxy::invoke"); - - if (scaEntryPoint == 0) - { - LOGINFO(4, "EntryPointProxy has not got an sca EntryPoint\n"); - return NULL; - } - - DataFactoryPtr dataFactoryPtr = scaEntryPoint->getDataFactory(); - - DataObjectPtr outputDataObject = NULL; - SCARuntime* runtime = SCARuntime::getInstance(); - - Module* module = runtime->getCurrentModule(); - - EntryPoint* entryPoint = module->findEntryPoint(entryPointName); - - Binding* binding = entryPoint->getBinding(); - if(binding->getBindingType() == Binding::SCA) - { - LOGINFO_1(4, "EntryPointProxy has got SCA binding: %s\n", binding->getUri().c_str()); - LOGERROR(0, "EntryPoints with SCA bindings are not yet supported"); - return NULL; - } - else if(binding->getBindingType() == Binding::WS) - { - WSBinding* wsBinding = (WSBinding*) binding; - - string wsdlNamespace = wsBinding->getWSDLNamespaceURL(); - string wsdlPort = wsBinding->getPortName(); - string wsdlService = wsBinding->getServiceName(); - - Wsdl* wsdl = module->findWsdl(wsdlNamespace); - if (wsdl == 0) - { - LOGINFO_1(0, "WSDL description %s not found\n", wsdlNamespace.c_str()); - return NULL; - } - - WsdlOperation operation; - try - { - operation = wsdl->findOperation(wsdlService, wsdlPort, operationName); - } - catch(SystemConfigurationException &ex) - { - LOGERROR_1(0, "SystemConfigurationException has been caught: %s\n", ex.getMessageText()); - return NULL; - } - - LOGINFO_2(4, "EntryPointProxy has got WsdlOperation with inputType: %s#%s", - operation.getInputTypeUri().c_str(), - operation.getInputTypeName().c_str()); - LOGINFO_2(4, "EntryPointProxy has got WsdlOperation with outputType: %s#%s", - operation.getOutputTypeUri().c_str(), - operation.getOutputTypeName().c_str()); - LOGINFO_2(4, "EntryPointProxy has got WsdlOperation with documentStyle=%d and encoded=%d", - operation.isDocumentStyle(), - operation.isEncoded()); - - if(operation.isDocumentStyle()) - { - // Document style - outputDataObject = dataFactoryPtr->create(operation.getOutputTypeUri().c_str(), operation.getOutputTypeName().c_str()); - - //printf("outputDataObject %s#%s\n", outputDataObject->getType().getURI(), outputDataObject->getType().getName()); - //Utils::printDO(outputDataObject); - } - else - { - // RPC style - LOGERROR(0, "EntryPoints with RPC style WSDL Operations are not yet supported"); - return NULL; - } - } - - // Create new Operation object and set parameters and return value - Operation operation(operationName); - - // Go through input data object to set the operation parameters - PropertyList pl = inputDataObject->getInstanceProperties(); - - for(int i=0; igetBoolean(pl[i]); - //printf("inputDataObject has BooleanType named %s with value %d\n", name, boolData); - operation.addParameter(boolData); - } - break; - case Type::ByteType: - { - char* byteData = new char; - //printf("inputDataObject has ByteType named %s\n", name); - *byteData = inputDataObject->getByte(pl[i]); - operation.addParameter(byteData); - } - break; - case Type::BytesType: - { - int len = inputDataObject->getLength(pl[i]); - char* bytesData = new char[len+1]; - int bytesWritten = inputDataObject->getBytes(pl[i], bytesData, len); - // Ensure the bytes end with the null char. Not sure if this is neccessary - if(bytesWritten <= len) - { - bytesData[bytesWritten] = 0; - } - else - { - bytesData[len] = 0; - } - //printf("inputDataObject has BytesType named %s with length %d\n", name, bytesWritten); - operation.addParameter(&bytesData); - } - break; - case Type::CharacterType: - { - // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType - wchar_t* charData = new wchar_t; - //printf("inputDataObject has CharacterType named %s\n", name); - *charData = inputDataObject->getCharacter(pl[i]); - operation.addParameter(charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = new long double; - *doubleData = inputDataObject->getDouble(pl[i]); - //printf("inputDataObject has DoubleType named %s\n", name); - operation.addParameter(doubleData); - } - break; - case Type::FloatType: - { - float* floatData = new float; - *floatData = inputDataObject->getFloat(pl[i]); - //printf("inputDataObject has FloatType named %s with value %f\n", name, *floatData); - operation.addParameter(floatData); - } - break; - case Type::IntegerType: - { - long* intData = new long; - //printf("inputDataObject has IntegerType named %s\n", name); - *intData = inputDataObject->getInteger(pl[i]); - operation.addParameter(intData); - } - break; - case Type::ShortType: - { - short* shortData = new short; - //printf("inputDataObject has ShortType named %s\n", name); - *shortData = inputDataObject->getShort(pl[i]); - operation.addParameter(shortData); - } - break; - case Type::StringType: - { - const char* stringData = inputDataObject->getCString(pl[i]); - //printf("inputDataObject has StringType named %s with value %s\n", name, stringData); - operation.addParameter(&stringData); - } - break; - case Type::DataObjectType: - { - DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]); - //printf("inputDataObject has DataObjectType named %s (#%d)\n", name, dataObjectData); - - if(!dataObjectData) - { - LOGINFO_1(4, "SDO DataObject parameter named %s was null", name); - } - operation.addParameter(&dataObjectData); - } - break; - case Type::OpenDataObjectType: - { - /* - * This code deals with xsd:any element parameters - * Get each element as a DataObject and add in to the parameter list - */ - - //printf("inputDataObject has OpenDataObjectType named %s\n", name); - DataObjectList& dataObjectList = inputDataObject->getList(pl[i]); - - for(int j=0; jgetInstanceProperties(); - - // Set up the possible return value pointers - bool boolData = 0; - char byteData = 0; - wchar_t charData = 0; - long double doubleData = 0; - float floatData = 0; - long intData = 0; - short shortData = 0; - const char* stringData; - DataObjectPtr dataObjectData; - - - // There should only be one return value, but go through any list anyway? - if(pl.size() > 1) - { - LOGINFO(4, "More than one return value is defined in the WSDL, just defining the first"); - } - else if(pl.size() == 0) - { - if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with returning xsd:any elements - * Return as a DataObject set within the outputDataObject - */ - - // An OpenDataObject for the data to return in - operation.setReturnValue(&dataObjectData); - } - else - { - LOGINFO(4, "No return values are defined in the WSDL"); - } - - } - - if(pl.size() > 0) - { - const char* name = pl[0].getName(); - - switch (pl[0].getTypeEnum()) - { - case Type::BooleanType: - { - //printf("outputDataObject has BooleanType named %s\n", name); - operation.setReturnValue(&boolData); - } - break; - case Type::ByteType: - { - //printf("outputDataObject has ByteType named %s\n", name); - operation.setReturnValue(&byteData); - } - break; - case Type::CharacterType: - { - //printf("outputDataObject has CharacterType named %s\n", name); - operation.setReturnValue(&charData); - } - break; - case Type::DoubleType: - { - //printf("outputDataObject has DoubleType named %s\n", name); - operation.setReturnValue((long double*) &doubleData); - } - break; - case Type::FloatType: - { - //printf("outputDataObject has FloatType named %s\n", name); - operation.setReturnValue(&floatData); - } - break; - case Type::IntegerType: - { - //printf("outputDataObject has IntegerType named %s\n", name); - operation.setReturnValue(&intData); - } - break; - case Type::ShortType: - { - //printf("outputDataObject has ShortType named %s\n", name); - operation.setReturnValue(&shortData); - } - break; - case Type::StringType: - case Type::BytesType: - { - //printf("outputDataObject has StringType or BytesType named %s\n", name); - operation.setReturnValue((const char**) &stringData); - } - break; - case Type::DataObjectType: - { - // printf("outputDataObject has DataObjectType named %s with type %s # %s\n", name, pl[0].getType().getURI(), pl[0].getType().getName()); - operation.setReturnValue(&dataObjectData); - } - break; - case Type::DateType: - LOGERROR_1(0, "SDO DateType return values are not yet supported (%s)", name); - return NULL; - case Type::LongType: - LOGERROR_1(0, "SDO LongType (int64_t) return values are not yet supported (%s)", name); - return NULL; - case Type::UriType: - LOGERROR_1(0, "SDO UriType return values are not yet supported (%s)", name); - return NULL; - case Type::BigDecimalType: - LOGERROR_1(0, "SDO BigDecimalType return values are not yet supported (%s)", name); - return NULL; - case Type::BigIntegerType: - LOGERROR_1(0, "SDO BigIntegerType return values are not yet supported (%s)", name); - return NULL; - default: - LOGERROR_1(0, "Unknown SDO type return value named %s has been found. Unknown types are not yet supported", name); - return NULL; - } - } - - try - { - // Call into the wired module - scaEntryPoint->invoke(operation); - - // Set the data in the outputDataObject to be returned - setOutputData(operation, outputDataObject); - } - catch(SDORuntimeException &ex) - { - // TODO: Return more error information than just a null DataObject - LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText()); - return NULL; - } - catch(ServiceRuntimeException &ex) - { - // TODO: Return more error information than just a null DataObject - LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText()); - return NULL; - } - - LOGEXIT(1,"EntryPointProxy::invoke"); - - return outputDataObject; -} - - -void EntryPointProxy::setOutputData(Operation operation, DataObjectPtr outputDataObject) -{ - // Go through data object to set the return value - PropertyList pl = outputDataObject->getInstanceProperties(); - - if(pl.size() == 0) - { - if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType()) - { - /* - * This code deals with returning xsd:any elements - * Return as a DataObject set within the outputDataObject - */ - - DataObjectPtr* dataObjectData = (DataObjectPtr*) operation.getReturnValue(); - //Utils::printDO(*dataObjectData); - - // Need to provide a name for the dataobject being returned, use the containment property name if there is one. - const char* rootName = "OpenDataObject"; - try - { - const Property& prop = (*dataObjectData)->getContainmentProperty(); - rootName = prop.getName(); - (*dataObjectData)->detach(); - } - catch(SDOPropertyNotFoundException&) - { - // DataObject has no containment property - use default rootName - } - outputDataObject->setDataObject(rootName, *dataObjectData); - } - else - { - LOGINFO(4, "No return values are defined in the WSDL"); - } - - } - - // Should only be one return value.. This goes through all return values - for(int i=0; isetBoolean(pl[i], *boolData); - } - break; - case Type::ByteType: - { - char* byteData = (char*) operation.getReturnValue(); - //printf("outputDataObject has ByteType named %s with value %c (#%d)\n", name, *byteData, *byteData); - outputDataObject->setByte(pl[i], *byteData); - } - break; - case Type::BytesType: - { - const char** bytesData = (const char**) operation.getReturnValue(); - // TODO This looks for the first NULL byte - this may not be the full length of the data... - int len = 0; - while((*bytesData)[len] != 0) - { - len++; - } - //printf("outputDataObject has BytesType named %s with value %s and length %d\n", name, *bytesData, len); - outputDataObject->setBytes(pl[i], *bytesData, len); - } - break; - case Type::CharacterType: - { - wchar_t* charData = (wchar_t*) operation.getReturnValue(); - //printf("outputDataObject has CharacterType named %s with value %s\n", name, charData); - outputDataObject->setCharacter(pl[i], *charData); - } - break; - case Type::DoubleType: - { - long double* doubleData = (long double*) operation.getReturnValue(); - //printf("outputDataObject has DoubleType named %s with value %f\n", name, *doubleData); - outputDataObject->setDouble(pl[i], *doubleData); - } - break; - case Type::FloatType: - { - float* floatData = (float*) operation.getReturnValue(); - //printf("outputDataObject has FloatType named %s with value %f \n", name, *floatData); - outputDataObject->setFloat(pl[i], *floatData); - } - break; - case Type::IntegerType: - { - long* intData = (long*) operation.getReturnValue(); - //printf("outputDataObject has IntegerType named %s with value %d\n", name, *intData); - outputDataObject->setInteger(pl[i], *intData); - } - break; - case Type::ShortType: - { - short* shortData = (short*) operation.getReturnValue(); - //printf("outputDataObject has ShortType named %s with value %d\n", name, *shortData); - outputDataObject->setShort(pl[i], *shortData); - } - break; - case Type::StringType: - { - const char** stringData = (const char**) operation.getReturnValue(); - //printf("outputDataObject has StringType named %s with value %s\n", name, *stringData); - outputDataObject->setCString(pl[i], *stringData); - } - break; - case Type::DataObjectType: - { - DataObjectPtr* dataObjectData = (DataObjectPtr*) operation.getReturnValue(); - //printf("outputDataObject has DataObjectType named %s with value (%d)\n", name, (*dataObjectData)); - outputDataObject->setDataObject(pl[i], *dataObjectData); - } - break; - case Type::DateType: - LOGERROR_1(0, "SDO DateType return values are not yet supported (%s)", name); - break; - case Type::LongType: - LOGERROR_1(0, "SDO LongType (int64_t) return values are not yet supported (%s)", name); - break; - case Type::UriType: - LOGERROR_1(0, "SDO UriType return values are not yet supported (%s)", name); - break; - case Type::BigDecimalType: - LOGERROR_1(0, "SDO BigDecimalType return values are not yet supported (%s)", name); - break; - case Type::BigIntegerType: - LOGERROR_1(0, "SDO BigIntegerType return values are not yet supported (%s)", name); - break; - default: - LOGERROR_1(0, "Unknown SDO type return value named %s has been found. Unknown types are not yet supported", name); - } - } -} - diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.h deleted file mode 100644 index 959a5ee07c..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/EntryPointProxy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef tuscany_sca_ws_entrypointproxy_h -#define tuscany_sca_ws_entrypointproxy_h - -#include "osoa/sca/export.h" - -#include "commonj/sdo/SDO.h" -using commonj::sdo::DataObjectPtr; - -#include "tuscany/sca/core/SCAEntryPoint.h" -using tuscany::sca::SCAEntryPoint; - -#include "tuscany/sca/core/TuscanyRuntime.h" -using tuscany::sca::TuscanyRuntime; - -#include -using std::string; - -namespace tuscany -{ - namespace sca - { - namespace ws - { - class SCA_API EntryPointProxy - { - public: - static EntryPointProxy* getInstance(); - virtual ~EntryPointProxy(); - virtual void init(const char* systemRoot, const char* entryPointName); - virtual DataFactoryPtr getDataFactory(void); - virtual DataObjectPtr invoke(const char* operationName, DataObjectPtr inputDataObject); - private: - EntryPointProxy(); - static EntryPointProxy* entryPointProxyInstance; - virtual void setOutputData(Operation operation, DataObjectPtr outputDataObject); - string entryPointName; - string systemRoot; - string moduleComponent; - SCAEntryPoint* scaEntryPoint; - TuscanyRuntime* tuscanyRuntime; - }; - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ws_entrypointproxy_h diff --git a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/WSServiceWrapper.h b/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/WSServiceWrapper.h deleted file mode 100644 index 713c575735..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3/sca/runtime/core/src/tuscany/sca/ws/WSServiceWrapper.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Rev$ $Date: 2005/12/22 11:33:21 $ */ - -#ifndef tuscany_sca_ws_wsservicewrapper_h -#define tuscany_sca_ws_wsservicewrapper_h -#include "osoa/sca/export.h" - -#include "tuscany/sca/core/ExternalServiceWrapper.h" -#include "tuscany/sca/model/ExternalService.h" -#include "tuscany/sca/core/Operation.h" - -namespace tuscany -{ - namespace sca - { - namespace ws - { - - class SCA_API WSServiceWrapper : public tuscany::sca::ExternalServiceWrapper - { - public: - WSServiceWrapper(tuscany::sca::model::WireTarget* target); - virtual ~WSServiceWrapper(); - - virtual void invoke(Operation& operation); - }; - } // End namespace ws - } // End namespace sca -} // End namespace tuscany - -#endif // tuscany_sca_ws_wsservicewrapper_h -- cgit v1.2.3