You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/08/28 12:42:20 UTC

svn commit: r437637 [5/8] - in /incubator/tuscany/cpp/sca: runtime/core/src/ runtime/core/src/osoa/sca/ runtime/core/src/tuscany/sca/core/ runtime/core/src/tuscany/sca/cpp/ runtime/core/src/tuscany/sca/extension/ runtime/core/src/tuscany/sca/model/ run...

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,89 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_model_servicebinding_h
+#define tuscany_sca_model_servicebinding_h
+#include <string>
+using std::string;
+
+#include "tuscany/sca/model/Binding.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        class ServiceWrapper;
+
+        using namespace tuscany::sca;
+        
+        namespace model
+        {
+            class Service;
+            
+            /**
+             * Represents a service binding.
+             * Bindings are used by services and references. References use bindings
+             * to describe the access mechanism used to call an external service (which can
+             * be a service provided by another SCA composite). Services use bindings to describe
+             * the access mechanism that clients (which can be a client from another SCA composite)
+             * have to use to call the service.
+             * This interface will typically be extended by binding implementations to allow
+             * specification of binding/transport specific information.
+             */
+            class ServiceBinding : public Binding 
+            {
+            public:
+
+                /**
+                 * Constructor to create a new binding.
+                 */ 
+                ServiceBinding(Service* service, const string& uri);
+
+                /**
+                 * Destructor.
+                 */ 
+                virtual ~ServiceBinding();
+                            
+               /**
+                 * Create a service wrapper handling the interaction
+                 * with the service configured with this binding.
+                 */
+                 virtual ServiceWrapper* getServiceWrapper() = 0;
+ 
+                /**
+                 * Returns the service
+                 * @return The service.
+                 */
+                 Service* getService() const { return service; };
+                                
+             private:
+            
+                /**
+                 * The service configured with the binding.
+                 */
+                 Service* service;
+            
+            };
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_servicebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,56 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/model/ServiceType.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            
+            
+            // Constructor
+            ServiceType::ServiceType(ComponentType* componentType, const string& name,
+                Interface* interface, Interface* callbackInterface, bool conversational)
+                : Contract(interface, callbackInterface, conversational),
+                componentType(componentType), name(name)
+            {
+            }
+
+            // Destructor
+            ServiceType::~ServiceType()
+            {
+            }
+
+            void ServiceType::setBinding(Binding* binding)
+            {
+                this->binding = binding;
+            }
+            
+            Binding* ServiceType::getBinding() const
+            {
+                return binding;
+            }
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,107 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_model_servicetype_h
+#define tuscany_sca_model_servicetype_h
+
+#include <string>
+using std::string;
+
+#include "tuscany/sca/model/Contract.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            class ComponentType;
+            class Binding;
+            class Interface;
+
+            /**
+             * Represents a service type. Services are used to publish services provided by
+             * implementations, so that they are addressable by other components.
+             */
+            class ServiceType : public Contract
+            {
+            public:
+            
+                /**
+                 * Constructor.
+                 * @param componentType The component type on which this service is defined.
+                 * @param name The name of the service.
+                 */
+                ServiceType(ComponentType* componentType, const string& name,
+                    Interface* interface, Interface* callbackInterface, bool conversational);
+
+                /**
+                 * Destructor.
+                 */
+                 virtual ~ServiceType();
+                 
+                /**
+                 * Returns the component type on which this service is defined.
+                 * @return The component type on which this service is defined.
+                 */
+                ComponentType* getComponentType() const { return componentType; }
+
+                /**
+                 * Returns the name of the service type.
+                 * @return The name of the service type
+                 */
+                 string getName() const { return name; }
+
+                /**
+                 * Returns the binding supported by this service type.
+                 * @return The binding supported by this service type
+                 */
+                Binding* getBinding() const;
+                
+                /**
+                 * Sets the binding supported by this service type.
+                 * @param binding the binding supported by this service type
+                 */
+                void setBinding(Binding* binding);
+
+            private:
+
+                /**
+                 * The component type on which this service is defined.
+                 */
+                 ComponentType* componentType;
+                 
+                 /**
+                  * The name of the service type.
+                  */
+                 string name;
+
+                /**
+                 * The binding supported by this service
+                 */
+                 Binding* binding;
+
+            };
+
+         } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_servicetype_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ServiceType.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,353 @@
+/*
+ *
+ *  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/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLOperation.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
+            WSDLDefinition::WSDLDefinition(DataObjectPtr wsdlModel) 
+                : wsdlModel(wsdlModel)
+            {
+                LOGENTRY(1, "WSDLDefinition::constructor");
+
+                // Trace
+                //Utils::printDO(wsdlModel);
+                
+                LOGEXIT(1, "WSDLDefinition::constructor");
+            }
+
+            WSDLDefinition::~WSDLDefinition()
+            {
+            }
+
+
+            /// 
+            /// The namespace of the service and other definitions defined in this wsdl definition
+            string WSDLDefinition::getNamespace()
+            {
+                return wsdlModel->getCString("targetNamespace");
+            }
+
+            ///
+            /// Find the operation defined in this wsdl
+            ///
+            const WSDLOperation& WSDLDefinition::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; j<portList.size();j++)
+                    {
+                        string portListName(portList[j]->getCString("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; i<bindingOperationList.size(); i++)
+                            {
+                                string name(bindingOperationList[i]->getCString("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 WSDLDefinition::findService(const string& serviceName)
+            {
+                DataObjectPtr service = 0;
+        
+
+                // Find the binding
+                DataObjectList& serviceList = wsdlModel->getList("service");
+                for (int i=0; i<serviceList.size(); i++)
+                {
+                    string name(serviceList[i]->getCString("name"));
+
+                    if (name.compare(serviceName) == 0)
+                    {
+                        return serviceList[i];
+                    }
+                }
+
+                return service;
+            }
+
+
+            ///
+            /// Find a named binding
+            ///
+            DataObjectPtr WSDLDefinition::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; i<bindingList.size(); i++)
+                {
+                    string nameBinding(bindingList[i]->getCString("name"));
+
+                    if (nameBinding.compare(name) == 0)
+                    {
+                        return bindingList[i];
+                    }
+                }
+
+                return binding;
+            }
+
+            ///
+            /// Find a named portType
+            ///
+            DataObjectPtr WSDLDefinition::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; i<portTypeList.size(); i++)
+                {
+                    string namePortType(portTypeList[i]->getCString("name"));
+
+                    if (namePortType.compare(name) == 0)
+                    {
+                        return portTypeList[i];
+                    }
+                }
+
+                return portType;
+            }
+
+            ///
+            /// Find a named message
+            ///
+            DataObjectPtr WSDLDefinition::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; i<messageList.size(); i++)
+                {
+                    string nameMessage(messageList[i]->getCString("name"));
+
+                    if (nameMessage.compare(name) == 0)
+                    {
+                        return messageList[i];
+                    }
+                }
+
+                return message;
+            }
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,129 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_model_wsdldefinition_h
+#define tuscany_sca_model_wsdldefinition_h
+
+#include "osoa/sca/export.h"
+#include <string>
+using std::string;
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+#include <map>
+using std::map;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            
+            class WSDLOperation;
+
+            /**
+             * Holds information about a WSDL definition loaded into the runtime.
+             */ 
+            class WSDLDefinition
+            {
+            public:
+                /**
+                 * Constructor.
+                 * @param wsdlModel The data object representing the WSDL document
+                 * defining a web service.
+                 */
+                 WSDLDefinition(DataObjectPtr wsdlModel);
+
+                /**
+                 * Destructor.
+                 */ 
+                ~WSDLDefinition();
+
+
+                /**
+                 * 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<string, WSDLOperation> OperationMap;
+                OperationMap operationMap;
+            };
+
+         } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_wsdldefinition_h
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,56 @@
+/*
+ *
+ *  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/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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,141 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_model_wsdloperation_h
+#define tuscany_sca_model_wsdloperation_h
+#include "osoa/sca/export.h"
+#include <string>
+using std::string;
+
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+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
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLOperation.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.h?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wire.h Mon Aug 28 03:42:10 2006
@@ -35,6 +35,7 @@
             class Wire
             {
             public: 
+            
                 /**
                  * Constructor.
                  * @param source The source of the wire. Either the component and 
@@ -42,7 +43,7 @@
                  * @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);
+                Wire(const string& source, const string& target);
 
                 /**
                  * Destructor.
@@ -53,19 +54,20 @@
                  * 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;}
+                const string& getSourceComponent() const { 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;}
+                const string& getSourceReference() const { 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;}
+                const string& getTarget() { return target; }
+                
              private:
                 /**
                  * The source component of the wire.

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp Mon Aug 28 03:42:10 2006
@@ -110,7 +110,7 @@
             if (hDLL == NULL)
             {
                 LOGERROR_1(1, "Library::load: Unable to load library %s", name.c_str());
-                msg = "Unable to load dll: " + name;
+                msg = "Unable to load library: " + name;
                 throw ServiceRuntimeException(msg.c_str());
             }    
         }

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h Mon Aug 28 03:42:10 2006
@@ -23,35 +23,35 @@
 #include "tuscany/sca/util/Logger.h"
 
 #define LOGENTRY(level, methodName) \
-if (Logger::loggingLevel >= level) \
-Logger::log(level, "Entering: " methodName);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::log(level, "Entering: " methodName);
 
 #define LOGEXIT(level, methodName) \
-if (Logger::loggingLevel >= level) \
-Logger::log(level, "Exiting: " methodName);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::log(level, "Exiting: " methodName);
 
 #define LOGINFO(level, message) \
-if (Logger::loggingLevel >= level) \
-Logger::log(level, message);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::log(level, message);
 
 #define LOGINFO_1(level, message, arg1) \
-if (Logger::loggingLevel >= level) \
-Logger::logArgs(level, message, arg1);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::logArgs(level, message, arg1);
 
 #define LOGINFO_2(level, message, arg1, arg2) \
-if (Logger::loggingLevel >= level) \
-Logger::logArgs(level, message, arg1, arg2);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::logArgs(level, message, arg1, arg2);
 
 #define LOGERROR(level, message) \
-if (Logger::loggingLevel >= level) \
-Logger::log(level, message);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::log(level, message);
 
 #define LOGERROR_1(level, message, arg1) \
-if (Logger::loggingLevel >= level) \
-Logger::logArgs(level, message, arg1);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::logArgs(level, message, arg1);
 
 #define LOGERROR_2(level, message, arg1, arg2) \
-if (Logger::loggingLevel >= level) \
-Logger::logArgs(level, message, arg1, arg2);
+if (tuscany::sca::Logger::loggingLevel >= level) \
+tuscany::sca::Logger::logArgs(level, message, arg1, arg2);
 
 #endif // tuscany_sca_util_logging_h

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,138 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ws/WSReferenceBinding.h"
+#include "tuscany/sca/core/ServiceProxy.h"
+
+using namespace tuscany::sca;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ws
+        {
+
+            // Constructor
+            WSReferenceBinding::WSReferenceBinding(Reference* reference, const string& uri, const string& port)
+                : ReferenceBinding(reference, uri), port(port)
+            {
+                parsePort();
+            }
+            
+            void WSReferenceBinding::parsePort()
+            {
+                // Port is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<port-name>)
+                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 = "";
+                }
+            }
+
+            // Destructor
+            WSReferenceBinding::~WSReferenceBinding()
+            {
+            }
+            
+            void WSReferenceBinding::configure(ServiceBinding *binding)
+            {
+                //TODO configure this reference binding from the info in the
+                // given service binding
+            }
+            
+            ServiceProxy* WSReferenceBinding::getServiceProxy()
+            {
+                //TODO create the service proxy
+                return (ServiceProxy*)0;
+            }
+                
+        } // End namespace ws
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,125 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_ws_wsreferencebinding_h
+#define tuscany_sca_ws_wsreferencebinding_h
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ws
+        {
+            /**
+             * Information about a web service binding for service or a reference.
+             */
+            class WSReferenceBinding : public ReferenceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 * @param uri The uri of the binding.
+                 * @param port The definition of the port to which the entrypoint
+                 * or external service is to be bound. This is of the form
+                 * "namespace"#endpoint("service"/"port")
+                 */
+                WSReferenceBinding(Reference* reference, const string&uri, const string& port);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~WSReferenceBinding();
+                            
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; };
+                            
+                 /**
+                  * Configure this binding from a service binding.
+                  */
+                  virtual void configure(ServiceBinding* serviceBinding);
+                                
+                /**
+                 * Create a proxy representing the reference to the
+                 * client component.
+                 */
+                 virtual ServiceProxy* getServiceProxy();
+                                
+                /**
+                 * Return the part of the port definition describing the wsdl 
+                 * namespace.
+                 * @return The wsdl namespace.
+                 */
+                string getWSDLNamespaceURL() const { return wsdlNamespaceURL; };
+
+                /**
+                 * Return the service part of the port definition.
+                 * @return The service to use.
+                 */
+                string getServiceName() const { return serviceName; };
+
+                /**
+                 * Return the port name part of the port definition.
+                 * @return The port name to use.
+                 */
+                string getPortName() const { return portName; };
+                
+            private:
+            
+                /**
+                 * Parse the port specification.
+                 */
+                void parsePort();
+            
+                /**
+                 * 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_ws_wsreferencebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSReferenceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,134 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ws/WSServiceBinding.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/ws/WSServiceWrapper.h"
+
+using namespace tuscany::sca;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ws
+        {
+
+            // Constructor
+            WSServiceBinding::WSServiceBinding(Service* service, const string& uri, const string& port)
+                : ServiceBinding(service, uri), port(port)
+            {
+                parsePort();
+                
+                serviceWrapper = new WSServiceWrapper(service);
+            }
+
+            void WSServiceBinding::parsePort()
+            {
+                // Port is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<port-name>)
+                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 = "";
+                }
+            }
+
+            // Destructor
+            WSServiceBinding::~WSServiceBinding()
+            {
+            }
+            
+            ServiceWrapper* WSServiceBinding::getServiceWrapper()
+            {
+                return serviceWrapper;
+            }
+                
+        } // End namespace ws
+    } // End namespace sca
+} // End namespace tuscany

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,126 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_ws_wsservicebinding_h
+#define tuscany_sca_ws_wsservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace ws
+        {
+            /**
+             * Information about a web service binding for service or a reference.
+             */
+            class WSServiceBinding : public ServiceBinding
+            {    
+            public:
+
+                /**
+                 * Constructor.
+                 * @param uri The uri of the binding.
+                 * @param port The definition of the port to which the entrypoint
+                 * or external service is to be bound. This is of the form
+                 * "namespace"#endpoint("service"/"port")
+                 */
+                WSServiceBinding(Service* service, const string&uri, const string& port);  
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~WSServiceBinding();
+                            
+                /**
+                 * Returns the type of binding.
+                 */                
+                virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; };
+                            
+                /**
+                 * Create a wrapper for the service configured by this
+                 * binding.
+                 */
+                 virtual ServiceWrapper* getServiceWrapper();
+                                
+                /**
+                 * Return the part of the port definition describing the wsdl 
+                 * namespace.
+                 * @return The wsdl namespace.
+                 */
+                string getWSDLNamespaceURL() const { return wsdlNamespaceURL; };
+
+                /**
+                 * Return the service part of the port definition.
+                 * @return The service to use.
+                 */
+                string getServiceName() const { return serviceName; };
+
+                /**
+                 * Return the port name part of the port definition.
+                 * @return The port name to use.
+                 */
+                string getPortName() const { return portName; };
+                
+            private:
+            
+                /**
+                 * Parse the port specification.
+                 */
+                void parsePort();
+            
+                /**
+                 * 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;
+
+                /**
+                 * The wrapper for the service configured by this binding.
+                 */            
+                ServiceWrapper* serviceWrapper;
+            
+            };
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ws_wsservicebinding_h

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/WSServiceBinding.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org