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 [3/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...

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?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- 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 Mon Aug 28 03:42:10 2006
@@ -20,7 +20,13 @@
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/util/Utils.h"
 #include "tuscany/sca/model/Composite.h"
-
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Wire.h"
+#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/model/ReferenceBinding.h"
 
 namespace tuscany
 {
@@ -31,41 +37,31 @@
         {
             
             // Constructor
-            Composite::Composite(const std::string& compositeName) 
-                : name(compositeName)
+            Composite::Composite(const string& name, const string& root) 
+                : ComponentType(name), root(root)
             {
                 LOGENTRY(1, "Composite::constructor");
                 LOGEXIT(1, "Composite::constructor");
             }
             
+            // Destructor
             Composite::~Composite()
             {
             }
             
-            void Composite::setRoot(const std::string& rootDirectory)
-            {
-                compositeRoot = rootDirectory;
-            }
-            
-            
-            ///
-            /// Add a new component to the composite component
-            ///
-            Component* Composite::addComponent(const std::string& name)
+            void Composite::addComponent(Component* component)
             {
                 LOGENTRY(1, "Composite::addComponent");
-                Component* newComponent = new Component(name, this);
-                components[name] = newComponent;
+                components[component->getName()] = component;
                 LOGEXIT(1, "Composite::addComponent");
-                return newComponent;
             }
             
             Component* Composite::findComponent(const std::string& name)
             {
                 LOGENTRY(1, "Composite::findComponent");
-                Component* foundComponent = components[name];
+                Component* component = components[name];
                 LOGEXIT(1, "Composite::findComponent");
-                return foundComponent;
+                return component;
             }
             
             Service* Composite::findComponentService(const std::string& name)
@@ -79,128 +75,97 @@
                 Utils::tokeniseUri(name, componentName, serviceName);
                 
                 // Locate the component
-                Component* foundComponent = components[componentName];
-                if (foundComponent)
+                Component* component = findComponent(componentName);
+                if (component)
                 {
                     // Locate the service
-                    service = foundComponent->findService(serviceName);
+                    service = component->findService(serviceName);
                 }
                 LOGEXIT(1, "Composite::findComponentService");
                 return service;
             }
             
-            CompositeReferenceType* Composite::findCompositeReferenceType(const std::string& name)
-            {
-                LOGENTRY(1, "Composite::findCompositeReferenceType");
-                CompositeReferenceType* foundService = externalServices[name];
-                LOGEXIT(1, "Composite::findCompositeReferenceType");
-                return foundService;
-            }
-            
-            
-            CompositeServiceType* Composite::addCompositeServiceType(const std::string& name)
-            {
-                LOGENTRY(1, "Composite::addCompositeServiceType");
-                CompositeServiceType* ep = new CompositeServiceType(name);
-                compositeServices[name] = ep;
-                LOGEXIT(1, "Composite::addCompositeServiceType");
-                return findCompositeServiceType(name);
-            }
-            
-            CompositeServiceType* Composite::findCompositeServiceType(const std::string& name)
-            {
-                return compositeServices[name];
-            }
-
-
-            CompositeReferenceType* Composite::addCompositeReferenceType(const std::string& name)
-            {
-                LOGENTRY(1, "Composite::addCompositeReferenceType");
-                CompositeReferenceType* es = new CompositeReferenceType(name, this);
-                externalServices[name] = es;
-                LOGEXIT(1, "Composite::addCompositeReferenceType");
-                return es;
-            }
-            
             void Composite::addWire(const std::string& source, const std::string& target)
             {
                 LOGENTRY(1, "Composite::addWire");
-                wires.push_back(Wire(source, target));
+                Wire* wire=new Wire(source, target);
+                wires.push_back(wire);
                 LOGEXIT(1, "Composite::addWire");
             }
             
+            void Composite::addInclude(Composite* composite)
+            {
+                LOGENTRY(1, "Composite::addInclude");
+                includes.push_back(composite);
+
+                for (COMPONENT_MAP::iterator iter = composite->components.begin();
+                iter != composite->components.end();
+                iter++)
+                {
+                    components[iter->first] = iter->second;
+                } 
+                LOGEXIT(1, "Composite::addInclude");
+            }
             
             void Composite::resolveWires()
             {
                 LOGENTRY(1, "Composite::resolveWires");
-                 for (WIRES::iterator iter = wires.begin();
+
+                for (WIRES::iterator iter = wires.begin();
                 iter != wires.end();
                 iter++)
                 {
-                    // -----------------
+                    Wire* wire = *iter;
+                    
                     // Locate the target
-                    // -----------------
-                    WireTarget* target = findComponentService(iter->getTarget());
-                    if (!target)
-                    {
-                        target = findCompositeReferenceType(iter->getTarget());
-                    }
-                    if (!target)
+                    Service* service = findComponentService(wire->getTarget());
+                    if (!service)
                     {
-                        LOGERROR_1(0, "Composite::resolveWires: Wire target %s not found", iter->getTarget().c_str());
+                        LOGERROR_1(0, "Composite::resolveWires: Wire target %s not found", wire->getTarget().c_str());
                     }
                     else
                     {
-                        CompositeServiceType* entrypoint = findCompositeServiceType(iter->getSourceComponent());
-                        if (entrypoint)
+                        Component* component = findComponent(wire->getSourceComponent());
+                        if (component)
                         {
-                            entrypoint->addTarget(target);
-                        }
-                        else
-                        {
-                            Component* component = findComponent(iter->getSourceComponent());
-                            if (component)
+                            Reference* reference = component->findReference(wire->getSourceReference());
+                            if (reference)
                             {
-                                ServiceReference* serviceReference = component->findReference(iter->getSourceReference());
-                                if (serviceReference)
-                                {
-                                    serviceReference->addTarget(target);
-                                }
-                                else
-                                {
-                                    LOGERROR_1(0, "Composite::resolveWires: Wire source reference %s not found", iter->getSourceReference().c_str());
-                                }
+                                
+                                // Configure the binding on the reference from the binding on the target
+                                // service
+                                reference->getBinding()->configure(service->getBinding());
                             }
                             else
                             {
-                                LOGERROR_1(0, "Composite::resolveWires: Wire source %s not found", iter->getSourceComponent().c_str());
+                                LOGERROR_1(0, "Composite::resolveWires: Wire source reference %s not found", wire->getSourceReference().c_str());
                             }
                         }
+                        else
+                        {
+                            LOGERROR_1(0, "Composite::resolveWires: Wire source %s not found", wire->getSourceComponent().c_str());
+                        }
                     }
                 }
 
                 LOGEXIT(1, "Composite::resolveWires");
             }
 
-
-            
-            void Composite::addWsdl(commonj::sdo::DataObjectPtr wsdlModel)
+            void Composite::addWSDLDefinition(commonj::sdo::DataObjectPtr wsdlModel)
             {
-                LOGENTRY(1, "Composite::addWsdl");
-                Wsdl* wsdl = new Wsdl(wsdlModel);
-                wsdls[wsdl->getNamespace()] = wsdl;
-                LOGEXIT(1, "Composite::addWsdl");
+                LOGENTRY(1, "Composite::addWSDLDefinition");
+                WSDLDefinition* wsdlDefinition = new WSDLDefinition(wsdlModel);
+                wsdlDefinitions[wsdlDefinition->getNamespace()] = wsdlDefinition;
+                LOGEXIT(1, "Composite::addWSDLDefinition");
 
             }
 
-            Wsdl* Composite::findWsdl(const std::string& wsdlNamespace )
+            WSDLDefinition* Composite::findWSDLDefinition(const std::string& wsdlNamespace )
             {
-                return wsdls[wsdlNamespace];
+                return wsdlDefinitions[wsdlNamespace];
 
             }
 
-
-            // Get an XSDHelper - one will be created for each composite
             commonj::sdo::XSDHelperPtr Composite::getXSDHelper()
             {
                 if (xsdHelper == 0)
@@ -211,7 +176,6 @@
                 return xsdHelper;
             }
 
-            // Get an XMLHelper - one will be created for each composite
             commonj::sdo::XMLHelperPtr Composite::getXMLHelper()
             {
                 if (xmlHelper == 0)
@@ -222,14 +186,11 @@
                 return xmlHelper;
             }
 
-
-            // Get a data factory - the one in the xsd/xml helper
             commonj::sdo::DataFactoryPtr Composite::getDataFactory()
             {
                 return getXSDHelper()->getDataFactory();
             }
             
         } // End namespace model
-        
     } // End namespace sca
 } // End namespace tuscany

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?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- 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 Mon Aug 28 03:42:10 2006
@@ -30,12 +30,7 @@
 
 #include "commonj/sdo/SDO.h"
 
