summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/runtime/extensions/php/src
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-23 05:48:11 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-23 05:48:11 +0000
commit1c2df9a2458897ff6c2393913b2723457e42a0da (patch)
tree69652a0305830b4472f39c55ad1168522d8301f1 /sca-cpp/trunk/runtime/extensions/php/src
parente5d978186780787e8dad6681cca139486df93643 (diff)
Simplified the automake build using configure options instead of environment variables and cleaned up some of the makefile.am files. Adjusted build instructions. Moved directories that don't yet build or work out of the main build dir and obsolete docs to a contrib dir.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@883254 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/runtime/extensions/php/src')
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/Makefile.am57
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp71
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h57
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp73
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h74
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp76
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h74
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp81
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h83
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp505
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h112
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/export.h41
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp85
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h95
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp53
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h77
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp61
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h82
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp58
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h81
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/php_sca.h132
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.cpp517
-rw-r--r--sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.h49
23 files changed, 0 insertions, 2594 deletions
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/Makefile.am b/sca-cpp/trunk/runtime/extensions/php/src/Makefile.am
deleted file mode 100644
index d0b04262f5..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-# 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.
-
-libdir=$(prefix)/lib
-lib_LTLIBRARIES = libtuscany_sca_php.la
-
-noinst_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/PHPInterfaceExtension.cpp \
-tuscany/sca/php/PHPServiceWrapper.cpp \
-tuscany/sca/php/PHPServiceProxy.cpp \
-tuscany/sca/php/sca.cpp \
-tuscany/sca/php/model/PHPImplementation.cpp \
-tuscany/sca/php/model/PHPInterface.cpp \
-tuscany/sca/php/model/PHPReferenceBinding.cpp \
-tuscany/sca/php/model/PHPServiceBinding.cpp
-
-libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca \
- -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
- -L${PHP_LIB} -lphp5 \
- -L${PHP_SCA_SDO_LIB} -lsdo
-
-INCLUDES = -I${TUSCANY_SCACPP}/include \
- -I${TUSCANY_SDOCPP}/include \
- -I${PHP_INCLUDE} \
- -I${PHP_INCLUDE}/main \
- -I${PHP_INCLUDE}/Zend \
- -I${PHP_INCLUDE}/TSRM \
- -I${PHP_INCLUDE}/sapi/embed \
- -I${PHP_SCA_SDO_INCLUDE}
-
-moduledir=$(prefix)/module
-extension = libtuscany_sca_php$(libsuffix)
-
-install-exec-hook:
- test -z $(moduledir) || $(mkdir_p) $(moduledir);
- -rm -f $(moduledir)/$(extension)
- $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension)
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
deleted file mode 100644
index 0ffb660139..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#include "tuscany/sca/php/PHPExtension.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/php/PHPImplementationExtension.h"
-#include "tuscany/sca/php/PHPInterfaceExtension.h"
-
-
-extern "C"
-{
-#if defined(WIN32) || defined(_WINDOWS)
- __declspec(dllexport)
-#endif
- void tuscany_sca_php_initialize()
- {
- tuscany::sca::php::PHPExtension::initialize();
- }
-}
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- // ===================================================================
- // Constructor for the PHPExtension class.
- // ===================================================================
- PHPExtension::PHPExtension()
- {
- logentry();
- }
-
- // ===================================================================
- // Destructor for the PHPExtension class.
- // ===================================================================
- PHPExtension::~PHPExtension()
- {
- logentry();
- }
-
- void PHPExtension::initialize()
- {
- logentry();
- SCARuntime::getCurrentRuntime()->registerImplementationExtension(new PHPImplementationExtension());
- SCARuntime::getCurrentRuntime()->registerInterfaceExtension(new PHPInterfaceExtension());
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
deleted file mode 100644
index 971ed93c86..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#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
-
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
deleted file mode 100644
index 101667302f..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#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"
-
-using namespace std;
-using namespace commonj::sdo;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- // ===================================================================
- // Constructor for the PHPImplementationExtension class.
- // ===================================================================
- PHPImplementationExtension::PHPImplementationExtension()
- {
- logentry();
- }
-
- // ===================================================================
- // Destructor for the PHPImplementationExtension class.
- // ===================================================================
- PHPImplementationExtension::~PHPImplementationExtension()
- {
- logentry();
- }
-
- 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)
- {
- logentry();
-
- string module = scdlImplementation->getCString("module");
- string className = scdlImplementation->getCString("class");
-
- PHPImplementation* phpImpl = new PHPImplementation(composite, module, className);
-
- return phpImpl;
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
deleted file mode 100644
index 604c4ea102..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#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 std::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 std::string& getExtensionTypeQName() {return typeQName;}
-
- virtual tuscany::sca::model::ComponentType* getImplementation(
- tuscany::sca::model::Composite* composite,
- commonj::sdo::DataObjectPtr scdlImplementation);
-
- private:
- static const std::string extensionName;
- static const std::string typeQName;
-
- };
-
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_phpimplementationextension_h
-
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp
deleted file mode 100644
index a07c499dec..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#include "tuscany/sca/php/PHPInterfaceExtension.h"
-#include "tuscany/sca/php/model/PHPInterface.h"
-#include "tuscany/sca/util/Logging.h"
-
-using namespace std;
-using namespace commonj::sdo;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- // ===================================================================
- // Constructor for the PHPInterfaceExtension class.
- // ===================================================================
- PHPInterfaceExtension::PHPInterfaceExtension()
- {
- logentry();
- }
-
- // ===================================================================
- // Destructor for the PHPInterfaceExtension class.
- // ===================================================================
- PHPInterfaceExtension::~PHPInterfaceExtension()
- {
- logentry();
- }
-
- const string PHPInterfaceExtension::extensionName("php");
- const string PHPInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface");
-
- // ===================================================================
- // loadModelElement - load the info from interface.php
- // ===================================================================
- tuscany::sca::model::Interface* PHPInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
- {
- logentry();
-
- // Determine the type
- string ifType = scdlInterface->getType().getName();
- if (ifType == "PHPInterface")
- {
- bool remotable = scdlInterface->getBoolean("remotable");
- bool conversational = scdlInterface->getBoolean("conversational");
-
- return new PHPInterface(remotable, conversational);
- }
- return 0;
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h
deleted file mode 100644
index 4279376300..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_phpinterfaceextension_h
-#define tuscany_sca_php_phpinterfaceextension_h
-
-#include "tuscany/sca/extension/InterfaceExtension.h"
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- class PHPInterfaceExtension : public InterfaceExtension
- {
- public:
- /**
- * Default constructor
- */
- PHPInterfaceExtension();
-
- /**
- * Destructor
- */
- virtual ~PHPInterfaceExtension();
-
- /**
- * return the name of the extension
- */
- virtual const std::string& getExtensionName() {return extensionName;}
-
- /**
- * return the QName of schema elemant for this implementation extension
- * (e.g. "http://www.osoa.org/xmlns/sca/1.0#PHPInterface")
- */
- virtual const std::string& getExtensionTypeQName() {return typeQName;}
-
- virtual tuscany::sca::model::Interface* getInterface(
- tuscany::sca::model::Composite* composite,
- commonj::sdo::DataObjectPtr scdlInterface);
-
- private:
- static const std::string extensionName;
- static const std::string typeQName;
-
- };
-
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_phpinterfaceextension_h
-
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp
deleted file mode 100644
index 4b66c42a5b..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#include "tuscany/sca/php/PHPServiceProxy.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/model/ServiceBinding.h"
-#include "tuscany/sca/php/model/PHPReferenceBinding.h"
-
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- // ============================================
- // Constructor: Create a proxy from a reference
- // ============================================
- PHPServiceProxy::PHPServiceProxy(Reference* reference)
- : ServiceProxy(reference)
- {
- logentry();
-
- // Get the service wrapper
- PHPReferenceBinding* referenceBinding = (PHPReferenceBinding*)reference->getBinding();
- serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
- }
-
- // ==========================================
- // Constructor: Create a proxy from a service
- // ==========================================
- PHPServiceProxy::PHPServiceProxy(Service* service)
- : ServiceProxy(NULL)
- {
- logentry();
-
- // Get the service wrapper
- serviceWrapper = service->getBinding()->getServiceWrapper();
- }
-
- // ==========
- // Destructor
- // ==========
- PHPServiceProxy::~PHPServiceProxy()
- {
- logentry();
- }
-
- // =====================================================
- // invokeService: invoke the service wired to this proxy
- // =====================================================
- void PHPServiceProxy::invokeService(Operation& operation)
- {
- logentry();
-
- // Invoke the service
- serviceWrapper->invoke(operation);
- }
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h
deleted file mode 100644
index bddb262617..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_phpserviceproxy_h
-#define tuscany_sca_php_phpserviceproxy_h
-
-#include "tuscany/sca/php/export.h"
-#include "tuscany/sca/core/ServiceProxy.h"
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/util/Library.h"
-#include "tuscany/sca/model/Component.h"
-#include "tuscany/sca/model/Reference.h"
-#include "tuscany/sca/model/Service.h"
-
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- /**
- * Holds a proxy for a given reference from a component implemented in PHP.
- */
- class PHPServiceProxy : public ServiceProxy
- {
- public:
- /**
- * Create a new service proxy for a reference. The proxy will contain a pointer to
- * the target ServiceWrapper.
- * @param reference The reference on the source component.
- */
- PHPServiceProxy(tuscany::sca::model::Reference* reference);
-
- /**
- * Create a new service proxy for a service. The proxy will contain a pointer to
- * the target ServiceWrapper.
- * @param service The service on the target component.
- */
- PHPServiceProxy(tuscany::sca::model::Service* service);
-
- /**
- * Destructor.
- */
- virtual ~PHPServiceProxy();
-
- /**
- * Invoke the wired service.
- */
- virtual void invokeService(Operation& operation);
-
- private:
-
- /**
- * The target service wrapper
- */
- ServiceWrapper* serviceWrapper;
- };
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_phpserviceproxy_h
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
deleted file mode 100644
index 8c92be0d83..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifdef WIN32
-
-// some strangeness in the build that causes
-// WinSock.h and WinSock2.h to be included leading to redefinitions
-#define _WINSOCKAPI_
-
-// sdo.cpp also includes the math libraries and causes redeclarations
-// of all the math functions
-#define _INC_MATH
-
-#endif //WIN32
-
-#include <iostream>
-#include <sstream>
-
-#include <sapi/embed/php_embed.h>
-
-
-#include "tuscany/sca/php/PHPServiceWrapper.h"
-#include "tuscany/sca/php/PHPServiceProxy.h"
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/core/Exceptions.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/model/Interface.h"
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/php/model/PHPImplementation.h"
-
-
-#include "sca.h"
-#include "php_sdo_int.h"
-
-using namespace std;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- int embedSAPIInitializeCount = 0;
-
- // Global callbacks used by the PHP engine
-
- // Callback for SAPI error
- void php_sapi_error(int type, const char *error_msg, ...)
- {
- logwarning("PHP sapi error: %s", error_msg);
- //TODO - do something sensible with this output
- zend_bailout();
- }
-
- // Callback for log messages
- void php_log_message(char *message)
- {
- loginfo("PHP log: %s", message);
- //TODO - do something sensible with this output
- }
-
- // Callback for unbuffered writes (echo, print etc.)
- int php_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
- {
- logentry();
- loginfo("PHP Output: %s", str);
- //TODO - do something sensible with this output
- 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)
- {
- logentry();
-
- char buffer[2048];
- int len;
-
- len = snprintf(buffer, 2048, "Error in file %s on line %d: ", error_filename, error_lineno);
- vsnprintf(buffer + len, (2048 - len), format, args);
- logwarning("PHP error: %s", buffer);
- //TODO - do something sensible with this output
- zend_bailout();
- }
-
-
- // ===========
- // Constructor
- // ===========
- PHPServiceWrapper::PHPServiceWrapper(Service* service)
- : ServiceWrapper(service)
- {
- logentry();
-
- component = service->getComponent();
- interf = service->getType()->getInterface();
- remotable = interf->isRemotable();
-
- // -----------------------------------------------
- // Get the implementation for the target component
- // -----------------------------------------------
- PHPImplementation* impl = (PHPImplementation*)component->getType();
- if (!impl)
- {
- string msg = "Component " + component->getName() + " has no implementation defined";
- throwException(SystemConfigurationException, msg.c_str());
- }
-
- loginfo("Module: %s", impl->getModule().c_str());
- loginfo("Class: %s", impl->getClass().c_str());
- }
-
- // ==========
- // Destructor
- // ==========
- PHPServiceWrapper::~PHPServiceWrapper()
- {
- logentry();
- }
-
-
- // ======================================================================
- // invoke: wrapper call to service with setting the component context
- // ======================================================================
- void PHPServiceWrapper::invoke(Operation& operation)
- {
- zval z_func_name, retval, z_component_name, z_class_name, z_operation_name, z_arg_array;
- zval *params[5];
-
- logentry();
-
- // set the current component in the SCA runtime
- // so that other things can get at it thorugh this
- // static class
- SCARuntime* runtime = SCARuntime::getCurrentRuntime();
- runtime->setCurrentComponent(component);
-
- try
- {
- // get the component type information
- PHPImplementation* impl = (PHPImplementation*)component->getType();
-
- // get the directory containing the component type
- const string &compositeDir = impl->getComposite()->getRoot();
-
- // get some useful information that will be used later
- // when we construct the wrapper script
- string componentName = component->getName();
- string className = impl->getClass();
- string operationName = operation.getName();
- loginfo("Component %s class %s operation: %s",
- componentName.c_str(),
- className.c_str(),
- operationName.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.sapi_error = php_sapi_error;
-
- // would normally use the following macro before the embeded call
- // but we need to take account of multiple nested calls
- // and ZTS threading safety is not behaving itself
- // PHP_EMBED_START_BLOCK(/* argc */ 0, /* argv */ NULL)
- // =====================================================================
- {
-#ifdef ZTS
- static void ***tsrm_ls;
- loginfo("ZTS enabled");
-
- printf("tsrm_ls = %x, embedSAPIInitializeCount = %d\n",
- tsrm_ls, embedSAPIInitializeCount);
-#endif
-
- if ( embedSAPIInitializeCount == 0 )
- {
- embedSAPIInitializeCount = 1;
-
- php_embed_init(0, NULL PTSRMLS_CC);
-
- // load up the sca module that provides the interface between
- // C++ and user space PHP
- zend_first_try {
- zend_startup_module(&sca_module_entry);
- } zend_end_try();
- } else {
- embedSAPIInitializeCount++;
- }
-
- zend_try {
- // set error handler
- zend_error_cb = php_error_cb;
-
- /*
- * Open the include files
- */
- // includeFile("SCA/SCA.php" TSRMLS_CC);
- // includeFile("SCA/Bindings/tuscany/SCA_TuscanyWrapper.php" TSRMLS_CC);
-
- /* Instantiate a SCA_Tuscany (mediator) object, and
- * set its operation property
- */
- zval z_tuscany_mediator;
- zval *pz_mediator = &z_tuscany_mediator;
- INIT_ZVAL(z_tuscany_mediator);
- zend_class_entry *ce_mediator =
- zend_fetch_class("SCA_Tuscany", sizeof("SCA_Tuscany") - 1, 0 TSRMLS_CC);
- object_init_ex(pz_mediator, ce_mediator);
- z_tuscany_mediator.value.obj.handlers->add_ref(pz_mediator TSRMLS_CC);
-
- zend_update_property_long(ce_mediator, pz_mediator,
- "operation", sizeof("operation") - 1, (long)&operation TSRMLS_CC);
-
- /* get the class info loaded up */
- zend_eval_string("include 'SCA/SCA.php';",
- NULL, "Include SCA" TSRMLS_CC);
- zend_eval_string("include 'SCA/Bindings/tuscany/SCA_TuscanyWrapper.php';",
- NULL, "Include SCA_TuscanyWrapper" TSRMLS_CC);
-
- /* Now instantiate an SCA_TuscanyWrapper object and call its constructor */
- zval z_tuscany_wrapper;
- zval *pz_tuscany_wrapper = &z_tuscany_wrapper;
- INIT_ZVAL(z_tuscany_wrapper);
- object_init_ex(pz_tuscany_wrapper,
- zend_fetch_class("SCA_TuscanyWrapper", sizeof("SCA_TuscanyWrapper") - 1, 0 TSRMLS_CC));
- z_tuscany_wrapper.value.obj.handlers->add_ref(pz_tuscany_wrapper TSRMLS_CC);
-
- ZVAL_STRING(&z_func_name, "__construct", 1);
- ZVAL_STRING(&z_component_name, (char *)componentName.c_str(), 1);
- if( &className != NULL && className.size() > 0) {
- ZVAL_STRING(&z_class_name, (char *)className.c_str(), 1);
- } else {
- ZVAL_NULL(&z_class_name);
- }
- ZVAL_STRING(&z_operation_name, (char *)operationName.c_str(), 1);
-
- array_init(&z_arg_array);
-
- // get the parameters from the operation structure
- for(unsigned int i = 0; i < operation.getNParms(); i++)
- {
- const Operation::Parameter& parm = operation.getParameter(i);
- //printf("Arg %d type %d\n", i, parm.getType());
- switch(parm.getType())
- {
- case Operation::BOOL:
- {
- add_next_index_bool(&z_arg_array, (int)*(bool*)parm.getValue() );
- break;
- }
- case Operation::SHORT:
- case Operation::USHORT:
- case Operation::LONG:
- case Operation::ULONG:
- {
- add_next_index_long(&z_arg_array, *(long*)parm.getValue() );
- break;
- }
- case Operation::FLOAT:
- {
- add_next_index_double(&z_arg_array,( double)*(float*)parm.getValue() );
- break;
- }
- case Operation::DOUBLE:
- case Operation::LONGDOUBLE:
- {
- add_next_index_double(&z_arg_array, *(double*)parm.getValue() );
- break;
- }
- case Operation::CHARS:
- {
- add_next_index_string(&z_arg_array, *(char**)parm.getValue(), 1 );
- break;
- }
- case Operation::STRING:
- {
- add_next_index_string(&z_arg_array, (char*)(*(string*)parm.getValue()).c_str(), 1 );
- break;
- }
- case Operation::DATAOBJECT:
- {
- // convert the tuscany SDO into a PHP SDO
-
- // create the object
- zval *sdo;
- ALLOC_INIT_ZVAL(sdo);
- sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC);
-
- // add it to the arg array
- add_next_index_zval(&z_arg_array, sdo);
- break;
- }
- default:
- {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Argument type %d not supported",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- parm.getType());
- }
- }
- }
-
- params[0] = &z_tuscany_mediator;
- params[1] = &z_component_name;
- params[2] = &z_class_name;
- params[3] = &z_operation_name;
- params[4] = &z_arg_array;
-
- call_user_function(EG(function_table),
- &pz_tuscany_wrapper,
- &z_func_name,
- &retval,
- 5,
- params TSRMLS_CC);
-
- zval_dtor(&z_func_name);
- zval_dtor(&z_component_name);
- zval_dtor(&z_class_name);
- zval_dtor(&z_operation_name);
- zval_dtor(&z_arg_array);
-
- string script;
- script = "include '" + compositeDir + "/" + impl->getModule() + ".php';";
- loginfo("Script: %s", script.c_str());
-
- // call the dynamically created script
- // I'm not trapping the return value here
- // as it seems to prevent any kind of output
- // being produced. Needs investigation.
- //zval retval;
- zend_eval_string((char *) script.c_str(),
- NULL, //&retval,
- "Include module" TSRMLS_CC);
-
- loginfo(">>>> About to call SCA_TuscanyWrapper->invoke()");
-
- /* Now call SCA_TuscanyWrapper->invoke() ... */
- ZVAL_STRING(&z_func_name, "invoke", 1);
- call_user_function(EG(function_table),
- &pz_tuscany_wrapper, &z_func_name,
- &retval, 0, NULL TSRMLS_CC);
-
- loginfo("<<<< Return from SCA_TuscanyWrapper->invoke()");
-
- zval_dtor(&z_func_name);
-
- /* ... and copy the return value into the operation */
- switch(Z_TYPE(retval))
- {
- case IS_NULL:
- {
- //printf("NULL response");
- break;
- }
- case IS_BOOL:
- {
- bool *newBool = new bool;
- *newBool = ZEND_TRUTH(Z_BVAL(retval));
- operation.setReturnValue(newBool);
- break;
- }
- case IS_LONG:
- {
- long *newLong = new long;
- *newLong = Z_LVAL(retval);
- operation.setReturnValue(newLong);
- break;
- }
- case IS_DOUBLE:
- {
- //double *newDouble = new double;
- float *newDouble = new float;
- *newDouble = (float)Z_DVAL(retval);
- operation.setReturnValue(newDouble);
- break;
- }
- case IS_STRING:
- {
- string newString (Z_STRVAL(retval));
- operation.setReturnValue(&newString);
- break;
- }
- case IS_OBJECT:
- {
- // convert the PHP SDO into a Tuscany SDO
- DataObjectPtr sdo = sdo_do_get(&retval TSRMLS_CC);
- operation.setReturnValue(&sdo);
- break;
- }
- default:
- {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Input argument type %d not supported on invoke",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- Z_TYPE(retval));
- }
- }
- } zend_catch {
- /* int exit_status = EG(exit_status); */
- }
- zend_end_try();
-
- if ( embedSAPIInitializeCount == 1 )
- {
- php_embed_shutdown(TSRMLS_C);
- loginfo("Engine shutdown");
- }
- else
- {
- embedSAPIInitializeCount--;
- }
- }
- // =====================================================================
- }
- catch (...)
- {
- runtime->unsetCurrentComponent();
- throw;
- }
- runtime->unsetCurrentComponent();
-
- }
-
- // ======================================================================
- // getServiceWrapper: create a wrapper for the target ComponentService
- // ======================================================================
- PHPServiceWrapper* PHPServiceWrapper::getServiceWrapper(Service* service)
- {
- logentry();
- PHPServiceWrapper* serviceWrapper = 0;
-
- // ---------------------------------
- // Create an instance of the wrapper
- // ---------------------------------
- serviceWrapper = new PHPServiceWrapper(service);
- if (!serviceWrapper)
- {
- string msg = "Could not create new PHPServiceWrapper";
- throwException(SystemConfigurationException, msg.c_str());
- }
-
- return serviceWrapper;
- }
-
- /* Not used at the moment
- * Can find the include file and execute it,
- * but doesn't make the contents available
- */
- void PHPServiceWrapper::includeFile(char *includeFileName TSRMLS_DC)
- {
- zend_file_handle include_file_handle;
-
- include_file_handle.type = ZEND_HANDLE_FP;
- include_file_handle.filename = includeFileName;
- include_file_handle.opened_path = NULL;
- include_file_handle.free_filename = 0;
- if (!(include_file_handle.handle.fp = php_fopen_with_path(
- include_file_handle.filename, "rb", PG(include_path),
- &include_file_handle.opened_path TSRMLS_CC))) {
- php_error(E_ERROR,
- "Could not open %s", include_file_handle.filename);
- return;
- }
- php_execute_script(&include_file_handle TSRMLS_CC);
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
deleted file mode 100644
index be20f34217..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-
-#ifndef tuscany_sca_php_phpservicewrapper_h
-#define tuscany_sca_php_phpservicewrapper_h
-
-#include "tuscany/sca/php/export.h"
-#include "tuscany/sca/core/ServiceWrapper.h"
-#include "tuscany/sca/core/Operation.h"
-#include "tuscany/sca/model/Component.h"
-#include "tuscany/sca/model/Interface.h"
-
-#include <TSRM/TSRM.h>
-
-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(tuscany::sca::model::Service* service);
-
- /**
- * Constructor.
- * @param target The component service to which this wrapper refers.
- */
- PHPServiceWrapper(tuscany::sca::model::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:
-
- /**
- * Utility method to execute a script on the include_path.
- */
- static void includeFile(char *includeFileName TSRMLS_DC);
-
- /**
- * The component to which this wrapper refers.
- */
- tuscany::sca::model::Component* component;
-
- /**
- * Set to true if the service is remotable.
- */
- bool remotable;
-
- /**
- * A pointer to the interface which the service exposes.
- */
- tuscany::sca::model::Interface* interf;
-
- };
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_phpservicewrapper_h
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/export.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/export.h
deleted file mode 100644
index 11a9519361..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/export.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_export_h
-#define tuscany_sca_php_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 // tuscany_sca_export_h
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
deleted file mode 100644
index 63f1672ec5..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#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"
-
-using namespace std;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
-
- namespace php
- {
-
- // Constructor
- PHPImplementation::PHPImplementation(Composite* composite, const string& module, const string& className)
- : ComponentType(composite, module),
- module(module), className(className)
- {
- logentry();
- }
-
- PHPImplementation::~PHPImplementation()
- {
- logentry();
- }
-
- void PHPImplementation::initializeComponent(Component* component)
- {
- logentry();
- 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++;
- }
-
- // 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++;
- }
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
deleted file mode 100644
index 78e678dff5..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_model_phpimplementation_h
-#define tuscany_sca_php_model_phpimplementation_h
-
-#include <string>
-
-#include "tuscany/sca/model/ComponentType.h"
-
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- /**
- * Holds information about an SCA implementation written in PHP
- */
- class PHPImplementation : public tuscany::sca::model::ComponentType
- {
-
- public:
- /**
- * Constructor.
- * @param composite Composite containing this implementation.
- * @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(tuscany::sca::model::Composite* composite, const std::string& module, const std::string& className);
-
- /**
- * Destructor
- */
- virtual ~PHPImplementation();
-
- /**
- * Initialize a component of this type.
- * @param component The component to initialize.
- */
- virtual void initializeComponent(tuscany::sca::model::Component* component);
-
- /**
- * Returns the name of the module.
- * @return The name of the module.
- */
- const std::string& getModule() const { return module; }
-
- /**
- * Get the name of the class.
- * @return The class name if specified.
- */
- const std::string& getClass() const { return className; }
-
- private:
-
- /**
- * Name of the module.
- */
- std::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.
- */
- std::string className;
- };
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_model_phpimplementation_h
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp
deleted file mode 100644
index cbea3f2b71..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/php/export.h"
-#include "tuscany/sca/php/model/PHPInterface.h"
-
-using namespace std;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- const string PHPInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface");
-
- // Constructor
- PHPInterface::PHPInterface(
- bool remotable,
- bool conversational)
- : Interface(remotable, conversational)
- {
- logentry();
- }
-
- PHPInterface::~PHPInterface()
- {
- logentry();
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h
deleted file mode 100644
index 9a4f658eb0..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-
-#ifndef tuscany_sca_php_model_phpinterface_h
-#define tuscany_sca_php_model_phpinterface_h
-
-#include <string>
-
-#include "tuscany/sca/php/export.h"
-#include "tuscany/sca/model/Interface.h"
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- /**
- * Holds information about an interface described using a PHP
- * header file.
- */
- class PHPInterface : public tuscany::sca::model::Interface
- {
-
- public:
- /**
- * Constuctor.
- * @param scope The scope of the interface (stateless or composite).
- * @param remotable True if the interface is remotable.
- */
- PHPInterface(
- bool remotable,
- bool conversational);
-
- /**
- * Destructor.
- */
- virtual ~PHPInterface();
-
- /**
- * return the QName of the schema type for this interface type
- * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
- */
- const std::string& getInterfaceTypeQName() { return typeQName; };
-
- /**
- * The QName of the schema type for this interface type.
- */
- SCA_PHP_API static const std::string typeQName;
-
- };
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_model_phpinterface_h
-
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp
deleted file mode 100644
index 919d4c8646..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/php/model/PHPReferenceBinding.h"
-#include "tuscany/sca/php/PHPServiceProxy.h"
-
-using namespace std;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- // Constructor
- PHPReferenceBinding::PHPReferenceBinding(Reference* reference)
- : ReferenceBinding(reference, ""), serviceProxy(NULL)
- {
- }
-
- // Destructor
- PHPReferenceBinding::~PHPReferenceBinding()
- {
- }
-
- ServiceProxy* PHPReferenceBinding::getServiceProxy()
- {
- return serviceProxy;
- }
-
- void PHPReferenceBinding::configure(ServiceBinding* binding)
- {
- setTargetServiceBinding(binding);
-
- serviceProxy = new PHPServiceProxy(getReference());
- }
-
- } // End namespace
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h
deleted file mode 100644
index 45b422da2c..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_model_phpreferencebinding_h
-#define tuscany_sca_php_model_phpreferencebinding_h
-
-#include <string>
-
-#include "tuscany/sca/model/ReferenceBinding.h"
-
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- /**
- * Information about a PHP service binding for service or a reference.
- */
- class PHPReferenceBinding : public tuscany::sca::model::ReferenceBinding
- {
- public:
-
- /**
- * Constructor.
- */
- PHPReferenceBinding(tuscany::sca::model::Reference* reference);
-
- /**
- * Destructor.
- */
- virtual ~PHPReferenceBinding();
-
- /**
- * Returns the type of binding.
- */
- virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; };
-
- /**
- * Create a proxy representing the reference to the
- * client component.
- */
- virtual ServiceProxy* getServiceProxy();
-
- /**
- * Configure this binding from a service binding.
- */
- virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding);
-
- private:
-
- /**
- * The proxy representing the reference to the client
- * component.
- */
- ServiceProxy* serviceProxy;
- };
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
-
-#endif // tuscany_sca_php_model_phpreferencebinding_h
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
deleted file mode 100644
index 4d18424ae2..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#include "tuscany/sca/util/Logging.h"
-#include "tuscany/sca/php/model/PHPServiceBinding.h"
-#include "tuscany/sca/php/PHPServiceWrapper.h"
-
-using namespace std;
-using namespace tuscany::sca::model;
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
-
- // Constructor
- PHPServiceBinding::PHPServiceBinding(Service* service)
- : ServiceBinding(service, "")
- {
- logentry();
- serviceWrapper = PHPServiceWrapper::getServiceWrapper(service);
- }
-
- // Destructor
- PHPServiceBinding::~PHPServiceBinding()
- {
- logentry();
- }
-
- ServiceWrapper* PHPServiceBinding::getServiceWrapper()
- {
- logentry();
- return (ServiceWrapper*)serviceWrapper;
- }
-
- } // End namespace php
- } // End namespace sca
-} // End namespace tuscany
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
deleted file mode 100644
index ef3d6b1604..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-/* $Rev$ $Date$ */
-
-#ifndef tuscany_sca_php_model_phpservicebinding_h
-#define tuscany_sca_php_model_phpservicebinding_h
-
-#include <string>
-
-#include "tuscany/sca/model/ServiceBinding.h"
-
-
-namespace tuscany
-{
- namespace sca
- {
- namespace php
- {
- /**
- * Information about a PHP service binding for service or a reference.
- */
- class PHPServiceBinding : public tuscany::sca::model::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(tuscany::sca::model::Service* service);
-
- /**
- * Destructor.
- */
- virtual ~PHPServiceBinding();
-
- /**
- * Returns the type of binding.
- */
- virtual std::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
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/php_sca.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/php_sca.h
deleted file mode 100644
index 8aea8dadb2..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/php_sca.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-/* $ Id: $ */
-
-#ifndef PHP_SCA_H
-#define PHP_SCA_H
-
-#include "tuscany/sca/core/Operation.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <main/php.h>
-
-#ifdef HAVE_SCA
-
-#include <main/php_ini.h>
-#include <main/SAPI.h>
-#include <ext/standard/info.h>
-#include <Zend/zend_extensions.h>
-#ifdef __cplusplus
-} // extern "C"
-#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-//extern zend_module_entry sca_module_entry;
-#define phpext_sca_ptr &sca_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SCA_API __declspec(dllexport)
-#else
-#define PHP_SCA_API
-#endif
-
-PHP_MINIT_FUNCTION(sca);
-PHP_MSHUTDOWN_FUNCTION(sca);
-PHP_MINFO_FUNCTION(sca);
-
-#ifdef ZTS
-#include "TSRM/TSRM.h"
-#endif
-
-#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))
-
-#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
-#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)
-
-#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
-#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)
-
-#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
-#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
-#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
-#define PROP_SET_STRINGL(name, s, l) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)
-
-
-PHP_METHOD(SCA_Tuscany, __construct);
-#if (PHP_MAJOR_VERSION >= 5)
-ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
-ZEND_END_ARG_INFO()
-#else /* PHP 4.x */
-#define SCA_Tuscany____construct_args NULL
-#endif
-
-PHP_METHOD(SCA_Tuscany, invoke);
-#if (PHP_MAJOR_VERSION >= 5)
-ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__invoke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4)
- ZEND_ARG_INFO(0, component_name)
- ZEND_ARG_INFO(0, reference_name)
- ZEND_ARG_INFO(0, method_name)
-#if (PHP_MINOR_VERSION > 0)
- ZEND_ARG_ARRAY_INFO(0, arguments, 1)
-#else
- ZEND_ARG_INFO(0, arguments)
-#endif
-ZEND_END_ARG_INFO()
-#else /* PHP 4.x */
-#define SCA_Tuscany__invoke_args NULL
-#endif
-
-PHP_METHOD(SCA_Tuscany, getArgArray);
-#if (PHP_MAJOR_VERSION >= 5)
-ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__getArgArray_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
-ZEND_END_ARG_INFO()
-#else /* PHP 4.x */
-#define SCA_Tuscany__getArgArray_args NULL
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-
-
-#endif /* PHP_HAVE_SCA */
-
-#endif /* PHP_SCA_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.cpp b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.cpp
deleted file mode 100644
index 4078226f63..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * 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.
- */
-
-/* $ Id: $ */
-
-#ifdef WIN32
-
-// some strangeness in the build that causes
-// WinSock.h and WinSock2.h to be included leading to redefinitions
-#define _WINSOCKAPI_
-
-#endif //WIN32
-
-#include "tuscany/sca/core/SCARuntime.h"
-#include "tuscany/sca/php/PHPServiceProxy.h"
-#include "commonj/sdo/RefCountingPointer.h"
-
-using namespace std;
-using namespace tuscany::sca;
-using namespace tuscany::sca::model;
-using namespace tuscany::sca::php;
-using namespace commonj::sdo;
-
-#define HAVE_SCA 1
-
-
-#include "php_sca.h"
-#include "sca.h"
-
-#if HAVE_SCA
-
-#include "php_sdo.h"
-#include "php_sdo_int.h"
-/* {{{ Class definitions */
-
-/* {{{ Class SCA_Tuscany */
-
-static zend_class_entry * SCA_Tuscany_ce_ptr = NULL;
-
-/* {{{ Methods */
-
-/* {{{ proto void __construct(int operation_handle)
- */
-PHP_METHOD(SCA_Tuscany, __construct)
-{
- zval *_this_zval = getThis();
- zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval);
-
- long operation_handle = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &operation_handle) == FAILURE) {
- return;
- }
-
- if (!operation_handle) {
- php_error(E_ERROR, "SCA_Tuscany ctor called with NULL operation");
- }
-
- PROP_SET_LONG(operation, operation_handle);
-}
-/* }}} __construct */
-
-/* {{{ proto int invoke(string component_name, string reference_name, string method_name, array arguments)
- Invoke a Tuscany component */
-PHP_METHOD(SCA_Tuscany, invoke)
-{
- //zval * _this_zval = NULL;
- const char * component_name = NULL;
- int component_name_len = 0;
- const char * reference_name = NULL;
- int reference_name_len = 0;
- const char * method_name = NULL;
- int method_name_len = 0;
- zval * arguments = NULL;
- HashTable * arguments_hash = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssa/",
- &component_name, &component_name_len,
- &reference_name, &reference_name_len,
- &method_name, &method_name_len,
- &arguments) == FAILURE) {
- return;
- }
-
- arguments_hash = HASH_OF(arguments);
-
- // find the correct service proxy
- SCARuntime* runtime = SCARuntime::getCurrentRuntime();
- Component* component = runtime->getCurrentComponent();
- Reference* ref = component->findReference(reference_name);
- if(!ref) {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Can't find reference %s",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- reference_name);
- return;
- }
-
- ReferenceBinding* refBinding = ref->getBinding();
- PHPServiceProxy *serviceProxy = (PHPServiceProxy*) refBinding->getServiceProxy();
-
- // construct an operation structure
- Operation operation(method_name);
-
- // add the parameters to the operation
- for ( zend_hash_internal_pointer_reset(arguments_hash);
- zend_hash_has_more_elements(arguments_hash) == SUCCESS;
- zend_hash_move_forward(arguments_hash) )
- {
- zval **data;
-
- if ( zend_hash_get_current_data(arguments_hash,
- (void**)&data ) == FAILURE )
- {
- continue;
- }
-
- char *hashKey;
- uint hashKeyLength;
- ulong hashIndex;
- int type;
-
- type = zend_hash_get_current_key_ex(arguments_hash,
- &hashKey,
- &hashKeyLength,
- &hashIndex,
- 0,
- NULL);
-
- switch(Z_TYPE_PP(data))
- {
- case IS_NULL:
- {
- //printf("NULL argument");
- break;
- }
- case IS_BOOL:
- {
- convert_to_boolean(*data);
- bool *newBool = new bool;
- *newBool = ZEND_TRUTH(Z_BVAL_PP(data));
- operation.addParameter(newBool);
- break;
- }
- case IS_LONG:
- {
- convert_to_long(*data);
- long *newLong = new long;
- *newLong = Z_LVAL_PP(data);
- operation.addParameter(newLong);
- break;
- }
- case IS_DOUBLE:
- {
- //convert_to_double(*data);
- //double *newDouble = new double;
- convert_to_double(*data);
- float *newDouble = new float;
- *newDouble = (float)Z_DVAL_PP(data);
- operation.addParameter(newDouble);
- break;
- }
- case IS_STRING:
- {
- convert_to_string(*data);
- string newString (Z_STRVAL_PP(data));
- operation.addParameter(&newString);
- break;
- }
- case IS_OBJECT:
- {
- // convert the PHP SDO into a Tuscany SDO
- DataObjectPtr sdo = sdo_do_get(*data TSRMLS_CC);
- operation.addParameter(&sdo);
- break;
- }
- default:
- {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Input argument type %d not supported on invoke",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- Z_TYPE_PP(data));
- }
- }
- }
-
- // call the proxy
- serviceProxy->invokeService(operation);
-
- switch(operation.getReturnType())
- {
- case Operation::BOOL:
- {
- ZVAL_BOOL(return_value, *(bool*)operation.getReturnValue());
- break;
- }
- case Operation::SHORT:
- case Operation::USHORT:
- case Operation::LONG:
- case Operation::ULONG:
- {
- ZVAL_LONG(return_value, *(long*)operation.getReturnValue());
- break;
- }
- case Operation::FLOAT:
- case Operation::DOUBLE:
- case Operation::LONGDOUBLE:
- {
- ZVAL_DOUBLE(return_value, (double)*(float*)operation.getReturnValue());
- break;
- }
- case Operation::CHARS:
- {
- ZVAL_STRING(return_value, (char*)operation.getReturnValue(), 1);
- break;
- }
- case Operation::STRING:
- {
- ZVAL_STRING(return_value, (char*)((string*)operation.getReturnValue())->c_str(), 1);
- break;
- }
- case Operation::VOID_TYPE:
- {
- // do nothing
- break;
- }
- case Operation::DATAOBJECT:
- {
- // convert the tuscany SDO into a PHP SDO
- sdo_do_new(return_value, *(DataObjectPtr*)operation.getReturnValue() TSRMLS_CC);
- break;
- }
- default:
- {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Response type %d not supported on invoke",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- operation.getReturnType());
- }
- }
-
-}
-/* }}} invoke */
-
-/* {{{ proto array getArgArray()
- return the arguments for the operation as an array */
-PHP_METHOD(SCA_Tuscany, getArgArray)
-{
- zval * _this_zval = getThis();
- zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval);
-
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- // get the operation object from the object properties
- Operation *operation = (Operation *)PROP_GET_LONG(operation);
-
- // get the parameters from the operation structure
- for(unsigned int i = 0; i < operation->getNParms(); i++)
- {
- const Operation::Parameter& parm = operation->getParameter(i);
- //printf("Arg %d type %d\n", i, parm.getType());
- switch(parm.getType())
- {
- case Operation::BOOL:
- {
- add_next_index_bool(return_value,(int)*(bool*)parm.getValue() );
- break;
- }
- case Operation::SHORT:
- case Operation::USHORT:
- case Operation::LONG:
- case Operation::ULONG:
- {
- add_next_index_long(return_value,*(long*)parm.getValue() );
- break;
- }
- case Operation::FLOAT:
- {
- add_next_index_double(return_value,(double)*(float*)parm.getValue() );
- break;
- }
- case Operation::DOUBLE:
- case Operation::LONGDOUBLE:
- {
- add_next_index_double(return_value,*(double*)parm.getValue() );
- break;
- }
- case Operation::CHARS:
- {
- add_next_index_string(return_value,*(char**)parm.getValue(), 1 );
- break;
- }
- case Operation::STRING:
- {
- add_next_index_string(return_value,(char*)(*(string*)parm.getValue()).c_str(), 1 );
- break;
- }
- case Operation::DATAOBJECT:
- {
- // convert the tuscany SDO into a PHP SDO
-
- // create the object
- zval *sdo;
- ALLOC_INIT_ZVAL(sdo);
- sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC);
-
- // add it to the arg array
- add_next_index_zval(return_value, sdo);
- break;
- }
- default:
- {
- char *class_name;
- char *space;
- class_name = get_active_class_name(&space TSRMLS_CC);
- php_error(E_ERROR,
- "%s%s%s(): Argument type %d not supported",
- class_name,
- space,
- get_active_function_name(TSRMLS_C),
- parm.getType());
- }
- }
- }
-}
-/* }}} getArgArray */
-
-static zend_function_entry SCA_Tuscany_methods[] = {
- PHP_ME(SCA_Tuscany, __construct, SCA_Tuscany____construct_args, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(SCA_Tuscany, invoke, SCA_Tuscany__invoke_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(SCA_Tuscany, getArgArray, SCA_Tuscany__getArgArray_args, ZEND_ACC_PUBLIC)
- { NULL, NULL, NULL }
-};
-
-/* }}} Methods */
-
-static void class_init_SCA_Tuscany(TSRMLS_D)
-{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, "SCA_Tuscany", SCA_Tuscany_methods);
- SCA_Tuscany_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC);
-
- /* {{{ Property registration */
-
- zend_declare_property_null(SCA_Tuscany_ce_ptr,
- "operation", sizeof("operation") -1,
- ZEND_ACC_PUBLIC TSRMLS_CC);
-
- /* }}} Property registration */
-
-}
-
-/* }}} Class SCA_Tuscany */
-
-/* }}} Class definitions*/
-
-/* {{{ sca_functions[] */
-function_entry sca_functions[] = {
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ cross-extension dependencies */
-
-#if ZEND_EXTENSION_API_NO >= 220050617
-static zend_module_dep sca_deps[] = {
- ZEND_MOD_REQUIRED("sdo")
- {NULL, NULL, NULL, 0}
-};
-#endif
-/* }}} */
-
-/* {{{ sca_module_entry */
-zend_module_entry sca_module_entry = {
-#if ZEND_EXTENSION_API_NO >= 220050617
- STANDARD_MODULE_HEADER_EX, NULL,
- sca_deps,
-#else
- STANDARD_MODULE_HEADER,
-#endif
-
- "sca",
- sca_functions,
- PHP_MINIT(sca), /* Replace with NULL if there is nothing to do at php startup */
- PHP_MSHUTDOWN(sca), /* Replace with NULL if there is nothing to do at php shutdown */
- NULL, /* Replace with NULL if there is nothing to do at request start */
- NULL, /* Replace with NULL if there is nothing to do at request end */
- PHP_MINFO(sca),
- "0.0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SCA
-extern "C" {
-ZEND_GET_MODULE(sca)
-} // extern "C"
-#endif
-
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(sca)
-{
- /* We use the SDO extension for reference because it is a prereq */
- zend_module_entry *req_module_entry;
- char *req_module_name = "libxml";
- if (zend_hash_find(&module_registry, req_module_name, strlen(req_module_name)+1, (void**)&req_module_entry) == SUCCESS) {
- if (req_module_entry->zend_debug != ZEND_DEBUG ||
- req_module_entry->zts != USING_ZTS ||
- req_module_entry->zend_api != ZEND_MODULE_API_NO) {
- php_error(E_ERROR,
- "Cannot initialize module sca.\nModule sca compiled with module API=%d, debug=%d, thread-safety=%d\nModule %n compiled with module API=%d, debug=%d, thread-safety=%d\nThese options need to match",
- req_module_name,
- ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS,
- req_module_entry->zend_api, req_module_entry->zend_debug, req_module_entry->zts);
- return FAILURE;
- }
- } else {
- /* The dependency checker should already have found this, but to be on the safe side ... */
- php_error (E_ERROR,
- "Cannot load module sca because required module %n is not loaded",
- req_module_name);
- return FAILURE;
- }
-
- class_init_SCA_Tuscany(TSRMLS_C);
-
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION(sca)
-{
- /*
- * There is some corruption going on at shutdown.
- * The following hack eliminates the symptom, but there's probably still
- * an underlying problem.
- */
- free(SCA_Tuscany_ce_ptr->name);
- SCA_Tuscany_ce_ptr->name = NULL;
- destroy_zend_class(&SCA_Tuscany_ce_ptr);
- SCA_Tuscany_ce_ptr = NULL;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION(sca)
-{
- php_info_print_box_start(0);
- php_printf("<p>SCA Extension</p>\n");
- php_printf("<p>Version 0.0.1alpha (2007-01-15)</p>\n");
- php_printf("<p><b>Authors:</b></p>\n");
- php_printf("<p>Simon Laws &lt;slaws@php.net&gt; (lead)</p>\n");
- php_printf("<p>Caroline Maynard &lt;cem@php.net&gt; (lead)</p>\n");
- php_info_print_box_end();
- php_info_print_table_start();
- php_info_print_table_header(2, "SCA", "enabled");
- php_info_print_table_row(2, "SCA Version", "0.0.1");
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* Other functions not directly related to implementing the
- SCA_Tuscany extension */
-
-#endif /* HAVE_SCA */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.h b/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.h
deleted file mode 100644
index 5bbc9001dc..0000000000
--- a/sca-cpp/trunk/runtime/extensions/php/src/tuscany/sca/php/sca.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-/* $ Id: $ */
-
-#ifndef SCA_H
-#define SCA_H
-
-#include "tuscany/sca/core/Operation.h"
-
-#include <main/php.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern zend_module_entry sca_module_entry;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* SCA_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */