You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2007/06/27 22:48:08 UTC

svn commit: r551319 - in /incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model: Composite.cpp Composite.h WSDLDefinition.cpp WSDLDefinition.h

Author: robbinspg
Date: Wed Jun 27 13:48:06 2007
New Revision: 551319

URL: http://svn.apache.org/viewvc?view=rev&rev=551319
Log:
TUSCANY-1383  Apply Brady Johnson's patches

Modified:
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.h
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.cpp?view=diff&rev=551319&r1=551318&r2=551319
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.cpp Wed Jun 27 13:48:06 2007
@@ -158,7 +158,7 @@
             void Composite::addInclude(Composite* composite)
             {
                 logentry(); 
-                includes.push_back(composite);
+                includes[composite->getName()] = composite;
 
                 for (COMPONENT_MAP::iterator iter = composite->components.begin();
                 iter != composite->components.end();
@@ -223,6 +223,50 @@
                 logentry(); 
                 return wsdlDefinitions[wsdlNamespace];
 
+            }
+
+            std::list<std::string> Composite::getWSDLNamespaces()
+            {
+                logentry();
+                std::list<std::string> namespaceList;
+                WSDL_MAP::const_iterator iter = wsdlDefinitions.begin();
+                WSDL_MAP::const_iterator iterEnd = wsdlDefinitions.end();
+
+                for( ; iter != iterEnd; ++iter )
+                {
+                    namespaceList.push_back( iter->first );
+                }
+
+                return namespaceList;
+            }
+
+            Composite* Composite::findIncludedComposite(const std::string& compositeName)
+            {
+                logentry();
+
+                // remember the map operator[] inserts a blank object if key not found
+                INCLUDES::iterator iter = includes.find( compositeName );
+                if( iter == includes.end() )
+                {
+                  return NULL;
+                }
+
+                return iter->second;
+            }
+
+            std::list<std::string> Composite::getIncludedComposites()
+            {
+                logentry();
+                std::list<std::string> compositeList;
+                INCLUDES::const_iterator iter = includes.begin();
+                INCLUDES::const_iterator iterEnd = includes.end();
+
+                for( ; iter != iterEnd; ++iter )
+                {
+                    compositeList.push_back( iter->first );
+                }
+
+                return compositeList;
             }
 
             commonj::sdo::XSDHelperPtr Composite::getXSDHelper()

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.h?view=diff&rev=551319&r1=551318&r2=551319
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Composite.h Wed Jun 27 13:48:06 2007
@@ -138,6 +138,24 @@
                  */
                 SCA_API WSDLDefinition* findWSDLDefinition(const std::string& wsdlNamespace);
 
+                /**
+                 * Get all loaded WSDL namespaces
+                 * @return A list of strings, each of which is a different project namespace
+                 */
+                SCA_API std::list<std::string> getWSDLNamespaces();
+
+                /**
+                 * Find an Included Composite by its name
+                 * @param compositeName The name of the included composite to find.
+                 */
+                SCA_API Composite* findIncludedComposite(const std::string& compositeName);
+
+                /**
+                 * Get all included composites
+                 * @return A list of Composite name strings
+                 */
+                SCA_API std::list<std::string> getIncludedComposites();
+
                  /**
                  * Initialize a component of this type.
                  * @param component The component to initialize.
@@ -190,9 +208,10 @@
                 COMPONENT_MAP components;
 
                 /**
-                 * Vector of all the composites included in this composite.
+                 * Map of all the composites included by this composite.
+                 * Map the Composite name to the Composite
                  */
-                typedef std::vector<Composite*> INCLUDES;
+                typedef std::map<std::string, Composite*> INCLUDES;
                 INCLUDES includes;
 
                 /**

Modified: 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?view=diff&rev=551319&r1=551318&r2=551319
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp Wed Jun 27 13:48:06 2007
@@ -335,7 +335,62 @@
                 throwException(SystemConfigurationException, message.c_str());
                 
             }
-            
+
+            ///
+            /// Get all of the PortType names defined in the wsdl
+            ///
+            std::list<std::string> WSDLDefinition::getPortTypes()
+            {
+                logentry();
+
+                std::list<std::string> ptList;
+                DataObjectPtr portType = 0;
+
+                // Find the binding
+                for (unsigned int m = 0; m < wsdlModels.size(); m++)
+                {
+                    DataObjectList& portTypeList = wsdlModels[m]->getList("portType");
+                    for (unsigned int i=0; i<portTypeList.size(); i++)
+                    {
+                        string namePortType(portTypeList[i]->getCString("name"));
+
+                        ptList.push_back( namePortType );
+                    }
+                }
+
+                return ptList;
+            }
+
+            ///
+            /// Get all of the operation names for the PortType specified
+            ///
+            std::list<std::string> WSDLDefinition::getOperations( const std::string &portTypeName )
+            {
+                logentry();
+
+                std::list<std::string> ptOpList;
+
+                // Get the portType
+                DataObjectPtr wsPortType = findPortType(portTypeName);
+                if (!wsPortType)
+                {
+                    string message = "Unable to find PortType ";
+                    message = message + portTypeName;
+                    message = message + " in the WSDL definition";
+                    throwException(SystemConfigurationException, message.c_str());
+                }
+
+                // Found the portType, find the operation
+                DataObjectList& operationList = wsPortType->getList("operation");
+                for (unsigned int i=0; i < operationList.size(); i++)
+                {
+                    string opName(operationList[i]->getCString("name"));
+                    ptOpList.push_back( opName );
+                }
+
+                return ptOpList;
+            }
+
             ///
             /// Find a service
             ///

Modified: 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?view=diff&rev=551319&r1=551318&r2=551319
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.h Wed Jun 27 13:48:06 2007
@@ -92,6 +92,19 @@
                  */
                 SCA_API const WSDLOperation& findOperation(const std::string& portTypeName, 
                                         const std::string& operationName);
+
+                /**
+                 * Get all of the PortTypes in this WSDL definition.
+                 * @return A standard list of standard strings, each being a different PortType
+                 */
+                SCA_API std::list<std::string> getPortTypes();
+
+                /**
+                 * Get all of the Operations for a particular PortType in this WSDL definition.
+                 * @param portTypeName Get all of the operations for this portTypeName
+                 * @return A standard list of standard strings, each of which is a different operation
+                 */
+                SCA_API std::list<std::string> getOperations( const std::string &portTypeName );
                 
             private:
 



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