tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edslatt...@apache.org
Subject svn commit: r366158 [11/25] - in /incubator/tuscany/cpp/sdo: ./ bin/ dependencies/ include/ include/commonj/ include/commonj/sdo/ lib/ projects/ projects/tuscany_sdo/ projects/tuscany_sdo/sdo_runtime/ projects/tuscany_sdo/sdo_samples/ projects/tuscany_...
Date Thu, 05 Jan 2006 10:58:55 GMT
Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,42 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/PropertySetting.h"
+namespace commonj
+{
+    namespace sdo
+    {
+        PropertySetting::PropertySetting()
+            : dataObject(NULL), isNULL(false), isIDREF(false)
+
+        {
+        }
+                        
+        PropertySetting::PropertySetting(DataObjectPtr dataObj, const SDOXMLString& propertyName,
+            bool isNull, bool IDREF)
+            : dataObject(dataObj), name(propertyName), isNULL(isNull),isIDREF(IDREF)
+        {
+        }
+
+        PropertySetting::~PropertySetting()
+        {
+        }
+        
+    } // End - namespace sdo
+} // End - namespace commonj

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,60 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _PROPERTYSETTING_H_
+#define _PROPERTYSETTING_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/DataObject.h"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * PropertySetting holds some information about properties as
+ * they are read by the parser, for subsequent creation
+ */        
+        class PropertySetting
+        {
+            
+        public:
+            PropertySetting();
+            PropertySetting(DataObjectPtr dataObj, 
+                const SDOXMLString& propertyName,
+                bool isNull=false,
+                bool isIDREF=false);
+            virtual ~PropertySetting();
+            
+            SDOXMLString name;    
+            SDOXMLString value;
+            DataObjectPtr dataObject;
+            bool isIDREF;
+            bool isNULL;
+                        
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_PROPERTYSETTING_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertySetting.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,74 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/Logging.h"
+
+#include <iostream>
+using namespace std;
+
+namespace commonj{
+namespace sdo{
+
+long RefCountingObject::allObs = 0;
+
+RefCountingObject::RefCountingObject()
+: refCount(0)
+{
+    LOGINFO_2(HIGHVOLUME,"RCO:CREATE:%p Count:%ld",this, ++allObs);
+}
+
+RefCountingObject::RefCountingObject(const RefCountingObject& rc)
+: refCount(0)
+{
+    LOGINFO_2(HIGHVOLUME,"RCO:COPCON:%p Count:%ld",this,++allObs);
+}
+
+RefCountingObject& RefCountingObject::operator=(const RefCountingObject& rc)
+{
+    return *this;
+}
+
+RefCountingObject::~RefCountingObject()
+{
+    LOGINFO_2(HIGHVOLUME,"RCO:DELETE:%p Count:%ld",this, --allObs);
+    //
+    //if (allObs < 0) 
+    //    LOGINFO(HIGHVOLUME,"RCO:More objects deleted than created");
+    //if (allObs == 0) 
+    //    LOGINFO(HIGHVOLUME,"RCO: All data objects deleted");;
+}
+
+void RefCountingObject::addRef()
+
+{
+    
+    ++refCount;
+    LOGINFO_2(HIGHVOLUME,"RCO:ADDREF:%p:%ld",this,refCount);
+}
+
+void RefCountingObject::releaseRef()
+{
+    LOGINFO_2(HIGHVOLUME,"RCO:DECREF:%p:%ld",this,refCount-1);
+    if (--refCount == 0) delete this;
+}
+
+
+};
+};

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,59 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _REFCOUNTINGOBJECT_H
+#define _REFCOUNTINGOBJECT_H
+
+
+#include "commonj/sdo/export.h"
+
+
+namespace commonj {
+    namespace sdo {
+
+/**
+ * RefcountingObject is the base class for all objects in SDO
+ * These objects keep a count of references to themselves, then
+ * free themselves when they are unused.
+ */
+    class RefCountingObject 
+    {
+        public:
+        SDO_API RefCountingObject();
+        SDO_API RefCountingObject(const RefCountingObject& rc);
+        SDO_API RefCountingObject& operator=(const RefCountingObject& rc);
+        SDO_API virtual ~RefCountingObject() = 0;
+/**
+ * Add to the reference count - a new pointer has been created.
+ */
+        SDO_API void addRef();
+/**
+ * Subtract from the the reference count - a reference has dropped.
+ */
+        SDO_API void releaseRef();
+
+        private:
+        unsigned int refCount;
+        static long allObs;
+    };
+
+    };
+};
+
+#endif

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingObject.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,153 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+
+namespace commonj{
+    namespace sdo{
+        
+        // officially, there is nothing here- but if I dont use the overrides in
+        // the templates, then they dont get generated.
+        void Test ()
+        {
+            
+#if defined(WIN32) || defined (_WINDOWS)
+            /* 1) construct */
+            DataFactoryPtr fptr = DataFactory::getDataFactory();
+            
+            /* 2) use the & operator= */
+            fptr = DataFactory::getDataFactory();
+            
+            /* 3) copy */
+            DataFactoryPtr fptr2 = fptr;
+            
+            /* 4) use the == and ! */
+            if (fptr2 == fptr || !fptr){}
+            
+            /* 5) Use the T*  and  * */
+            DataFactory* dmsf = fptr;
+            DataFactory& dmsr = *fptr;
+            
+            /* 1) construct */
+            DataFactoryPtr dfptr(fptr);
+            
+            /* 3) copy */
+            DataFactoryPtr dfptr2 = dfptr;
+            
+            /* 2) use the & operator= */
+            dfptr = dfptr2;
+            
+            /* 4) use the == and ! */
+            if (dfptr2 == dfptr || !dfptr){}
+            
+            /* 5) Use the T*  and  * */
+            DataFactory* ddmsf = dfptr;
+            DataFactory& ddmsr = *dfptr;
+            
+            /* 6) Use the -> */
+            DataObjectPtr dptr = dfptr->create("nothing","nowhere"); 
+            
+            /* and agin to catch the = */
+            dptr = fptr->create("nothing","nowhere");
+            
+            DataObjectPtr dptr2 = dptr;
+            
+            /* Use the T*  and  * */
+            DataObject* dof = dptr;
+            DataObject& dor = *dptr;
+            
+            if (dptr2 == dptr || !dptr){}
+            
+            
+            ChangeSummaryPtr cptr = dptr->getChangeSummary();
+            cptr = dptr->getChangeSummary();
+            ChangeSummaryPtr cptr2 = cptr;
+            
+            ChangeSummary* cof = cptr;
+            ChangeSummary& cop = *cptr;
+            
+            
+            if (cptr2 == cptr || !cptr){}
+            
+            cptr->endLogging();
+            
+            SequencePtr sptr = dptr->getSequence();
+            sptr = dptr->getSequence();
+            SequencePtr sptr2 = sptr;
+            
+            Sequence* sof = sptr;
+            Sequence& sop = *sptr;
+            
+            
+            if (sptr2 == sptr || !sptr){}
+            
+            sptr->getBooleanValue(0);
+            
+            
+            // Generate code for XMLDocumentPtr
+            XMLDocumentPtr xmldocptr1 = 0;
+            XMLDocumentPtr xmldocptr2 = xmldocptr1;
+            xmldocptr1 = xmldocptr2;
+            if (xmldocptr2 == xmldocptr1 || !xmldocptr1){}
+            XMLDocument* xmldocp = xmldocptr1;
+            XMLDocument& xmldocref = *xmldocptr2;
+            xmldocptr1->getEncoding();
+
+            // Generate code for XSDHelperPtr
+            XSDHelperPtr xsdhptr1 = 0;
+            XSDHelperPtr xsdhptr2 = xsdhptr1;
+            xsdhptr1 = xsdhptr2;
+            if (xsdhptr2 == xsdhptr1 || !xsdhptr1){}
+            XSDHelper* xsdhp = xsdhptr1;
+            XSDHelper& xsdhref = *xsdhptr2;
+            xsdhptr1->define("dummy");
+
+            // Generate code for XMLHelperPtr
+            XMLHelperPtr xmlhptr1 = 0;
+            XMLHelperPtr xmlhptr2 = xmlhptr1;
+            xmlhptr1 = xmlhptr2;
+            if (xmlhptr2 == xmlhptr1 || !xmlhptr1){}
+            XMLHelper* xmlhp = xmlhptr1;
+            XMLHelper& xmlhref = *xmlhptr2;
+            xmlhptr1->load("dummy");
+
+            // Generate code for DataGraphPtr
+            DataGraphPtr dgptr1 = 0;
+            DataGraphPtr dgptr2 = dgptr1;
+            dgptr1 = dgptr2;
+            if (dgptr2 == dgptr1 || !dgptr1){}
+            DataGraph* dghp = dgptr1;
+            DataGraph& dgref = *dgptr2;
+            dgptr1->getRootObject();
+
+#endif
+            
+        }
+    };
+};
+
+
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,179 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _REFCOUNTINGPOINTER_H
+#define _REFCOUNTINGPOINTER_H
+
+
+#include "commonj/sdo/export.h"
+
+#include <iostream>
+using namespace std;
+
+namespace commonj{
+namespace sdo{
+
+/** 
+ * RefcountingPointer is a template for all SDO pointers.
+ * The ref count increases with each use, and drops when one of these
+ * goes out of scope.
+ * Refcounting pointers are a lot like smart pointers, however in this
+ * implementation there is a cast method to a void*, so unlike real
+ * smart pointers, a user might call "delete mypointer", which would
+ * compile, but cause a crash. 
+ * RefCountingPointers do not need to be deleted.
+ */
+
+template <class T>
+class RefCountingPointer {
+    public:
+        SDO_API RefCountingPointer(T* realPtr = 0);
+        SDO_API RefCountingPointer(const RefCountingPointer& rhs);
+        SDO_API ~RefCountingPointer();
+        SDO_API RefCountingPointer& operator=(const RefCountingPointer& rhs);
+        SDO_API bool operator==(RefCountingPointer& test) const;
+        SDO_API T* operator->() const;
+        SDO_API T& operator*() const;
+        SDO_API bool operator!() const;
+
+#ifdef MFT
+        // MFT == member function templates
+        // Notes on the items below.
+        // In our code, we use subclasses to expose the API, and super
+        // classes to implement. E,g DataObject and DataObjectImpl.
+        // In some cases, we know that the DataObject given to us is a 
+        // DataObjectImpl, and cast it. With RefCountingPointers, however,
+        // the cast cannot work, as the RefCountingPointer to the superclass
+        // is not related to the RCP to the subclass. Recent changes in the
+        // C++ language allow this to work by defining an operator which 
+        // causes a pointer of the other type to be returned, as long as pointee
+        // is acceptable as a parameter to the cosntructor of the other type 
+        // of pointer. This works in C++.NET, but not in C++6:
+        operator RefCountingPointer<otherType>()
+        { 
+             return RefCountingPointer<otherType>(pointee);
+        }
+
+        // Since we are using C6, a possible workround is to provide a method
+        // which returns the dumb pointer, then construct a pointer to the 
+        // base class from the pointer returned. This is that the operator T* does.
+        // The code in DataObject could be simpler if we used C7,and we should
+        // discusss changing.
+#else 
+        operator T*() {return pointee;}
+#endif
+
+        template <class otherType>
+        operator RefCountingPointer<otherType>()
+        {
+            return RefCountingPointer<otherType>(pointee);
+        }
+
+    private:
+        T *pointee;
+        void init();
+};
+
+
+
+template<class T>
+void RefCountingPointer<T>::init()
+{
+    if (pointee == 0) return;
+    pointee->addRef();
+}
+
+template<class T>
+SDO_API RefCountingPointer<T>::RefCountingPointer(T* realPtr)
+:pointee(realPtr)
+{
+    init();
+}
+
+template<class T>
+SDO_API RefCountingPointer<T>::RefCountingPointer(const RefCountingPointer& rhs)
+: pointee(rhs.pointee)
+{
+    init();
+}
+
+template<class T>
+SDO_API RefCountingPointer<T>::~RefCountingPointer()
+{
+    if (pointee)pointee->releaseRef();
+}
+
+template<class T>
+SDO_API RefCountingPointer<T>& RefCountingPointer<T>::operator=(const RefCountingPointer& rhs)
+{
+    if (pointee != rhs.pointee)
+    {
+        T *oldP = pointee;
+        pointee = rhs.pointee;
+        init();
+        if (oldP) oldP->releaseRef();
+    }
+    return *this;
+}
+
+template<class T>
+SDO_API bool RefCountingPointer<T>::operator!() const
+{
+    return (pointee == 0);
+}
+
+template<class T>
+SDO_API bool RefCountingPointer<T>::operator==(RefCountingPointer& test) const
+{
+    return (pointee == test.pointee);
+}
+
+template<class T>
+SDO_API T* RefCountingPointer<T>::operator->() const 
+{
+    return pointee;
+}
+
+template<class T>
+SDO_API T& RefCountingPointer<T>::operator*() const
+{
+    return *pointee;
+}
+
+class DataObject;
+typedef RefCountingPointer<DataObject> DataObjectPtr;
+class DataGraph;
+typedef RefCountingPointer<DataGraph> DataGraphPtr;
+class DataFactory;
+typedef RefCountingPointer<DataFactory> DataFactoryPtr;
+class Sequence;
+typedef Sequence* SequencePtr;
+class ChangeSummary;
+typedef ChangeSummary* ChangeSummaryPtr;
+class XMLDocument;
+typedef RefCountingPointer<XMLDocument> XMLDocumentPtr;
+class XSDHelper;
+typedef RefCountingPointer<XSDHelper> XSDHelperPtr;
+class XMLHelper;
+typedef RefCountingPointer<XMLHelper> XMLHelperPtr;
+
+};
+};
+
+#endif

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,49 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SAX2Attribute.h"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+            
+/**
+ * SAX2Attribute holds an attribute supplied by the SAX2 parser.
+ */
+        SAX2Attribute::SAX2Attribute()
+        {
+        }
+        
+        SAX2Attribute::SAX2Attribute(const xmlChar **attribute) // localname/prefix/URI/value/end
+        {
+            name = attribute[0];
+            prefix = attribute[1];
+            uri = attribute[2];
+            value = SDOXMLString(attribute[3],0, (int)(attribute[4] - attribute[3]));
+        }
+        
+        SAX2Attribute::~SAX2Attribute()
+        {    
+        }
+        
+        
+    } // End - namespace sdo
+} // End - namespace commonj

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,64 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _SAX2ATTRIBUTE_H_
+#define _SAX2ATTRIBUTE_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * SAX2Attribute holds an attribute supplied by the SAX2 parser.
+ */
+        
+        class SAX2Attribute
+        {
+            
+        public:
+            
+            SAX2Attribute();
+            SAX2Attribute(const xmlChar **attribute);
+            
+            virtual ~SAX2Attribute();
+            
+            const SDOXMLString& getName() const {return name;}
+            const SDOXMLString& getPrefix() const {return prefix;}
+            const SDOXMLString& getUri() const {return uri;}
+            const SDOXMLString& getValue() const {return value;}
+            
+            
+        private:
+            SDOXMLString name;
+            SDOXMLString prefix;
+            SDOXMLString uri;
+            SDOXMLString value;
+            
+            
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2ATTRIBUTE_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attribute.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,92 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SAX2Attributes.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * SAX2Attributes holds a list of attributes supplied by the SAX2 parser.
+ */
+        SAX2Attributes::SAX2Attributes(
+            int nb_attributes,
+            int nb_defaulted,
+            const xmlChar **attrs) // localname/prefix/URI/value/end
+        {
+            for (int i=0; i < nb_attributes*5; i+=5)
+            {
+                attributes.insert(attributes.end(), SAX2Attribute(&attrs[i]));
+            }
+        }
+        
+        SAX2Attributes::~SAX2Attributes()
+        {    
+        }
+        
+        const SAX2Attribute& SAX2Attributes::operator[] (int pos) const
+        {
+            return attributes[pos];
+        }
+        
+        int SAX2Attributes::size () const
+        {
+            return attributes.size();
+        }
+        
+        
+        const SDOXMLString SAX2Attributes::nullValue;
+        
+        const SDOXMLString& SAX2Attributes::getValue(
+            const SDOXMLString& attributeUri,
+            const SDOXMLString& attributeName) const
+        {
+            for (int i=0; i < attributes.size(); i++)
+            {
+                if (attributes[i].getUri().equalsIgnoreCase(attributeUri))
+                {                    
+                    if (attributes[i].getName().equalsIgnoreCase(attributeName))
+                    {
+                        return attributes[i].getValue();
+                    }
+                }
+            }
+            
+            return nullValue;
+        }
+        
+        const SDOXMLString& SAX2Attributes::getValue(
+            const SDOXMLString& attributeName) const
+        {
+            for (int i=0; i < attributes.size(); i++)
+            {
+                if (attributes[i].getName().equalsIgnoreCase(attributeName))
+                {
+                    return attributes[i].getValue();
+                }
+            }
+            
+            return nullValue;
+        }
+        
+        
+    } // End - namespace sdo
+} // End - namespace commonj

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h Thu Jan  5 02:55:00 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 16:54:15 $ */
+
+#ifndef _SAX2ATTRIBUTES_H_
+#define _SAX2ATTRIBUTES_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Attribute.h"
+
+#include "vector"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * SAX2Attributes holds a list of attributes supplied by the SAX2 parser.
+ */        
+        class SAX2Attributes
+        {
+            
+        public:
+            
+            SAX2Attributes(
+                int nb_attributes,
+                int nb_defaulted,
+                const xmlChar **attributes);
+            
+            virtual ~SAX2Attributes();
+            
+            const SAX2Attribute& operator[] (int pos) const;
+            int size() const;
+            
+            const SDOXMLString& getValue(
+                const SDOXMLString& attributeUri,
+                const SDOXMLString& attributeName) const; 
+
+            const SDOXMLString& getValue(
+                const SDOXMLString& attributeName) const; 
+            
+        private:
+            typedef std::vector<SAX2Attribute> ATTRIBUTE_LIST;
+            ATTRIBUTE_LIST    attributes;
+
+            static const SDOXMLString nullValue;
+            
+            
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2ATTRIBUTES_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Attributes.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,93 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SAX2Namespaces.h"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+        SAX2Namespaces::SAX2Namespaces()
+        {
+        }
+        
+        SAX2Namespaces::SAX2Namespaces(int nb_namespaces, const xmlChar** namespaces)
+        {
+            for (int i=0; i<nb_namespaces*2; i+=2)
+            {
+                namespaceMap[namespaces[i]] = namespaces[i+1];        
+            }
+        }
+        
+        SAX2Namespaces::~SAX2Namespaces()
+        {    
+        }
+        
+        const SDOXMLString* SAX2Namespaces::find(const SDOXMLString& prefix) const
+        {    
+            NAMESPACE_MAP::const_iterator nsIter;
+            nsIter = namespaceMap.find(prefix);
+            if(nsIter == namespaceMap.end())
+            {
+                return 0;
+            }
+            
+            return &(nsIter->second);
+            
+        }        
+
+        const SDOXMLString* SAX2Namespaces::findPrefix(const SDOXMLString& uri) const
+        {    
+            NAMESPACE_MAP::const_iterator nsIter;
+            for (nsIter = namespaceMap.begin(); nsIter != namespaceMap.end(); nsIter++)
+            {
+                if (nsIter->second.equals(uri))
+                    return &(nsIter->first);
+            }
+            return 0;
+        }        
+
+        void SAX2Namespaces::merge(const SAX2Namespaces& inspaces)
+        {
+            NAMESPACE_MAP::const_iterator nsIter;
+            for (nsIter = inspaces.namespaceMap.begin(); 
+                 nsIter != inspaces.namespaceMap.end(); nsIter++)
+            {
+                // add will not overwrite if it already exists
+                namespaceMap[nsIter->first] = nsIter->second;
+            }
+            return;
+        }
+
+
+
+        void SAX2Namespaces::add(const SDOXMLString& prefix, const SDOXMLString& uri)
+        {
+            namespaceMap[prefix] = uri;
+        }
+
+        void SAX2Namespaces::empty()
+        {
+            namespaceMap.empty();
+        }
+
+    } // End - namespace sdo
+} // End - namespace commonj

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,67 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _SAX2NAMESPACES_H_
+#define _SAX2NAMESPACES_H_
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "map"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * SAX2Namespaces holds a list of namespaces supplied by the SAX2 parser.
+ */
+        
+        class SAX2Namespaces
+        {
+            
+        public:
+            
+            SAX2Namespaces();
+            
+            SAX2Namespaces(int nb_namespaces, const xmlChar** namespaces);
+            
+            virtual ~SAX2Namespaces();
+
+            void add(const SDOXMLString& prefix, const SDOXMLString& uri);
+
+            void merge(const SAX2Namespaces& inspaces);
+            
+            const SDOXMLString* find(const SDOXMLString& prefix) const;
+            const SDOXMLString* findPrefix(const SDOXMLString& uri) const;
+
+            void empty();
+            
+        private:
+            typedef std::map<SDOXMLString, SDOXMLString> NAMESPACE_MAP;
+            NAMESPACE_MAP    namespaceMap;
+            
+            
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2NAMESPACES_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Namespaces.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,415 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SAX2Parser.h"
+#include "libxml/SAX2.h"
+#include "commonj/sdo/SDORuntimeException.h"
+using namespace commonj::sdo;
+
+/**
+ * SAX2Parser holds the methods which will be called back.
+ * The implementation uses libxml, which provides callbacks for
+ * errors, warnings , elements etc. These methods correspond to thos
+ * callbacks.
+ * Callbacks from libxml to these C methods are converted into calls
+ * to the C++ equivalent (with some parameter manipulation
+ * In the callback methods the void* ctx is a pointer to 'this' SAX2Parser
+ */
+
+
+
+int sdo_isStandalone(void *ctx)
+{
+    return 0;
+}
+
+
+int sdo_hasInternalSubset(void *ctx)
+{
+    return(0);
+}
+
+int sdo_hasExternalSubset(void *ctx)
+{
+    return(0);
+}
+
+void sdo_internalSubset(void *ctx, const xmlChar *name,
+                        const xmlChar *ExternalID, const xmlChar *SystemID)
+{
+}
+
+
+void sdo_externalSubset(void *ctx, const xmlChar *name,
+                        const xmlChar *ExternalID, const xmlChar *SystemID)
+{
+}
+
+xmlParserInputPtr sdo_resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
+{
+    return(NULL);
+}
+
+
+xmlEntityPtr sdo_getEntity(void *ctx, const xmlChar *name)
+{
+    return(NULL);
+}
+
+
+xmlEntityPtr sdo_getParameterEntity(void *ctx, const xmlChar *name)
+{
+    return(NULL);
+}
+
+
+void sdo_entityDecl(void *ctx, const xmlChar *name, int type,
+                    const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
+{
+}
+
+
+void sdo_attributeDecl(void *ctx, const xmlChar * elem,
+                       const xmlChar * name, int type, int def,
+                       const xmlChar * defaultValue, xmlEnumerationPtr tree)
+{
+}
+
+void sdo_elementDecl(void *ctx, const xmlChar *name, int type,
+                     xmlElementContentPtr content)
+{
+}
+
+
+void sdo_notationDecl(void *ctx, const xmlChar *name,
+                      const xmlChar *publicId, const xmlChar *systemId)
+{
+}
+
+void sdo_unparsedEntityDecl(void *ctx, const xmlChar *name,
+                            const xmlChar *publicId, const xmlChar *systemId,
+                            const xmlChar *notationName)
+{
+}
+
+
+void sdo_setDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
+{
+}
+
+
+void sdo_startDocument(void *ctx)
+{    
+    if (!((SAX2Parser*)ctx)->parserError)
+        ((SAX2Parser*)ctx)->startDocument();
+}
+
+
+void sdo_endDocument(void *ctx)
+{
+    if (!((SAX2Parser*)ctx)->parserError)
+        ((SAX2Parser*)ctx)->endDocument();
+}
+
+
+void sdo_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
+{
+    //    ((SAX2Parser*)ctx)->startElement(name, atts);
+}
+
+
+void sdo_endElement(void *ctx, const xmlChar *name)
+{
+    //    ((SAX2Parser*)ctx)->endElement(name);
+}
+
+
+void sdo_characters(void *ctx, const xmlChar *ch, int len)
+{
+    if (!((SAX2Parser*)ctx)->parserError)
+        ((SAX2Parser*)ctx)->characters(SDOXMLString(ch, 0, len));
+}
+
+
+void sdo_reference(void *ctx, const xmlChar *name)
+{
+}
+
+
+void sdo_ignorableWhitespace(void *ctx, const xmlChar *ch, int len)
+{
+}
+
+
+void sdo_processingInstruction(void *ctx, const xmlChar *target,
+                               const xmlChar *data)
+{
+}
+
+
+void sdo_cdataBlock(void *ctx, const xmlChar *value, int len)
+{
+}
+
+void sdo_comment(void *ctx, const xmlChar *value)
+{
+}
+
+
+void sdo_warning(void *ctx, const char *msg, ...)
+{
+    va_list args;
+    va_start(args, msg);
+    ((SAX2Parser*)ctx)->warning(msg, args);
+    va_end(args);
+}
+
+void sdo_error(void *ctx, const char *msg, ...)
+{
+    va_list args;
+    va_start(args, msg);
+    ((SAX2Parser*)ctx)->error(msg, args);
+    va_end(args);
+    
+    
+}
+
+void sdo_fatalError(void *ctx, const char *msg, ...)
+{
+    va_list args;
+    va_start(args, msg);
+    ((SAX2Parser*)ctx)->fatalError(msg, args);
+    va_end(args);
+}
+
+
+
+// ===============
+// SAX2 callbacks
+// ===============
+void sdo_startElementNs(void *ctx,
+                        const xmlChar *localname,
+                        const xmlChar *prefix,
+                        const xmlChar *URI,
+                        int nb_namespaces,
+                        const xmlChar **namespaces,
+                        int nb_attributes,
+                        int nb_defaulted,
+                        const xmlChar **attributes)
+{
+    if (!((SAX2Parser*)ctx)->parserError)
+        ((SAX2Parser*)ctx)->startElementNs(
+        localname,
+        prefix,
+        URI,
+        SAX2Namespaces(nb_namespaces, namespaces),
+        SAX2Attributes(nb_attributes, nb_defaulted, attributes));
+}
+
+
+void sdo_endElementNs(void *ctx,
+                      const xmlChar *localname,
+                      const xmlChar *prefix,
+                      const xmlChar *URI)
+{
+    if (!((SAX2Parser*)ctx)->parserError)
+        ((SAX2Parser*)ctx)->endElementNs(localname, prefix, URI);
+}
+
+
+// The callback method structure
+xmlSAXHandler SDOSAX2HandlerStruct = {
+    sdo_internalSubset,
+        sdo_isStandalone,
+        sdo_hasInternalSubset,
+        sdo_hasExternalSubset,
+        sdo_resolveEntity,
+        sdo_getEntity,
+        sdo_entityDecl,
+        sdo_notationDecl,
+        sdo_attributeDecl,
+        sdo_elementDecl,
+        sdo_unparsedEntityDecl,
+        sdo_setDocumentLocator,
+        sdo_startDocument,
+        sdo_endDocument,
+        sdo_startElement,
+        sdo_endElement,
+        sdo_reference,
+        sdo_characters,
+        sdo_ignorableWhitespace,
+        sdo_processingInstruction,
+        sdo_comment,
+        sdo_warning,
+        sdo_error,
+        sdo_fatalError,
+        sdo_getParameterEntity,
+        sdo_cdataBlock,
+        sdo_externalSubset,
+        XML_SAX2_MAGIC,
+        NULL,
+        sdo_startElementNs,
+        sdo_endElementNs,
+        NULL
+};
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+        
+        
+        
+        SAX2Parser::SAX2Parser()
+        {
+            setter = 0;
+            parserError = false;
+            currentFile = 0;
+        }
+
+        SAX2Parser::SAX2Parser(ParserErrorSetter* insetter)
+        {
+            setter = insetter;
+            parserError = false;
+            currentFile = 0;
+        }
+        
+        SAX2Parser::~SAX2Parser()
+        {
+            // xmlCleanupParser();
+            if (currentFile != 0)delete currentFile;
+            
+        }
+        
+        const char* SAX2Parser::getCurrentFile() const
+        {
+            return currentFile;
+        }
+
+        int SAX2Parser::parse(const char* filename)
+        {
+            
+            parserError = false;
+            xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+
+            if (currentFile != 0)
+            {
+                delete currentFile;
+            }
+            currentFile = new char[strlen(filename)+1];
+            strcpy(currentFile,filename);
+
+            int rc = xmlSAXUserParseFile(handler, this, filename);
+            if (rc == -1)
+            {
+                sdo_error(this, "xmlSAXUserParseFile returned an error %d", rc);
+                SDO_THROW_EXCEPTION("parse", SDOFileNotFoundException,messageBuffer);
+            }
+            return rc;
+        }
+
+        void SAX2Parser::startDocument()
+        {
+        }
+
+        void SAX2Parser::endDocument()
+        {
+        }
+        
+        void SAX2Parser::startElementNs(
+            const SDOXMLString& localname,
+            const SDOXMLString& prefix,
+            const SDOXMLString& URI,
+            const SAX2Namespaces& namespaces,
+            const SAX2Attributes& attributes)
+        {
+        }
+        
+        void SAX2Parser::endElementNs(
+            const SDOXMLString& localname,
+            const SDOXMLString& prefix,
+            const SDOXMLString& URI)
+        {
+        }
+                    
+        void SAX2Parser::characters(const SDOXMLString& chars)
+        {
+        }
+                    
+        
+        void SAX2Parser::warning(const char* msg, va_list args)
+        {
+            // warnings are perhaps too frequent
+        //    vsprintf(messageBuffer, msg, args);
+        //    if (setter != 0)setter->setError(messageBuffer);
+        }
+
+        void SAX2Parser::fatalError(const char* msg, va_list args)
+        {
+            parserError = true;
+            vsprintf(messageBuffer, msg, args);
+            if (setter != 0)setter->setError(messageBuffer);
+        }
+        
+        void SAX2Parser::error(const char* msg, va_list args)
+        {
+            vsprintf(messageBuffer, msg, args);
+            if (setter != 0)setter->setError(messageBuffer);
+        }
+
+        void SAX2Parser::stream(std::istream& input)
+        {
+            char buffer[100];
+            parserError = false;
+            xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+            xmlParserCtxtPtr ctxt;
+            
+            input.read(buffer,4);
+            ctxt = xmlCreatePushParserCtxt(handler, this,
+                buffer, input.gcount(), NULL);
+            
+            while (input.read(buffer,100))
+            {
+                xmlParseChunk(ctxt, buffer, input.gcount(), 0);
+                
+            }
+            
+            xmlParseChunk(ctxt, buffer, input.gcount(), 1);
+            xmlFreeParserCtxt(ctxt);
+
+            if (parserError)
+            {
+               SDO_THROW_EXCEPTION("stream", SDOXMLParserException,messageBuffer);
+            }
+            
+        }
+
+        
+        std::istream& operator>>(std::istream& input, SAX2Parser& parser)
+        {
+            parser.stream(input);                            
+            return input;
+        }
+        
+        
+    } // End - namespace sdo
+} // End - namespace commonj
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,103 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _SAX2PARSER_H_
+#define _SAX2PARSER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SAX2Attributes.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+
+
+
+#include "sstream"
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**
+ * SAX2Parser holds the methods which will be called back.
+ * The implementation uses libxml, which provides callbacks for
+ * errors, warnings , elements etc. These methods correspond to thos
+ * callbacks.
+ * Callbacks from libxml to these C methods are converted into calls
+ * to the C++ equivalent (with some parameter manipulation
+ * In the callback methods the void* ctx is a pointer to 'this' SAX2Parser
+ */
+        class SAX2Parser
+        {
+            
+        public:
+            
+            SAX2Parser();
+            
+            SAX2Parser(ParserErrorSetter* insetter);
+
+            virtual ~SAX2Parser();
+            
+            virtual int parse (const char* filename);
+            
+            virtual void startDocument();
+            virtual void endDocument();
+
+            virtual void startElementNs(
+                const SDOXMLString& localname,
+                const SDOXMLString& prefix,
+                const SDOXMLString& URI,
+                const SAX2Namespaces& namespaces,
+                const SAX2Attributes& attributes);
+            
+            virtual void endElementNs(
+                const SDOXMLString& localname,
+                const SDOXMLString& prefix,
+                const SDOXMLString& URI);
+            
+            virtual void characters(const SDOXMLString& chars);
+            
+            virtual void warning(const char* msg, va_list args);
+
+            virtual void fatalError(const char* msg, va_list args);
+            
+            virtual void error(const char* msg, va_list args);
+
+            virtual void stream(std::istream& input);
+            
+            friend std::istream& operator>>(std::istream& input, SAX2Parser& parser);
+            
+            ParserErrorSetter* setter;
+            bool parserError;
+
+            char messageBuffer[1024];
+
+            virtual const char* getCurrentFile() const;
+        private:
+
+            char* currentFile;
+
+
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SAX2PARSER_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,56 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/PropertyList.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataObjectList.h"
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+#include "commonj/sdo/EqualityHelper.h"
+#include "commonj/sdo/CopyHelper.h"
+#include "commonj/sdo/SdoRuntime.h"
+#include "commonj/sdo/HelperProvider.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOUtils.h"
+#include "commonj/sdo/ChangedDataObjectList.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObjectInstance.h"
+#include "commonj/sdo/DefaultLogWriter.h"
+#include "commonj/sdo/Logger.h"
+#include "commonj/sdo/LogWriter.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/SdoCheck.h"
+#include "commonj/sdo/Setting.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/DASValue.h"
+#include "commonj/sdo/XpathHelper.h"
+
+
+
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDO.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,52 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SDODate.h"
+
+namespace commonj{
+namespace sdo{
+
+
+     SDODate::~SDODate()
+     {
+     }
+
+     SDODate::SDODate(time_t inval)
+     {
+         value = inval;
+     }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    const time_t SDODate::getTime(void) const
+    {
+        return value;
+    }
+
+    const char* SDODate::ascTime(void) const
+    {
+        return asctime(localtime(&value));
+    }
+
+};
+};
+// end - namespace sdo
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,77 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#ifndef _SDO_SDODATE_H_
+#define _SDO_SDODATE_H_
+
+
+#include "commonj/sdo/export.h"
+#include "time.h"
+
+
+
+ 
+namespace commonj{
+namespace sdo{
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // A representation of the type of a date.
+    ///////////////////////////////////////////////////////////////////////////
+
+/**
+ * SDODate - a means of hiding the time_t.
+ * The SDO API in several places uses method overloads to allow the
+ * same method to set many types of data. As time_t and long are 
+ * sometimes synonymous, it was not possible to have a time_t and a
+ * long method, so SDODate simply wraps the time_t.
+ * SDODate also allows modifcation of the implementation, as time_t is
+ * only a short-term solution - better date/time handling is required.
+ */
+
+class SDODate
+{
+
+public:
+
+
+    virtual SDO_API ~SDODate();
+
+    SDO_API SDODate(time_t inval);
+
+    /**
+     * Hand out the date as a time_t
+     */
+    virtual SDO_API const time_t getTime() const;
+
+    /**
+     * Format the date as a string
+     */
+
+    virtual const char* ascTime(void) const;
+  
+
+private:
+    time_t value;
+};
+
+};
+};
+#endif //_SDO_SDODATE_H_
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODate.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,225 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#include "commonj/sdo/SDORuntimeException.h"
+              
+// ========================================================================
+// Constructor
+// ========================================================================
+SDORuntimeException :: SDORuntimeException(const char* name,
+                             severity_level sev,
+                             const char* msg_text)
+              : severity(sev),location_set(0)
+{
+    class_name = new char[strlen(name) + 1];
+    strcpy(class_name,name);
+    message_text = new char[strlen(msg_text)+1];
+    strcpy(message_text,msg_text);
+
+} // end SDORuntimeException constuctor
+  
+// ========================================================================
+// Constructor
+// ========================================================================
+SDORuntimeException ::  SDORuntimeException(const SDORuntimeException& c)
+              : 
+                severity(c.getSeverity()), location_set(c.location_set)
+                
+{
+    class_name = new char[strlen(c.getEClassName()) + 1];
+    strcpy(class_name, c.getEClassName());
+    message_text = new char[strlen(c.getMessageText())+1];
+    strcpy(message_text,c.getMessageText());
+    for (int i=0;i<c.location_set;i++)
+    {
+        locations[i].file = new char[strlen(c.locations[i].file) + 1];
+        strcpy(locations[i].file,c.locations[i].file);
+        locations[i].line = c.locations[i].line;
+        locations[i].function = new char[strlen(c.locations[i].function) + 1];
+        strcpy(locations[i].function, c.locations[i].function);
+    }
+}
+           
+// ========================================================================
+// Destructor
+// ========================================================================
+SDORuntimeException :: ~SDORuntimeException()
+{
+    if (class_name) delete class_name;
+    if (message_text) delete message_text;
+    for (int i=0;i<location_set;i++)
+    {
+        if (locations[i].file) delete locations[i].file;
+        if (locations[i].function) delete locations[i].function;
+    }
+
+} // end SDORuntimeException destructor
+                    
+// ========================================================================
+// Return class name of this exception
+// ========================================================================
+const char* SDORuntimeException :: getEClassName() const
+{
+  return class_name;
+} // end getClassName()
+
+// ========================================================================
+// Return severity
+// ========================================================================
+SDORuntimeException::severity_level SDORuntimeException :: getSeverity() const
+{
+  return severity;
+} // end getSeverity()
+
+// ========================================================================
+// Return message text associated with exception
+// ========================================================================
+const char* SDORuntimeException :: getMessageText() const
+{
+  return message_text;
+} // end getMessageText()
+
+// ========================================================================
+// Return file name where exception was raised
+// ========================================================================
+const char* SDORuntimeException :: getFileName() const
+{
+  return locations[0].file;
+} // end getFileName()
+
+// ========================================================================
+// Return line number where exception was raised
+// ========================================================================
+unsigned long SDORuntimeException :: getLineNumber() const
+{
+  return locations[0].line;
+} // end getLineNumber()
+
+// ========================================================================
+// Return function name where exception was raised
+// ========================================================================
+const char* SDORuntimeException :: getFunctionName() const
+{
+  return locations[0].function;
+} // end getFunctionName()
+
+
+// ========================================================================
+// set severity of exception
+// ========================================================================
+void SDORuntimeException :: setSeverity(severity_level sev)
+{
+  severity = sev;
+} // end setSeverity(severity_level sev) const
+
+// ========================================================================
+// set message text associated with exception
+// ========================================================================
+void SDORuntimeException :: setMessageText(const char* msg_text)
+{
+  if (message_text != 0) delete message_text;
+  message_text = new char[strlen(msg_text) + 1];
+  strcpy(message_text,msg_text);
+} // end setMessageText(const string &msg_text) const
+                    
+// ========================================================================
+// set exception location
+// ========================================================================
+void SDORuntimeException :: setExceptionLocation(const char* file,    
+                                            unsigned long line,       
+                                            const char* function)
+{
+  // Only set this information once
+  if (location_set == 0)
+  {
+    locations[0].file = new char[strlen(file)+1];
+    strcpy(locations[0].file,file);
+    locations[0].line = line;
+    locations[0].function = new char[strlen(function) + 1];
+    strcpy(locations[0].function,function);
+    location_set = 1;
+  }
+} // end setLocation()
+
+// ========================================================================
+// set location of most recent throw/handling of the exception
+// ========================================================================
+void SDORuntimeException :: setLocation(const char* file,    
+                                  unsigned long line,       
+                                  const char* function)
+{
+  if (location_set < num_locations)
+  {
+    locations[location_set].file = new char[strlen(file) + 1];
+    strcpy(locations[location_set].file,file);
+    locations[location_set].line = line;
+    locations[location_set].function = new char[strlen(function) + 1];
+    strcpy(locations[location_set].function,function);
+
+    location_set++;
+  }
+} // end setLocation()
+
+// ========================================================================
+// Trace the exception  
+// ========================================================================
+void SDORuntimeException :: trace(const char* text)
+{
+    /* TODO */
+  // TRACE_STREAM(0, SDORuntimeException::trace, " ", (*this));
+} // end Trace()
+
+// ========================================================================
+// print self
+// ========================================================================
+ostream& SDORuntimeException :: PrintSelf(ostream &os) const
+{ 
+  char lineNumber[100];
+  sprintf(lineNumber, "%d",locations[0].line);
+
+  os << "Exception object :" << endl;
+  os << " class:           " << class_name << endl;
+  os << " file name:       " << locations[0].file << endl;
+  os << " line number:     " << lineNumber << endl;
+  os << " function:        " << locations[0].function << endl;
+  os << " description:     " << message_text << endl;
+  os << " location history:" << endl;
+
+  // TODO - commented out - a two-location rethrow causes an access
+  // violation here.
+  //int i=1;
+  //while (i < location_set)
+  //{
+  //  os << "  " <<  i << ")" << endl;
+  //  os << "   file:          " << locations[i].file << endl;
+  //  os << "   line:          " << locations[i].line << endl;
+  //  os << "   function:      " << locations[i].function << endl;
+  //  i++;
+  //}
+  return os;
+} // end ostream operator <<
+    
+// ========================================================================
+// ostream operator <<
+// ========================================================================
+SDO_API ostream& operator<< (ostream &os, const SDORuntimeException &except)
+{
+  return except.PrintSelf(os);
+} // end ostream operator <<
+    

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,500 @@
+/*
+ *
+ *  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 16:54:15 $ */
+
+#if !defined SDO_EXCEPTIONS_H
+#define SDO_EXCEPTIONS_H
+
+#include "commonj/sdo/export.h"
+
+
+#include <string>
+#include <iostream>
+
+using namespace std;
+
+
+/** SDORuntimeException - Exception base class.
+ *
+ *
+ * Description :
+ * -------------
+ *   SDO exception class definition
+ *
+ *   This is intended as a base class.
+ *
+ * Parent Classes :
+ * ----------------
+ *   none
+ *
+ * Public Member functions:
+ * ------------------------
+ *
+ *   Constructors :
+ *     SDORuntimeExceptionm(severity_level sev=severe,
+ *                          const string &msg_text="");
+ *
+ *       creates the exception object. Parameters are:
+ *         sev: the severity of the exception (Error, Severe)
+ *         msg_text:  descriptive message_text
+ *
+ *     copy constructor not necessary
+ *
+ *   Destructor :
+ *       virtual ~SDORuntimeException();
+ *
+ *   Assignment operator:
+ *       not necessary
+ *
+ *   void setSeverity(severity_level sev);
+ *     set the exception severity
+ *
+ *   void setMessageText(const char* msg_text);
+ *     set the message text associated with the exception. (This text should
+ *     come from a message catalog as it may be written to stdout/stderr at
+ *     some point)
+ *
+ *   void setExceptionLocation(const char* file,
+ *                             unsigned long line,
+ *                             const char* function="");
+ *
+ *     adds the location of the exception. Parameters
+ *       file: the filename from where the exception is being created
+ *       (from __FILE__)
+ *       line: the line number from where the exception is being created
+ *       (from __LINE__)
+ *       function: The function name from where the exception is being created
+ *
+ *   severity_level getSeverity() const;
+ *     returns the severity of the exception
+ *
+ *   const char* getMessageText() const;
+ *     returns the message text that describes this exception.
+ *
+ *   const tring& getFileName() const;
+ *     returns the file name from the location information in the exception
+ *
+ *   unsigned long getLineNumber() const;
+ *     returns the line number from the location information in the exception
+ *
+ *   const char* getFunctionName() const;
+ *     returns the function name from the location information in the exception
+ *
+ * Private Data Members :
+ * ----------------------
+ *   severity_level   severity;         * Severity of exception
+ *   string           message_text;     * Message associated with exception
+ *   string           file_name;        * File name (from __FILE__)
+ *   unsigned long    line_number;      * Line number (from __LINE__)
+ *   string           function_name;    * Function name
+ *
+ */
+
+class  SDORuntimeException
+{
+  public:
+    // Constructor
+    enum severity_level
+    {
+      Normal,
+      Warning,
+      Error,
+      Severe
+    };
+
+    SDO_API SDORuntimeException(const char *name="SDORuntimeException",
+                 severity_level sev=Severe,
+                 const char* msg_text="");
+
+    SDO_API SDORuntimeException(const SDORuntimeException& c);
+
+    // Destructor
+    virtual  SDO_API ~SDORuntimeException();
+
+    /**  getEClassName() get the exception class
+     *
+     * returns the name of the exception class, which will be
+     * a subclass of SDORuntimeException
+     */
+
+    SDO_API const char* getEClassName() const;
+
+    /**  getSeverity returns a level from severity_levels
+     *
+     * Return severity
+     * from the enumerator severity_levels, which is:
+     *
+     * Normal,Warning, Error,Severe
+      */
+
+    SDO_API severity_level getSeverity() const;
+
+    /**
+     * Return message text associated with exception
+     */
+
+    SDO_API const char* getMessageText() const;
+
+    /**  getFileName() the file where the exception occurred
+     *
+     *     Return file name where exception was raised
+     */
+
+    SDO_API const char* getFileName() const;
+
+    /**  getLineNumber gives the line where the excepion occurred
+     *
+     * Return line number where exception was raised
+     */
+
+    SDO_API unsigned long getLineNumber() const;
+
+    /**  getFunctionName give the name of the raising function
+     *
+     * Return function name where exception was raised
+     */
+
+    SDO_API const char* getFunctionName() const;
+
+
+    /**  setSeverity
+     *
+     * sets an exception severity
+     */
+
+    SDO_API void setSeverity(severity_level sev);
+
+    /**  setMessageText
+     *
+     * set the message text associated with exception
+     */
+
+    SDO_API void setMessageText(const char* msg_text);
+
+
+    /**  setExceptionLocation
+     *
+     * set exception location
+     */
+
+    SDO_API void setExceptionLocation(const char* file,
+                                unsigned long line,
+                                const char* function="");
+
+    SDO_API void setLocation(const char* file,
+                                unsigned long line,
+                                const char* function="");
+
+    SDO_API void trace(const char* text="%1:\n  %3 %4 %2");
+
+    SDO_API virtual ostream& PrintSelf(ostream &os) const;
+
+    /**  operator << to write the exception
+     *
+     * ostream operator <<
+     */
+
+    SDO_API friend ostream& operator<< (ostream &os, const SDORuntimeException &except);
+ 
+  protected:
+
+  private:
+
+    char*        class_name;
+
+    severity_level   severity;         // Severity of exception
+
+    char*        message_text;     // Description of exception
+
+    //* Location where the exception was last thrown*handled
+
+    class location
+    {
+      public:
+        char*            file;       //* File name (from __FILE__)
+        unsigned long   line;       //* Line number (from __LINE__)
+        char*            function;   //* Function name
+    };
+
+    // Array of locations
+    enum {num_locations=5};
+    location         locations[num_locations];
+
+    // Index into locations array
+    int              location_set;
+
+
+}; // End SDORuntimeException class definition
+
+/** 
+ ***************************************************************************
+ *
+ * SDOOutOfMemoryException - Exception for no-storage
+ *
+ * ***************************************************************************
+ */
+
+class SDOOutOfMemoryException: public SDORuntimeException
+{
+  public:
+    SDOOutOfMemoryException(unsigned long size)
+      : SDORuntimeException("SDOOutOfMemoryException", Severe,
+                     "Unable to obtain storage of length " + size)
+    {
+    }
+  private:
+}; // End SDOOutOfMemory class definition
+
+/**
+***************************************************************************
+*
+* SDOPathNotFoundException - Exception for bad path
+*
+****************************************************************************
+*/
+class SDOPathNotFoundException: public SDORuntimeException
+{
+  public:
+    SDOPathNotFoundException(const char* path)
+      : SDORuntimeException("SDOPathNotFoundException", Warning,
+                     path)
+    {
+    }
+  private:
+}; // End SDOPathNotFoundException class definition
+
+/**
+***************************************************************************
+*
+* SDOPropertyNotFoundException - Exception for property not found
+*
+****************************************************************************
+*/
+
+class SDOPropertyNotFoundException: public SDORuntimeException
+{
+  public:
+    SDOPropertyNotFoundException(const char* name)
+      : SDORuntimeException("SDOPropertyNotFoundException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOPropertyNotFoundException class definition
+
+/** 
+***************************************************************************
+*
+*  SDOTypeNotFoundException - Exception for type not found.
+*
+****************************************************************************
+*/
+class SDOTypeNotFoundException: public SDORuntimeException
+{
+  public:
+    SDOTypeNotFoundException(const char* name)
+      : SDORuntimeException("SDOTypeNotFoundException", Warning,
+                     name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+
+/**
+***************************************************************************
+*
+* SDOFileNotFoundException - Exception for file not found
+*
+****************************************************************************
+*/
+
+class SDOFileNotFoundException: public SDORuntimeException
+{
+  public:
+    SDOFileNotFoundException(const char* name)
+      : SDORuntimeException("SDOFileNotFoundException", Warning,
+                     name)
+    {
+    }
+  private:
+}; // End SDOFileNotFoundException class definition
+/** 
+***************************************************************************
+*
+* SDOPropertyNotSetException - Exception for asking for the value of an 
+* unset/undefaulted prop
+*
+****************************************************************************
+*/
+class SDOPropertyNotSetException: public SDORuntimeException
+{
+  public:
+    SDOPropertyNotSetException(const char* name)
+      : SDORuntimeException("SDOPropertyNotSetException", Warning,
+                     name)
+    {
+    }
+  private:
+}; // End SDOPropertyNotSetException class definition
+/** 
+***************************************************************************
+*
+* SDOUnsupportedOperationException - Invalid action or unimplemented method.
+*
+****************************************************************************
+*/
+class SDOUnsupportedOperationException: public SDORuntimeException
+{
+  public:
+    SDOUnsupportedOperationException(const char* name)
+      : SDORuntimeException("SDOUnsupportedOperationException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+
+/**
+***************************************************************************
+*
+* SDOInvalidConversionException - Invalid conversion - cannot convert to type.
+*
+****************************************************************************
+*/
+class SDOInvalidConversionException: public SDORuntimeException
+{
+  public:
+    SDOInvalidConversionException(const char* name)
+      : SDORuntimeException("SDOInvalidConversionException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+/** 
+***************************************************************************
+*
+* SDOIllegalArgumentException - Invalid argument passed (null name?).
+*
+****************************************************************************
+*/
+class SDOIllegalArgumentException: public SDORuntimeException
+{
+  public:
+    SDOIllegalArgumentException(const char* name)
+      : SDORuntimeException("SDOIllegalArgumentException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+/**
+****************************************************************************
+*
+* SDOIndexOutOfRangeException - element index not in a list.
+*
+****************************************************************************
+*/
+class SDOIndexOutOfRangeException: public SDORuntimeException
+{
+  public:
+    SDOIndexOutOfRangeException(const char* name)
+      : SDORuntimeException("SDOIndexOutOfRangeException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+
+/** 
+***************************************************************************
+*
+* SDOXMLParserException - XMLParser error
+*
+****************************************************************************
+*/
+class SDOXMLParserException: public SDORuntimeException
+{
+  public:
+    SDOXMLParserException(const char* name)
+      : SDORuntimeException("SDOXMLParserException", Warning,
+                      name)
+    {
+    }
+  private:
+}; // End SDOTypeNotFoundException class definition
+
+/* 
+***************************************************************************
+*
+* Macro definitions
+*
+****************************************************************************
+*/
+/**
+  * =========================================================================
+  * Macro  - SDO_THROW_EXCEPTION
+  *
+  * adds the current file name, line number and function name to the exception.
+  * then throws the exception.
+  * The parameter 'function_name' should be the name of the function throwing
+  * this exception.
+  * The parameter 'type' is the class of exception to throw and must be a
+  * SDORuntimeException or a class derived from SDORuntimeException.
+  * The parameter 'parameter' is the construction parameter for the exception
+  * =========================================================================
+*/
+
+  #define SDO_THROW_EXCEPTION(function_name, type, parameter )  \
+    {\
+     type ex(parameter); \
+     ex.setExceptionLocation(__FILE__,__LINE__,#function_name); \
+     throw ex;\
+    }
+
+/** 
+    =========================================================================
+  * Macro  - SDO_RETHROW_EXCEPTION
+  *
+  * adds the current file name, line number and function name to the exception.
+  * then re-throws the exception.
+  * The parameter 'function_name' should be the name of the function throwing
+  * this exception.
+  * =========================================================================
+*/
+  #define SDO_RETHROW_EXCEPTION(function_name, exception)  \
+     (exception).setLocation(__FILE__,__LINE__,#function_name); \
+     throw;
+
+/**
+  * =========================================================================
+  * Macro  - SDO_HANDLE_EXCEPTION
+  *
+  * adds the current file name, line number and function name to the exception.
+  * Writes an exception trace entry then continues.
+  * The parameter 'function_name' should be the name of the function handling
+  * this exception.
+  * =========================================================================
+*/
+  #define SDO_HANDLE_EXCEPTION(function_name, exception)  \
+    {\
+     (exception).setLocation(__FILE__,__LINE__,#function_name); \
+     (exception).Trace("Exception handled by %1: \n  %3 %4 %2");\
+    }
+
+#endif

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



Mime
View raw message