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/09/07 06:26:58 UTC
svn commit: r440973 - in /incubator/tuscany/cpp/sca/runtime/extensions/php:
./ src/ src/osoa/ src/osoa/sca/ src/tuscany/ src/tuscany/sca/
src/tuscany/sca/php/ src/tuscany/sca/php/model/ xsd/
Author: jsdelfino
Date: Wed Sep 6 21:26:57 2006
New Revision: 440973
URL: http://svn.apache.org/viewvc?view=rev&rev=440973
Log:
Patch from Simon's JIRA TUSCANY-698 contributing an initial implementation of a PHP extension. Not integrated in the Linux build yet
Added:
incubator/tuscany/cpp/sca/runtime/extensions/php/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/Makefile.am
incubator/tuscany/cpp/sca/runtime/extensions/php/src/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/Makefile.am
incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/ (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd (with props)
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/Makefile.am?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/Makefile.am Wed Sep 6 21:26:57 2006
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+datadir=$(prefix)/extensions/php
+
+nobase_data_DATA = xsd/*.xsd
\ No newline at end of file
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/Makefile.am?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/Makefile.am Wed Sep 6 21:26:57 2006
@@ -0,0 +1,26 @@
+libdir=$(prefix)/extensions/php/lib
+lib_LTLIBRARIES = libtuscany_sca_php.la
+includedir=$(prefix)/extensions/php/include
+nobase_include_HEADERS = \
+tuscany/sca/php/*.h \
+tuscany/sca/php/model/*.h
+
+libtuscany_sca_php_la_SOURCES = \
+tuscany/sca/php/PHPExtension.cpp \
+tuscany/sca/php/PHPImplementationExtension.cpp \
+tuscany/sca/php/PHPServiceProxy.cpp \
+tuscany/sca/php/PHPServiceWrapper.cpp \
+tuscany/sca/php/model/PHPImplementation.cpp \
+tuscany/sca/php/model/PHPReferenceBinding.cpp \
+tuscany/sca/php/model/PHPServiceBinding.cpp
+
+libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
+ -L$(top_builddir)/runtime/core/src -ltuscany_sca \
+ -L${PHP_LIB} -lphp
+
+INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \
+ -I${TUSCANY_SDOCPP}/include \
+ -I${PHP_INCLUDE}
+
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+
\ No newline at end of file
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,113 @@
+/*
+ * 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 osoa_sca_serviceruntimeexception_h
+#define osoa_sca_serviceruntimeexception_h
+
+#include "osoa/sca/export.h"
+
+#include "tuscany/sca/util/Exceptions.h"
+using tuscany::sca::TuscanyRuntimeException;
+namespace osoa
+{
+ namespace sca
+ {
+ /**
+ * Top level exception to represent all the exceptions that may be
+ * thrown by an SCA runtime implementation.
+ */
+ class SCA_PHP_API ServiceRuntimeException : public TuscanyRuntimeException
+ {
+ public:
+ ServiceRuntimeException(
+ const char *name="ServiceRuntimeException",
+ severity_level sev=Severe,
+ const char* msg_text="")
+ : TuscanyRuntimeException(name, sev, msg_text)
+ {
+ }
+ }; // End ServiceRuntimeException class definition
+
+
+ /**
+ * A remotable service is currently unavailable. It is possible that a retry
+ * may resolve this exception.
+ */
+ class SCA_PHP_API ServiceUnavailableException: public ServiceRuntimeException
+ {
+ public:
+ ServiceUnavailableException(const char* serviceName)
+ : ServiceRuntimeException("ServiceUnavailableException", Warning,
+ serviceName)
+ {
+ }
+ private:
+ }; // End ServiceUnavailableException class definition
+
+
+ /**
+ * The target of a wire cannot be found, or the reference has not been
+ * configured.
+ */
+ class SCA_PHP_API ServiceNotFoundException: public ServiceRuntimeException
+ {
+ public:
+ ServiceNotFoundException(const char* msg)
+ : ServiceRuntimeException("ServiceNotFoundException", Error,
+ msg)
+ {
+ }
+ private:
+ }; // End ServiceNotFoundException class definition
+
+
+ /**
+ * There is no current component (for example, if a non-SCA component
+ * tries to get the current ComponentContext).
+ */
+ class SCA_PHP_API ComponentContextException: public ServiceRuntimeException
+ {
+ public:
+ ComponentContextException(const char* msg)
+ : ServiceRuntimeException("ComponentContextException", Error,
+ msg)
+ {
+ }
+ private:
+ }; // End ComponentContextException class definition
+
+ /**
+ * There is an error whilst trying to invoke a component.
+ */
+ class SCA_PHP_API ComponentInvocationException: public ServiceRuntimeException
+ {
+ public:
+ ComponentInvocationException(const char* msg)
+ : ServiceRuntimeException("ComponentInvocationException", Error,
+ msg)
+ {
+ }
+ private:
+ }; // End ComponentInvocationException class definition
+
+
+ } // End namespace sca
+} // End namespace osoa
+
+#endif // osoa_sca_serviceruntimeexception_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/ServiceRuntimeException.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,41 @@
+/*
+ * 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 osoa_sca_export_h
+#define osoa_sca_export_h
+#include "tuscany/sca/export.h"
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+
+#ifdef TUSCANY_SCA_PHP_EXPORTS
+#define SCA_PHP_API __declspec(dllexport)
+#else
+#define SCA_PHP_API __declspec(dllimport)
+#endif
+
+#else
+#include <sys/time.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#define SCA_PHP_API
+#endif
+
+#endif // osoa_sca_export_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/osoa/sca/export.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp Wed Sep 6 21:26:57 2006
@@ -0,0 +1,71 @@
+/*
+* 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/php/PHPExtension.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/php/PHPImplementationExtension.h"
+
+
+extern "C"
+{
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void tuscany_sca_extension_initialize()
+ {
+ tuscany::sca::php::PHPExtension::initialize();
+ }
+}
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // ===================================================================
+ // Constructor for the PHPExtension class.
+ // ===================================================================
+ PHPExtension::PHPExtension()
+ {
+ LOGENTRY(1, "PHPExtension::constructor");
+ LOGEXIT(1, "PHPExtension::constructor");
+ }
+
+ // ===================================================================
+ // Destructor for the PHPExtension class.
+ // ===================================================================
+ PHPExtension::~PHPExtension()
+ {
+ LOGENTRY(1, "PHPExtension::destructor");;
+ LOGEXIT(1, "PHPExtension::destructor");
+ }
+
+ void PHPExtension::initialize()
+ {
+ LOGENTRY(1, "PHPExtension::initialize");;
+ SCARuntime::getInstance()->registerImplementationExtension(new PHPImplementationExtension());
+ //SCARuntime::getInstance()->registerInterfaceExtension(new PHPInterfaceExtension());
+ LOGEXIT(1, "PHPExtension::initialize");;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,55 @@
+/*
+ * 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_php_phpextension_h
+#define tuscany_sca_php_phpextension_h
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ class PHPExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ PHPExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPExtension();
+
+ static void initialize();
+
+ private:
+
+ };
+
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpextension_h
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp Wed Sep 6 21:26:57 2006
@@ -0,0 +1,76 @@
+/*
+ * 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/php/PHPImplementationExtension.h"
+#include "tuscany/sca/php/model/PHPImplementation.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // ===================================================================
+ // Constructor for the PHPImplementationExtension class.
+ // ===================================================================
+ PHPImplementationExtension::PHPImplementationExtension()
+ {
+ LOGENTRY(1, "PHPImplementationExtension::constructor");
+ LOGEXIT(1, "PHPImplementationExtension::constructor");
+ }
+
+ // ===================================================================
+ // Destructor for the PHPImplementationExtension class.
+ // ===================================================================
+ PHPImplementationExtension::~PHPImplementationExtension()
+ {
+ LOGENTRY(1, "PHPImplementationExtension::destructor");;
+ LOGEXIT(1, "PHPImplementationExtension::destructor");
+ }
+
+ const string PHPImplementationExtension::extensionName("php");
+ const string PHPImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPImplementation");
+
+ // ===================================================================
+ // loadModelElement - load the info from implementation.php
+ // ===================================================================
+ ComponentType* PHPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
+ {
+ string implType = scdlImplementation->getType().getName();
+ if (implType == "PHPImplementation")
+ {
+ string module = scdlImplementation->getCString("module");
+ string className = scdlImplementation->getCString("class");
+
+ PHPImplementation* phpImpl = new PHPImplementation(module, className);
+
+ return phpImpl;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,70 @@
+/*
+ * 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_php_phpimplementationextension_h
+#define tuscany_sca_php_phpimplementationextension_h
+
+#include "tuscany/sca/extension/ImplementationExtension.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ class PHPImplementationExtension : public ImplementationExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ PHPImplementationExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPImplementationExtension();
+
+ /**
+ * return the name of the extension
+ */
+ virtual const string& getExtensionName() {return extensionName;}
+
+ /**
+ * return the QName of schema element for this implementation extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.phpn")
+ */
+ virtual const string& getExtensionTypeQName() {return typeQName;}
+
+ virtual ComponentType* getImplementation(Composite* composite, DataObjectPtr scdlImplementation);
+
+ private:
+ static const string extensionName;
+ static const string typeQName;
+
+ };
+
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpimplementationextension_h
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp Wed Sep 6 21:26:57 2006
@@ -0,0 +1,402 @@
+/*
+ * 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.
+ */
+
+// some strangeness in the build that causes
+// WinSock.h and WinSock2.h to be included leading to redefinitions
+#define _WINSOCKAPI_
+
+#include "tuscany/sca/php/PHPServiceWrapper.h"
+
+#include "osoa/sca/ServiceRuntimeException.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/php/model/PHPImplementation.h"
+#include "tuscany/sca/cpp/model/CPPInterface.h"
+
+#include <php_embed.h>
+
+using namespace osoa::sca;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // a global!! place to put the response
+ // as I can't get the PHP return value
+ // processing to work. Need to be
+ // removed when the proper PHP SAPI is used
+ // The variable is only valid between the PHP engine call and
+ // the results processing. It stores the last thing that
+ // the script echoed
+ string scriptResponse;
+
+ // Global callbacks used by the PHP engine
+
+ // Callback for log messages
+ void php_log_message(char *message)
+ {
+ LOGINFO_1(5, "PHP Log (%s)", message);
+ }
+
+ // Callback for unbuffered writes (echo, print etc.)
+ int php_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
+ {
+ LOGINFO_1(5, "PHP Write (%s)", str);
+ scriptResponse = str;
+ return str_length;
+ }
+
+ // Callback for errors
+ void php_error_cb(int type,
+ const char *error_filename,
+ const uint error_lineno,
+ const char *format, va_list args)
+ {
+ char buffer[2048];
+ int len;
+
+ len = snprintf(buffer, 2048, "Error on line %d: ", error_lineno);
+ vsnprintf(buffer + len, (2048 - len), format, args);
+ LOGINFO_1(5, "PHP Unformatted Error (%s)", buffer);
+ zend_bailout();
+ }
+
+ // Callback for flush (could be used to do something with the scriptResponse)
+ void php_flush(void *server_context)
+ {
+ LOGINFO(5, "Flush");
+ }
+
+ // ===========
+ // Constructor
+ // ===========
+ PHPServiceWrapper::PHPServiceWrapper(Service* service)
+ : ServiceWrapper(service)
+ {
+ LOGENTRY(1,"PHPServiceWrapper::constructor");
+
+ component = service->getComponent();
+ interf = (CPPInterface*)service->getType()->getInterface();
+ remotable = interf->getRemotable();
+
+ // -----------------------------------------------
+ // Get the implementation for the target component
+ // -----------------------------------------------
+ PHPImplementation* impl = (PHPImplementation*)component->getType();
+ if (!impl)
+ {
+ string msg = "Component " + component->getName() + " has no implementation defined";
+ throw ServiceNotFoundException(msg.c_str());
+ }
+
+ LOGINFO_1(3,"PHPServiceWrapper::getServiceWrapper module %s", impl->getModule().c_str());
+ LOGINFO_1(3,"PHPServiceWrapper::getServiceWrapper class %s", impl->getClass().c_str());
+
+ LOGEXIT(1,"PHPServiceWrapper::constructor");
+
+ }
+
+ // ==========
+ // Destructor
+ // ==========
+ PHPServiceWrapper::~PHPServiceWrapper()
+ {
+ LOGENTRY(1,"PHPServiceWrapper::destructor");
+ LOGEXIT(1,"PHPServiceWrapper::destructor");
+ }
+
+
+ // ======================================================================
+ // invoke: wrapper call to service with setting the component context
+ // ======================================================================
+ void PHPServiceWrapper::invoke(Operation& operation)
+ {
+ LOGENTRY(1,"PHPServiceWrapper::invoke");
+
+ SCARuntime* runtime = SCARuntime::getInstance();
+ runtime->setCurrentComponent(component);
+
+ try
+ {
+ LOGINFO_1(4, "PHPServiceWrapper::invoke called with operation name: %s", operation.getName().c_str());
+
+ // create a temporary script which
+ // - includes the named script
+ // - creates a class instance if required
+ // - calls the named method with the provided arguments
+
+ // get the component type information
+ PHPImplementation* impl = (PHPImplementation*)component->getType();
+
+ // first create the temporay script and include the module
+ string script = "include '" + impl->getModule() + ".php';";
+
+ // if we have a class create an instance
+ string className = impl->getClass();
+ if( &className != NULL && className.size() > 0)
+ {
+ script += "$anobject = new " + className + "();";
+ }
+
+ // construct the call to the function
+ script += "$response = ";
+
+ if( &className != NULL && className.size() > 0)
+ {
+ script += " $anobject->";
+ }
+
+ script += operation.getName().c_str();
+ script += "(";
+
+ char tempString [32];
+
+ // add the parameters to the call
+ for(unsigned int i = 0; i < operation.getNParms(); i++)
+ {
+ Operation::Parameter& parm = operation.getParameter(i);
+ switch(parm.getType())
+ {
+ case Operation::BOOL:
+ {
+ if( *(bool*)parm.getValue())
+ {
+ //boolean true
+ script += "true";
+ }
+ else
+ {
+ script += "false";
+ }
+ break;
+ }
+ case Operation::SHORT:
+ {
+ sprintf ( tempString, "%d", *(short*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::USHORT:
+ {
+ sprintf ( tempString, "%d", *(unsigned short*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::LONG:
+ {
+ sprintf ( tempString, "%d", *(long*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::ULONG:
+ {
+ sprintf ( tempString, "%d", *(unsigned long*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ sprintf ( tempString, "%g", *(float*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ sprintf ( tempString, "%g", *(double*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ sprintf ( tempString, "%g", *(long double*)parm.getValue() );
+ script += tempString;
+ break;
+ }
+ case Operation::CHARS:
+ {
+ script += *(char**)parm.getValue();
+ break;
+ }
+ case Operation::STRING:
+ {
+ script += (*(string*)parm.getValue()).c_str();
+ break;
+ }
+ default:
+ {
+ throw new ComponentInvocationException("Operation parameter type not supported");
+ }
+ }
+
+ if ( ( i + 1 ) < operation.getNParms() )
+ {
+ script += ", ";
+ }
+ }
+
+
+ // the closing bracket of the call
+ script += ");echo $response;return $response;";
+
+ // we now have the temporary script to make the call
+ LOGINFO_1(5, "Executing PHP script \n%s", script.c_str());
+
+ // load the PHP logging and error callback methods
+ php_embed_module.log_message = php_log_message;
+ php_embed_module.ub_write = php_ub_write;
+ php_embed_module.flush = php_flush;
+
+ //PHP_EMBED_START_BLOCK(/* argc */ 0, /* argv */ NULL)
+ void ***tsrm_ls;
+ int status = php_embed_init(0, NULL PTSRMLS_CC);
+ LOGINFO_1(5, "Engine startup status %d", status);
+
+ zend_first_try {
+ // set error handler
+ zend_error_cb = php_error_cb;
+
+ // call the dynamically created script
+ //zval retval;
+ zend_eval_string((char *) script.c_str(),
+ NULL,//&retval,
+ "PHP Component" TSRMLS_CC);
+
+ // get the response
+ // This doesn't want to work for some reason
+ // so have chaced the last echo that the script
+ // returns in the global scriptResponse variable
+ // This is a bit of a rubbish way of doing things so
+ // needs replacing when proper SAPI is used
+ //convert_to_string(&retval);
+ //LOGINFO_1(5, "Script returned %s", Z_STRVAL(retval));
+ //zval_dtor(&retval);
+
+ //PHP_EMBED_END_BLOCK()
+ } zend_catch {
+ int exit_status = EG(exit_status);
+ LOGINFO_1(5, "In catch %d", exit_status);
+ } zend_end_try();
+
+ //clean up
+ php_embed_shutdown(TSRMLS_C);
+ LOGINFO(5, "Engine shutdown");
+
+ // get the response values
+ LOGINFO_1(5, "Script returned %s", scriptResponse.c_str());
+
+ switch(operation.getReturnType())
+ {
+ case Operation::BOOL:
+ {
+ if(scriptResponse == "true")
+ {
+ *(bool*)operation.getReturnValue() = true;
+ }
+ break;
+ }
+ case Operation::SHORT:
+ {
+ *(short*)operation.getReturnValue() = (short) strtol(scriptResponse.c_str(), NULL,10);
+ break;
+ }
+ case Operation::LONG:
+ {
+ *(long*)operation.getReturnValue() = (long) strtol(scriptResponse.c_str(), NULL,10);
+ break;
+ }
+ case Operation::USHORT:
+ {
+ *(unsigned short*)operation.getReturnValue() = (unsigned short) strtoul(scriptResponse.c_str(), NULL,10);
+ break;
+ }
+ case Operation::ULONG:
+ {
+ *(unsigned long*)operation.getReturnValue() = (unsigned long) strtoul(scriptResponse.c_str(), NULL,10);
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ *(float*)operation.getReturnValue() = (float) strtod(scriptResponse.c_str(), NULL);
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ *(double*)operation.getReturnValue() = (double) strtod(scriptResponse.c_str(), NULL);
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ *(long double*)operation.getReturnValue() = (long double) strtod(scriptResponse.c_str(), NULL);
+ break;
+ }
+ case Operation::CHARS:
+ {
+ *(char**)operation.getReturnValue() = (char *)scriptResponse.c_str();
+ break;
+ }
+ case Operation::STRING:
+ {
+ *(string*)operation.getReturnValue() = scriptResponse;
+ break;
+ }
+ default:;
+ }
+ }
+ catch (...)
+ {
+ runtime->unsetCurrentComponent();
+ throw;
+ }
+ runtime->unsetCurrentComponent();
+ LOGEXIT(1,"PHPServiceWrapper::invoke");
+
+ }
+
+ // ======================================================================
+ // getServiceWrapper: create a wrapper for the target ComponentService
+ // ======================================================================
+ PHPServiceWrapper* PHPServiceWrapper::getServiceWrapper(Service* service)
+ {
+ LOGENTRY(1,"PHPServiceWrapper::getServiceWrapper");
+ PHPServiceWrapper* serviceWrapper = 0;
+
+ // ---------------------------------
+ // Create an instance of the wrapper
+ // ---------------------------------
+ serviceWrapper = new PHPServiceWrapper(service);
+ if (!serviceWrapper)
+ {
+ string msg = "Could not create new PHPServiceWrapper";
+ LOGERROR(1, msg.c_str());
+ throw ServiceNotFoundException(msg.c_str());
+ }
+
+ LOGEXIT(1,"PHPServiceWrapper::getServiceWrapper");
+ return serviceWrapper;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,109 @@
+/*
+ * 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_php_phpservicewrapper_h
+#define tuscany_sca_php_phpservicewrapper_h
+
+
+#include "osoa/sca/export.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Component.h"
+
+#include "tuscany/sca/cpp/model/CPPInterface.h"
+
+using namespace tuscany::sca::model;
+using tuscany::sca::cpp::CPPInterface;
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ class PHPInterface;
+
+ /**
+ * Wraps the service on a component implementation.
+ * This abstract class is extended by generated code which provides
+ * the implementation of some of the methods.
+ * An instance of this class wraps the actual component implementation which
+ * has been written by a developer of an SCA application.
+ */
+ class SCA_PHP_API PHPServiceWrapper : public ServiceWrapper
+ {
+ public:
+ /**
+ * Factory method to create a new PHPServiceWrapper for a given target
+ * service. This method will provide all the loading of dlls required to
+ * create the target component.
+ * @param target The service on the component for which this wrapper is to be
+ * created.
+ * @return A wrapper that references the given target.
+ */
+ static PHPServiceWrapper* getServiceWrapper(Service* service);
+
+ /**
+ * Constructor.
+ * @param target The component service to which this wrapper refers.
+ */
+ PHPServiceWrapper(Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPServiceWrapper();
+
+ /**
+ * All business method calls to the target component go through the invoke method.
+ * @param operation The details of the method, paramaters and return value for the
+ * business method to be called on the target component.
+ */
+ virtual void invoke(Operation& operation);
+
+
+ protected:
+
+
+ private:
+
+
+ /**
+ * The component to which this wrapper refers.
+ */
+ Component* component;
+
+ /**
+ * Set to true if the service is remotable.
+ */
+ bool remotable;
+
+ /**
+ * A pointer to the interface which the service exposes.
+ */
+ CPPInterface* interf;
+
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpservicewrapper_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp Wed Sep 6 21:26:57 2006
@@ -0,0 +1,85 @@
+/*
+ * 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/php/model/PHPImplementation.h"
+#include "tuscany/sca/php/model/PHPServiceBinding.h"
+//#include "tuscany/sca/php/model/PHPReferenceBinding.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 php
+ {
+
+ // Constructor
+ PHPImplementation::PHPImplementation(const string& module, const string& className)
+ : ComponentType(module),
+ module(module), className(className)
+ {
+ LOGENTRY(1,"PHPImplementation::constructor");
+ LOGEXIT(1,"PHPImplementation::constructor");
+ }
+
+ PHPImplementation::~PHPImplementation()
+ {
+ LOGENTRY(1,"PHPImplementation::destructor");
+ LOGEXIT(1,"PHPImplementation::destructor");
+ }
+
+ void PHPImplementation::initializeComponent(Component* component)
+ {
+ LOGENTRY(1,"PHPImplementation::initializeComponent");
+ ComponentType::initializeComponent(component);
+
+ // Create PHP bindings for all the services
+ const Component::SERVICE_MAP& services = component->getServices();
+ Component::SERVICE_MAP::const_iterator iter = services.begin();
+ for (unsigned int i=0; i< services.size(); i++)
+ {
+ Service *service = iter->second;
+ PHPServiceBinding* binding = new PHPServiceBinding(service);
+ service->setBinding(binding);
+ iter++;
+ }
+
+ // References not yet supported..
+
+ //// Create PHP bindings for all the references
+ //const Component::REFERENCE_MAP& references = component->getReferences();
+ //Component::REFERENCE_MAP::const_iterator refiter = references.begin();
+ //for (int ri=0; ri< references.size(); ri++)
+ //{
+ // Reference *reference = refiter->second;
+ // PHPReferenceBinding* binding = new PHPReferenceBinding(reference);
+ // reference->setBinding(binding);
+ // refiter++;
+ //}
+ LOGEXIT(1,"PHPImplementation::initializeComponent");
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h Wed Sep 6 21:26:57 2006
@@ -0,0 +1,95 @@
+/*
+ * 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_php_model_phpimplementation_h
+#define tuscany_sca_php_model_phpimplementation_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 php
+ {
+ /**
+ * Holds information about an SCA implementation written in PHP
+ */
+ class PHPImplementation : public ComponentType
+ {
+
+ public:
+ /**
+ * Constructor.
+ * @param module Name of the module.
+ * @param modulePath Path to the module (could be a blank string
+ * if this is not specified).
+ * @param className Name of the class in the module (could be a blank string
+ * if this is not specified).
+ */
+ PHPImplementation(const string& module, const string& className);
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPImplementation();
+
+ /**
+ * Initialize a component of this type.
+ * @param component The component to initialize.
+ */
+ virtual void initializeComponent(Component* component);
+
+ /**
+ * Returns the name of the module.
+ * @return The name of the module.
+ */
+ const string& getModule() const { return module; }
+
+ /**
+ * Get the name of the class.
+ * @return The class name if specified.
+ */
+ const string& getClass() const { return className; }
+
+ private:
+
+ /**
+ * Name of the module.
+ */
+ string module;
+
+ /**
+ * 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 php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpimplementation_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp Wed Sep 6 21:26:57 2006
@@ -0,0 +1,56 @@
+/*
+ * 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/php/model/PHPServiceBinding.h"
+#include "tuscany/sca/php/PHPServiceWrapper.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ // Constructor
+ PHPServiceBinding::PHPServiceBinding(Service* service)
+ : ServiceBinding(service, "")
+ {
+ LOGENTRY(1,"PHPServiceBinding::constructor");
+ serviceWrapper = PHPServiceWrapper::getServiceWrapper(service);
+ LOGEXIT(1,"PHPServiceBinding::constructor");
+ }
+
+ // Destructor
+ PHPServiceBinding::~PHPServiceBinding()
+ {
+ LOGENTRY(1,"PHPServiceBinding::destructor");
+ LOGEXIT(1,"PHPServiceBinding::destructor");
+ }
+
+ ServiceWrapper* PHPServiceBinding::getServiceWrapper()
+ {
+ LOGENTRY(1,"PHPServiceBinding::getServiceWrapper");
+ LOGEXIT(1,"PHPServiceBinding::getServiceWrapper");
+ return (ServiceWrapper*)serviceWrapper;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h Wed Sep 6 21:26:57 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_php_model_phpservicebinding_h
+#define tuscany_sca_php_model_phpservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+using namespace tuscany::sca::model;
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ /**
+ * Information about a PHP service binding for service or a reference.
+ */
+ class PHPServiceBinding : 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")
+ */
+ PHPServiceBinding(Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPServiceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; };
+
+ /**
+ * 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 php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpservicebinding_h
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 6 21:26:57 2006
@@ -0,0 +1,29 @@
+configure
+Makefile.in
+config.log
+depcomp
+config.guess
+config.h
+config.sub
+ltmain.sh
+Makefile
+config.status
+stamp-h1
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
+.deps
+*.dat
+.libs
+tmp
+bld
+.project
+.cdtproject
+.settings
+*_Proxy.cpp
+*_Proxy.h
+*_Wrapper.cpp
+*_Wrapper.h
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd?view=auto&rev=440973
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd Wed Sep 6 21:26:57 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="implementation.php" type="sca:PHPImplementation" substitutionGroup="sca:implementation"/>
+ <complexType name="PHPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/xsd/sca-implementation-php.xsd
------------------------------------------------------------------------------
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