-
-#include "tuscany/sca/model/Component.h"
-#include "tuscany/sca/model/CompositeReferenceType.h"
-#include "tuscany/sca/model/CompositeServiceType.h"
-#include "tuscany/sca/model/Wire.h"
-#include "tuscany/sca/model/Wsdl.h"
+#include "tuscany/sca/model/ComponentType.h"
 
 
 namespace tuscany
@@ -45,17 +40,29 @@
 
         namespace model
         {
+            class Component;
+            class ComponentType;
+            class Service;
+            class WSDLDefinition;
+            class Wire;
+            
             /**
-             * Information about a composite.
+             * Represents a composite.
+             * A composite is used to assemble SCA elements in logical groupings.
+             * It is the basic unit of composition within an SCA System. An SCA composite contains a
+             * set of components, services, references and the wires that interconnect them, plus a set
+             * of properties which can be used to configure components.
              */
-            class Composite
+            class Composite : public ComponentType
             {
             public:
+
                 /**
                  * Constructor.
                  * @param name the name of the composite.
+                 * @param root the root of the composite in the file system.
                  */
-                Composite(const std::string& name);
+                Composite(const string& name, const string& root);
 
                 /**
                  * Destructor.
@@ -63,50 +70,22 @@
                 virtual ~Composite();
 
                 /**
-                 * Set the root directory of the composite information.
-                 * @param rootDirectory The root of the composite in the file system.
-                 */
-                void setRoot(const std::string& rootDirectory);
-
-                /**
-                 * Get the root directory of the composite.
+                 * Returns the root directory of the composite.
                  * @return The root of the composite in the file system.
                  */
-                const std::string& getRoot() {return compositeRoot;}
+                const string& getRoot() const { return root; }
                 
                 /**
-                 * Return the name of the composite.
-                 * @return Name of the composite.
-                 */
-                const std::string& getName() {return name;}
-
-                /**
                  * Add a new component to the composite.
-                 * @param componentName The name of the new component.
-                 * @return The Component added to the composite.
+                 * @param component The component to add.
                  */
-                Component* addComponent(const std::string& componentName);
+                void addComponent(Component* component);
 
                 /**
-                 * Add a new entry point to the composite.
-                 * @param name The name of the new entry point.
-                 * @return The entry point added to the composite.
+                 * Add/include a composite in this composite.
+                 * @param composite The composite included in this composite.
                  */
-                CompositeServiceType* addCompositeServiceType(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.
-                 */
-                CompositeServiceType* findCompositeServiceType(const std::string& name);
-                
-                /**
-                 * Add a new external service to the composite.
-                 * @param name The name of the new external service.
-                 * @return The external service added to the composite.
-                 */
-                CompositeReferenceType* addCompositeReferenceType(const std::string& name);
+                void addInclude(Composite* composite);
 
                 /**
                  * Add a wire to the model.
@@ -115,14 +94,14 @@
                  * @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);
+                void addWire(const string& source, const 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);
+                Component* findComponent(const string& componentName);
 
                 /**
                  * Find a component and service by name.
@@ -131,27 +110,20 @@
                  * 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.
-                 */
-                CompositeReferenceType* findCompositeReferenceType(const std::string& serviceName);
+                Service* findComponentService(const string& componentServiceName);
 
                 /**
                  * Add a WSDL definition to the composite.
                  * @param wsdlModel A data object holding all the information about 
                  * the WSDL definition from a WSDL file.
                  */
-                void addWsdl(commonj::sdo::DataObjectPtr wsdlModel);
+                void addWSDLDefinition(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);
+                WSDLDefinition* findWSDLDefinition(const string& wsdlNamespace);
 
                 /**
                  * Return a cached SDO XSDHelper.
@@ -176,15 +148,11 @@
                 void resolveWires();
  
             private:
-                /**
-                 * Name of the composite.
-                 */
-                string name;
 
                 /**
                  * Directory of the root of the composite.
                  */
-                string compositeRoot;
+                string root;
 
                 /**
                  * Cached XSDHelper.
@@ -196,40 +164,33 @@
                  */
                 commonj::sdo::XMLHelperPtr xmlHelper;
 
-                typedef map<std::string, Component*> COMPONENT_MAP;
                 /**
                  * Map (by name) of all the components in this composite.
                  */
+                typedef map<string, Component*> COMPONENT_MAP;
                 COMPONENT_MAP components;
 
-                typedef map<std::string, CompositeReferenceType*> EXTERNALSERVICE_MAP;
                 /**
-                 * Map (by name) of all the external services in this composite.
+                 * Vector of all the composites included in this composite.
                  */
-                EXTERNALSERVICE_MAP externalServices;
+                typedef vector<Composite*> INCLUDES;
+                INCLUDES includes;
 
-                typedef map<std::string, CompositeServiceType*> ENTRYPOINT_MAP;
-                /**
-                 * Map (by name) of all the entry points in this composite.
-                 */
-                ENTRYPOINT_MAP compositeServices;
-
-                typedef vector<Wire> WIRES;
                 /**
                  * Vector of all the wires in this composite.
                  */
+                typedef vector<Wire*> WIRES;
                 WIRES wires;
 
-                typedef map<std::string, Wsdl*> WSDL_MAP;
                 /**
                  * Map by namespace of all the wsdl definitions in this composite.
                  */
-                WSDL_MAP wsdls;
+                typedef map<string, WSDLDefinition*> WSDL_MAP;
+                WSDL_MAP wsdlDefinitions;
             };
 
         } // End namespace model
     } // End namespace sca
 } // End namespace tuscany
 
