tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robbin...@apache.org
Subject svn commit: r366157 [10/33] - in /incubator/tuscany/cpp/sca: ./ bin/ include/ include/osoa/ include/osoa/sca/ include/tuscany/ include/tuscany/sca/ include/tuscany/sca/core/ include/tuscany/sca/model/ include/tuscany/sca/util/ include/tuscany/sca/ws/ l...
Date Thu, 05 Jan 2006 10:59:14 GMT
Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,132 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_model_wsdl_h
+#define tuscany_sca_model_wsdl_h
+
+#include <string>
+using std::string;
+
+#include "tuscany/sca/model/WsdlOperation.h"
+
+#include "commonj/sdo/SDO.h"
+using commonj::sdo::DataObjectPtr;
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+
+            /**
+             * Holds information about a WSDL definition loaded into the runtime.
+             */ 
+            class Wsdl
+            {
+            public:
+                /**
+                 * Constructor.
+                 * @param wsdlModel The data object representing the WSDL document
+                 * defining a web service.
+                 */
+                 Wsdl(DataObjectPtr wsdlModel);
+
+                /**
+                 * Destructor.
+                 */ 
+                ~Wsdl();
+
+
+                /**
+                 * Returns the target namespace of the WSDL definitions.
+                 * @return The target namespace.
+                 */
+                string getNamespace(void);
+
+                /**
+                 * Find an operation in the WSDL definitions.
+                 * @param serviceName The name of the service on which this
+                 * operation is defined.
+                 * @param portName The name of the port in the service to
+                 * use.
+                 * @param operationName The name of the operation to find.
+                 * @return The operation if found. Exception thrown if not found.
+                 */
+                WsdlOperation findOperation(const string& serviceName, 
+                                        const string& portName, 
+                                        const string& operationName);
+                
+            private:
+
+                /**
+                 * Find a service in the wsdl definition.
+                 * @param serviceName The name of the service.
+                 * @return A data object describing the service if found, otherwise
+                 * a 0 if not found.
+                 */
+                DataObjectPtr findService(const string& serviceName);
+
+                /**
+                 * Find a binding in the wsdl definition.
+                 * @param bindingName The name of the binding to find.
+                 * @return A data object describing the binding if found, otherwise
+                 * a 0 if not found.
+                 */
+                DataObjectPtr findBinding(const string& bindingName);
+
+                /**
+                 * Find a portType in the wsdl definition.
+                 * @param portTypeName The name of the portType.
+                 * @return A data object describing the portType if found, otherwise
+                 * a 0 if not found.
+                 */
+                DataObjectPtr findPortType(const string& portTypeName);
+
+                /**
+                 * Find a message in the wsdl definition.
+                 * @param messageName The name of the message.
+                 * @return A data object describing the message if found, otherwise
+                 * a 0 if not found.
+                 */
+                DataObjectPtr findMessage(const string& messageName);
+
+                /**
+                 * The the details of the soap action setting for an operation
+                 * on a soap binding.
+                 * @param binding The data object describing the binding.
+                 * @param operationName The name of the operation.
+                 * @return The soap action setting from the WSDL.
+                 */
+                string getSoapAction(DataObjectPtr binding, const string& operationName);
+
+
+                /**
+                 * The data object representation of the WSDL document.
+                 */
+                DataObjectPtr wsdlModel;
+            };
+
+         } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_wsdl_h
+

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,57 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/model/Wsdl.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+            
+            
+            // Constructor
+            WsdlOperation::WsdlOperation(const string& operation, 
+                const string& soapAct, 
+                const string& endpointAddress,
+                const string& response) 
+                : operationName(operation), 
+                responseName(response), 
+                soapAction(soapAct),  
+                endpoint(endpointAddress)
+            {
+                LOGENTRY(1, "WsdlOperation::constructor");
+
+
+
+                
+                LOGEXIT(1, "WsdlOperation::constructor");
+            }
+
+            WsdlOperation::~WsdlOperation()
+            {
+            }
+
+            
+        } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,117 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_model_wsdlOperation_h
+#define tuscany_sca_model_wsdlOperation_h
+
+#include <string>
+using std::string;
+
+
+namespace tuscany
+{
+    namespace sca
+    {
+        namespace model
+        {
+
+            /**
+             * Represents a single.,bound WSDL defined operation.
+             * This class includes information from the soapBinding
+             * in addition to the WSDL definition of the operation.
+             */ 
+            class WsdlOperation
+            {
+            public:
+                /**
+                 * Constructor.
+                 * @param operation The name of the operation.
+                 * @param soapAction The soapAction associated with this operation
+                 * in the SOAP binding of the operation.
+                 * @param endpoint The endpoint address of the operation.
+                 * @param responseName The name of the response message.
+                 */
+                 WsdlOperation(const string& operation,
+                    const string& soapAction, 
+                    const string& endpoint,
+                    const string& responseName);
+
+                /**
+                 * Destructor.
+                 */ 
+                ~WsdlOperation();
+
+                /**
+                 * Return the name of the operation for use when serializing an
+                 * outgoing message.
+                 * @return The name of the element in the request message.
+                 */ 
+                const string& getOperationName() {return operationName;};
+
+                /**
+                 * Return the name of the response for use when deserializing an
+                 * incoming message.
+                 * @return The name of the element in the response message.
+                 */
+                const string& getResponseName() {return responseName;};
+
+                /**
+                 * The soap action string for this operation.
+                 * @return The soap action.
+                 */
+                const string& getSoapAction() {return soapAction;};
+
+                /**
+                 * Return the endpoint address for the target web service.
+                 * @return The endpoint address.
+                 */
+                const string& getEndpoint() {return endpoint;};
+
+
+                
+            private:
+                /**
+                 * The name of the operation for use when serializing an
+                 * outgoing message.
+                 */ 
+                string operationName;
+
+                /**
+                 * The name of the response for use when deserializing an
+                 * incoming message.
+                 */
+                string responseName;
+
+                /**
+                 * The soap action string for this operation.
+                 */
+                string soapAction;
+
+                /**
+                 * The endpoint address of the target web service.
+                 */
+                string endpoint;
+            };
+
+         } // End namespace model
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_model_wsdlOperation_h
+

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

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

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,43 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/DefaultLogWriter.h"
+#include <iostream>
+using namespace std;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        DefaultLogWriter::~DefaultLogWriter()
+        {
+        }
+
+        void DefaultLogWriter::log(int level, const char* msg)
+        {
+            for (int i=0; i < level; i++)
+            {
+                cout << "  ";
+            }
+            cout << msg <<endl;
+        }
+
+    } // End namespace sca
+} // End namespace tuscany
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,46 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_defaultlogwriter_h
+#define tuscany_sca_util_defaultlogwriter_h
+
+#include "tuscany/sca/util/LogWriter.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Log writer to write out to standard out.
+         */
+        class DefaultLogWriter : public LogWriter
+        {
+        public:
+            virtual ~DefaultLogWriter();
+
+            /**
+             * Will write to the console.
+             * See LogWriter#log.
+             */
+            virtual void log(int level, const char* msg);
+        };
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_defaultlogwriter_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/DefaultLogWriter.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,48 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_exceptions_h
+#define tuscany_sca_util_exceptions_h
+
+#include "osoa/sca/ServiceRuntimeException.h"
+using osoa::sca::ServiceRuntimeException;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Indicates a problem in the consistency of the SCA model provided to the
+         * Tuscany runtime.
+         */
+        class SystemConfigurationException: public ServiceRuntimeException
+        {
+        public:
+            SystemConfigurationException(const char* msg)
+                : ServiceRuntimeException("SystemConfigurationException", Severe,
+                msg)
+            {
+            }
+        private:
+        };
+
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_exceptions_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,214 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/File.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include <iostream>
+
+#include <string>
+
+#if defined(WIN32)  || defined (_WINDOWS)
+#include <windows.h> 
+#else
+#include <unistd.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#endif
+
+namespace tuscany
+{
+    namespace sca
+    {
+        File::File(const string& dir, const string& file)
+            : directory(dir), fileName(file)
+        {
+        }
+        File::~File()
+        {
+        }
+        
+        
+        Files::Files(const string& rootDir, const string& pattern, bool subdirectories)
+            : rootDirectory(rootDir)
+        {
+            findFiles(rootDirectory, pattern, subdirectories);
+        }
+        
+        Files::~Files()
+        {
+        }
+        
+        unsigned int Files::size()
+        {
+            return files.size();
+        }
+        
+        const File& Files::operator[] (unsigned int index)
+        {
+            if (size() <= index)
+            {
+                throw ServiceRuntimeException("Files::operator[] index out of bounds");
+            }
+            
+            FILES::iterator iter = files.begin();
+            for (unsigned int i=0; i<index; i++)
+            {
+                iter++;
+            }
+            
+            return *iter;
+        }
+        
+        
+        void Files::findFiles(const string& rootDir, const string& pattern, bool subdirectories)
+        {
+            
+#if defined(WIN32)  || defined (_WINDOWS)
+            char currentDir[ _MAX_FNAME];
+            
+            
+            GetCurrentDirectory(_MAX_FNAME, currentDir);
+            
+            // Set current directory, from which to search.
+            if (!SetCurrentDirectory(rootDir.c_str()))
+            {
+                cout << "Unable to set current directory to: " << rootDir.c_str() << endl;
+                return;
+            }
+            char fullDirname[ _MAX_FNAME];
+            GetCurrentDirectory(_MAX_FNAME, fullDirname);
+            
+            // First, look for all files in this directory that meet the pattern
+            char search[ _MAX_FNAME];
+            strcpy(search, pattern.c_str());
+            
+            // Find the first file in the directory
+            WIN32_FIND_DATA data;
+            HANDLE searchHandle = FindFirstFile(search, &data);
+            
+            int more = TRUE;
+            if (searchHandle != INVALID_HANDLE_VALUE)
+            {
+                // Found some matching files, so call the function with the details of each one
+                while (more)
+                {
+                    // Skip over directories
+                    if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+                    {
+                        // Add the file to our list
+                        files.push_back(File(fullDirname, data.cFileName));
+                    }
+                    
+                    more = FindNextFile(searchHandle, &data);
+                }
+            }
+            
+            
+            if (!subdirectories)
+                return;
+            
+            // Now recurse down all the directories
+            // Find the first file in the directory
+            searchHandle = FindFirstFile( "*.*", &data);
+            more = TRUE;
+            
+            if (searchHandle != INVALID_HANDLE_VALUE)
+            {
+                // Found some files in the directory.
+                while (more)
+                {
+                    // If directory
+                    if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+                    {                        
+                        // Skip over '.' and '..'
+                        if ((strcmp(data.cFileName, ".")) && (strcmp("..", data.cFileName)))
+                        {
+                            // Recurse
+                            findFiles(data.cFileName, pattern, subdirectories);
+                        }
+                    }
+                    
+                    more = FindNextFile(searchHandle, &data);
+                }
+            }
+            SetCurrentDirectory(currentDir);
+#else
+            // Linux
+            //char fullDirname[MAX_PATH];
+            //getcwd(fullDirname, MAX_PATH);
+            
+            DIR* root = opendir(rootDir.c_str());
+            if (!root)
+            {
+                cout << "Unable to open directory: " << rootDir.c_str() << endl;
+                return;
+            }
+            
+            bool exactMatch = true;
+            string token1, token2;
+            if (pattern.find('*') != string::npos)
+            {
+                exactMatch = false;
+                Utils::tokeniseString("*", pattern, token1, token2);
+            }
+            
+            struct dirent *entry=0;
+            while ((entry = readdir(root)))
+            {
+                string entryName = rootDir + "/" + entry->d_name;
+                struct stat statbuf;
+                if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
+                    continue;
+                if (stat(entryName.c_str(), &statbuf)  != 0)
+                {
+                    perror("stat");
+                }
+                else
+                {
+                    if (S_ISDIR(statbuf.st_mode))
+                    {
+                        if (subdirectories)
+                        {
+                            findFiles(entryName, pattern, subdirectories);
+                        }
+                    }
+                    else if (S_ISREG(statbuf.st_mode))
+                    {
+                        string filename = entry->d_name;
+                
+                        if ((exactMatch && filename == pattern) ||
+                            (!exactMatch && ((filename.find(token1) == 0)
+                             && (filename.rfind(token2) == filename.length() - token2.length()))))
+                        {
+                            // Add the file to our list
+                            files.push_back(File(rootDir, filename));
+                        }
+                    }
+                }            
+            }
+            closedir(root);
+#endif
+        }
+        
+        
+    } // End namespace sca
+} // End namespace tuscany
+
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,133 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_file_h
+#define tuscany_sca_util_file_h
+
+#include <string>
+using std::string;
+#include <vector>
+using std::vector;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * File access methods. Provides platform independent
+         * access to files.
+         */
+        class File
+        {
+        public:
+            /**
+             * Constructor.
+             * @param directory Name of the directory in which this file is located.
+             * Either / or \ can be used interchangeably for separating directory elements.
+             * @param fileName Name of the file in the dirctory.
+             */
+            File(const string& directory, const string& fileName);
+
+            /**
+             * Destructor.
+             */ 
+            virtual ~File();
+
+            /**
+             * Return the directory in which this file is located.
+             * @return Name of the directory.
+             */
+            const string& getDirectory() const {return directory;}
+
+            /**
+             * Name of the file.
+             * @return Name of the file.
+             */
+            const string& getFileName() const {return fileName;}
+        private:
+            /**
+             * Name of the directory.
+             */
+            string directory;
+
+            /**
+             * Name of the file.
+             */ 
+            string fileName;
+        };
+        
+        /**
+         * Collection of File to provide platform independent access
+         * to files and directories.
+         */
+        class Files
+        {
+        public:
+            /**
+             * Constructor which will search a given directory with a pattern and return a 
+             * new instance of this collection class.
+             * @param rootDirectory The directory in which to search.
+             * @param pattern A pattern for matching file names. Can include * and ?.
+             * @param subdirectories Whether subdirectories should be searched too.
+             */
+            Files(const string& rootDirectory, const string& pattern, bool subdirectories = false);
+
+            /**
+             * Destructor.
+             */ 
+            virtual ~Files();
+
+            /**
+             * Return the number of files found.
+             * @return The number of files found.
+             */
+            unsigned int size();
+
+            /**
+             * Return a File at this position in the collection.
+             * @param index The index into the collection.
+             * @return The File at this index in the collection.
+             */
+            const File& operator[] (unsigned int index);
+
+        private:
+            /**
+             * Search the given directory and pattern for matching files.
+             * @param rootDirectory The directory in which to search.
+             * @param pattern A pattern for matching file names. Can include * and ?.
+             * @param subdirectories Whether subdirectories should be searched too.
+             */
+            void findFiles(const string& rootDirectory, const string& pattern, bool subdirectories);
+            
+            /**
+             * The top level directory to search.
+             */ 
+            string rootDirectory;
+
+            typedef vector<File> FILES;
+
+            /**
+             * Vector of File.
+             */ 
+            FILES files;
+        };
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_file_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/File.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,119 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/Library.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include "tuscany/sca/util/Logging.h"
+using namespace osoa::sca;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        Library::Library()
+            : hDLL(NULL)
+        {
+        }
+        
+        Library::Library(const string& libraryName)
+            : name(libraryName), hDLL(NULL)
+        {
+            LOGINFO_1(3, "Library::construcor : %s", name.c_str()); 
+            load();
+        }
+
+        Library::Library(const Library& lib)
+            : name(lib.name), hDLL(NULL)
+        {
+            LOGINFO_1(3, "Library::copy constructor : %s", name.c_str()); 
+            if (lib.hDLL)
+            {
+                load();
+            }
+        }
+        
+        Library& Library::operator=(const Library& lib)
+        {
+            LOGINFO_1(3, "Library::operator= : %s", name.c_str()); 
+            if (&lib != this)
+            {
+                unload();
+                name = lib.name;
+                load();
+            }
+            return *this;
+        }
+        
+        Library::~Library()
+        {
+            LOGINFO_1(3, "Library::destructor: %s", name.c_str()); 
+            unload();
+        }
+        
+        
+        void Library::load()
+        {
+            LOGINFO_1(3, "Library::load : %s", name.c_str()); 
+            string msg;
+#if defined(WIN32)  || defined (_WINDOWS)
+            hDLL = LoadLibrary(name.c_str());
+#else
+            hDLL = dlopen(name.c_str(), RTLD_NOW);
+#endif
+            if (hDLL == NULL)
+            {
+                LOGERROR_1(1, "Library::load: Unable to load library %s", name.c_str());
+                msg = "Unable to load dll: " + name;
+                throw ServiceRuntimeException(msg.c_str());
+            }    
+        }
+        
+        void Library::unload()
+        {
+            if (hDLL != NULL)
+            {
+            LOGINFO_1(3, "Library::unload : %s", name.c_str()); 
+#if defined(WIN32)  || defined (_WINDOWS)
+                FreeLibrary(hDLL);
+#else
+                dlclose(hDLL);
+#endif
+                hDLL = NULL;
+            }
+        }
+    
+        void* Library::getSymbol(const string& symbol)
+        {
+            LOGINFO_1(3, "Library::getSymbol : %s", symbol.c_str()); 
+            if (!hDLL)
+            {
+                return 0;
+            }
+#if defined(WIN32)  || defined (_WINDOWS)
+            return GetProcAddress(hDLL, symbol.c_str());        
+#else
+            return dlsym(hDLL, symbol.c_str());    
+#endif            
+        }    
+        
+    } // End namespace sca
+} // End namespace tuscany
+
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,97 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_library_h
+#define tuscany_sca_util_library_h
+
+
+#if defined(WIN32)  || defined (_WINDOWS)
+#include <windows.h> 
+#else
+#include <unistd.h>
+#include <dlfcn.h>
+#endif
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Information about shared libraries and methods to 
+         * access these shared libraries.
+         */
+        class Library
+        {
+        public:
+            Library();
+
+            /** 
+             * Constructor. Will load the library.
+             * @param libraryName Fully qualified name of the library.
+             */
+            Library(const string& libraryName);
+
+            /**
+             * Destructor. Will unload the library.
+             */ 
+            virtual ~Library();
+
+            Library(const Library& lib);
+            Library& operator=(const Library& lib);
+            
+            /**
+             * Find an externalized symbol in the library.
+             * @param symbol The name of the symbol to be found.
+             * @return The pointer to the symbol if found, otherwise 0.
+             */ 
+            void* getSymbol(const string& symbol);
+        private:
+            /**
+             * Name of the library.
+             */ 
+            string name;
+
+            /**
+             * Handle to the loaded library.
+             */ 
+#if defined(WIN32)  || defined (_WINDOWS)
+            HINSTANCE hDLL;
+#else
+            void* hDLL;
+#endif
+
+            /**
+             * Load the library.
+             */
+            void load();
+
+            /**
+             * Unload the library, if successfully loaded.
+             */ 
+            void unload();
+                        
+        };
+                
+    } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_util_library_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Library.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,32 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/LogWriter.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        LogWriter::~LogWriter()
+        {
+        }
+
+    } // End namespace sca
+} // End namespace tuscany
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,47 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_logwriter_h
+#define tuscany_sca_util_logwriter_h
+
+#include "osoa/sca/export.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Abstract class for extending logging to other destinations.
+         */
+        class SCA_API LogWriter 
+        {
+        public:
+            virtual ~LogWriter();
+            
+            /**
+             * Log a message.
+             * @param level The level of logging for this message.
+             * @param msg The message to log.
+             */
+            virtual void log(int level, const char* msg) = 0;
+        };
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_logwriter_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/LogWriter.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,100 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include <iostream>
+#include <stdarg.h>
+
+#include "tuscany/sca/util/Logger.h"
+#include "tuscany/sca/util/DefaultLogWriter.h"
+
+using namespace std;
+
+namespace tuscany
+{
+    namespace sca
+    {
+        LogWriter* Logger::logWriter = getLogWriter();
+
+        LogWriter* Logger::getLogWriter()
+        {
+            if (logWriter == 0)
+            {
+                setLogWriter(0);
+            }
+            return logWriter;
+        }
+
+        void Logger::setLogWriter(LogWriter* writer)
+        {
+            if (logWriter != writer)
+            {
+                delete logWriter;
+            }
+
+            if (writer == 0)
+            {
+                logWriter = new DefaultLogWriter;
+            }
+            else
+            {
+                logWriter = writer;
+            }
+        }
+
+        int Logger::loggingLevel = setLogging();
+        
+        int Logger::setLogging()
+        {
+            char*  loggingVar = 0;
+            loggingVar = getenv("SCA4CPP_LOGGING");
+            if (loggingVar == 0)
+                return 0;
+            else
+                return atoi(loggingVar);
+        }
+        
+        void Logger::setLogging(int level)
+        {
+            loggingLevel = level;
+        }
+            
+        void Logger::log(int level, const char* msg)
+        {
+            if (level <= loggingLevel)
+            {
+                logWriter->log(level, msg);
+            }
+        }
+
+        void Logger::logArgs(int level, const char* msg, ...)
+        {
+            if (level <= loggingLevel)
+            {
+                va_list variableArguments;
+                va_start(variableArguments, msg);
+                char messageBuffer[1024];
+                vsprintf(messageBuffer, msg, variableArguments);
+                logWriter->log(level, messageBuffer);
+                va_end(variableArguments);
+            }
+        }
+        
+    } // End namespace sca
+} // End namespace tuscany
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,89 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_logger_h
+#define tuscany_sca_util_logger_h
+
+#include "osoa/sca/export.h"
+#include "tuscany/sca/util/LogWriter.h"
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Provide a logging interface.
+         */
+        class Logger {
+
+        public:
+            /**
+             * Set the log writer to use.
+             * @param writer The writer to use for all subsequent logging.
+             */
+            SCA_API static void setLogWriter(LogWriter* writer);
+
+            /**
+             * Set or reset the logging level. Any message with a higher logging
+             * level than this value will be filtered (i.e. not shown).
+             * @param level The level of logging to use for all subsequent logging.
+             */
+            SCA_API static void setLogging(int level);
+
+            /**
+             * Log a message.
+             * @param level The log level of this message.
+             * @param msg The message to be logged.
+             */
+            static void log(int level, const char* msg);
+
+            /**
+             * Log a message with variable arguments.
+             * @param level The log level of this message.
+             * @param msg The message to be logged. Must include template 
+             * characters as described in printf.
+             * @param ... Variable arguments.
+             */
+            static void logArgs(int level, const char* msg, ...);
+
+            /**
+             * The currently set logging level
+             */
+            static int loggingLevel;
+
+        private:
+            /** 
+             * The current log writer.
+             */
+            static LogWriter* logWriter;
+
+            /**
+             * Get the current log writer.
+             * @return The current log writer.
+             */
+            static LogWriter* getLogWriter();
+
+            /**
+             * Retrieves the logging level set as an environment variable.
+             */
+            static int setLogging();
+        };
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_logger_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,72 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_logging_h
+#define tuscany_sca_util_logging_h
+
+#include "tuscany/sca/util/Logger.h"
+
+#ifdef _DEBUG
+#define LOGENTRY(level, methodName) \
+if (Logger::loggingLevel >= level) \
+Logger::log(level, "Entering: " methodName);
+
+#define LOGEXIT(level, methodName) \
+if (Logger::loggingLevel >= level) \
+Logger::log(level, "Exiting: " methodName);
+
+#define LOGINFO(level, message) \
+if (Logger::loggingLevel >= level) \
+Logger::log(level, message);
+
+#define LOGINFO_1(level, message, arg1) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(level, message, arg1);
+
+#define LOGINFO_2(level, message, arg1, arg2) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(level, message, arg1, arg2);
+
+#define LOGERROR(level, message) \
+if (Logger::loggingLevel >= level) \
+Logger::log(level, message);
+
+#define LOGERROR_1(level, message, arg1) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(level, message, arg1);
+
+#define LOGERROR_2(level, message, arg1, arg2) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(level, message, arg1, arg2);
+#else // Not DEBUG
+#define LOGENTRY(level, methodName)
+
+#define LOGEXIT(level, methodName)
+
+#define LOGINFO(level, message)
+
+#define LOGINFO_1(level, message, arg1)
+
+#define LOGINFO_2(level, message, arg1, arg2)
+#define LOGERROR(level, message)
+#define LOGERROR_1(level, message, arg1)
+#define LOGERROR_2(level, message, arg1, arg2)
+
+#endif
+#endif // tuscany_sca_util_logging_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logging.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,212 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "tuscany/sca/util/Utils.h"
+
+using namespace std;
+using namespace commonj::sdo;
+namespace tuscany
+{
+    namespace sca
+    {
+        void Utils::tokeniseUri(const string& uri, string& token1, string& token2)
+        {
+            tokeniseString("/", uri, token1, token2);
+        }
+    
+        void Utils::tokeniseQName(const string& qname, string& uri, string& name)
+        {
+            tokeniseString("#", qname, uri, name);
+            if (name == "")
+            {
+                name =  uri;
+                uri = "";
+            }
+        }
+
+        void Utils::tokeniseString(
+            const string& separator,
+            const string& str,
+            string& token1,
+            string& token2)
+        {
+            string::size_type sep = str.find(separator);
+            if (sep != string::npos)
+            {
+                token1 = str.substr(0, sep);
+                if ( (sep+1) < str.length())
+                {
+                    token2 = str.substr(sep+1);
+                }
+                else
+                {
+                    token2 = "";
+                }
+            }
+            else
+            {
+                token1 = str;
+                token2 = "";
+            }
+        }
+
+        void Utils::rTokeniseString(
+            const string& separator,
+            const string& str,
+            string& token1,
+            string& token2)
+        {
+            string::size_type sep = str.rfind(separator);
+            if (sep != string::npos)
+            {
+                token1 = str.substr(0, sep);
+                if ( (sep+1) < str.length())
+                {
+                    token2 = str.substr(sep+1);
+                }
+                else
+                {
+                    token2 = "";
+                }
+            }
+            else
+            {
+                token1 = "";
+                token2 = str;
+            }
+        }
+        
+        //////////////////////////////////////////////////////////////////////////
+        // Print a DatObject tree
+        //////////////////////////////////////////////////////////////////////////
+        void Utils::tabs(int inc)
+        {
+            for (int ind=0; ind <inc; ind++)
+            {
+                cout << "  ";
+            }            
+        }        
+    
+        void Utils::printDO(DataObjectPtr dataObject, int increment)
+        {
+            int inc=increment;
+            if (!dataObject)
+                return;
+            const Type& dataObjectType = dataObject->getType();
+            tabs(inc);
+            cout << "DataObject type: " << dataObjectType.getURI()<< "#" << dataObjectType.getName() << endl;
+            inc++;
+            
+            //////////////////////////////////////////////////////////////////////////
+            // Iterate over all the properties
+            //////////////////////////////////////////////////////////////////////////
+            PropertyList pl = dataObject->getInstanceProperties();
+            for (int i = 0; i < pl.size(); i++)
+            {
+                tabs(inc);
+                cout << "Property: " << pl[i].getName() << endl;
+                
+                const Type& propertyType = pl[i].getType();
+                
+                tabs(inc);
+                cout << "Property Type: " << propertyType.getURI()<< "#" << propertyType.getName() << endl;
+                
+                if (dataObject->isSet(pl[i]))
+                {
+                    
+                    //////////////////////////////////////////////////////////////////////
+                    // For a many-valued property get the list of values
+                    //////////////////////////////////////////////////////////////////////
+                    if (pl[i].isMany())
+                    {
+                        inc++;
+                        DataObjectList& dol = dataObject->getList(pl[i]);
+                        for (int j = 0; j <dol.size(); j++)
+                        {
+                            tabs(inc);
+                            cout << "Value " << j <<endl;
+                            inc++;
+                            
+                            if (propertyType.isDataType())
+                            {
+                                tabs(inc);
+                                cout<< "Property Value: " << dol.getCString(j) <<endl ; 
+                            }
+                            else
+                                printDO(dol[j], inc);
+                            inc--;
+                        }
+                        inc--;
+                    } // end IsMany
+                    
+                    
+                    //////////////////////////////////////////////////////////////////////
+                    // For a primitive data type print the value
+                    //////////////////////////////////////////////////////////////////////
+                    else if (propertyType.isDataType())
+                    {
+                        tabs(inc);
+                        cout<< "Property Value: " << dataObject->getCString(pl[i]) <<endl ; 
+                    }
+                    
+                    //////////////////////////////////////////////////////////////////////
+                    // For a dataobject print the do
+                    //////////////////////////////////////////////////////////////////////
+                    else
+                    {
+                        inc++;
+                        printDO(dataObject->getDataObject(pl[i]), inc);
+                        inc--;
+                    }
+                }
+                else
+                {
+                    tabs(inc);
+                    cout<< "Property Value: not set" <<endl ; 
+                }
+                
+            }
+            inc--;
+        }
+        
+        void Utils::printTypes(DataFactoryPtr df) 
+        {
+            //////////////////////////////////////////////////////////////////////////
+            // Retrieve the DataFactory from the mediator
+            // get the list of Types in the DataFactory and list them
+            //////////////////////////////////////////////////////////////////////////
+            TypeList tl = df->getTypes();
+            for (int i = 0; i < tl.size(); i++)
+            {
+                cout << "Type: " << tl[i].getURI()<< "#" << tl[i].getName() << endl;
+                PropertyList pl = tl[i].getProperties();
+                for (int j = 0; j < pl.size(); j++)
+                {
+                    cout << "\tProperty: " << pl[j].getName()
+                        << " type: " <<pl[j].getType().getURI()<<"#"<<pl[j].getType().getName()<< endl;
+                    
+                }
+            }
+            
+        }
+        
+        
+    } // End namespace sca
+} // End namespace tuscany
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.h?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.h Thu Jan  5 02:54:16 2006
@@ -0,0 +1,61 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#ifndef tuscany_sca_util_utils_h
+#define tuscany_sca_util_utils_h
+#include <string>
+using std::string;
+#include "commonj/sdo/SDO.h"
+
+#include "osoa/sca/export.h"
+
+namespace tuscany
+{
+    namespace sca
+    {
+        /**
+         * Utility methods to parse strings and provide debugging information.
+         */
+        class Utils {
+
+        public:
+            static void tokeniseUri(const string& uri, string& token1, string& token2);
+            static void tokeniseQName(const string& sdoname, string& uri, string& name);
+            static void tokeniseString(
+                const string& separator,
+                const string& str,
+                string& token1,
+                string& token2);
+
+            static void rTokeniseString(
+                const string& separator,
+                const string& str,
+                string& token1,
+                string& token2);
+
+            SCA_API static void printDO(commonj::sdo::DataObjectPtr dataObject, int increment=0);
+            SCA_API static void printTypes(commonj::sdo::DataFactoryPtr df);
+
+        private:
+            static void tabs(int increment=0);
+        };
+        
+    } // End namespace sca
+} // End namespace tuscany
+#endif // tuscany_sca_util_utils_h

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Utils.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/SDOStub.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/SDOStub.cpp?rev=366157&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/SDOStub.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/SDOStub.cpp Thu Jan  5 02:54:16 2006
@@ -0,0 +1,476 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 11:33:21 $ */
+
+#include "SDOStub.h"
+#include "commonj/sdo/HelperProvider.h"
+#include "osoa/sca/export.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include "tuscany/sca/util/Utils.h"
+
+
+// For Axis stub code
+#include <axis/AxisWrapperAPI.hpp>
+#include <axis/client/Stub.hpp>
+#include <axis/OtherFaultException.hpp>
+#include <axis/ISoapFault.hpp>
+
+using namespace std;
+
+AXIS_CPP_NAMESPACE_USE
+
+using namespace commonj::sdo;
+using namespace tuscany::sca;
+
+
+namespace tuscany
+{
+namespace sca
+{
+    namespace ws
+    {
+        /** Construct an SDOStub using the default HTTP 1.1 transport.
+         */
+        SDOStub::SDOStub() 
+                : Stub(" ", APTHTTP1_1),
+                  m_strEndpoint(""), 
+                  m_strTargetNamespace(""),
+                  m_strOperationName(""),
+                  m_strOperationResponseName(""),
+                  m_strSoapAction("")
+        {
+        }
+
+
+        /** Construct an SDOStub using the default HTTP 1.1 transport 
+         *  and set the web service endpoint URI.
+         *  @param endpoint - web service endpoint URI
+         */
+        SDOStub::SDOStub(const char* endpoint)
+                : Stub(endpoint, APTHTTP1_1), 
+                  m_strEndpoint(endpoint),
+                  m_strTargetNamespace(""),
+                  m_strOperationName(""),
+                  m_strOperationResponseName(""),
+                  m_strSoapAction("")
+        {
+        }
+
+
+        /** Destruct the SDOStub
+         */
+        SDOStub::~SDOStub()
+        {
+        }
+
+        /** Set the web service endpoint URI.
+         *  The endpoint is the value of the soap:address element in the WSDL.
+         *  @param endpoint - web service endpoint URI.
+         */
+        void SDOStub::setEndpoint(const char* endpoint)
+        {
+            m_strEndpoint = endpoint;
+            // Stub::setEndPoint
+            setEndPoint(endpoint);
+        }
+
+        /** Get the web service endpoint URI. 
+         *  @return web service endpoint URI.
+         */
+        const char* SDOStub::getEndpoint()
+        {
+            return m_strEndpoint.c_str();
+        }
+
+        /** Set the target namespace for elements and operations.
+         *  @param targetNamespace - the target namespace.
+          */
+        void SDOStub::setTargetNamespace(const char* targetNamespace)
+        {
+            m_strTargetNamespace = targetNamespace;
+        }
+
+        /** Get the target namespace.
+         *  @return - target namespace.
+         */
+        const char* SDOStub::getTargetNamesapce()
+        {
+            return m_strTargetNamespace.c_str();
+        }
+
+        /** Set the name of the operation to invoke. 
+         *  @param operationName - operation name
+         */
+        void SDOStub::setOperationName(const char* operationName)
+        {
+            m_strOperationName = operationName;
+        }
+
+        /** Get the operation name.
+         *  @return operation name.
+         */
+        const char* SDOStub::getOperationName()
+        {
+            return m_strOperationName.c_str();
+        }
+        
+        /** Set the name of the element that is returned as the result of a soap method.
+         *  @param operationResponseName - name of the response element.
+         */
+        void SDOStub::setOperationResponseName(const char* operationResponseName)
+        {
+            m_strOperationResponseName = operationResponseName;
+        }
+
+        /** Get the name of the element that is returned as the result of a soap method.
+         *  @return operation response name.
+         */
+        const char* SDOStub::getOperationResponseName()
+        {
+            return m_strOperationResponseName.c_str();
+        }
+
+        /** Set the SOAPAction header.
+         *  @param soapAction - the soap action.
+         */
+        void SDOStub::setSoapAction(const char* soapAction)
+        {
+            m_strSoapAction = soapAction;
+        }
+        
+        /** Get the SoapAction header.
+         *  @return soap action.
+         */
+        const char* SDOStub::getSoapAction()
+        {
+            return m_strSoapAction.c_str();
+        }
+
+        /** Invoke the operation on the web service.
+         *  @param requestDO - SDO containing the input parameters for the operation.
+         *  @param dataFactory - DataFactory for de/serialzing the SDOs.
+         *  @return DataObjectPtr - SDO containg the response from the web service.
+         */
+        DataObjectPtr SDOStub::invoke(DataObjectPtr requestDO, DataFactoryPtr dataFactory)
+        {
+            // SDO return object
+            DataObjectPtr pReturn;
+
+            // For faults
+            //const char* pcCmplxFaultName = NULL;
+
+            //  Get an XMLHelper
+            XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(dataFactory);
+
+
+            try
+            {
+                // Initialize the call structure for Doc Literal request/response.
+                if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER))
+                {
+                    return pReturn; // Return if there is a failure
+                }
+
+                // Set the SoapAction if it is not already set.
+                if (NULL == m_pCall->getTransportProperty("SOAPAction",false))
+                {
+                    m_pCall->setTransportProperty(SOAPACTION_HEADER , m_strSoapAction.c_str());
+                }
+
+                // Set the Soap Version.
+                m_pCall->setSOAPVersion(SOAP_VER_1_1);
+
+                // Set the Operation (operationName and targetNamespace)
+                m_pCall->setOperation(m_strOperationName.c_str(), m_strTargetNamespace.c_str());
+
+                //includeSecure(); 
+                //applyUserPreferences(); 
+
+                //
+                // Serialize the DataObject.
+                //
+
+                // DEBUG
+                XMLDocumentPtr requestDoc = 
+                    xmlHelper->createDocument(requestDO, 
+                                              m_strTargetNamespace.c_str(),
+                                              m_strOperationName.c_str());
+                requestDoc->setXMLDeclaration(false);
+                char *requestXML = xmlHelper->save(requestDoc);
+                cout << "SDOStub::invoke: Request XML= " << endl;
+                cout << requestXML << endl;
+                cout << endl;
+                // DEBUG
+
+                // Loop through the top level data object, serializing individual properties.
+                // We cannot simply serialize the request DataObject to an XML string and add 
+                // the XML as an AnyType parameter because Axis will wrap the request with an 
+                // element named for the operationName (Doc Literal/Wrapped), duplicating the
+                // top-level element.
+                PropertyList properties = requestDO->getInstanceProperties();
+                for (int i=0; i < properties.size() ; i++)
+                {
+                    Property& property = properties[i];
+                    const char *propertyName = property.getName();
+                    
+                    // If the property is not set, don't bother adding it as a parameter.
+                    if (!requestDO->isValid(property)) continue;
+
+                    switch (property.getTypeEnum())
+                    {
+                       // Simple string property - add it as an XSD_STRING parameter.
+                       case Type::StringType:
+                            {
+                                if (!property.isMany())
+                                {
+                                    string strPrefixAndParamName;
+                                    const char *namespacePrefix = 
+                                        m_pCall->getNamespacePrefix(m_strTargetNamespace.c_str());
+                                    strPrefixAndParamName.append(namespacePrefix);
+                                    strPrefixAndParamName.append(":");
+                                    strPrefixAndParamName.append(propertyName);
+                                    const char *paramValue = requestDO->getCString(i);
+                                    m_pCall->addParameter((void *)paramValue, 
+                                                          strPrefixAndParamName.c_str(), 
+                                                          XSD_STRING);
+                                }
+                            }
+                            break;
+
+                        // DataObject property.
+                        case Type::DataObjectType:
+                            {
+                                const char *dobXML = NULL; 
+                                if (property.isMany())
+                                {
+                                    // Many valued property - get the list.
+                                    DataObjectList& dobList = requestDO->getList(property);
+                                    for (int j=0; j< dobList.size(); j++)
+                                    {
+                                        DataObjectPtr dob = dobList[j];
+                                        if (dob != 0)
+                                        {
+                                            // Create an XML string from the DataObject.
+                                            XMLDocumentPtr doc = 
+                                            xmlHelper->createDocument(dob, 
+                                                                        m_strTargetNamespace.c_str(),
+                                                                        propertyName);
+                                            doc->setXMLDeclaration(false);
+                                            dobXML = xmlHelper->save(doc);
+
+                                            // DEBUG
+                                            cout << "SDOStub::invoke: DataObject \"" << propertyName << "\" as XML:" << endl;
+                                            cout << dobXML << endl;
+                                            cout << endl;
+                                            // DEBUG
+
+                                            // Add the XML to the call as an AnyType.
+                                            AnyType* pAny = new AnyType();
+                                            pAny->_size = 1;
+                                            pAny->_array = new char*[1];
+                                            pAny->_array[0] = strdup(dobXML);
+                                            m_pCall->addAnyObject(pAny);
+                                        }
+                                    } 
+                                } // if isMany
+                                else
+                                {
+                                    // Single valued property.
+                                    DataObjectPtr dob = requestDO->getDataObject(property);
+                                    if (dob != 0)
+                                    {
+                                        // Create an XML string from the DataObject.
+                                        XMLDocumentPtr doc = 
+                                            xmlHelper->createDocument(dob,
+                                                                        m_strTargetNamespace.c_str(),
+                                                                        propertyName);
+                                        doc->setXMLDeclaration(false);
+                                        dobXML = xmlHelper->save(doc);
+
+                                        // DEBUG
+                                        cout << "SDOStub::invoke: DataObject \"" << propertyName << "\" as XML:" << endl;
+                                        cout  << dobXML << endl;
+                                        cout << endl;
+                                        // DEBUG
+
+                                        // Add the XML to the call as an AnyType.
+                                        AnyType* pAny = new AnyType();
+                                        pAny->_size = 1;
+                                        pAny->_array = new char*[1];
+                                        pAny->_array[0] = strdup(dobXML);
+                                        m_pCall->addAnyObject(pAny);
+                                    }
+                                } 
+                             }
+                            break;
+
+                        default:
+                            break;
+                    }
+                }
+
+                // Invoke the operation.
+                if (AXIS_SUCCESS == m_pCall->invoke())
+                {
+                    // Make sure the response element is what we expect; ie that the element matches
+                    // the operation response name set on the stub and its targetNamespace matches
+                    // the targetNamespace set on the stub.
+                    if (AXIS_SUCCESS == m_pCall->checkMessage(m_strOperationResponseName.c_str(), 
+                                                              m_strTargetNamespace.c_str()))
+                    {
+                        cout << "SDOStub::invoke: Successful call..." << endl;
+
+                        // Deserialize the soap response.
+                        string strResponse = getSoapResponse();
+                        
+                        // DEBUG
+                        cout << "SDOStub::invoke: Response XML= " << endl;
+                        cout << strResponse.c_str() << endl;
+                        cout << endl;
+                        // DEBUG
+
+                        // Create an XMLDocument from the soap reponse
+                        XMLDocumentPtr returnDoc = 
+                            xmlHelper->load(strResponse.c_str(), m_strTargetNamespace.c_str());
+                        // Get the root DataObject to return as the result.
+                        pReturn = returnDoc->getRootDataObject();
+                        // DEBUG
+                        cout << "SDOStub::invoke: Response DataObject= " << endl;
+                        Utils::printDO(pReturn);
+                        cout << endl;
+                        // DEBUG
+                    }
+                }
+                else
+                {
+                    cout << "SDOStub::invoke: checkMessage failed:" << endl;
+                    cout << "SDOStub::invoke: Expected \'" 
+                         << m_strOperationResponseName.c_str() 
+                         << "\' element with namespace \'" 
+                         << m_strTargetNamespace.c_str()
+                         << "\'."
+                         << endl;
+                }
+
+
+                // Invoked the operation successfully - uninitialize the Call object.
+                m_pCall->unInitialize();
+                
+            }
+            catch (AxisException& e)
+            {
+                // Get the exception code.
+                int iExceptionCode = e.getExceptionCode();
+
+                if (AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
+                {
+                    m_pCall->unInitialize();
+                    throw ServiceRuntimeException("AxisException", ServiceRuntimeException::Error, e.what());
+                }
+
+                // Get the details of the SoapFault.
+                ISoapFault* pSoapFault = (ISoapFault*) m_pCall->checkFault("Fault", m_strEndpoint.c_str());
+
+                if (pSoapFault)
+                {
+                    const char *detail = pSoapFault->getSimpleFaultDetail();
+                    bool deleteDetail=false;
+
+                    if (NULL==detail || 0==strlen(detail))
+                    {
+                        detail=m_pCall->getFaultAsXMLString();
+
+                        
+                        if (NULL==detail)
+                        {
+                            detail="";
+                        }
+                        else
+                        {
+                            deleteDetail=true;
+                        }
+                    }
+
+                    OtherFaultException ofe(pSoapFault->getFaultcode(),
+                                            pSoapFault->getFaultstring(), 
+                                            pSoapFault->getFaultactor(),
+                                            detail, iExceptionCode);
+
+                    if (deleteDetail && NULL!=detail)
+                    {
+                        delete [] const_cast<char*>(detail);
+                    }
+
+                    m_pCall->unInitialize();
+                    throw ofe;
+                }
+                else
+                {
+                    m_pCall->unInitialize();
+                    throw ServiceRuntimeException("AxisException", ServiceRuntimeException::Error, e.what());
+                }
+            }
+            catch(SDORuntimeException sdoE)
+            {
+                cout << "SDOStub::invoke: SDORuntimeException: " << endl;
+                sdoE.PrintSelf(cout);
+            }
+
+
+            return pReturn;
+
+        }
+
+        // Deserialize the soap response from the web service.
+        string SDOStub::getSoapResponse()
+        {
+            // Get the response as an XML string.
+            AnyType* soapAny = m_pCall->getAnyObject();
+
+            // The Doc Literal response does not include the top level
+            // response element if we use getAnyObject - we need to wrap
+            // the response with the response element.
+            string strResponse("<");
+            strResponse.append(m_strOperationResponseName);
+            strResponse.append(" xmlns=\"");
+            strResponse.append(m_strTargetNamespace);
+            strResponse.append("\">");
+            
+            for (int j=0; j < soapAny->_size ; j++)
+            {
+                // DEBUG
+                cout << "SDOStub::getSoapResponse: soapAny->_array[" << j << "]=" << endl;
+                cout << soapAny->_array[j] << endl;
+                cout << endl;
+                // DEBUG
+                
+                strResponse.append(soapAny->_array[j]);
+            }
+            
+            strResponse.append("</");
+            strResponse.append(m_strOperationResponseName);
+            strResponse.append(">");
+
+            return strResponse;
+        }
+
+    } // end namespace ws
+} // end namespace sca
+} // end namespace tuscany
+

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

Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/ws/SDOStub.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



Mime
View raw message