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 2006/08/29 22:03:20 UTC
svn commit: r438185 [3/3] - in /incubator/tuscany/cpp/sca/runtime:
core/src/osoa/ core/src/tuscany/sca/ core/src/tuscany/sca/core/
core/src/tuscany/sca/cpp/ core/src/tuscany/sca/extension/
core/src/tuscany/sca/model/ core/src/tuscany/sca/util/ extensio...
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp Tue Aug 29 13:03:17 2006
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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 "osoa/sca/ServiceRuntimeException.h"
+#include "tuscany/sca/cpp/CompositeContextImpl.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/core/ServiceProxy.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/cpp/CPPServiceProxy.h"
+#include "commonj/sdo/SDO.h"
+
+using namespace tuscany::sca::model;
+using namespace osoa::sca;
+using namespace commonj::sdo;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+
+ // ===========
+ // Constructor
+ // ===========
+ CompositeContextImpl::CompositeContextImpl(Component* component)
+ : CompositeContext(0), component(component), composite((Composite*)component->getType())
+ {
+ }
+
+ // ==========
+ // Destructor
+ // ==========
+ CompositeContextImpl::~CompositeContextImpl()
+ {
+ // --------------------------------------------
+ // Delete the proxies served up by this context
+ // --------------------------------------------
+ for (PROXIES::iterator iter = proxies.begin(); iter != proxies.end(); iter++)
+ {
+ delete (ServiceProxy*)*iter;
+ }
+ }
+
+ // ===========================================================================
+ // locateService: return a proxy connected to a wrapper for the target service
+ // ===========================================================================
+ void* CompositeContextImpl::locateService(const char* serviceName)
+ {
+ LOGENTRY(1, "CompositeContextImpl::locateService");
+
+ // ----------------------------
+ // Locate the component service
+ // ----------------------------
+ Service* service = composite->findComponentService(serviceName);
+ string msg;
+ if (!service)
+ {
+ msg = "Service not found: ";
+ msg = msg + serviceName;
+ throw ServiceNotFoundException(msg.c_str());
+ }
+
+ // ----------------------------
+ // Get a Proxy for this service
+ // ----------------------------
+
+ // The locate service API is used from CPP clients so we are using
+ // our default service proxy here
+ //TODO is that right?
+ ServiceProxy* serviceProxy = new cpp::CPPServiceProxy(service);
+ proxies.push_back(serviceProxy);
+ LOGEXIT(1, "CompositeContextImpl::locateService");
+ return serviceProxy->getProxy();
+
+ }
+
+ // ==============================================
+ // getDataFactory: return the data factory for the current composite
+ // ==============================================
+ DataFactoryPtr CompositeContextImpl::getDataFactory()
+ {
+ LOGENTRY(1, "CompositeContextImpl::getDataFactory");
+ DataFactoryPtr dataFactory = composite->getDataFactory();
+
+ LOGEXIT(1, "CompositeContextImpl::getDataFactory");
+ return dataFactory;
+ }
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h Tue Aug 29 13:03:17 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_cpp_compositecontextimpl_h
+#define tuscany_sca_cpp_compositecontextimpl_h
+
+#include <vector>
+using std::vector;
+
+#include "osoa/sca/CompositeContext.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/core/ServiceProxy.h"
+
+using namespace osoa::sca;
+
+namespace tuscany
+{
+ namespace sca
+ {
+
+ namespace cpp
+ {
+
+ /**
+ * Contains the actual implementation of a CompositeContext interface.
+ */
+ class CompositeContextImpl : public CompositeContext
+ {
+
+ public:
+ /**
+ * Constructor that takes a Composite which represents the runtime
+ * model for this context.
+ */
+ CompositeContextImpl(Component* component);
+
+ /**
+ * See CompositeContext#locateService.
+ */
+ virtual void* locateService(const char* serviceName);
+
+ /**
+ * See CompositeContext.
+ */
+ virtual commonj::sdo::DataFactoryPtr getDataFactory();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CompositeContextImpl();
+
+ private:
+ CompositeContextImpl(const CompositeContextImpl&);
+ CompositeContextImpl& operator=(const CompositeContextImpl&);
+
+ /**
+ * Pointer to the runtime model Composite object to which this
+ * context refers.
+ */
+ Composite* composite;
+
+ /**
+ * Pointer to the runtime model Component object to which this
+ * context refers.
+ */
+ Component* component;
+
+ /**
+ * Vector of proxies created from calls to the locateService
+ * method.
+ */
+ typedef vector<tuscany::sca::ServiceProxy*> PROXIES;
+ PROXIES proxies;
+ };
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_compositecontextimpl_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CompositeContextImpl.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp Tue Aug 29 13:03:17 2006
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/cpp/model/CPPImplementation.h"
+#include "tuscany/sca/cpp/model/CPPServiceBinding.h"
+#include "tuscany/sca/cpp/model/CPPReferenceBinding.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/util/Utils.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+
+ namespace cpp
+ {
+
+ // Constructor
+ CPPImplementation::CPPImplementation(const string& library, const string& header,
+ const string&headerPath, const string& headerStub, const string& className)
+ : ComponentType(headerPath + headerStub),
+ library(library), header(header), headerPath(headerPath),
+ headerStub(headerStub), className(className)
+ {
+ }
+
+ CPPImplementation::~CPPImplementation()
+ {
+ }
+
+ void CPPImplementation::initializeComponent(Component* component)
+ {
+ ComponentType::initializeComponent(component);
+
+ // Create CPP bindings for all the services
+ const Component::SERVICE_MAP& services = component->getServices();
+ Component::SERVICE_MAP::const_iterator iter = services.begin();
+ for (int i=0; i< services.size(); i++)
+ {
+ Service *service = iter->second;
+ CPPServiceBinding* binding = new CPPServiceBinding(service);
+ service->setBinding(binding);
+ iter++;
+ }
+
+ // Create CPP bindings for all the references
+ const Component::REFERENCE_MAP& references = component->getReferences();
+ Component::REFERENCE_MAP::const_iterator refiter = references.begin();
+ for (i=0; i< references.size(); i++)
+ {
+ Reference *reference = refiter->second;
+ CPPReferenceBinding* binding = new CPPReferenceBinding(reference);
+ reference->setBinding(binding);
+ refiter++;
+ }
+ }
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h Tue Aug 29 13:03:17 2006
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_cpp_model_cppimplementation_h
+#define tuscany_sca_cpp_model_cppimplementation_h
+#include "tuscany/sca/model/ComponentType.h"
+
+#include <map>
+using std::map;
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+ /**
+ * Holds information about an SCA implementation written in C++
+ */
+ class CPPImplementation : public ComponentType
+ {
+
+ public:
+ /**
+ * Constructor.
+ * @param dllName Name of the shared library.
+ * @param header Name of the header file that contains the class declaring the
+ * implementation class.
+ * @param className Name of the class in the header file (could be a blank string
+ * if this is not specified).
+ */
+ CPPImplementation(const string& library, const string& header, const string&headerPath,
+ const string& headerStub, const string& className);
+
+ /**
+ * Destructor
+ */
+ virtual ~CPPImplementation();
+
+ /**
+ * Initialize a component of this type.
+ * @param component The component to initialize.
+ */
+ virtual void initializeComponent(Component* component);
+
+ /**
+ * Returns the name of the shared library.
+ * @return The name of the shared library.
+ */
+ const string& getLibrary() const { return library; }
+
+ /**
+ * Get the name of the header file.
+ * @return Name of the header file.
+ */
+ const string& getHeader() const { return header; }
+
+ /**
+ * Get the header file name without the extension.
+ * @return The name of the header file without any extension.
+ */
+ const string& getHeaderStub() const { return headerStub; }
+
+ /**
+ * Get the header path.
+ * @return The pathe element of the header.
+ */
+ const string& getHeaderPath() const { return headerPath; }
+
+ /**
+ * Get the name of the class.
+ * @return The class name if specified.
+ */
+ const string& getClass() const { return className; }
+
+ private:
+
+ /**
+ * Name of the shared library.
+ */
+ string library;
+
+ /**
+ * Name of the header file describing the interface.
+ */
+ string header;
+
+ /**
+ * Name of the header file without the extension.
+ */
+ string headerStub;
+
+ /**
+ * Path element of the header.
+ */
+ string headerPath;
+
+ /**
+ * Name of the class in the header file declaring the implementation.
+ * May be an empty string if not set in the SCDL file.
+ */
+ string className;
+ };
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_model_cppimplementation_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPImplementation.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp Tue Aug 29 13:03:17 2006
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/cpp/model/CPPInterface.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+
+ // Constructor
+ CPPInterface::CPPInterface(
+ const string& header,
+ const string& className,
+ const string& scop,
+ bool remotable)
+ : header(header), className(className), remotable(remotable)
+ {
+ string::size_type dot = header.rfind(".h"); // this will also find .hpp
+ if (dot != string::npos)
+ {
+ headerStub = header.substr(0, dot);
+ }
+ else
+ {
+ headerStub = header;
+ }
+
+ if (scop == "composite")
+ {
+ scope = COMPOSITE;
+ }
+ else
+ {
+ scope = STATELESS;
+ }
+ }
+
+ CPPInterface::~CPPInterface()
+ {
+ }
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h Tue Aug 29 13:03:17 2006
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_cpp_model_cppinterface_h
+#define tuscany_sca_cpp_model_cppinterface_h
+
+#include "tuscany/sca/model/Interface.h"
+
+#include <map>
+using std::map;
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+ /**
+ * Holds information about an interface described using a C++
+ * header file.
+ */
+ class CPPInterface : public Interface
+ {
+
+ public:
+ /**
+ * Constuctor.
+ * @param header Name of the header file containing the class that
+ * describes the interface.
+ * @param className Name of the class in the header file that
+ * describes the interface.
+ * @param scope The scope of the interface (stateless or composite).
+ * @param remotable True if the interface is remotable.
+ */
+ CPPInterface(
+ const string& header,
+ const string& className,
+ const string& scope,
+ bool remotable);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPPInterface();
+
+ /**
+ * Get the name of the header file.
+ * @return The name of the header file containing the definition of the
+ * interface.
+ */
+ const string& getHeader() { return header; }
+
+ /**
+ * Return the name of the header file without the extension.
+ * @return Header file name without any extension.
+ */
+ const string& getHeaderStub() { return headerStub; }
+
+ /**
+ * Get the name of the class.
+ * @return The name of the class defining the interface.
+ */
+ const string& getClass() { return className; }
+
+ /**
+ * Scope of interface.
+ */
+ enum SCOPE
+ {
+ COMPOSITE,
+ STATELESS
+ };
+
+ /**
+ * Get the scope of the interface.
+ * @return The scope of the interface.
+ */
+ SCOPE getScope() { return scope; }
+
+ /**
+ * Return whether the interface is remotable or local.
+ * @return True if the interface is remotable, otherwise false.
+ */
+ bool getRemotable() { return remotable; }
+
+ private:
+
+ /**
+ * Name of the header file containing the definition of the interface.
+ */
+ string header;
+
+ /**
+ * Name of the header file without the extension.
+ */
+ string headerStub;
+
+ /**
+ * Name of the class in the header file.
+ */
+ string className;
+
+ /**
+ * Scope of the interface.
+ */
+ SCOPE scope;
+
+ /**
+ * Remotable interface or not.
+ */
+ bool remotable;
+ };
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_model_cppinterface_h
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp Tue Aug 29 13:03:17 2006
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/cpp/model/CPPReferenceBinding.h"
+#include "tuscany/sca/cpp/CPPServiceProxy.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+
+ // Constructor
+ CPPReferenceBinding::CPPReferenceBinding(Reference* reference)
+ : ReferenceBinding(reference, ""), serviceProxy(NULL)
+ {
+ }
+
+ // Destructor
+ CPPReferenceBinding::~CPPReferenceBinding()
+ {
+ }
+
+ ServiceProxy* CPPReferenceBinding::getServiceProxy()
+ {
+ return serviceProxy;
+ }
+
+ void CPPReferenceBinding::configure(ServiceBinding* binding)
+ {
+ targetServiceBinding = binding;
+
+ serviceProxy = new CPPServiceProxy(getReference());
+ }
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h Tue Aug 29 13:03:17 2006
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_cpp_model_cppreferencebinding_h
+#define tuscany_sca_cpp_model_cppreferencebinding_h
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+
+#include <string>
+using std::string;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+ /**
+ * Information about a CPP service binding for service or a reference.
+ */
+ class CPPReferenceBinding : 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")
+ */
+ CPPReferenceBinding(Reference* reference);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPPReferenceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#CPPImplementationBinding"; };
+
+ /**
+ * Create a proxy representing the reference to the
+ * client component.
+ */
+ virtual ServiceProxy* getServiceProxy();
+
+ /**
+ * Configure this binding from a service binding.
+ */
+ virtual void configure(ServiceBinding* serviceBinding);
+
+ /**
+ * Returns the target service binding.
+ */
+ ServiceBinding* getTargetServiceBinding() const { return targetServiceBinding; };
+
+ private:
+
+ /**
+ * The proxy representing the reference to the client
+ * component.
+ */
+ ServiceProxy* serviceProxy;
+
+ /**
+ * The service binding of the target
+ */
+ ServiceBinding* targetServiceBinding;
+ };
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_model_cppreferencebinding_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPReferenceBinding.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp Tue Aug 29 13:03:17 2006
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/cpp/model/CPPServiceBinding.h"
+#include "tuscany/sca/cpp/CPPServiceWrapper.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+
+ // Constructor
+ CPPServiceBinding::CPPServiceBinding(Service* service)
+ : ServiceBinding(service, "")
+ {
+ serviceWrapper = CPPServiceWrapper::getServiceWrapper(service);
+ }
+
+ // Destructor
+ CPPServiceBinding::~CPPServiceBinding()
+ {
+ }
+
+ ServiceWrapper* CPPServiceBinding::getServiceWrapper()
+ {
+ return (ServiceWrapper*)serviceWrapper;
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h?rev=438185&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h Tue Aug 29 13:03:17 2006
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef tuscany_sca_cpp_model_cppservicebinding_h
+#define tuscany_sca_cpp_model_cppservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+using namespace tuscany::sca::model;
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace cpp
+ {
+ /**
+ * Information about a CPP service binding for service or a reference.
+ */
+ class CPPServiceBinding : 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")
+ */
+ CPPServiceBinding(Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPPServiceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#CPPImplementationBinding"; };
+
+ /**
+ * Create a wrapper for the service configured by this
+ * binding.
+ */
+ virtual ServiceWrapper* getServiceWrapper();
+
+ private:
+
+ /**
+ * The wrapper for the service configured by this binding.
+ */
+ ServiceWrapper* serviceWrapper;
+
+ };
+
+ } // End namespace cpp
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_model_cppservicebinding_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPServiceBinding.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