-#endif // SCA_CompositeComponent_h
-
+#endif // tuscany_sca_model_composite_h

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,65 @@
+/*
+ *
+ *  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/CompositeReference.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ComponentType.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Service.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+
+        namespace model
+        {
+
+            // Constructor
+            CompositeReference::CompositeReference(Composite* composite, const string& name,
+                    Interface* interface, Interface* callbackInterface, bool conversational, ReferenceType::Multiplicity multiplicity) :
+                Component(composite, name, new ComponentType(name))
+            {
+                LOGENTRY(1, "CompositeReference::constructor");
+                LOGINFO_1(2, "CompositeReference::constructor: CompositeReference name: %s", name.c_str());
+                
+                // Initialize the component type, service type and service
+                ComponentType* componentType = getType();
+                ServiceType* serviceType = new ServiceType(
+                    componentType, "", interface, callbackInterface, conversational);
+                componentType->addServiceType(serviceType);
+                
+                service = new Service(this, serviceType);
+                addService(service);
+                
+                LOGEXIT(1, "CompositeReference::constructor");
+            }
+
+            // Destructor
+            CompositeReference::~CompositeReference()
+            {
+            }
+
+        } // End namespace model
+
+    } // End namespace sca
+} // End namespace tuscany

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeReference.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,80 @@
+/*
+ *
+ *  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_compositereferencetype_h
+#define tuscany_sca_model_compositereferencetype_h
+
+#include <string>
+
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ReferenceType.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+
+        namespace model
+        {
+            class ComponentType;
+            class Composite;
+            class Interface;
+            class Service;
+
+            /**
+             * Represents a reference in a composite.
+             * Composite references represent dependencies that the composite has on services provided elsewhere,
+             * outside the composite.
+             */
+            class CompositeReference : public Component
+            {
+            public:
+
+                /**
+                 * Constructor.
+                 * @param name The name of the reference.
+                 */
+                CompositeReference(Composite* composite, const string& name,
+                    Interface* interface, Interface* callbackInterface, bool conversational, ReferenceType::Multiplicity multiplicity);
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~CompositeReference();
+                
+                /**
+                 * Returns the service exposed by this composite reference.
+                 * @return The service exposed by this composite reference.
+                 */
+                Service* getService() const { return service; };
+
+            private:
+            
+                /**
+                 * The service exposed by this composite reference.
+                 */
+                Service* service;
+
+            };
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_compositereferencetype_h
+

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,67 @@
+/*
+ *
+ *  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/CompositeService.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ComponentType.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/ServiceType.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+
+        namespace model
+        {
+
+            // Constructor
+            CompositeService::CompositeService(Composite* composite, const string& name,
+                    Interface* interface, Interface* callbackInterface, bool conversational,
+                    ReferenceType::Multiplicity multiplicity) :
+                Component(composite, name, new ComponentType(name))
+            {
+                LOGENTRY(1, "CompositeService::constructor");
+                LOGINFO_1(2, "CompositeService::constructor: CompositeService name: %s", name.c_str());
+                
+                // Initialize the component type, reference type and reference
+                ComponentType* componentType = getType();
+                ReferenceType* referenceType = new ReferenceType(
+                    componentType, "", interface, callbackInterface, conversational, multiplicity);
+                componentType->addReferenceType(referenceType);
+                
+                reference = new Reference(this, referenceType);
+                addReference(reference);
+                
+                LOGEXIT(1, "CompositeService::constructor");
+            }
+
+            // Destructor
+            CompositeService::~CompositeService()
+            {
+            }
+
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CompositeService.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,84 @@
+/*
+ *
+ *  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_compositeservicetype_h
+#define tuscany_sca_model_compositeservicetype_h
+
+#include <string>
+using std::string;
+#include <vector>
+using std::vector;
+
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ReferenceType.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            class Composite;
+            class Component;
+            class Interface;
+            class Reference;
+
+            /**
+             * Represents a service in a composite.
+             * Composite services define the public services provided by the composite, which can be
+             * accessed from outside the composite.
+             */
+            class CompositeService : public Component
+            {
+
+            public:
+
+                /**
+                 * Constructor.
+                 * @param componentType The component type on which this service is defined.
+                 * @param name The name of the service.
+                 */
+                CompositeService(Composite* composite, const string& name,
+                    Interface* interface, Interface* callbackInterface, bool conversational, ReferenceType::Multiplicity multiplicity);
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~CompositeService();
+
+                /**
+                 * Returns the reference used by this composite service.
+                 * @return The reference used by this composite service.
+                 */
+                Reference* getReference() const { return reference; };
+                
+            private:
+            
+                /**
+                 * The reference used by this composite service.
+                 */
+                Reference* reference;
+           };
+
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_compositeservicetype_h
+

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.cpp?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.cpp Mon Aug 28 03:42:10 2006
@@ -0,0 +1,45 @@
+/*
+ *
+ *  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/Contract.h"
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+
+        namespace model
+        {
+
+            // Constructor
+            Contract::Contract(Interface *interface, Interface* callbackInterface, bool conversational) :
+                interface(interface), callbackInterface(callbackInterface), conversational(conversational)
+            {
+            }
+
+            // Destructor
+            Contract::~Contract()
+            {
+            }
+
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.h?rev=437637&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Contract.h Mon Aug 28 03:42:10 2006
@@ -0,0 +1,97 @@
+/*
+ *
+ *  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_contract_h
+#define tuscany_sca_model_contract_h
+
+#include <string>
+using std::string;
+
+#include "tuscany/sca/model/Interface.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            /**
+             * Interface contracts define one or more business functions.  These business functions are
+             * provided by services and are used by references.  Services are defined by the interface which
+             * they implement.
+             * This interface will typically be extended to support concrete interface type systems, such as
+             * CPP classes, Java interfaces, WSDL 1.1 portTypes and WSDL 2.0 interfaces.
+             */
+            class Contract
+            {
+            public:
+                
+                /**
+                 * Constructor.
+                 */
+                Contract(Interface* interface, Interface* callbackInterface, bool conversational);
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~Contract();
+                
+                /**
+                 * Returns the interface for invocations from the requestor to the provider.
+                 * @return The interface for invocations from the requestor to the provider.
+                 */
+                Interface* getInterface() const { return interface; }
+                
+                /**
+                 * Returns the interface for invocations from the provider back to the requestor.
+                 * @return The interface for invocations from the provider back to the requestor.
+                 */
+                Interface* getCallbackInterface() const { return callbackInterface; }
+                
+                /**
+                 * Returns true if the interface contract is conversational. 
+                 * @return True if the interface contract is conversational
+                 */
+                 bool isConversational() const { return conversational; }
+                 
+            private:
+
+                /**
+                 * The interface for invocations from the requestor to the provider.
+                 */
+                Interface* interface;
+
+                /**
+                 * The interface for invocations from the provider back to the requestor.
+                 */
+                Interface* callbackInterface;
+                
+                /**
+                 * True if the interface contract is conversational
+                 */
+                bool conversational;
+
+            };
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_contract_h
+

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

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

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h?rev=437637&r1=437636&r2=437637&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h Mon Aug 28 03:42:10 2006
@@ -35,16 +35,11 @@
             class SCA_API Interface 
             {
                 
-            public:                
+            public:
+                
                 Interface();  
                 virtual ~Interface();
                             
-                /**
-                 * Returns the type of the interface.
-                 * @return Will depend on the subtype.
-                 */
-                virtual const std::string getInterfaceType() = 0;
-                
             private:
             };
             



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